/**
 * Minified by jsDelivr using Terser v5.48.0.
 * Original file: /npm/@geops/mobility-web-component@0.1.12/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{$ as Bs,$a as h2,$b as R_,$c as MS,A as Ul,Aa as I_,Ab as C2,Ac as so,B as Cw,Ba as md,Bb as $f,Bc as X2,C as Ew,Ca as Wl,Cb as E2,Cc as Y2,D as Os,Da as t2,Db as vd,Dc as k_,E as Zl,Ea as Of,Eb as A2,Ec as Hf,F as Aw,Fa as i2,Fb as Oa,G as Lw,Ga as M_,Gb as L2,Gc as qf,H as Af,Ha as C_,Hb as R2,Hc as K2,I as Lf,Ia as gd,Ib as Eo,Ic as Ze,J as Rw,Ja as Lu,Jb as bd,Jc as dS,K as Dw,Ka as E_,Kb as wd,Kc as Ct,L as kw,La as r2,Lb as D2,Lc as N,M as Fw,Ma as Bf,Mb as k2,Mc as Qe,N as Rf,Na as vn,Nb as Ba,Nc as pS,O as Cu,Oa as n2,Ob as ql,Oc as fS,P as $l,Pa as qr,Pb as F2,Pc as mS,Q as zw,Qa as $n,Qb as A_,Qc as gS,R as Df,Ra as o2,Rb as z2,Rc as _S,S as Ow,Sa as s2,Sb as O2,Sc as yS,T as za,Ta as a2,Tb as Sr,Tc as xS,U as Dr,Ua as l2,Ub as B2,Uc as vS,V as kf,Va as ns,Vb as N2,Vc as bS,W as Bw,Wa as Nf,Wb as Ao,Wc as wS,X as Nw,Xa as c2,Xb as L_,Xc as SS,Y as qi,Ya as Hl,Yb as V2,Yc as TS,Z as wi,Za as u2,Zb as j2,Zc as PS,_ as Vw,_a as Wn,_b as G2,_c as IS,a as Da,aa as pd,ab as Vf,ac as Sd,ad as CS,b as Zt,ba as fd,bb as _d,bc as Lo,bd as ES,c as ka,ca as Eu,cb as jf,cc as U2,cd as Td,d as Cf,da as jw,db as d2,dc as Wf,e as bw,ea as Au,eb as p2,ec as an,f as Co,fa as Gw,fb as f2,fc as Xl,g as zs,ga as Uw,gb as m2,gc as kn,h as qe,ha as Wt,hb as g2,hc as Fn,i as ww,ia as rs,ib as _2,ic as Yl,j as Ae,ja as Zw,jb as y2,jc as Kl,k as Sw,ka as $w,kb as Ns,kc as Z2,l as Qi,la as Ww,lb as yd,lc as zn,m as nt,ma as Ff,mb as xd,mc as Na,n as $t,na as Bt,nb as Gf,nc as Jl,o as Dn,oa as Hw,ob as Uf,oc as Vs,p as jl,pa as qw,pb as x2,pc as Ql,q as Fe,qa as P_,qb as v2,qc as $2,r as Ef,ra as Xw,rb as b2,rc as D_,s as Tw,sa as zf,sb as w2,sc as W2,t as Pw,ta as Yw,tb as S2,tc as H2,u as dd,ua as xn,ub as T2,uc as q2,v as Iw,va as Kw,vb as P2,vc as Hn,w as Fa,wa as Jw,wb as I2,wc as qn,x as Mw,xa as Qw,xb as bn,xc as Va,y as is,ya as e2,yb as M2,yc as Fr,z as Gl,za as kr,zb as Zf,zc as ec}from"./chunk-GI37GZBU.js";import{a as Ru,b as Du}from"./chunk-O7SUU6QH.js";import{a as J2,b as Q2,c as eS,d as tS,e as Si,h as iS,i as rS,j as nS,k as oS,m as ja,n as F_,o as sS,p as aS,q as lS,r as cS,s as z_,t as uS,u as hS}from"./chunk-3NENMGIW.js";import{a as Vl,b as WE,c as Rn}from"./chunk-5TBO732O.js";var Vo=Vl((e,t)=>{var i=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,a=/^0o[0-7]+$/i,s=parseInt,o="object"==typeof global&&global&&global.Object===Object&&global,l="object"==typeof self&&self&&self.Object===Object&&self,h=o||l||Function("return this")(),u=Object.prototype.toString,c=Math.max,d=Math.min,p=function(){return h.Date.now()};function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return NaN;if(f(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=f(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var o=n.test(e);return o||a.test(e)?s(e.slice(2),o?2:8):r.test(e)?NaN:+e}t.exports=function(e,t,i){var r,n,a,s,o,l,h=0,u=!1,g=!1,_=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=r,a=n;return r=n=void 0,h=t,s=e.apply(a,i)}function v(e){var i=e-l;return void 0===l||i>=t||i<0||g&&e-h>=a}function x(){var e=p();if(v(e))return b(e);o=setTimeout(x,function(e){var i=t-(e-l);return g?d(i,a-(e-h)):i}(e))}function b(e){return o=void 0,_&&r?y(e):(r=n=void 0,s)}function w(){var e=p(),i=v(e);if(r=arguments,n=this,l=e,i){if(void 0===o)return function(e){return h=e,o=setTimeout(x,t),u?y(e):s}(l);if(g)return o=setTimeout(x,t),y(l)}return void 0===o&&(o=setTimeout(x,t)),s}return t=m(t)||0,f(i)&&(u=!!i.leading,a=(g="maxWait"in i)?c(m(i.maxWait)||0,t):a,_="trailing"in i?!!i.trailing:_),w.cancel=function(){void 0!==o&&clearTimeout(o),h=0,r=l=n=o=void 0},w.flush=function(){return void 0===o?s:b(p())},w}}),mP=Vl((e,t)=>{var i,r;i=e,r=function(){"use strict";var e={},t={};function i(i,r,n){if(t[i]=n,"index"===i){var a="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",s={};return t.shared(s),t.index(e,s),typeof window<"u"&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:"text/javascript"}))),e}}return i("shared",0,function(e){function t(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(s,o)}l((r=r.apply(e,t||[])).next())})}function i(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,a;"function"==typeof SuppressedError&&SuppressedError,i.prototype={clone(){return new i(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround(e,t){let i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:i},i.convert=function(e){if(e instanceof i)return e;if(Array.isArray(e))return new i(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new i(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var s=function(){if(a)return n;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return a=1,n=e,e.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,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=n/a}var s=0,o=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:o=i,i=.5*(o-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},n}(),o=r(s);let l,h;function u(){return null!=l||(l=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function c(){if(null==h&&(h=!1,u())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let i=4*t;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){h=!0;break}}}return h||!1}var d=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function f(){var e=new p(9);return p!=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 m(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 g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function _(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function y(e,t,i){var r=new p(3);return r[0]=e,r[1]=t,r[2]=i,r}function v(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function x(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function b(e,t,i){var r=t[0],n=t[1],a=t[2],s=i[0],o=i[1],l=i[2];return e[0]=n*l-a*o,e[1]=a*s-r*l,e[2]=r*o-n*s,e}var w,T=_;function S(e,t,i){var r=t[0],n=t[1],a=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*s,e}function I(){var e=new p(4);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function P(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",a=Math.PI/360;t*=a,r*=a,i*=a;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(i),h=Math.cos(i),u=Math.sin(r),c=Math.cos(r);switch(n){case"xyz":e[0]=s*h*c+o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c-s*l*u;break;case"xzy":e[0]=s*h*c-o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c+s*l*u;break;case"yxz":e[0]=s*h*c+o*l*u,e[1]=o*l*c-s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c+s*l*u;break;case"yzx":e[0]=s*h*c+o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c-s*l*u;break;case"zxy":e[0]=s*h*c-o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u+s*l*c,e[3]=o*h*c-s*l*u;break;case"zyx":e[0]=s*h*c-o*l*u,e[1]=o*l*c+s*h*u,e[2]=o*h*u-s*l*c,e[3]=o*h*c+s*l*u;break;default:throw new Error("Unknown angle order "+n)}return e}function C(){var e=new p(2);return p!=Float32Array&&(e[0]=0,e[1]=0),e}function E(e,t){var i=new p(2);return i[0]=e,i[1]=t,i}g(),w=new p(4),p!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),y(1,0,0),y(0,1,0),I(),I(),f(),C();let M=8192;function A(e,t,i){return t*(M/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function k(e){return e instanceof Error?e:new Error("string"==typeof e?e:String(e))}function L(e,t){return(e%t+t)%t}function F(e,t,i){return e*(1-i)+t*i}function D(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 R(e,t,i,r){let n=new o(e,t,i,r);return e=>n.solve(e)}let z=R(.25,.1,.25,1);function N(e,t,i){return Math.min(i,Math.max(t,e))}function O(e,t,i){let r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function B(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}let j=1;function V(e,t,i){let r={};for(let i in e)r[i]=t.call(this,e[i],i,e);return r}function G(e,t,i){let r={};for(let i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function U(e){return Array.isArray(e)?e.map(U):"object"==typeof e&&e?V(e,U):e}let Z={};function $(e){Z[e]||(typeof console<"u"&&console.warn(e),Z[e]=!0)}function q(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function W(e){return typeof WorkerGlobalScope<"u"&&void 0!==e&&e instanceof WorkerGlobalScope}let H=null;function X(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}let Y,K,J="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Q(e,i,r,n,a){return t(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let t=new VideoFrame(e,{timestamp:0});try{let s=t?.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw new Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(n*a*4);if(yield t.copyTo(l,function(e,t,i,r,n){let a=4*Math.max(-t,0),s=(Math.max(0,i)-i)*r*4+a,o=4*r,l=Math.max(0,t),h=Math.max(0,i);return{rect:{x:l,y:h,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+n)-h},layout:[{offset:s,stride:o}]}}(e,i,r,n,a)),o)for(let e=0;e<l.length;e+=4){let t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{t.close()}})}function ee(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function te(e){return e*Math.PI/180}function ie(e){return e/Math.PI*180}let re={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ne={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ae="AbortError";class se extends Error{constructor(e=ae){super(e instanceof Error?e.message:e),this.name=ae,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function oe(e){return e instanceof Error&&e.name===ae}function le(e){if(e.aborted)throw new se(e.reason)}let he={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ue(e){return he.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}let ce="global-dispatcher";class de extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}let pe=()=>{var e;return W(self)?null===(e=self.worker)||void 0===e?void 0:e.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},fe=function(e,i){return t(this,void 0,void 0,function*(){var r,n,a,s;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let t=ue(e.url);if(t){let r=yield t(e,i);return r.data||"arrayBuffer"!==e.type?r:B(r,{data:new ArrayBuffer(0)})}if(W(self)&&null!==(r=self.worker)&&void 0!==r&&r.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ce},i)}if(!((a=e.url).startsWith("file:")||(null===(s=pe())||void 0===s?void 0:s.startsWith("file:"))&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,function*(){let t,r,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:pe(),referrerPolicy:e.referrerPolicy,signal:i.signal});"json"!==e.type||n.headers.has("Accept")||n.headers.set("Accept","application/json");try{t=yield fetch(n)}catch(t){throw oe(t)?t:new de(0,k(t).message,e.url,new Blob)}if(!t.ok){let i=yield t.blob();throw new de(t.status,t.statusText,e.url,i)}r="arrayBuffer"===e.type||"image"===e.type?t.arrayBuffer():"json"===e.type?t.json():t.text();let a=yield r;return le(i.signal),{data:a,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),etag:t.headers.get("ETag")}})}(e,i);if(W(self)&&null!==(n=self.worker)&&void 0!==n&&n.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ce},i)}return function(e,t){return new Promise((i,r)=>{var n;let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(a.responseType="arraybuffer");for(let t in e.headers)a.setRequestHeader(t,e.headers[t]);"json"===e.type&&(a.responseType="text",!(null===(n=e.headers)||void 0===n)&&n.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===e.credentials,a.onerror=()=>{r(new Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let t=a.response;if("json"===e.type)try{t=JSON.parse(a.response)}catch(e){return void r(e)}i({data:t,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let t=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});r(new de(a.status,a.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{a.abort(),r(new se(t.signal.reason))}),a.send(e.body)})}(e,i)})};function me(e){if(!e||e.indexOf("://")<=0||e.startsWith("data:image/")||e.startsWith("blob:"))return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function ge(e,t,i){var r;null!==(r=i[e])&&void 0!==r&&r.includes(t)||(i[e]||(i[e]=[]),i[e].push(t))}function _e(e,t,i){if(i?.[e]){let r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class ye{constructor(e,t={}){B(this,t),this.type=e}}class ve extends ye{constructor(e,t={}){super("error",B({error:e},t))}}class xe{on(e,t){return this._listeners||(this._listeners={}),ge(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return _e(e,t,this._listeners),_e(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),ge(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){var i,r;"string"==typeof e&&(e=new ye(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=null!==(i=this._listeners)&&void 0!==i&&i[n]?this._listeners[n].slice():[];for(let i of t)i.call(this,e);let a=null!==(r=this._oneTimeListeners)&&void 0!==r&&r[n]?this._oneTimeListeners[n].slice():[];for(let t of a)_e(n,t,this._oneTimeListeners),t.call(this,e);let s=this._eventedParent;s&&(B(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(e))}else e instanceof ve&&console.error(e.error);return this}listens(e){var t,i,r,n,a;return(null===(i=null===(t=this._listeners)||void 0===t?void 0:t[e])||void 0===i?void 0:i.length)>0||(null===(n=null===(r=this._oneTimeListeners)||void 0===r?void 0:r[e])||void 0===n?void 0:n.length)>0||(null===(a=this._eventedParent)||void 0===a?void 0:a.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var be={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},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"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},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"}},source_video:{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"}}},source_image:{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"}}},layer:{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"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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}},sky:{"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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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"}},"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:{"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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"}},paint_symbol:{"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"}},paint_raster:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let we=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Te(e,t){let i={};for(let t in e)"ref"!==t&&(i[t]=e[t]);return we.forEach(e=>{e in t&&(i[e]=t[e])}),i}function Se(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(!Se(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!Se(e[i],t[i]))return!1;return!0}return e===t}function Ie(e,t){e.push(t)}function Pe(e,t,i){Ie(i,{command:"addSource",args:[e,t[e]]})}function Ce(e,t,i){Ie(t,{command:"removeSource",args:[e]}),i[e]=!0}function Ee(e,t,i,r){Ce(e,i,r),Pe(e,t,i)}function Me(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!Se(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!Se(e[i][r],t[i][r]))return!1;return!0}function Ae(e,t,i,r,n,a){e=e||{},t=t||{};for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(Se(e[s],t[s])||i.push({command:a,args:[r,s,t[s],n]}));for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(Se(e[s],t[s])||i.push({command:a,args:[r,s,t[s],n]}))}function ke(e){return e.id}function Le(e,t){return e[t.id]=t,e}class Fe{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function De(e,...t){for(let i of t)for(let t in i)e[t]=i[t];return e}class Re extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class ze{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,i]of t)this.bindings[e]=i}concat(e){return new ze(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]||!!this.parent&&this.parent.has(e)}}let Ne={kind:"null"},Oe={kind:"number"},Be={kind:"string"},je={kind:"boolean"},Ve={kind:"color"},Ge={kind:"projectionDefinition"},Ue={kind:"object"},Ze={kind:"value"},$e={kind:"collator"},qe={kind:"formatted"},We={kind:"padding"},He={kind:"colorArray"},Xe={kind:"numberArray"},Ye={kind:"resolvedImage"},Ke={kind:"variableAnchorOffsetCollection"};function Je(e,t){return{kind:"array",itemType:e,N:t}}function Qe(e){if("array"===e.kind){let t=Qe(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}let et=[Ne,Oe,Be,je,Ve,Ge,qe,Ue,Je(Ze),We,Xe,He,Ye,Ke];function tt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!tt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(let e of et)if(!tt(e,t))return null}return`Expected ${Qe(e)} but found ${Qe(t)} instead.`}function it(e,t){return t.some(t=>t.kind===e.kind)}function rt(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function nt(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}let at=.96422,st=.82521,ot=4/29,lt=6/29,ht=3*lt*lt,ut=lt*lt*lt,ct=Math.PI/180,dt=180/Math.PI;function pt(e){return(e%=360)<0&&(e+=360),e}function ft([e,t,i,r]){let n,a,s=gt((.2225045*(e=mt(e))+.7168786*(t=mt(t))+.0606169*(i=mt(i)))/1);e===t&&t===i?n=a=s:(n=gt((.4360747*e+.3850649*t+.1430804*i)/at),a=gt((.0139322*e+.0971045*t+.7141733*i)/st));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),r]}function mt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function gt(e){return e>ut?Math.pow(e,1/3):e/ht+ot}function _t([e,t,i,r]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,s=isNaN(i)?n:n-i/200;return n=1*vt(n),a=at*vt(a),s=st*vt(s),[yt(3.1338561*a-1.6168667*n-.4906146*s),yt(-.9787684*a+1.9161415*n+.033454*s),yt(.0719453*a-.2289914*n+1.4052427*s),r]}function yt(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function vt(e){return e>lt?e*e*e:ht*(e-ot)}let xt=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function bt(e,t){return xt(e,t)?e[t]:void 0}function wt(e){return parseInt(e.padEnd(2,e),16)/255}function Tt(e,t){return St(t?e/100:e,0,1)}function St(e,t,i){return Math.min(Math.max(t,e),i)}function It(e){return!e.some(Number.isNaN)}let Pt={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 Ct(e,t,i){return e+i*(t-e)}function Et(e,t,i){return e.map((e,r)=>Ct(e,t[r],i))}class Mt{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof Mt)return e;if("string"!=typeof e)return;let t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=bt(Pt,e);if(t){let[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,i=1;return[wt(e.slice(i,i+=t)),wt(e.slice(i,i+=t)),wt(e.slice(i,i+=t)),wt(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,i,r,n,a,s,o,l,h,u,c,d]=t,p=[n||" ",o||" ",u].join("");if("  "===p||"  /"===p||",,"===p||",,,"===p){let e=[r,s,h].join(""),t="%%%"===e?100:""===e?255:0;if(t){let e=[St(+i/t,0,1),St(+a/t,0,1),St(+l/t,0,1),c?Tt(+c,d):1];if(It(e))return e}}return}}let i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[e,t,r,n,a,s,o,l,h]=i,u=[r||" ",a||" ",o].join("");if("  "===u||"  /"===u||",,"===u||",,,"===u){let e=[+t,St(+n,0,100),St(+s,0,100),l?Tt(+l,h):1];if(It(e))return function([e,t,i,r]){function n(r){let n=(r+e/30)%12,a=t*Math.min(i,1-i);return i-a*Math.max(-1,Math.min(n-3,9-n,1))}return e=pt(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}(e);return t?new Mt(...t,!1):void 0}get rgb(){let{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){let[t,i,r,n]=ft(e),a=Math.sqrt(i*i+r*r);return[Math.round(1e4*a)?pt(Math.atan2(r,i)*dt):NaN,a,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ft(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map(e=>Math.round(255*e)).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{let[r,n,a,s]=Et(e.rgb,t.rgb,i);return new Mt(r,n,a,s,!1)}case"hcl":{let r,n,[a,s,o,l]=e.hcl,[h,u,c,d]=t.hcl;if(isNaN(a)||isNaN(h))isNaN(a)?isNaN(h)?r=NaN:(r=h,1!==o&&0!==o||(n=u)):(r=a,1!==c&&0!==c||(n=s));else{let e=h-a;h>a&&e>180?e-=360:h<a&&a-h>180&&(e+=360),r=a+i*e}let[p,f,m,g]=function([e,t,i,r]){return e=isNaN(e)?0:e*ct,_t([i,Math.cos(e)*t,Math.sin(e)*t,r])}([r,n??Ct(s,u,i),Ct(o,c,i),Ct(l,d,i)]);return new Mt(p,f,m,g,!1)}case"lab":{let[r,n,a,s]=_t(Et(e.lab,t.lab,i));return new Mt(r,n,a,s,!1)}}}}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1);class At{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":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}}let kt=["bottom","center","top"];class Lt{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}}class Ft{constructor(e){this.sections=e}static fromString(e){return new Ft([new Lt(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof Ft?e:Ft.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dt)return e;if("number"==typeof e)return new Dt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if("number"!=typeof t)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]]}return new Dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Dt(Et(e.values,t.values,i))}}class Rt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rt)return e;if("number"==typeof e)return new Rt([e]);if(Array.isArray(e)){for(let t of e)if("number"!=typeof t)return;return new Rt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Rt(Et(e.values,t.values,i))}}class zt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zt)return e;if("string"==typeof e){let t=Mt.parse(e);return t?new zt([t]):void 0}if(!Array.isArray(e))return;let t=[];for(let i of e){if("string"!=typeof i)return;let e=Mt.parse(i);if(!e)return;t.push(e)}return new zt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,r="rgb"){let n=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)n.push(Mt.interpolate(e.values[a],t.values[a],i,r));return new zt(n)}}class Nt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}let Ot=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Bt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Bt)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let i=e[t],r=e[t+1];if("string"!=typeof i||!Ot.has(i)||!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Bt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){let r=e.values,n=t.values;if(r.length!==n.length)throw new Nt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==n[e])throw new Nt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${n[e]}`);a.push(r[e]);let[t,s]=r[e+1],[o,l]=n[e+1];a.push([Ct(t,o,i),Ct(s,l,i)])}return new Bt(a)}}class jt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new jt({name:e,available:!1}):null}}class Vt{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new Vt(e,t,i)}static parse(e){return e instanceof Vt?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new Vt(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new Vt(e.from,e.to,e.transition):"string"==typeof e?new Vt(e,e,1):void 0}}function Gt(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ut(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Vt||e instanceof Mt||e instanceof At||e instanceof Ft||e instanceof Dt||e instanceof Rt||e instanceof zt||e instanceof Bt||e instanceof jt)return!0;if(Array.isArray(e)){for(let t of e)if(!Ut(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!Ut(e[t]))return!1;return!0}return!1}function Zt(e){if(null===e)return Ne;if("string"==typeof e)return Be;if("boolean"==typeof e)return je;if("number"==typeof e)return Oe;if(e instanceof Mt)return Ve;if(e instanceof Vt)return Ge;if(e instanceof At)return $e;if(e instanceof Ft)return qe;if(e instanceof Dt)return We;if(e instanceof Rt)return Xe;if(e instanceof zt)return He;if(e instanceof Bt)return Ke;if(e instanceof jt)return Ye;if(Array.isArray(e)){let t,i=e.length;for(let i of e){let e=Zt(i);if(t){if(t===e)continue;t=Ze;break}t=e}return Je(t||Ze,i)}return Ue}function $t(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Mt||e instanceof Vt||e instanceof Ft||e instanceof Dt||e instanceof Rt||e instanceof zt||e instanceof Bt||e instanceof jt?e.toString():JSON.stringify(e)}class qt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ut(e[1]))return t.error("invalid value");let i=e[1],r=Zt(i),n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new qt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let Wt={string:Be,number:Oe,boolean:je,object:Ue};class Ht{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1,n=e[0];if("array"===n){let n,a;if(e.length>2){let i=e[1];if("string"!=typeof i||!(i in Wt)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Wt[i],r++}else n=Ze;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);a=e[2],r++}i=Je(n,a)}else{if(!Wt[n])throw new Error(`Types doesn't contain name = ${n}`);i=Wt[n]}let a=[];for(;r<e.length;r++){let i=t.parse(e[r],r,Ze);if(!i)return null;a.push(i)}return new Ht(i,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(!tt(this.type,Zt(i)))return i;if(t===this.args.length-1)throw new Nt(`Expected value to be of type ${Qe(this.type)}, but found ${Qe(Zt(i))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let Xt={"to-boolean":je,"to-color":Ve,"to-number":Oe,"to-string":Be};class Yt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[0];if(!Xt[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");let r=Xt[i],n=[];for(let i=1;i<e.length;i++){let r=t.parse(e[i],i,Ze);if(!r)return null;n.push(r)}return new Yt(r,n)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(let r of this.args){if(t=r.evaluate(e),i=null,t instanceof Mt)return t;if("string"==typeof t){let i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Gt(t[0],t[1],t[2],t[3]),!i))return new Mt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Nt(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(let i of this.args){t=i.evaluate(e);let r=Dt.parse(t);if(r)return r}throw new Nt(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(let i of this.args){t=i.evaluate(e);let r=Rt.parse(t);if(r)return r}throw new Nt(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(let i of this.args){t=i.evaluate(e);let r=zt.parse(t);if(r)return r}throw new Nt(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(let i of this.args){t=i.evaluate(e);let r=Bt.parse(t);if(r)return r}throw new Nt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(let i of this.args){if(t=i.evaluate(e),null===t)return 0;let r=Number(t);if(!isNaN(r))return r}throw new Nt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Ft.fromString($t(this.args[0].evaluate(e)));case"resolvedImage":return jt.fromString($t(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return $t(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}let Kt=["Unknown","Point","LineString","Polygon"];class Jt{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?"number"==typeof this.feature.type?Kt[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=Mt.parse(e),this._parseColorCache.set(e,t)),t}}class Qt{constructor(e,t,i=[],r,n=new ze,a=[]){this.registry=e,this.path=i,this.key=i.map(e=>`[${e}]`).join(""),this.scope=n,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Ht(t,[e]):"coerce"===i?new Yt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))r=i(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof qt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){let e=new Jt;try{r=new qt(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){let r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new Qt(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){let i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Re(i,e))}checkSubtype(e,t){let i=tt(e,t);return i&&this.error(i),i}}class ei{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let r=1;r<e.length-1;r+=2){let n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);let a=t.parse(e[r+1],r+1);if(!a)return null;i.push([n,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new ei(i,r):null}outputDefined(){return this.result.outputDefined()}}class ti{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");let i=e[1];return t.scope.has(i)?new ti(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ii{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,Oe),r=t.parse(e[2],2,Je(t.expectedType||Ze));return i&&r?new ii(r.type.itemType,i,r):null}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Nt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new Nt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Nt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ri{constructor(e,t){this.type=je,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,Ze),r=t.parse(e[2],2,Ze);return i&&r?it(i.type,[je,Be,Oe,Ne,Ze])?new ri(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!rt(t,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(Zt(t))} instead.`);if(!rt(i,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${Qe(Zt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ni{constructor(e,t,i){this.type=Oe,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,Ze),r=t.parse(e[2],2,Ze);if(!i||!r)return null;if(!it(i.type,[je,Be,Oe,Ne,Ze]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`);if(4===e.length){let n=t.parse(e[3],3,Oe);return n?new ni(i,r,n):null}return new ni(i,r)}evaluate(e){let t,i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!rt(i,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(Zt(i))} instead.`);if(this.fromIndex&&(t=this.fromIndex.evaluate(e)),rt(r,["string"])){let e=r.indexOf(i,t);return-1===e?-1:[...r.slice(0,e)].length}if(rt(r,["array"]))return r.indexOf(i,t);throw new Nt(`Expected second argument to be of type array or string, but found ${Qe(Zt(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ai{constructor(e,t,i,r,n,a){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);let n={},a=[];for(let s=2;s<e.length-1;s+=2){let o=e[s],l=e[s+1];Array.isArray(o)||(o=[o]);let h=t.concat(s);if(0===o.length)return h.error("Expected at least one branch label.");for(let e of o){if("number"!=typeof e&&"string"!=typeof e)return h.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,Zt(e)))return null}else i=Zt(e);if(void 0!==n[String(e)])return h.error("Branch labels must be unique.");n[String(e)]=a.length}let u=t.parse(l,s,r);if(!u)return null;r=r||u.type,a.push(u)}let s=t.parse(e[1],1,Ze);if(!s)return null;let o=t.parse(e[e.length-1],e.length-1,r);return o?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new ai(i,r,s,n,a,o):null}evaluate(e){let t=this.input.evaluate(e);return(Zt(t)===this.inputType&&this.outputs[this.cases[t]]||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()}}class si{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);let r=[];for(let n=1;n<e.length-1;n+=2){let a=t.parse(e[n],n,je);if(!a)return null;let s=t.parse(e[n+1],n+1,i);if(!s)return null;r.push([a,s]),i=i||s.type}let n=t.parse(e[e.length-1],e.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new si(i,r,n)}evaluate(e){for(let[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class oi{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,Ze),r=t.parse(e[2],2,Oe);if(!i||!r)return null;if(!it(i.type,[Je(Ze),Be,Ze]))return t.error(`Expected first argument to be of type array or string, but found ${Qe(i.type)} instead`);if(4===e.length){let n=t.parse(e[3],3,Oe);return n?new oi(i.type,i,r,n):null}return new oi(i.type,i,r)}evaluate(e){let t,i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(this.endIndex&&(t=this.endIndex.evaluate(e)),rt(i,["string"]))return[...i].slice(r,t).join("");if(rt(i,["array"]))return i.slice(r,t);throw new Nt(`Expected first argument to be of type array or string, but found ${Qe(Zt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function li(e,t){let i,r,n=e.length-1,a=0,s=n,o=0;for(;a<=s;)if(o=Math.floor((a+s)/2),i=e[o],r=e[o+1],i<=t){if(o===n||t<r)return o;a=o+1}else{if(!(i>t))throw new Nt("Input is not a number.");s=o-1}return 0}class hi{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");let i=t.parse(e[1],1,Oe);if(!i)return null;let r=[],n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){let a=1===i?-1/0:e[i],s=e[i+1],o=i,l=i+1;if("number"!=typeof a)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(r.length&&r[r.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);let h=t.parse(s,l,n);if(!h)return null;n=n||h.type,r.push([a,h])}return new hi(n,i,r)}evaluate(e){let t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);let n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[li(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}var ui,ci,di,pi=function(){if(ci)return ui;function e(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return ci=1,ui=e,e.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,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=n/a}var s=0,o=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:o=i,i=.5*(o-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},ui}(),fi=(di=pi)&&di.__esModule&&Object.prototype.hasOwnProperty.call(di,"default")?di.default:di;class mi{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=gi(t,e.base,i,r);else if("linear"===e.name)n=gi(t,1,i,r);else if("cubic-bezier"===e.name){let a=e.controlPoints;n=new fi(a[0],a[1],a[2],a[3]).solve(gi(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...a]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){let e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Oe),!n)return null;let s=[],o=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||t.expectedType==He?t.expectedType&&"value"!==t.expectedType.kind&&(o=t.expectedType):o=Ve;for(let e=0;e<a.length;e+=2){let i=a[e],r=a[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let h=t.parse(r,l,o);if(!h)return null;o=o||h.type,s.push([i,h])}return nt(o,Oe)||nt(o,Ge)||nt(o,Ve)||nt(o,We)||nt(o,Xe)||nt(o,He)||nt(o,Ke)||nt(o,Je(Oe))?new mi(o,i,r,n,s):t.error(`Type ${Qe(o)} is not interpolatable.`)}evaluate(e){let t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);let n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);let a=li(t,r),s=mi.interpolationFactor(this.interpolation,r,t[a],t[a+1]),o=i[a].evaluate(e),l=i[a+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ct(o,l,s);case"color":return Mt.interpolate(o,l,s);case"padding":return Dt.interpolate(o,l,s);case"colorArray":return zt.interpolate(o,l,s);case"numberArray":return Rt.interpolate(o,l,s);case"variableAnchorOffsetCollection":return Bt.interpolate(o,l,s);case"array":return Et(o,l,s);case"projectionDefinition":return Vt.interpolate(o,l,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return Mt.interpolate(o,l,s,"hcl");case"colorArray":return zt.interpolate(o,l,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Mt.interpolate(o,l,s,"lab");case"colorArray":return zt.interpolate(o,l,s,"lab")}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function gi(e,t,i,r){let n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}let _i={color:Mt.interpolate,number:Ct,padding:Dt.interpolate,numberArray:Rt.interpolate,colorArray:zt.interpolate,variableAnchorOffsetCollection:Bt.interpolate,array:Et};class yi{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null,r=t.expectedType;r&&"value"!==r.kind&&(i=r);let n=[];for(let r of e.slice(1)){let e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");let a=r&&n.some(e=>tt(r,e.type));return new yi(a?Ze:i,n)}evaluate(e){let t,i=null,r=0;for(let n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof jt&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function vi(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function xi(e,t,i,r){return 0===r.compare(t,i)}function bi(e,t,i){let r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=je,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let i=e[0],a=t.parse(e[1],1,Ze);if(!a)return null;if(!vi(i,a.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Qe(a.type)}'.`);let s=t.parse(e[2],2,Ze);if(!s)return null;if(!vi(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Qe(s.type)}'.`);if(a.type.kind!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${Qe(a.type)}' and '${Qe(s.type)}'.`);r&&("value"===a.type.kind&&"value"!==s.type.kind?a=new Ht(s.type,[a]):"value"!==a.type.kind&&"value"===s.type.kind&&(s=new Ht(a.type,[s])));let o=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(o=t.parse(e[3],3,$e),!o)return null}return new n(a,s,o)}evaluate(n){let a=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){let t=Zt(a),i=Zt(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Nt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=Zt(a),i=Zt(s);if("string"!==e.kind||"string"!==i.kind)return t(n,a,s)}return this.collator?i(n,a,s,this.collator.evaluate(n)):t(n,a,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let wi=bi("==",function(e,t,i){return t===i},xi),Ti=bi("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!xi(0,t,i,r)}),Si=bi("<",function(e,t,i){return t<i},function(e,t,i,r){return r.compare(t,i)<0}),Ii=bi(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}),Pi=bi("<=",function(e,t,i){return t<=i},function(e,t,i,r){return r.compare(t,i)<=0}),Ci=bi(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0});class Ei{constructor(e,t,i){this.type=$e,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");let i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");let r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,je);if(!r)return null;let n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,je);if(!n)return null;let a=null;return i.locale&&(a=t.parse(i.locale,1,Be),!a)?null:new Ei(r,n,a)}evaluate(e){return new At(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}}class Mi{constructor(e,t,i,r,n,a){this.type=Be,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=a}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,Oe);if(!i)return null;let r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,Be),!n))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,Be),!a))return null;let s=null;if(r.unit&&(s=t.parse(r.unit,1,Be),!s))return null;if(a&&s)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let o=null;if(r["min-fraction-digits"]&&(o=t.parse(r["min-fraction-digits"],1,Oe),!o))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parse(r["max-fraction-digits"],1,Oe),!l)?null:new Mi(i,n,a,s,o,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.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.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Ai{constructor(e){this.type=qe,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");let r=[],n=!1;for(let i=1;i<=e.length-1;++i){let a=e[i];if(n&&"object"==typeof a&&!Array.isArray(a)){n=!1;let e=null;if(a["font-scale"]&&(e=t.parse(a["font-scale"],1,Oe),!e))return null;let i=null;if(a["text-font"]&&(i=t.parse(a["text-font"],1,Je(Be)),!i))return null;let s=null;if(a["text-color"]&&(s=t.parse(a["text-color"],1,Ve),!s))return null;let o=null;if(a["vertical-align"]){if("string"==typeof a["vertical-align"]&&!kt.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(o=t.parse(a["vertical-align"],1,Be),!o)return null}let l=r[r.length-1];l.scale=e,l.font=i,l.textColor=s,l.verticalAlign=o}else{let a=t.parse(e[i],1,Ze);if(!a)return null;let s=a.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ai(r)}evaluate(e){return new Ft(this.sections.map(t=>{let i=t.content.evaluate(e);return Zt(i)===Ye?new Lt("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Lt($t(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class ki{constructor(e){this.type=Ye,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");let i=t.parse(e[1],1,Be);return i?new ki(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=jt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class Li{constructor(e){this.type=Oe,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Qe(i.type)} instead.`):new Li(i):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Nt(`Expected value to be of type string or array, but found ${Qe(Zt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let Fi=8192;function Di(e,t){let i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*Fi),Math.round(r*n*Fi)]}function Ri(e,t){let i=Math.pow(2,t.z);return[(n=(e[0]/Fi+t.x)/i,360*n-180),(r=(e[1]/Fi+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function zi(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 Ni(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Oi(e,t,i){let r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],s=e[1]-i[1];return r*s-a*n==0&&r*a<=0&&n*s<=0}function Bi(e,t,i,r){return(n=[r[0]-i[0],r[1]-i[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*a[0]!=0&&!(!$i(e,t,i,r)||!$i(i,r,e,t));var n,a}function ji(e,t,i){for(let r of i)for(let i=0;i<r.length-1;++i)if(Bi(e,t,r[i],r[i+1]))return!0;return!1}function Vi(e,t,i=!1){let r=!1;for(let o of t)for(let t=0;t<o.length-1;t++){if(Oi(e,o[t],o[t+1]))return i;(a=o[t])[1]>(n=e)[1]!=(s=o[t+1])[1]>n[1]&&n[0]<(s[0]-a[0])*(n[1]-a[1])/(s[1]-a[1])+a[0]&&(r=!r)}var n,a,s;return r}function Gi(e,t){for(let i of t)if(Vi(e,i))return!0;return!1}function Ui(e,t){for(let i of e)if(!Vi(i,t))return!1;for(let i=0;i<e.length-1;++i)if(ji(e[i],e[i+1],t))return!1;return!0}function Zi(e,t){for(let i of t)if(Ui(e,i))return!0;return!1}function $i(e,t,i,r){let n=r[0]-i[0],a=r[1]-i[1],s=(e[0]-i[0])*a-n*(e[1]-i[1]),o=(t[0]-i[0])*a-n*(t[1]-i[1]);return s>0&&o<0||s<0&&o>0}function qi(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=[];for(let r=0;r<e[n].length;r++){let s=Di(e[n][r],i);zi(t,s),a.push(s)}r.push(a)}return r}function Wi(e,t,i){let r=[];for(let n=0;n<e.length;n++){let a=qi(e[n],t,i);r.push(a)}return r}function Hi(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let t=.5*r,n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}zi(t,e)}function Xi(e,t,i,r){let n=Math.pow(2,r.z)*Fi,a=[r.x*Fi,r.y*Fi],s=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];Hi(r,t,i,n),s.push(r)}return s}function Yi(e,t,i,r){let n=Math.pow(2,r.z)*Fi,a=[r.x*Fi,r.y*Fi],s=[];for(let i of e){let e=[];for(let r of i){let i=[r.x+a[0],r.y+a[1]];zi(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(o=t)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(let e of s)for(let r of e)Hi(r,t,i,n)}var o;return s}class Ki{constructor(e,t){this.type=je,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ut(e[1])){let t=e[1];if("FeatureCollection"===t.type){let e=[];for(let i of t.features){let{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new Ki(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){let e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Ki(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Ki(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(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("Polygon"===t.type){let a=qi(t.coordinates,r,n),s=Xi(e.geometry(),i,r,n);if(!Ni(i,r))return!1;for(let e of s)if(!Vi(e,a))return!1}if("MultiPolygon"===t.type){let a=Wi(t.coordinates,r,n),s=Xi(e.geometry(),i,r,n);if(!Ni(i,r))return!1;for(let e of s)if(!Gi(e,a))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(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("Polygon"===t.type){let a=qi(t.coordinates,r,n),s=Yi(e.geometry(),i,r,n);if(!Ni(i,r))return!1;for(let e of s)if(!Ui(e,a))return!1}if("MultiPolygon"===t.type){let a=Wi(t.coordinates,r,n),s=Yi(e.geometry(),i,r,n);if(!Ni(i,r))return!1;for(let e of s)if(!Zi(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ji=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)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 r=1+(e<<1),a=r+1;if(a<this.length&&i(t[a],t[r])<0&&(r=a),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}};function Qi(e,t,i=0,r=e.length-1,n=tr){for(;r>i;){if(r-i>600){let a=r-i+1,s=t-i+1,o=Math.log(a),l=.5*Math.exp(2*o/3),h=.5*Math.sqrt(o*l*(a-l)/a)*(s-a/2<0?-1:1);Qi(e,t,Math.max(i,Math.floor(t-s*l/a+h)),Math.min(r,Math.floor(t+(a-s)*l/a+h)),n)}let a=e[t],s=i,o=r;for(er(e,i,t),n(e[r],a)>0&&er(e,i,r);s<o;){for(er(e,s,o),s++,o--;n(e[s],a)<0;)s++;for(;n(e[o],a)>0;)o--}0===n(e[i],a)?er(e,i,o):(o++,er(e,o,r)),o<=t&&(i=o+1),t<=o&&(r=o-1)}}function er(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function tr(e,t){return e<t?-1:e>t?1:0}function ir(e,t){if(e.length<=1)return[e];let i,r,n=[];for(let t of e){let e=nr(t);0!==e&&(t.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(i&&n.push(i),i=[t]):i.push(t))}if(i&&n.push(i),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(Qi(n[e],t,1,n[e].length-1,rr),n[e]=n[e].slice(0,t));return n}function rr(e,t){return t.area-e.area}function nr(e){let t=0;for(let i,r,n=0,a=e.length,s=a-1;n<a;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}let ar=1/298.257223563,sr=ar*(2-ar),or=Math.PI/180;class lr{constructor(e){let t=6378.137*or*1e3,i=Math.cos(e*or),r=1/(1-sr*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-sr)}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,r,n,a,s=1/0;for(let o=0;o<e.length-1;o++){let l=e[o][0],h=e[o][1],u=this.wrap(e[o+1][0]-l)*this.kx,c=(e[o+1][1]-h)*this.ky,d=0;0===u&&0===c||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-h)*this.ky*c)/(u*u+c*c),d>1?(l=e[o+1][0],h=e[o+1][1]):d>0&&(l+=u/this.kx*d,h+=c/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,c=(t[1]-h)*this.ky;let p=u*u+c*c;p<s&&(s=p,i=l,r=h,n=o,a=d)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function hr(e,t){return t[0]-e[0]}function ur(e){return e[1]-e[0]+1}function cr(e,t){return e[1]>=e[0]&&e[1]<t}function dr(e,t){if(e[0]>e[1])return[null,null];let i=ur(e);if(t){if(2===i)return[e,null];let t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function pr(e,t){if(!cr(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)zi(i,e[r]);return i}function fr(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let e of i)zi(t,e);return t}function mr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function gr(e,t,i){if(!mr(e)||!mr(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 _r(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function yr(e,t,i,r,n){let a=Math.min(_r(e,[i,r],n),_r(t,[i,r],n)),s=Math.min(_r(i,[e,t],n),_r(r,[e,t],n));return Math.min(a,s)}function vr(e,t,i,r,n){if(!cr(t,e.length)||!cr(r,i.length))return 1/0;let a=1/0;for(let s=t[0];s<t[1];++s){let t=e[s],o=e[s+1];for(let e=r[0];e<r[1];++e){let r=i[e],s=i[e+1];if(Bi(t,o,r,s))return 0;a=Math.min(a,yr(t,o,r,s,n))}}return a}function xr(e,t,i,r,n){if(!cr(t,e.length)||!cr(r,i.length))return NaN;let a=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,n.distance(e[s],i[t])),0===a)return a;return a}function br(e,t,i){if(Vi(e,t,!0))return 0;let r=1/0;for(let n of t){let t=n[0],a=n[n.length-1];if(t!==a&&(r=Math.min(r,_r(e,[a,t],i)),0===r))return r;let s=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,s.point)),0===r)return r}return r}function wr(e,t,i,r){if(!cr(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(Vi(e[r],i,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],s=e[a+1];for(let e of i)for(let i=0,a=e.length,o=a-1;i<a;o=i++){let a=e[o],l=e[i];if(Bi(t,s,a,l))return 0;n=Math.min(n,yr(t,s,a,l,r))}}return n}function Tr(e,t){for(let i of e)for(let e of i)if(Vi(e,t,!0))return!0;return!1}function Sr(e,t,i,r=1/0){let n=fr(e),a=fr(t);if(r!==1/0&&gr(n,a,i)>=r)return r;if(Ni(n,a)){if(Tr(e,t))return 0}else if(Tr(t,e))return 0;let s=1/0;for(let r of e)for(let e=0,n=r.length,a=n-1;e<n;a=e++){let n=r[a],o=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],l=e[t];if(Bi(n,o,r,l))return 0;s=Math.min(s,yr(n,o,r,l,i))}}return s}function Ir(e,t,i,r,n,a){if(!a)return;let s=gr(pr(r,a),n,i);s<t&&e.push([s,a,[0,0]])}function Pr(e,t,i,r,n,a,s){if(!a||!s)return;let o=gr(pr(r,a),pr(n,s),i);o<t&&e.push([o,a,s])}function Cr(e,t,i,r,n=1/0){let a=Math.min(r.distance(e[0],i[0][0]),n);if(0===a)return a;let s=new Ji([[0,[0,e.length-1],[0,0]]],hr),o=fr(i);for(;s.length>0;){let n=s.pop();if(n[0]>=a)continue;let l=n[1],h=t?50:100;if(ur(l)<=h){if(!cr(l,e.length))return NaN;if(t){let t=wr(e,l,i,r);if(isNaN(t)||0===t)return t;a=Math.min(a,t)}else for(let t=l[0];t<=l[1];++t){let n=br(e[t],i,r);if(a=Math.min(a,n),0===a)return 0}}else{let i=dr(l,t);Ir(s,a,r,e,o,i[0]),Ir(s,a,r,e,o,i[1])}}return a}function Er(e,t,i,r,n,a=1/0){let s=Math.min(a,n.distance(e[0],i[0]));if(0===s)return s;let o=new Ji([[0,[0,e.length-1],[0,i.length-1]]],hr);for(;o.length>0;){let a=o.pop();if(a[0]>=s)continue;let l=a[1],h=a[2],u=t?50:100,c=r?50:100;if(ur(l)<=u&&ur(h)<=c){if(!cr(l,e.length)&&cr(h,i.length))return NaN;let a;if(t&&r)a=vr(e,l,i,h,n),s=Math.min(s,a);else if(t&&!r){let t=e.slice(l[0],l[1]+1);for(let e=h[0];e<=h[1];++e)if(a=_r(i[e],t,n),s=Math.min(s,a),0===s)return s}else if(!t&&r){let t=i.slice(h[0],h[1]+1);for(let i=l[0];i<=l[1];++i)if(a=_r(e[i],t,n),s=Math.min(s,a),0===s)return s}else a=xr(e,l,i,h,n),s=Math.min(s,a)}else{let a=dr(l,t),u=dr(h,r);Pr(o,s,n,e,i,a[0],u[0]),Pr(o,s,n,e,i,a[0],u[1]),Pr(o,s,n,e,i,a[1],u[0]),Pr(o,s,n,e,i,a[1],u[1])}}return s}function Mr(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class Ar{constructor(e,t){this.type=Oe,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ut(e[1])){let t=e[1];if("FeatureCollection"===t.type)return new Ar(t,t.features.map(e=>Mr(e.geometry)).flat());if("Feature"===t.type)return new Ar(t,Mr(t.geometry));if("type"in t&&"coordinates"in t)return new Ar(t,Mr(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let i=e.geometry(),r=i.flat().map(t=>Ri([t.x,t.y],e.canonical));if(0===i.length)return NaN;let n=new lr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,Er(r,!1,[e.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Er(r,!1,e.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Cr(r,!1,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let i=e.geometry(),r=i.flat().map(t=>Ri([t.x,t.y],e.canonical));if(0===i.length)return NaN;let n=new lr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,Er(r,!0,[e.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Er(r,!0,e.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Cr(r,!0,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){let i=e.geometry();if(0===i.length||0===i[0].length)return NaN;let r=ir(i,0).map(t=>t.map(t=>t.map(t=>Ri([t.x,t.y],e.canonical)))),n=new lr(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case"Point":a=Math.min(a,Cr([e.coordinates],!1,t,n,a));break;case"LineString":a=Math.min(a,Cr(e.coordinates,!0,t,n,a));break;case"Polygon":a=Math.min(a,Sr(t,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class kr{constructor(e){this.type=Ze,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return null==i?t.error("Global state property must be defined."):"string"!=typeof i?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new kr(i)}evaluate(e){var t;let i=null===(t=e.globals)||void 0===t?void 0:t.globalState;return i&&0!==Object.keys(i).length?bt(i,this.key):null}eachChild(){}outputDefined(){return!1}}let Lr={"==":wi,"!=":Ti,">":Ii,"<":Si,">=":Ci,"<=":Pi,array:Ht,at:ii,boolean:Ht,case:si,coalesce:yi,collator:Ei,format:Ai,image:ki,in:ri,"index-of":ni,interpolate:mi,"interpolate-hcl":mi,"interpolate-lab":mi,length:Li,let:ei,literal:qt,match:ai,number:Ht,"number-format":Mi,object:Ht,slice:oi,step:hi,string:Ht,"to-boolean":Yt,"to-color":Yt,"to-number":Yt,"to-string":Yt,var:ti,within:Ki,distance:Ar,"global-state":kr};class Fr{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let i=e[0],r=Fr.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=a.filter(([t])=>!Array.isArray(t)||t.length===e.length-1),o=null;for(let[r,a]of s){o=new Qt(t.registry,Or,t.path,null,t.scope);let s=[],l=!1;for(let t=1;t<e.length;t++){let i=e[t],n=Array.isArray(r)?r[t-1]:r.type,a=o.parse(i,1+s.length,n);if(!a){l=!0;break}s.push(a)}if(!l)if(Array.isArray(r)&&r.length!==s.length)o.error(`Expected ${r.length} arguments, but found ${s.length} instead.`);else{for(let e=0;e<s.length;e++){let t=Array.isArray(r)?r[e]:r.type,i=s[e];o.concat(e+1).checkSubtype(t,i.type)}if(0===o.errors.length)return new Fr(i,n,a,s)}}if(1===s.length)t.errors.push(...o.errors);else{let i=(s.length?s:a).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(Qe).join(", ")})`:`(${Qe(t.type)}...)`;var t}).join(" | "),r=[];for(let i=1;i<e.length;i++){let n=t.parse(e[i],1+r.length);if(!n)return null;r.push(Qe(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){Fr.definitions=t;for(let i in t)e[i]=Fr}}function Dr(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let a=n?n.evaluate(e):1,s=Gt(t,i,r,a);if(s)throw new Nt(s);return new Mt(t/255,i/255,r/255,a,!1)}function Rr(e,t){return e in t}function zr(e,t){let i=t[e];return void 0===i?null:i}function Nr(e){return{type:e}}function Or(e){if(e instanceof ti)return Or(e.boundExpression);if(e instanceof Fr&&"error"===e.name||e instanceof Ei||e instanceof Ki||e instanceof Ar||e instanceof kr)return!1;let t=e instanceof Yt||e instanceof Ht,i=!0;return e.eachChild(e=>{i=t?i&&Or(e):i&&e instanceof qt}),!!i&&Br(e)&&Vr(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Br(e){if(e instanceof Fr&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof Ki||e instanceof Ar)return!1;let t=!0;return e.eachChild(e=>{t&&!Br(e)&&(t=!1)}),t}function jr(e){if(e instanceof Fr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!jr(e)&&(t=!1)}),t}function Vr(e,t){if(e instanceof Fr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!Vr(e,t)&&(i=!1)}),i}function Gr(e){return{result:"success",value:e}}function Ur(e){return{result:"error",value:e}}function Zr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function $r(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function qr(e){return!!e.expression&&e.expression.interpolated}function Wr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Hr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Zt(e)===Ue}function Xr(e){return e}function Yr(e,t){let i=e.stops&&"object"==typeof e.stops[0][0],r=i||!(i||void 0!==e.property),n=e.type||(qr(t)?"exponential":"interval"),a=function(e){switch(e.type){case"color":return Mt.parse;case"padding":return Dt.parse;case"numberArray":return Rt.parse;case"colorArray":return zt.parse;default:return null}}(t);if(a&&((e=De({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],a(e[1])])),e.default=a(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==(s=e.colorSpace)&&"hcl"!==s&&"lab"!==s)throw new Error(`Unknown color space: "${e.colorSpace}"`);var s;let o,l,h=function(e){switch(e){case"exponential":return en;case"interval":return Qr;case"categorical":return Jr;case"identity":return tn;default:throw new Error(`Unknown function type "${e}"`)}}(n);if("categorical"===n){o=Object.create(null);for(let t of e.stops)o[t[0]]=t[1];l=typeof e.stops[0][0]}if(i){let i={},r=[];for(let t=0;t<e.stops.length;t++){let n=e.stops[t],a=n[0].zoom;void 0===i[a]&&(i[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),i[a].stops.push([n[0].value,n[1]])}let n=[];for(let e of r)n.push([i[e].zoom,Yr(i[e],t)]);let a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:mi.interpolationFactor.bind(void 0,a),zoomStops:n.map(e=>e[0]),evaluate:({zoom:i},r)=>en({stops:n,base:e.base},t,i).evaluate(i,r)}}if(r){let i="exponential"===n?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:mi.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>h(e,t,i,o,l)}}return{kind:"source",evaluate(i,r){let n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Kr(e.default,t.default):h(e,t,n,o,l)}}}function Kr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Jr(e,t,i,r,n){return Kr(typeof i===n?r[i]:void 0,e.default,t.default)}function Qr(e,t,i){if("number"!==Wr(i))return Kr(e.default,t.default);let r=e.stops.length;if(1===r||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=li(e.stops.map(e=>e[0]),i);return e.stops[n][1]}function en(e,t,i){let r=void 0!==e.base?e.base:1;if("number"!==Wr(i))return Kr(e.default,t.default);let n=e.stops.length;if(1===n||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=li(e.stops.map(e=>e[0]),i),s=function(e,t,i,r){let n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[a][0],e.stops[a+1][0]),o=e.stops[a][1],l=e.stops[a+1][1],h=_i[t.type]||Xr;return"function"==typeof o.evaluate?{evaluate(...t){let i=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return h(i,r,s,e.colorSpace)}}:h(o,l,s,e.colorSpace)}function tn(e,t,i){switch(t.type){case"color":i=Mt.parse(i);break;case"formatted":i=Ft.fromString(i.toString());break;case"resolvedImage":i=jt.fromString(i.toString());break;case"padding":i=Dt.parse(i);break;case"colorArray":i=zt.parse(i);break;case"numberArray":i=Rt.parse(i);break;default:Wr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Kr(i,e.default,t.default)}Fr.register(Lr,{error:[{kind:"error"},[Be],(e,[t])=>{throw new Nt(t.evaluate(e))}],typeof:[Be,[Ze],(e,[t])=>Qe(Zt(t.evaluate(e)))],"to-rgba":[Je(Oe,4),[Ve],(e,[t])=>{let[i,r,n,a]=t.evaluate(e).rgb;return[255*i,255*r,255*n,a]}],rgb:[Ve,[Oe,Oe,Oe],Dr],rgba:[Ve,[Oe,Oe,Oe,Oe],Dr],has:{type:je,overloads:[[[Be],(e,[t])=>Rr(t.evaluate(e),e.properties())],[[Be,Ue],(e,[t,i])=>Rr(t.evaluate(e),i.evaluate(e))]]},get:{type:Ze,overloads:[[[Be],(e,[t])=>zr(t.evaluate(e),e.properties())],[[Be,Ue],(e,[t,i])=>zr(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Ze,[Be],(e,[t])=>zr(t.evaluate(e),e.featureState||{})],properties:[Ue,[],e=>e.properties()],"geometry-type":[Be,[],e=>e.geometryType()],id:[Ze,[],e=>e.id()],zoom:[Oe,[],e=>e.globals.zoom],"heatmap-density":[Oe,[],e=>e.globals.heatmapDensity||0],elevation:[Oe,[],e=>e.globals.elevation||0],"line-progress":[Oe,[],e=>e.globals.lineProgress||0],accumulated:[Ze,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Oe,Nr(Oe),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[Oe,Nr(Oe),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:Oe,overloads:[[[Oe,Oe],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Oe],(e,[t])=>-t.evaluate(e)]]},"/":[Oe,[Oe,Oe],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Oe,[Oe,Oe],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Oe,[],()=>Math.LN2],pi:[Oe,[],()=>Math.PI],e:[Oe,[],()=>Math.E],"^":[Oe,[Oe,Oe],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Oe,[Oe],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Oe,[Oe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Oe,[Oe],(e,[t])=>Math.log(t.evaluate(e))],log2:[Oe,[Oe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Oe,[Oe],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Oe,[Oe],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Oe,[Oe],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Oe,[Oe],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Oe,[Oe],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Oe,[Oe],(e,[t])=>Math.atan(t.evaluate(e))],min:[Oe,Nr(Oe),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Oe,Nr(Oe),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Oe,[Oe],(e,[t])=>Math.abs(t.evaluate(e))],round:[Oe,[Oe],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Oe,[Oe],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Oe,[Oe],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[je,[Be,Ze],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[je,[Ze],(e,[t])=>e.id()===t.value],"filter-type-==":[je,[Be],(e,[t])=>e.geometryType()===t.value],"filter-<":[je,[Be,Ze],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[je,[Ze],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[je,[Be,Ze],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[je,[Ze],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[je,[Be,Ze],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[je,[Ze],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[je,[Be,Ze],(e,[t,i])=>{let r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[je,[Ze],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[je,[Ze],(e,[t])=>t.value in e.properties()],"filter-has-id":[je,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[je,[Je(Be)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[je,[Je(Ze)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[je,[Be,Je(Ze)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[je,[Be,Je(Ze)],(e,[t,i])=>function(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}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:je,overloads:[[[je,je],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Nr(je),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:je,overloads:[[[je,je],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Nr(je),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[je,[je],(e,[t])=>!t.evaluate(e)],"is-supported-script":[je,[Be],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Be,[Be],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Be,[Be],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Be,Nr(Ze),(e,t)=>t.map(t=>$t(t.evaluate(e))).join("")],split:[Je(Be),[Be,Be],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],join:[Be,[Je(Be),Be],(e,[t,i])=>t.evaluate(e).join(i.evaluate(e))],"resolved-locale":[Be,[$e],(e,[t])=>t.evaluate(e).resolvedLocale()]});class rn{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new Jt,this._defaultValue=t?function(e){if("color"===e.type&&Hr(e.default))return new Mt(0,0,0,0);switch(e.type){case"color":return Mt.parse(e.default)||null;case"padding":return Dt.parse(e.default)||null;case"numberArray":return Rt.parse(e.default)||null;case"colorArray":return zt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Bt.parse(e.default)||null;case"projectionDefinition":return Vt.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._globalState&&(e=dn(e,this._globalState)),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._globalState&&(e=dn(e,this._globalState)),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 e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Nt(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<"u"&&console.warn(e.message)),this._defaultValue}}}function nn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Lr}function an(e,t,i){let r=new Qt(Lr,Or,[],t?function(e){let t={color:Ve,string:Be,number:Oe,enum:Be,boolean:je,formatted:qe,padding:We,numberArray:Xe,colorArray:He,projectionDefinition:Ge,resolvedImage:Ye,variableAnchorOffsetCollection:Ke};return"array"===e.type?Je(t[e.value]||Ze,e.length):t[e.type]}(t):void 0),n=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?Gr(new rn(n,t,i)):Ur(r.errors)}class sn{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!jr(t.expression),this.globalStateRefs=cn(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._globalState&&(e=dn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._globalState&&(e=dn(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,n,a)}}class on{constructor(e,t,i,r,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!jr(t.expression),this.globalStateRefs=cn(t.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(e,t,i,r,n,a){return this._globalState&&(e=dn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}evaluate(e,t,i,r,n,a){return this._globalState&&(e=dn(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,n,a)}interpolationFactor(e,t,i){return this.interpolationType?mi.interpolationFactor(this.interpolationType,e,t,i):0}}function ln(e,t,i){let r=an(e,t,i);if("error"===r.result)return r;let n=r.value.expression,a=Br(n);if(!a&&!Zr(t))return Ur([new Re("","data expressions not supported")]);let s=Vr(n,["zoom"]);if(!s&&!$r(t))return Ur([new Re("","zoom expressions not supported")]);let o=un(n);return o||s?o instanceof Re?Ur([o]):o instanceof mi&&!qr(t)?Ur([new Re("",'"interpolate" expressions cannot be used with this property')]):Gr(o?new on(a?"camera":"composite",r.value,o.labels,o instanceof mi?o.interpolation:void 0,i):new sn(a?"constant":"source",r.value,i)):Ur([new Re("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class hn{constructor(e,t){this._parameters=e,this._specification=t,De(this,Yr(this._parameters,this._specification))}static deserialize(e){return new hn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function un(e){let t=null;if(e instanceof ei)t=un(e.result);else if(e instanceof yi){for(let i of e.args)if(t=un(i),t)break}else(e instanceof hi||e instanceof mi)&&e.input instanceof Fr&&"zoom"===e.input.name&&(t=e);return t instanceof Re||e.eachChild(e=>{let i=un(e);i instanceof Re?t=i:!t&&i?t=new Re("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Re("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function cn(e,t=new Set){return e instanceof kr&&t.add(e.key),e.eachChild(e=>{cn(e,t)}),t}function dn(e,t){let{zoom:i,heatmapDensity:r,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=e??{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:t}}function pn(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!pn(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}let fn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function mn(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};pn(e)||(e=yn(e));let i=an(e,fn,t);if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,r)=>i.value.evaluate(e,t,{},r),needGeometry:_n(e),getGlobalStateRefs:()=>cn(i.value.expression)}}function gn(e,t){return e<t?-1:e>t?1:0}function _n(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(_n(e[t]))return!0;return!1}function yn(e){if(!e)return!0;let t=e[0];return e.length<=1?"any"!==t:"=="===t?vn(e[1],e[2],"=="):"!="===t?wn(vn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?vn(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(yn))):"all"===t?["all"].concat(e.slice(1).map(yn)):"none"===t?["all"].concat(e.slice(1).map(yn).map(wn)):"in"===t?xn(e[1],e.slice(2)):"!in"===t?wn(xn(e[1],e.slice(2))):"has"===t?bn(e[1]):"!has"!==t||wn(bn(e[1]));var i}function vn(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 xn(e,t){if(0===t.length)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(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(gn)]]:["filter-in-small",e,["literal",t]]}}function bn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function wn(e){return["!",e]}function Tn(e){let t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(let i of e)t+=`${Tn(i)},`;return`${t}]`}let i=Object.keys(e).sort(),r="{";for(let t=0;t<i.length;t++)r+=`${JSON.stringify(i[t])}:${Tn(e[i[t]])},`;return`${r}}`}function Sn(e){let t="";for(let i of we)t+=`/${Tn(e[i])}`;return t}function In(e){let t=e.value;return t?[new Fe(e.key,t,"constants have been deprecated as of v8")]:[]}function Pn(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Cn(e){if(Array.isArray(e))return e.map(Cn);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=Cn(e[i]);return t}return Pn(e)}function En(e){let t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,s=e.styleSpec,o=e.validateSpec,l=[],h=Wr(i);if("object"!==h)return[new Fe(t,i,`object expected, ${h} found`)];for(let e in i){let h,u=e.split(".")[0],c=bt(r,u)||r["*"];if(bt(n,u))h=n[u];else if(bt(r,u)){if(void 0===i[e])continue;h=o}else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new Fe(t,i[e],`unknown property "${e}"`));continue}h=o}l=l.concat(h({key:(t&&`${t}.`)+e,value:i[e],valueSpec:c,style:a,styleSpec:s,object:i,objectKey:e,validateSpec:o},i))}for(let e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new Fe(t,i,`missing required property "${e}"`));return l}function Mn(e){let t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,a=e.key,s=e.arrayElementValidator||e.validateSpec;if("array"!==Wr(t))return[new Fe(a,t,`array expected, ${Wr(t)} found`)];if(i.length&&t.length!==i.length)return[new Fe(a,t,`array length ${i.length} expected, length ${t.length} found`)];let o={type:i.value,values:i.values};n.$version<7&&(o.function=i.function),"object"===Wr(i.value)&&(o=i.value);let l=[];for(let i=0;i<t.length;i++)l=l.concat(s({array:t,arrayIndex:i,value:t[i],valueSpec:o,validateSpec:e.validateSpec,style:r,styleSpec:n,key:`${a}[${i}]`}));return l}function An(e){let t=e.key,i=e.value,r=e.valueSpec,n=Wr(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new Fe(t,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new Fe(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new Fe(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function kn(e){let t,i,r,n=e.valueSpec,a=Pn(e.value.type),s={},o="categorical"!==a&&void 0===e.value.property,l=!o,h="array"===Wr(e.value.stops)&&"array"===Wr(e.value.stops[0])&&"object"===Wr(e.value.stops[0][0]),u=En({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new Fe(e.key,e.value,'identity function may not have a "stops" property')];let t=[],i=e.value;return t=t.concat(Mn({key:e.key,value:i,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:c})),"array"===Wr(i)&&0===i.length&&t.push(new Fe(e.key,i,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:n,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&o&&u.push(new Fe(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||u.push(new Fe(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!qr(e.valueSpec)&&u.push(new Fe(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Zr(e.valueSpec)?u.push(new Fe(e.key,e.value,"property functions not supported")):o&&!$r(e.valueSpec)&&u.push(new Fe(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!h||void 0!==e.value.property||u.push(new Fe(e.key,e.value,'"property" property is required')),u;function c(e){let t=[],a=e.value,o=e.key;if("array"!==Wr(a))return[new Fe(o,a,`array expected, ${Wr(a)} found`)];if(2!==a.length)return[new Fe(o,a,`array length 2 expected, length ${a.length} found`)];if(h){if("object"!==Wr(a[0]))return[new Fe(o,a,`object expected, ${Wr(a[0])} found`)];if(void 0===a[0].zoom)return[new Fe(o,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new Fe(o,a,"object stop key must have value")];if(r&&r>Pn(a[0].zoom))return[new Fe(o,a[0].zoom,"stop zoom values must appear in ascending order")];Pn(a[0].zoom)!==r&&(r=Pn(a[0].zoom),i=void 0,s={}),t=t.concat(En({key:`${o}[0]`,value:a[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:An,value:d}}))}else t=t.concat(d({key:`${o}[0]`,value:a[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},a));return nn(Cn(a[1]))?t.concat([new Fe(`${o}[1]`,a[1],"expressions are not allowed in function stops.")]):t.concat(e.validateSpec({key:`${o}[1]`,value:a[1],valueSpec:n,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,r){let o=Wr(e.value),l=Pn(e.value),h=null!==e.value?e.value:r;if(t){if(o!==t)return[new Fe(e.key,h,`${o} stop domain type must match previous stop domain type ${t}`)]}else t=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new Fe(e.key,h,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==a){let t=`number expected, ${o} found`;return Zr(n)&&void 0===a&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Fe(e.key,h,t)]}return"categorical"!==a||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===o&&void 0!==i&&l<i?[new Fe(e.key,h,"stop domain values must appear in ascending order")]:(i=l,"categorical"===a&&l in s?[new Fe(e.key,h,"stop domain values must be unique")]:(s[l]=!0,[])):[new Fe(e.key,h,`integer expected, found ${l}`)]}}function Ln(e){let t=("property"===e.expressionContext?ln:an)(Cn(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new Fe(`${e.key}${t.key}`,e.value,t.message));let i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Fe(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!jr(i))return[new Fe(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!jr(i))return[new Fe(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Vr(i,["zoom","feature-state"]))return[new Fe(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Br(i))return[new Fe(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Fn(e){let t=e.key,i=e.value,r=Wr(i);return"string"!==r?[new Fe(t,i,`color expected, ${r} found`)]:Mt.parse(String(i))?[]:[new Fe(t,i,`color expected, "${i}" found`)]}function Dn(e){let t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(Pn(i))&&n.push(new Fe(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(Pn(i))&&n.push(new Fe(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function Rn(e){return pn(Cn(e.value))?Ln(De({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zn(e)}function zn(e){let t=e.value,i=e.key;if("array"!==Wr(t))return[new Fe(i,t,`array expected, ${Wr(t)} found`)];let r,n=e.styleSpec,a=[];if(t.length<1)return[new Fe(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Dn({key:`${i}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),Pn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Pn(t[1])&&a.push(new Fe(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&a.push(new Fe(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(r=Wr(t[1]),"string"!==r&&a.push(new Fe(`${i}[1]`,t[1],`string expected, ${r} found`)));for(let s=2;s<t.length;s++)r=Wr(t[s]),"$type"===Pn(t[1])?a=a.concat(Dn({key:`${i}[${s}]`,value:t[s],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&a.push(new Fe(`${i}[${s}]`,t[s],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)a=a.concat(zn({key:`${i}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=Wr(t[1]),2!==t.length?a.push(new Fe(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==r&&a.push(new Fe(`${i}[1]`,t[1],`string expected, ${r} found`))}return a}function Nn(e,t){let i=e.key,r=e.validateSpec,n=e.style,a=e.styleSpec,s=e.value,o=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let h=o.match(/^(.*)-transition$/);if("paint"===t&&h&&l[h[1]]&&l[h[1]].transition)return r({key:i,value:s,valueSpec:a.transition,style:n,styleSpec:a});let u,c=e.valueSpec||l[o];if(!c)return[new Fe(i,s,`unknown property "${o}"`)];if("string"===Wr(s)&&Zr(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(s)))return[new Fe(i,s,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];let d=[];return"symbol"===e.layerType&&"text-font"===o&&Hr(Cn(s))&&"identity"===Pn(s.type)&&d.push(new Fe(i,s,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:s,valueSpec:c,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:o}))}function On(e){return Nn(e,"paint")}function Bn(e){return Nn(e,"layout")}function jn(e){var t,i;let r=[],n=e.value,a=e.key,s=e.style,o=e.styleSpec;if("object"!==Wr(n))return[new Fe(a,n,`object expected, ${Wr(n)} found`)];n.type||n.ref||r.push(new Fe(a,n,'either "type" or "ref" is required'));let l=Pn(n.type),h=Pn(n.ref);if(n.id){let t=Pn(n.id);for(let i=0;i<e.arrayIndex;i++){let e=s.layers[i];Pn(e.id)===t&&r.push(new Fe(a,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if("ref"in n){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in n&&r.push(new Fe(a,n[e],`"${e}" is prohibited for ref layers`))}),s.layers.forEach(t=>{Pn(t.id)===h&&(e=t)}),e?e.ref?r.push(new Fe(a,n.ref,"ref cannot reference another ref layer")):l=Pn(e.type):r.push(new Fe(a,n.ref,`ref layer "${h}" not found`))}else if("background"!==l)if(n.source){let e=s.sources&&s.sources[n.source],t=e&&Pn(e.type);e?"vector"===t&&"raster"===l?r.push(new Fe(a,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==t&&"hillshade"===l||"raster-dem"!==t&&"color-relief"===l?r.push(new Fe(a,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===t&&"raster"!==l?r.push(new Fe(a,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==t||n["source-layer"]?"raster-dem"===t&&"hillshade"!==l&&"color-relief"!==l?r.push(new Fe(a,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!n.paint||!n.paint["line-gradient"]||"geojson"===t&&e.lineMetrics||r.push(new Fe(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Fe(a,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new Fe(a,n.source,`source "${n.source}" not found`))}else r.push(new Fe(a,n,'missing required property "source"'));return"raster"===l&&!(null===(t=n.paint)||void 0===t)&&t.resampling&&!(null===(i=n.paint)||void 0===i)&&i["raster-resampling"]&&r.push(new Fe(a,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(En({key:a,value:n,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${a}.type`,value:n.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:"type"}),filter:Rn,layout:e=>En({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Bn(De({layerType:l},e))}}),paint:e=>En({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>On(De({layerType:l},e))}})}})),r}function Vn(e){let t=e.value,i=e.key,r=Wr(t);return"string"!==r?[new Fe(i,t,`string expected, ${r} found`)]:[]}let Gn={promoteId:function({key:e,value:t}){if("string"===Wr(t))return Vn({key:e,value:t});{let i=[];for(let r in t)i.push(...Vn({key:`${e}.${r}`,value:t[r]}));return i}}};function Un(e){let t=e.value,i=e.key,r=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new Fe(i,t,'"type" is required')];let s,o=Pn(t.type);switch(o){case"vector":case"raster":return s=En({key:i,value:t,valueSpec:r[`source_${o.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Gn,validateSpec:a}),s;case"raster-dem":return s=function(e){var t;let i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,a=n.source_raster_dem,s=e.style,o=[],l=Wr(r);if(void 0===r)return o;if("object"!==l)return o.push(new Fe("source_raster_dem",r,`object expected, ${l} found`)),o;let h="custom"===Pn(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let t in r)!h&&u.includes(t)?o.push(new Fe(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):a[t]?o=o.concat(e.validateSpec({key:t,value:r[t],valueSpec:a[t],validateSpec:e.validateSpec,style:s,styleSpec:n})):o.push(new Fe(t,r[t],`unknown property "${t}"`));return o}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case"geojson":if(s=En({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:a,objectElementValidators:Gn}),t.cluster)for(let e in t.clusterProperties){let[r,n]=t.clusterProperties[e],a="string"==typeof r?[r,["accumulated"],["get",e]]:r;s.push(...Ln({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),s.push(...Ln({key:`${i}.${e}.reduce`,value:a,expressionContext:"cluster-reduce"}))}return s;case"video":return En({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:a,styleSpec:r});case"image":return En({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:a,styleSpec:r});case"canvas":return[new Fe(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Dn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Zn(e){let t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],s=Wr(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new Fe("light",t,`object expected, ${s} found`)]),a;for(let s in t){let o=s.match(/^(.*)-transition$/);a=a.concat(o&&r[o[1]]&&r[o[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i}):r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Fe(s,t[s],`unknown property "${s}"`)])}return a}function $n(e){let t=e.value,i=e.styleSpec,r=i.sky,n=e.style,a=Wr(t);if(void 0===t)return[];if("object"!==a)return[new Fe("sky",t,`object expected, ${a} found`)];let s=[];for(let a in t)s=s.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:n,styleSpec:i}):[new Fe(a,t[a],`unknown property "${a}"`)]);return s}function qn(e){let t=e.value,i=e.styleSpec,r=i.terrain,n=e.style,a=[],s=Wr(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new Fe("terrain",t,`object expected, ${s} found`)]),a;for(let s in t)a=a.concat(r[s]?e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Fe(s,t[s],`unknown property "${s}"`)]);return a}function Wn(e){let t=[],i=e.value,r=e.key;if(Array.isArray(i)){let n=[],a=[];for(let s in i)i[s].id&&n.includes(i[s].id)&&t.push(new Fe(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&a.includes(i[s].url)&&t.push(new Fe(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),a.push(i[s].url),t=t.concat(En({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Vn({key:r,value:i})}function Hn(e){return!!e&&e.constructor===Object}function Xn(e){return Hn(e.value)?[]:[new Fe(e.key,e.value,`object expected, ${Wr(e.value)} found`)]}let Yn={"*":()=>[],array:Mn,boolean:function(e){let t=e.value,i=e.key,r=Wr(t);return"boolean"!==r?[new Fe(i,t,`boolean expected, ${r} found`)]:[]},number:An,color:Fn,constants:In,enum:Dn,filter:Rn,function:kn,layer:jn,object:En,source:Un,light:Zn,sky:$n,terrain:qn,projection:function(e){let t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=Wr(t);if(void 0===t)return[];if("object"!==a)return[new Fe("projection",t,`object expected, ${a} found`)];let s=[];for(let a in t)s=s.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:n,styleSpec:i}):[new Fe(a,t[a],`unknown property "${a}"`)]);return s},projectionDefinition:function(e){let t=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=Wr(i);return"array"!==r||(n=i,Array.isArray(n)&&3===n.length&&"string"==typeof n[0]&&"string"==typeof n[1]&&"number"==typeof n[2])||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new Fe(t,i,`projection expected, invalid type "${r}" found`)]:[new Fe(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)];var n},string:Vn,formatted:function(e){return 0===Vn(e).length?[]:Ln(e)},resolvedImage:function(e){return 0===Vn(e).length?[]:Ln(e)},padding:function(e){let t=e.key,i=e.value;if("array"===Wr(i)){if(i.length<1||i.length>4)return[new Fe(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}return An({key:t,value:i,valueSpec:{}})},numberArray:function(e){let t=e.key,i=e.value;if("array"===Wr(i)){let r={type:"number"};if(i.length<1)return[new Fe(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}return An({key:t,value:i,valueSpec:{}})},colorArray:function(e){let t=e.key,i=e.value;if("array"===Wr(i)){if(i.length<1)return[new Fe(t,i,"array length at least 1 expected, length 0 found")];let e=[];for(let r=0;r<i.length;r++)e=e.concat(Fn({key:`${t}[${r}]`,value:i[r]}));return e}return Fn({key:t,value:i})},variableAnchorOffsetCollection:function(e){let t=e.key,i=e.value,r=Wr(i),n=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new Fe(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let r=0;r<i.length;r+=2)a=a.concat(Dn({key:`${t}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(Mn({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a},sprite:Wn,state:Xn,fontFaces:function(e){let t=e.key,i=e.value,r=e.validateSpec,n=e.styleSpec,a=e.style;if(!Hn(i))return[new Fe(t,i,`object expected, ${Wr(i)} found`)];let s=[];for(let e in i){let o=i[e],l=Wr(o);if("string"===l)s.push(...Vn({key:`${t}.${e}`,value:o}));else if("array"===l){let i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[l,h]of o.entries())s.push(...En({key:`${t}.${e}[${l}]`,value:h,valueSpec:i,styleSpec:n,style:a,validateSpec:r}))}else s.push(new Fe(`${t}.${e}`,o,`string or array expected, ${l} found`))}return s}};function Kn(e){let t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=Kn,i.expression&&Hr(Pn(t))?kn(e):i.expression&&nn(Cn(t))?Ln(e):i.type&&Yn[i.type]?Yn[i.type](e):En(De({},e,{valueSpec:i.type?r[i.type]:i}))}function Jn(e){let t=e.value,i=e.key,r=Vn(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new Fe(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new Fe(i,t,'"glyphs" url must include a "{range}" token'))),r}function Qn(e,t=be){let i=[];return i=i.concat(Kn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Kn,objectElementValidators:{glyphs:Jn,"*":()=>[]}})),e.constants&&(i=i.concat(In({key:"constants",value:e.constants}))),ta(i)}function ea(e){return function(t){return e(Object.assign({},t,{validateSpec:Kn}))}}function ta(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function ia(e){return function(...t){return ta(e.apply(this,t))}}Qn.source=ia(ea(Un)),Qn.sprite=ia(ea(Wn)),Qn.glyphs=ia(ea(Jn)),Qn.light=ia(ea(Zn)),Qn.sky=ia(ea($n)),Qn.terrain=ia(ea(qn)),Qn.state=ia(ea(Xn)),Qn.layer=ia(ea(jn)),Qn.filter=ia(ea(Rn)),Qn.paintProperty=ia(ea(On)),Qn.layoutProperty=ia(ea(Bn));let ra={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class na{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){var e;return null!==(e=this._literalValue)&&void 0!==e?e:this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=an(e,ra,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=cn(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let aa=be,sa=Qn,oa=sa.light,la=sa.sky,ha=sa.paintProperty,ua=sa.layoutProperty;function ca(e,t){let i=!1;if(t?.length)for(let r of t)e.fire(new ve(new Error(r.message))),i=!0;return i}class da{constructor(e,t,i){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(let e=0;e<this.d*this.d;e++){let t=n[3+e],i=n[3+e+1];r.push(t===i?null:n.subarray(t,i))}let a=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],a),this.bboxes=n.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;let n=i/t*e;this.min=-n,this.max=e+n}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,r,n,a){this.cells[n].push(a)}query(e,t,i,r,n){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=i&&s<=r&&!n)return[...this.keys];{let a=[];return this._forEachCell(e,t,i,r,this._queryCell,a,{},n),a}}_queryCell(e,t,i,r,n,a,s,o){let l=this.cells[n];if(null!==l){let n=this.keys,h=this.bboxes;for(let u of l)if(void 0===s[u]){let l=4*u;(o?o(h[l+0],h[l+1],h[l+2],h[l+3]):e<=h[l+2]&&t<=h[l+3]&&i>=h[l+0]&&r>=h[l+1])?(s[u]=!0,a.push(n[u])):s[u]=!1}}}_forEachCell(e,t,i,r,n,a,s,o){let l=this._convertToCellCoord(e),h=this._convertToCellCoord(t),u=this._convertToCellCoord(i),c=this._convertToCellCoord(r);for(let d=l;d<=u;d++)for(let l=h;l<=c;l++){let h=this.d*l+d;if((!o||o(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,i,r,h,a,s,o))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,t=3+this.cells.length+1+1,i=0;for(let e of this.cells)i+=e.length;let r=new Int32Array(t+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=t;for(let t=0;t<e.length;t++){let i=e[t];r[3+t]=n,r.set(i,n),n+=i.length}return r[3+e.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+e.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(e,t){let i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new da(e.buffer)}}let pa={};function fa(e,t,i={}){if(pa[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),pa[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}fa("Object",Object),fa("Set",Set),fa("TransferableGridIndex",da),fa("Color",Mt),fa("Error",Error),fa("AJAXError",de),fa("ResolvedImage",jt),fa("StylePropertyFunction",hn),fa("StyleExpression",rn,{omit:["_evaluator"]}),fa("ZoomDependentExpression",on),fa("ZoomConstantExpression",sn),fa("CompoundExpression",Fr,{omit:["_evaluate"]});for(let e in Lr)Lr[e]._classRegistryKey||fa(`Expression_${e}`,Lr[e]);function ma(e){var t;return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||"ArrayBuffer"===(null===(t=e.constructor)||void 0===t?void 0:t.name))}function ga(e){return e.$name||e.constructor._classRegistryKey}function _a(e){return!function(e){if(null===e||"object"!=typeof e)return!1;let t=ga(e);return t&&"Object"!==t}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||ma(e)||X(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function ya(e,t){if(_a(e))return(ma(e)||X(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let i=[];for(let r of e)i.push(ya(r,t));return i}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);let i=ga(e);if(!i)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!pa[i])throw new Error(`${i} is not registered.`);let{klass:r}=pa[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(n===t?.[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let r in e){if(!e.hasOwnProperty(r)||pa[i].omit.includes(r))continue;let a=e[r];n[r]=pa[i].shallow.includes(r)?a:ya(a,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function va(e){if(_a(e))return e;if(Array.isArray(e))return e.map(va);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);let t=ga(e)||"Object";if(!pa[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:i}=pa[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 i of Object.keys(e)){if("$name"===i)continue;let n=e[i];r[i]=pa[t].shallow.includes(i)?n:va(n)}return r}class xa{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))}}function ba(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function wa(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Ta(e){return/\s/u.test(String.fromCodePoint(e))}function Sa(e){for(let t of e)if(wa(t.codePointAt(0)))return!0;return!1}function Ia(e){for(let t of e)if(!Ea(t.codePointAt(0)))return!1;return!0}function Pa(e){let t=e.map(e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch{return null}}).filter(e=>e);return new RegExp(t.join("|"),"u")}let Ca=Pa(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ea(e){return!Ca.test(String.fromCodePoint(e))}function Ma(e){return!(wa(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}let Aa=Pa(["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"]);function ka(e){return Aa.test(String.fromCodePoint(e))}function La(e,t){return!(!t&&ka(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Fa(e){for(let t of e)if(ka(t.codePointAt(0)))return!0;return!1}let Da=new 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(Da.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 null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;let t=e.pluginURL,r=new Promise(e=>{this.loadScriptResolve=e});i(t);let n=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(yield Promise.race([r,n]),this.isParsed()){let e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)})}};class Ra{constructor(e,t){this.isSupportedScript=za,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new xa,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xa,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?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}}}function za(e){return function(e,t){for(let i of e)if(!La(i.codePointAt(0),t))return!1;return!0}(e,"loaded"===Da.getRTLTextPluginStatus())}let Na="-transition";class Oa{constructor(e,t,i){this.property=e,this.value=t,this.expression=function(e,t,i){if(Hr(e))return new hn(e,t);if(nn(e)){let r=ln(e,t,i);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return r.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=Mt.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==t.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=Bt.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=Vt.parse(e)):i=zt.parse(e):i=Rt.parse(e):i=Dt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Ba{constructor(e,t){this.property=e,this.value=new Oa(e,void 0,t)}transitioned(e,t){return new Va(this.property,this.value,t,B({},e.transition,this.transition),e.now)}untransitioned(){return new Va(this.property,this.value,null,{},0)}}class ja{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return U(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].value=new Oa(this._values[e].property,null===t?void 0:U(t),this._globalState)}getTransition(e){return U(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ba(this._values[e].property,this._globalState)),this._values[e].transition=U(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);void 0!==i&&(e[t]=i);let r=this.getTransition(t);void 0!==r&&(e[`${t}${Na}`]=r)}return e}transitioned(e,t){let i=new Ga(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 Ga(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Va{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 s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,D(s))}}return n}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new $a(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}}class Ua{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return U(this._values[e].value)}setValue(e,t){this._values[e]=new Oa(this._values[e].property,null===t?void 0:U(t),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let r=new $a(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}}class Za{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}class $a{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qa{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=_i[this.specification.type];return r?r(e,t,i):e}}class Wa{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new Za(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Za(this,{kind:"constant",value:void 0},e.parameters);let r=_i[this.specification.type];if(r){let n=r(e.value.value,t.value.value,i);return new Za(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,i,r,n,a){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,a)}}class Ha extends Wa{possiblyEvaluate(e,t,i,r){if(void 0===e.value)return new Za(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){let n=e.expression.evaluate(t,null,{},i,r),a="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,s=this._calculate(a,a,a,t);return new Za(this,{kind:"constant",value:s},t)}if("camera"===e.expression.kind){let i=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 Za(this,{kind:"constant",value:i},t)}return new Za(this,e.expression,t)}evaluate(e,t,i,r,n,a){if("source"===e.kind){let s=e.evaluate(t,i,r,n,a);return this._calculate(s,s,s,t)}return"composite"===e.kind?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}}class Xa{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){let n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Ra(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Ra(Math.floor(t.zoom),t)),e.expression.evaluate(new Ra(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}}class Ya{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Ka{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 Oa(i,void 0,void 0),n=this.defaultTransitionablePropertyValues[t]=new Ba(i,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}fa("DataDrivenProperty",Wa),fa("DataConstantProperty",qa),fa("CrossFadedDataDrivenProperty",Ha),fa("CrossFadedProperty",Xa),fa("ColorRampProperty",Ya);let Ja,Qa=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",es=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class ts extends xe{constructor(e,t,i){if(super(),this.id=e.id,this.type=e.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(r=this.visibility,new na(r,i)),"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=mn(e.filter,i)),t.layout&&(this._unevaluatedLayout=new Ua(t.layout,i)),t.paint)){this._transitionablePaint=new ja(t.paint,i);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new $a(t.paint)}var r}setFilter(e){this.filter=e,this._featureFilter=mn(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var t;if("visibility"===e)return this.visibility;if(null!==(t=this._transitionablePaint)&&void 0!==t&&t.hasProperty(e))throw new Error(e+Qa);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[t];for(let t of i.getGlobalStateRefs())e.add(t)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let n of r.getGlobalStateRefs()){let a=null!==(e=t.get(n))&&void 0!==e?e:[];a.push({name:i,value:r.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,i={}){var r;if("visibility"===e)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();null!==(r=this._transitionablePaint)&&void 0!==r&&r.hasProperty(e)?this.fire(new ve(new Error(e+Qa))):null!=t&&this._validate(ua,`layers.${this.id}.layout.${e}`,e,t,i)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){var t,i;if(e.endsWith(Na)){let i=e.slice(0,-11);if("visibility"===i||null!==(t=this._unevaluatedLayout)&&void 0!==t&&t.hasProperty(i))throw new Error(e+es);return this._transitionablePaint.getTransition(i)}if("visibility"===e||null!==(i=this._unevaluatedLayout)&&void 0!==i&&i.hasProperty(e))throw new Error(e+es);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){var r;if("visibility"===e||null!==(r=this._unevaluatedLayout)&&void 0!==r&&r.hasProperty(e))return this.fire(new ve(new Error(e+es))),!1;if(null!=t&&this._validate(ha,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(Na))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),a=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(e,a,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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(){var e,t;let i={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:null===(e=this._unevaluatedLayout)||void 0===e?void 0:e.serialize(),paint:null===(t=this._transitionablePaint)||void 0===t?void 0:t.serialize()};return this.visibility&&(i.layout||(i.layout={}),i.layout.visibility=this.visibility),G(i,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,i,r,n={}){return!1!==n?.validate&&ca(this,e.call(sa,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:be,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 Za&&Zr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}var is={get paint(){return Ja=Ja||new Ka({"raster-opacity":new qa(be.paint_raster["raster-opacity"]),"raster-hue-rotate":new qa(be.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qa(be.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qa(be.paint_raster["raster-brightness-max"]),"raster-saturation":new qa(be.paint_raster["raster-saturation"]),"raster-contrast":new qa(be.paint_raster["raster-contrast"]),resampling:new qa(be.paint_raster.resampling),"raster-resampling":new qa(be.paint_raster["raster-resampling"]),"raster-fade-duration":new qa(be.paint_raster["raster-fade-duration"])})}};class rs extends ts{constructor(e,t){super(e,is,t)}}let ns={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class as{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}}class ss{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(5*this.capacity),128),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")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function os(e,t=1){let i=0,r=0;return{members:e.map(e=>{let n=ns[e.type].BYTES_PER_ELEMENT,a=i=ls(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:a}}),size:ls(i,Math.max(r,t)),alignment:t}}function ls(e,t){return Math.ceil(e/t)*t}class hs extends ss{_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=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}hs.prototype.bytesPerElement=4,fa("StructArrayLayout2i4",hs);class us extends ss{_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=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}us.prototype.bytesPerElement=6,fa("StructArrayLayout3i6",us);class cs extends ss{_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=4*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}}cs.prototype.bytesPerElement=8,fa("StructArrayLayout4i8",cs);class ds extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,e}}ds.prototype.bytesPerElement=12,fa("StructArrayLayout2i4i12",ds);class ps extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,s){let o=4*e,l=8*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,e}}ps.prototype.bytesPerElement=8,fa("StructArrayLayout2i4ub8",ps);class fs extends ss{_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=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}fs.prototype.bytesPerElement=8,fa("StructArrayLayout2f8",fs);class ms extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,s,o,l,h){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,a,s,o,l,h)}emplace(e,t,i,r,n,a,s,o,l,h,u){let c=10*e;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]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=h,this.uint16[c+9]=u,e}}ms.prototype.bytesPerElement=20,fa("StructArrayLayout10ui20",ms);class gs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,n,a,s,o)}emplace(e,t,i,r,n,a,s,o,l){let h=8*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=o,this.uint16[h+7]=l,e}}gs.prototype.bytesPerElement=16,fa("StructArrayLayout8ui16",gs);class _s extends ss{_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,s,o,l,h,u,c){let d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,a,s,o,l,h,u,c)}emplace(e,t,i,r,n,a,s,o,l,h,u,c,d){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.uint16[p+4]=a,this.uint16[p+5]=s,this.uint16[p+6]=o,this.uint16[p+7]=l,this.int16[p+8]=h,this.int16[p+9]=u,this.int16[p+10]=c,this.int16[p+11]=d,e}}_s.prototype.bytesPerElement=24,fa("StructArrayLayout4i4ui4i24",_s);class ys extends ss{_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=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}ys.prototype.bytesPerElement=12,fa("StructArrayLayout3f12",ys);class vs extends ss{_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){return this.uint32[1*e+0]=t,e}}vs.prototype.bytesPerElement=4,fa("StructArrayLayout1ul4",vs);class xs extends ss{_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,s,o,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,i,r,n,a,s,o,l)}emplace(e,t,i,r,n,a,s,o,l,h){let u=10*e,c=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=a,this.int16[u+5]=s,this.uint32[c+3]=o,this.uint16[u+8]=l,this.uint16[u+9]=h,e}}xs.prototype.bytesPerElement=20,fa("StructArrayLayout6i1ul2ui20",xs);class bs extends ss{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,e}}bs.prototype.bytesPerElement=12,fa("StructArrayLayout2i2i2i12",bs);class ws extends ss{_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 s=4*e,o=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[o+6]=n,this.int16[o+7]=a,e}}ws.prototype.bytesPerElement=16,fa("StructArrayLayout2f1f2i16",ws);class Ts extends ss{_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 s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a)}emplace(e,t,i,r,n,a,s){let o=16*e,l=4*e,h=8*e;return this.uint8[o+0]=t,this.uint8[o+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[h+6]=a,this.int16[h+7]=s,e}}Ts.prototype.bytesPerElement=16,fa("StructArrayLayout2ub2f2i16",Ts);class Ss extends ss{_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=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Ss.prototype.bytesPerElement=6,fa("StructArrayLayout3ui6",Ss);class Is extends ss{_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,s,o,l,h,u,c,d,p,f,m,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g)}emplace(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_){let y=24*e,v=12*e,x=48*e;return this.int16[y+0]=t,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[y+10]=l,this.uint16[y+11]=h,this.uint16[y+12]=u,this.float32[v+7]=c,this.float32[v+8]=d,this.uint8[x+36]=p,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,e}}Is.prototype.bytesPerElement=48,fa("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Is);class Ps extends ss{_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,s,o,l,h,u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I,P,C){let E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I,P,C)}emplace(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I,P,C,E){let M=32*e,A=16*e;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=n,this.int16[M+4]=a,this.int16[M+5]=s,this.int16[M+6]=o,this.int16[M+7]=l,this.uint16[M+8]=h,this.uint16[M+9]=u,this.uint16[M+10]=c,this.uint16[M+11]=d,this.uint16[M+12]=p,this.uint16[M+13]=f,this.uint16[M+14]=m,this.uint16[M+15]=g,this.uint16[M+16]=_,this.uint16[M+17]=y,this.uint16[M+18]=v,this.uint16[M+19]=x,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=T,this.uint32[A+12]=S,this.float32[A+13]=I,this.float32[A+14]=P,this.uint16[M+30]=C,this.uint16[M+31]=E,e}}Ps.prototype.bytesPerElement=64,fa("StructArrayLayout8i15ui1ul2f2ui64",Ps);class Cs extends ss{_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){return this.float32[1*e+0]=t,e}}Cs.prototype.bytesPerElement=4,fa("StructArrayLayout1f4",Cs);class Es extends ss{_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=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}Es.prototype.bytesPerElement=12,fa("StructArrayLayout1ui2f12",Es);class Ms extends ss{_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=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=i,this.uint16[n+3]=r,e}}Ms.prototype.bytesPerElement=8,fa("StructArrayLayout1ul2ui8",Ms);class As extends ss{_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=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}As.prototype.bytesPerElement=4,fa("StructArrayLayout2ui4",As);class ks extends ss{_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){return this.uint16[1*e+0]=t,e}}ks.prototype.bytesPerElement=2,fa("StructArrayLayout1ui2",ks);class Ls extends ss{_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=4*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}}Ls.prototype.bytesPerElement=16,fa("StructArrayLayout4f16",Ls);class Fs extends as{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 i(this.anchorPointX,this.anchorPointY)}}Fs.prototype.size=20;class Ds extends xs{get(e){return new Fs(this,e)}}fa("CollisionBoxArray",Ds);class Rs extends as{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]}}Rs.prototype.size=48;class zs extends Is{get(e){return new Rs(this,e)}}fa("PlacedSymbolArray",zs);class Ns extends as{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]}}Ns.prototype.size=64;class Os extends Ps{get(e){return new Ns(this,e)}}fa("SymbolInstanceArray",Os);class Bs extends Cs{getoffsetX(e){return this.float32[1*e+0]}}fa("GlyphOffsetArray",Bs);class js extends us{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}fa("SymbolLineVertexArray",js);class Vs extends as{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]}}Vs.prototype.size=12;class Gs extends Es{get(e){return new Vs(this,e)}}fa("TextAnchorOffsetArray",Gs);class Us extends as{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]}}Us.prototype.size=8;class Zs extends Ms{get(e){return new Us(this,e)}}fa("FeatureIndexArray",Zs);class $s extends hs{}class qs extends hs{}class Ws extends hs{}class Hs extends ds{}class Xs extends ps{}class Ys extends fs{}class Ks extends ms{}class Js extends gs{}class Qs extends _s{}class eo extends ys{}class to extends vs{}class io extends bs{}class ro extends Ts{}class no extends Ss{}class ao extends As{}let so=os([{name:"a_pos",components:2,type:"Int16"}],4),{members:oo}=so;class lo{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){let n=this.segments[this.segments.length-1];return e>lo.MAX_VERTEX_ARRAY_LENGTH&&$(`Max vertices per segment is ${lo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${lo.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>lo.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(t,i,r):n}createNewSegment(e,t,i){let r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new lo([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ho(e,t){return 256*(e=N(Math.floor(e),0,255))+N(Math.floor(t),0,255)}lo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,fa("SegmentVector",lo);let uo=os([{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"}]),co=os([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var po,fo,mo,go={exports:{}},_o={exports:{}},yo={exports:{}},vo=function(){if(mo)return go.exports;mo=1;var e=(po||(po=1,_o.exports=function(e,t){var i,r,n,a,s,o,l,h;for(r=e.length-(i=3&e.length),n=t,s=3432918353,o=461845907,h=0;h<r;)l=255&e.charCodeAt(h)|(255&e.charCodeAt(++h))<<8|(255&e.charCodeAt(++h))<<16|(255&e.charCodeAt(++h))<<24,++h,n=27492+(65535&(a=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(h+2))<<16;case 2:l^=(255&e.charCodeAt(h+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(h)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),_o.exports),t=(fo||(fo=1,yo.exports=function(e,t){for(var i,r=e.length,n=t^r,a=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:n^=(255&e.charCodeAt(a+2))<<16;case 2:n^=(255&e.charCodeAt(a+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(a)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),yo.exports);return go.exports=e,go.exports.murmur3=e,go.exports.murmur2=t,go.exports}(),xo=r(vo);class bo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(wo(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=wo(e),i=0,r=this.ids.length-1;for(;i<r;){let e=i+r>>1;this.ids[e]>=t?r=e:i=e+1}let n=[];for(;this.ids[i]===t;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(e,t){let i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return To(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){let t=new bo;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function wo(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:xo(String(e))}function To(e,t,i,r){for(;i<r;){let n=e[i+r>>1],a=i-1,s=r+1;for(;;){do{a++}while(e[a]<n);do{s--}while(e[s]>n);if(a>=s)break;So(e,a,s),So(t,3*a,3*s),So(t,3*a+1,3*s+1),So(t,3*a+2,3*s+2)}s-i<r-s?(To(e,t,i,s),i=s+1):(To(e,t,s+1,r),r=s)}}function So(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}fa("FeaturePositionMap",bo);class Io{constructor(e,t){this.gl=e.gl,this.location=t}}class Po extends Io{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Co extends Io{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]))}}class Eo extends Io{constructor(e,t){super(e,t),this.current=Mt.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))}}let Mo=new Float32Array(16);function Ao(e){return[ho(255*e.r,255*e.g),ho(255*e.b,255*e.a)]}class ko{constructor(e,t,i){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Eo(e,t):new Po(e,t)}}class Lo{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),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}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,i,r){let n=null;"u_pattern_to"===r?n=this.patternTo:"u_pattern_from"===r?n=this.patternFrom:"u_dasharray_to"===r?n=this.dashTo:"u_dasharray_from"===r?n=this.dashFrom:"u_pixel_ratio_to"===r?n=this.pixelRatioTo:"u_pixel_ratio_from"===r&&(n=this.pixelRatioFrom),null!==n&&e.set(n)}getBinding(e,t,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new Co(e,t):new Po(e,t)}}class Fo{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i){let r=this.paintVertexArray.length,n=this.expression.evaluate(new Ra(0,i),t,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,n)}updatePaintArray(e,t,i,r,n){let a=this.expression.evaluate(new Ra(0,n),i,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,i){if("color"===this.type){let r=Ao(i);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,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){var t,i;null!==(t=this.paintVertexArray)&&void 0!==t&&t.arrayBuffer.byteLength&&(null!==(i=this.paintVertexBuffer)&&void 0!==i&&i.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Do{constructor(e,t,i,r,n,a){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i){let r=this.expression.evaluate(new Ra(this.zoom,i),t,{},i.canonical,[],i.formattedSection),n=this.expression.evaluate(new Ra(this.zoom+1,i),t,{},i.canonical,[],i.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,r,n)}updatePaintArray(e,t,i,r,n){let a=this.expression.evaluate(new Ra(this.zoom,n),i,r),s=this.expression.evaluate(new Ra(this.zoom+1,n),i,r);this._setPaintValue(e,t,a,s)}_setPaintValue(e,t,i,r){if("color"===this.type){let n=Ao(i),a=Ao(r);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,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){var t,i;null!==(t=this.paintVertexArray)&&void 0!==t&&t.arrayBuffer.byteLength&&(null!==(i=this.paintVertexBuffer)&&void 0!==i&&i.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=N(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new Po(e,t)}}class Ro{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,this.getPositionIds(t),i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,this.getPositionIds(i),n)}_setPaintValues(e,t,i,r){let n=this.getPositions(r);if(!n||!i)return;let a=n[i.min],s=n[i.mid],o=n[i.max];if(a&&s&&o)for(let i=e;i<t;i++)this.emplace(this.zoomInPaintVertexArray,i,s,a),this.emplace(this.zoomOutPaintVertexArray,i,s,o)}upload(e){var t,i;if(null!==(t=this.zoomInPaintVertexArray)&&void 0!==t&&t.arrayBuffer.byteLength&&null!==(i=this.zoomOutPaintVertexArray)&&void 0!==i&&i.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class zo extends Ro{getPositions(e){return e.imagePositions}getPositionIds(e){var t;return null===(t=e.patterns)||void 0===t?void 0:t[this.layerId]}getVertexAttributes(){return uo.members}emplace(e,t,i,r){e.emplace(t,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}}class No extends Ro{getPositions(e){return e.dashPositions}getPositionIds(e){var t;return null===(t=e.dashes)||void 0===t?void 0:t[this.layerId]}getVertexAttributes(){return co.members}emplace(e,t,i,r){e.emplace(t,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}}class Oo{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 Za&&Zr(a.property.specification)))continue;let s=jo(n,e.type),o=a.value,l=a.property.specification.type,h=a.property.useIntegerZoom,u=a.property.specification["property-type"],c="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===o.kind)this.binders[n]=c?new Lo(o.value,s):new ko(o.value,s,l),r.push(`/u_${n}`);else if("source"===o.kind||c){let i=Vo(n,l,"source");this.binders[n]=c?"line-dasharray"===n?new No(o,l,h,t,i,e.id):new zo(o,l,h,t,i,e.id):new Fo(o,s,l,i),r.push(`/a_${n}`)}else{let e=Vo(n,l,"composite");this.binders[n]=new Do(o,s,l,h,t,e),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Fo||t instanceof Do?t.maxValue:0}populatePaintArrays(e,t,i){for(let r in this.binders){let n=this.binders[r];(n instanceof Fo||n instanceof Do||n instanceof Ro)&&n.populatePaintArray(e,t,i)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof Lo&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof Lo&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let a=!1;for(let s in e){let o=t.getPositions(s);for(let t of o){let o=i.feature(t.index);for(let i in this.binders){let l=this.binders[i];if((l instanceof Fo||l instanceof Do||l instanceof Ro)&&!0===l.expression.isStateDependent){let h=r.paint.get(i);l.expression=h.value,l.updatePaintArray(t.start,t.end,o,e[s],n),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof ko||i instanceof Lo)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Fo||i instanceof Do)for(let t of i.paintVertexAttributes)e.push(t.name);else if(i instanceof Ro){let t=i.getVertexAttributes();for(let i of t)e.push(i.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof ko||i instanceof Lo||i instanceof Do)for(let t of i.uniformNames)e.push(t)}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 ko||n instanceof Lo||n instanceof Do)for(let a of n.uniformNames)if(t[a]){let s=n.getBinding(e,t[a],a);i.push({name:a,property:r,binding:s})}}return i}setUniforms(e,t,i,r){for(let{name:e,property:n,binding:a}of t)this.binders[n].setUniform(a,r,i.get(n),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof Ro){let t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof Fo||i instanceof Do)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Fo||i instanceof Do||i instanceof Ro)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Fo||t instanceof Do||t instanceof Ro)&&t.destroy()}}}class Bo{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Oo(r,t,i);this.needsUpload=!1,this._featureMap=new bo,this._bufferOffset=0}populatePaintArrays(e,t,i,r){for(let i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r);void 0!==t.id&&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 jo(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-dasharray":["dasharray_to","dasharray_from"],"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 Vo(e,t,i){let r={color:{source:fs,composite:Ls},number:{source:Cs,composite:fs}},n={"line-pattern":{source:Ks,composite:Ks},"fill-pattern":{source:Ks,composite:Ks},"fill-extrusion-pattern":{source:Ks,composite:Ks},"line-dasharray":{source:Js,composite:Js}}[e];return n?.[i]||r[t][i]}fa("ConstantBinder",ko),fa("CrossFadedConstantBinder",Lo),fa("SourceExpressionBinder",Fo),fa("CrossFadedPatternBinder",zo),fa("CrossFadedDasharrayBinder",No),fa("CompositeExpressionBinder",Do),fa("ProgramConfiguration",Oo,{omit:["_buffers"]}),fa("ProgramConfigurationSet",Bo);let Go=Math.pow(2,14)-1,Uo=-Go-1;function Zo(e){let t=M/e.extent,i=e.loadGeometry();for(let e of i)for(let i of e){let e=Math.round(i.x*t),r=Math.round(i.y*t);i.x=N(e,Uo,Go),i.y=N(r,Uo,Go),(e<i.x||e>i.x+1||r<i.y||r>i.y+1)&&$("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function $o(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Zo(e):[]}}let qo,Wo,Ho=-32768;function Xo(e,t,i,r,n){e.emplaceBack(Ho+8*t+r,Ho+8*i+n)}class Yo{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new qs,this.indexArray=new no,this.segments=new lo,this.programConfigurations=new Bo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){let r=this.layers[0],n=[],a=null,s=!1,o="heatmap"===r.type;if("circle"===r.type){let e=r;a=e.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o="map"===e.paint.get("circle-pitch-alignment"))}let l=o?t.subdivisionGranularity.circle:1;for(let{feature:t,id:r,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=$o(t,e);if(!this.layers[0]._featureFilter.filter(new Ra(this.zoom),h,i))continue;let u=s?a.evaluate(h,{},i):void 0,c={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?h.geometry:Zo(t),patterns:{},sortKey:u};n.push(c)}s&&n.sort((e,t)=>e.sortKey-t.sortKey);for(let r of n){let{geometry:n,index:a,sourceLayerIndex:s}=r,o=e[a].feature;this.addFeature(r,n,a,i,l),t.featureIndex.insert(o,n,a,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oo),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 s=a.length;for(let i of t)for(let t of i){let i=t.x,r=t.y;if(i<0||i>=M||r<0||r>=M)continue;let n=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),o=n.vertexLength;for(let e=0;e<s;e++)for(let t=0;t<s;t++)Xo(this.layoutVertexArray,i,r,a[t],a[e]);for(let e=0;e<s-1;e++)for(let t=0;t<s-1;t++){let i=o+e*s+t,r=o+(e+1)*s+t;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=s*s,n.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:{},canonical:r})}}function Ko(e,t){for(let i of e)if(sl(t,i))return!0;for(let i of t)if(sl(e,i))return!0;return tl(e,t)}function Jo(e,t,i){return!!sl(e,t)||rl(t,e,i)}function Qo(e,t){if(1===e.length)return al(t,e[0]);for(let i of t)for(let t of i)if(sl(e,t))return!0;for(let i of e)if(al(t,i))return!0;for(let i of t)if(tl(e,i))return!0;return!1}function el(e,t,i){if(e.length>1){if(tl(e,t))return!0;for(let r of t)if(rl(r,e,i))return!0}for(let r of e)if(rl(r,t,i))return!0;return!1}function tl(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(il(r,n,t[e],t[e+1]))return!0}return!1}function il(e,t,i,r){return q(e,i,r)!==q(t,i,r)&&q(e,t,i)!==q(e,t,r)}function rl(e,t,i){let r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(nl(e,t[i-1],t[i])<r)return!0;return!1}function nl(e,t,i){let r=t.distSqr(i);if(0===r)return e.distSqr(t);let n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function al(e,t){let i,r,n,a=!1;for(let s of e){i=s;for(let e=0,s=i.length-1;e<i.length;s=e++)r=i[e],n=i[s],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(a=!a)}return a}function sl(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let a=e[r],s=e[n];a.y>t.y!=s.y>t.y&&t.x<(s.x-a.x)*(t.y-a.y)/(s.y-a.y)+a.x&&(i=!i)}return i}function ol(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=q(e,t,i[0]);return a!==q(e,t,i[1])||a!==q(e,t,i[2])||a!==q(e,t,i[3])}function ll(e,t,i){let r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function hl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ul(e,t,r,n,a){if(!t[0]&&!t[1])return e;let s=i.convert(t)._mult(a);"viewport"===r&&s._rotate(-n);let o=[];for(let t of e)o.push(t.sub(s));return o}function cl(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],n=t.at(-1);(0===i||n&&!r.equals(n))&&t.push(r)}return t}function dl({queryGeometry:e,size:t},i){return Jo(e,i,t)}function pl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},a){return Jo(e,a,t*(i.projectTileCoordinates(a.x,a.y,r,n).signedDistanceFromCamera/i.cameraToCenterDistance))}function fl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},a){let s=i.projectTileCoordinates(a.x,a.y,r,n).signedDistanceFromCamera,o=t*(i.cameraToCenterDistance/s);return Jo(e,_l(a,i,r,n),o)}function ml({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n},a){return Jo(e,_l(a,i,r,n),t)}function gl({queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n,pitchAlignment:a="map",pitchScale:s="map"},o){let l="map"===a?"map"===s?dl:pl:"map"===s?fl:ml,h={queryGeometry:e,size:t,transform:i,unwrappedTileID:r,getElevation:n};for(let e of o)for(let t of e)if(l(h,t))return!0;return!1}function _l(e,t,r,n){let a=t.projectTileCoordinates(e.x,e.y,r,n).point;return new i((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}fa("CircleBucket",Yo,{omit:["layers"]});var yl={get paint(){return Wo=Wo||new Ka({"circle-radius":new Wa(be.paint_circle["circle-radius"]),"circle-color":new Wa(be.paint_circle["circle-color"]),"circle-blur":new Wa(be.paint_circle["circle-blur"]),"circle-opacity":new Wa(be.paint_circle["circle-opacity"]),"circle-translate":new qa(be.paint_circle["circle-translate"]),"circle-translate-anchor":new qa(be.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qa(be.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qa(be.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wa(be.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wa(be.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wa(be.paint_circle["circle-stroke-opacity"])})},get layout(){return qo=qo||new Ka({"circle-sort-key":new Wa(be.layout_circle["circle-sort-key"])})}};class vl extends ts{constructor(e,t){super(e,yl,t)}createBucket(e){return new Yo(e)}queryRadius(e){let t=e;return ll("circle-radius",this,t)+ll("circle-stroke-width",this,t)+hl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l,h,u=ul(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),d=this.paint.get("circle-pitch-scale"),p=this.paint.get("circle-pitch-alignment");return"map"===p?(l=u,h=c*a):(f=n,m=s,g=o,l=u.map(e=>_l(e,f,m,g)),h=c),gl({queryGeometry:l,size:h,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:p,pitchScale:d},r);var f,m,g}}class xl extends Yo{}let bl;fa("HeatmapBucket",xl,{omit:["layers"]});var wl={get paint(){return bl=bl||new Ka({"heatmap-radius":new Wa(be.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wa(be.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qa(be.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ya(be.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qa(be.paint_heatmap["heatmap-opacity"])})}};function Tl(e,{width:t,height:i},r,n){if(n){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}`)}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function Sl(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let n=Tl({},{width:t,height:i},r);Il(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 Il(e,t,i,r,n,a){if(0===n.width||0===n.height)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 s=e.data,o=t.data;if(s===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let h=((i.y+l)*e.width+i.x)*a,u=((r.y+l)*t.width+r.x)*a;for(let e=0;e<n.width*a;e++)o[u+e]=s[h+e]}return t}class Pl{constructor(e,t){Tl(this,e,1,t)}resize(e){Sl(this,e,1)}clone(){return new Pl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Il(e,t,i,r,n,1)}}class Cl{constructor(e,t){Tl(this,e,4,t)}resize(e){Sl(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Cl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Il(e,t,i,r,n,4)}setPixel(e,t,i){let r=4*(e*this.width+t);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}}function El(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){let r=e[i+3];t[i+0]=Math.round(e[i+0]*r/255),t[i+1]=Math.round(e[i+1]*r/255),t[i+2]=Math.round(e[i+2]*r/255),t[i+3]=r}return t}function Ml(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Cl({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);let a=(r,a,s)=>{t[e.evaluationKey]=s;let o=e.expression.evaluate(t);n.setPixel(r/4/i,a/4,o)};if(e.clips)for(let t=0,n=0;t<r;++t,n+=4*i)for(let r=0,s=0;r<i;r++,s+=4){let o=r/(i-1),{start:l,end:h}=e.clips[t];a(n,s,l*(1-o)+h*o)}else for(let e=0,t=0;e<i;e++,t+=4)a(0,t,e/(i-1));return n}fa("AlphaImage",Pl),fa("RGBAImage",Cl);let Al,kl="big-fb";class Ll extends ts{createBucket(e){return new xl(e)}constructor(e,t){super(e,wl,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ml({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(kl)&&this.heatmapFbos.delete(kl)}queryRadius(e){return ll("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return gl({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,i)*a,transform:n,unwrappedTileID:s,getElevation:o},r)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}var Fl={get paint(){return Al=Al||new Ka({"hillshade-illumination-direction":new qa(be.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new qa(be.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new qa(be.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qa(be.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qa(be.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qa(be.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qa(be.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new qa(be.paint_hillshade["hillshade-method"]),resampling:new qa(be.paint_hillshade.resampling)})}};class Dl extends ts{constructor(e,t){super(e,Fl,t),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(te);return{directionRadians:e.map(te),altitudeRadians:a,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let Rl;var zl={get paint(){return Rl=Rl||new Ka({"color-relief-opacity":new qa(be["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ya(be["paint_color-relief"]["color-relief-color"]),resampling:new qa(be["paint_color-relief"].resampling)})}};function Nl(e){return"data"in e}class Ol{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,i){var r;let{width:n,height:a}=e,s=((null===(r=this.size)||void 0===r?void 0:r[0])!==n||this.size[1]!==a)&&!i,{context:o}=this,{gl:l}=o;this.useMipmap=!!t?.useMipmap,l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let h=this.format===l.RGBA&&!1!==t?.premultiply;if(s)this.size=[n,a],Nl(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,h,n,a,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(h),this._uploadDomImage(e,l));else{let{x:t,y:r}=i||{x:0,y:0};Nl(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,h,t,r,n,a,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(h),this._updateDomImage(e,t,r,l))}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,i,r,n){let{data:a}=e;t&&a&&(a=El(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,i,r,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(e,t,i,r){r.texSubImage2D(r.TEXTURE_2D,0,t,i,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,i,r,n,a,s){let{data:o}=e;t&&o&&(o=El(o)),s.texSubImage2D(s.TEXTURE_2D,0,i,r,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(e,t,i){let{context:r}=this,{gl:n}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),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,this._ownedHandle=null}}class Bl{constructor(e,t,i,r=1,n=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void $(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let o=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=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<o;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(o,e)]=this.data[this._idx(o-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,o)]=this.data[this._idx(e,o-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(o,-1)]=this.data[this._idx(o-1,0)],this.data[this._idx(-1,o)]=this.data[this._idx(0,o-1)],this.data[this._idx(o,o)]=this.data[this._idx(o-1,o-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<o;e++)for(let t=0;t<o;t++){let i=this.get(e,t);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(e,t){let i=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);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. x: ${e}, y: ${t}, dim: ${this.dim}`);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 jl(e,this.getUnpackVector())}getPixels(){return new Cl({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,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:a=s-1;break;case 1:s=a+1}let o=-t*this.dim,l=-i*this.dim;for(let t=a;t<s;t++)for(let i=r;i<n;i++)this.data[this._idx(i,t)]=e.data[this._idx(i+o,t+l)]}}function jl(e,t){let i=t[0],r=t[1],n=t[2],a=t[3],s=Math.min(i,r,n),o=Math.round((e+a)/s);return{r:Math.floor(o*s/i)%256,g:Math.floor(o*s/r)%256,b:Math.floor(o*s/n)%256}}fa("DEMData",Bl);class Vl extends ts{constructor(e,t){super(e,zl,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof sn&&i._styleExpression.expression instanceof mi){this.colorRampExpression=i;let e=i._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let i of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:i}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Mt.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 e=0;e<t.elevationStops.length-.5;e+=n)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return $(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),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 Cl({width:r.colorStops.length,height:1}),a=new Cl({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=jl(r.elevationStops[e],i);a.setPixel(0,e,new Mt(t.r/255,t.g/255,t.b/255,1)),n.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new Ol(e,a,e.gl.RGBA),colorTexture:new Ol(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let Gl=os([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ul}=Gl;function Zl(e,t,i){let r=i.patternDependencies,n=!1;for(let i of t){let t=i.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);let a=t.constantOr(null);a&&(n=!0,r[a.to]=!0,r[a.from]=!0)}return n}function $l(e,t,i,r,n){let{zoom:a}=r,s=n.patternDependencies;for(let r of t){let t=r.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:a-1},i,{},n.availableImages),o=t.evaluate({zoom:a},i,{},n.availableImages),l=t.evaluate({zoom:a+1},i,{},n.availableImages);e=e?.name?e.name:e,o=o?.name?o.name:o,l=l?.name?l.name:l,s[e]=!0,s[o]=!0,s[l]=!0,i.patterns[r.id]={min:e,mid:o,max:l}}}return i}function ql(e,t,i,r,n){let a;if(n===function(e,t,i,r){let n=0;for(let a=t,s=i-r;a<i;a+=r)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)a=fh(n/r|0,e[n],e[n+1],a);else for(let n=i-r;n>=t;n-=r)a=fh(n/r|0,e[n],e[n+1],a);return a&&lh(a,a.next)&&(mh(a),a=a.next),a}function Wl(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!lh(r,r.next)&&0!==oh(r.prev,r,r.next))r=r.next;else{if(mh(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function Hl(e,t,i,r,n,a,s){if(!e)return;!s&&a&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=ih(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,function(e){let t,i=1;do{let r,n=e;e=null;let a=null;for(t=0;n;){t++;let s=n,o=0;for(let e=0;e<i&&(o++,s=s.nextZ,s);e++);let l=i;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=s}a.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,a);let o=e;for(;e.prev!==e.next;){let l=e.prev,h=e.next;if(a?Yl(e,r,n,a):Xl(e))t.push(l.i,e.i,h.i),mh(e),e=h.next,o=h.next;else if((e=h)===o){s?1===s?Hl(e=Kl(Wl(e),t),t,i,r,n,a,2):2===s&&Jl(e,t,i,r,n,a):Hl(Wl(e),t,i,r,n,a,1);break}}}function Xl(e){let t=e.prev,i=e,r=e.next;if(oh(t,i,r)>=0)return!1;let n=t.x,a=i.x,s=r.x,o=t.y,l=i.y,h=r.y,u=Math.min(n,a,s),c=Math.min(o,l,h),d=Math.max(n,a,s),p=Math.max(o,l,h),f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=c&&f.y<=p&&ah(n,o,a,l,s,h,f.x,f.y)&&oh(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Yl(e,t,i,r){let n=e.prev,a=e,s=e.next;if(oh(n,a,s)>=0)return!1;let o=n.x,l=a.x,h=s.x,u=n.y,c=a.y,d=s.y,p=Math.min(o,l,h),f=Math.min(u,c,d),m=Math.max(o,l,h),g=Math.max(u,c,d),_=ih(p,f,t,i,r),y=ih(m,g,t,i,r),v=e.prevZ,x=e.nextZ;for(;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==s&&ah(o,u,l,c,h,d,v.x,v.y)&&oh(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==s&&ah(o,u,l,c,h,d,x.x,x.y)&&oh(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==s&&ah(o,u,l,c,h,d,v.x,v.y)&&oh(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&x!==s&&ah(o,u,l,c,h,d,x.x,x.y)&&oh(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Kl(e,t){let i=e;do{let r=i.prev,n=i.next.next;!lh(r,n)&&hh(r,i,i.next,n)&&dh(r,n)&&dh(n,r)&&(t.push(r.i,i.i,n.i),mh(i),mh(i.next),i=e=n),i=i.next}while(i!==e);return Wl(i)}function Jl(e,t,i,r,n,a){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&sh(s,e)){let o=ph(s,e);return s=Wl(s,s.next),o=Wl(o,o.next),Hl(s,t,i,r,n,a,0),void Hl(o,t,i,r,n,a,0)}e=e.next}s=s.next}while(s!==e)}function Ql(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function eh(e,t){let i=function(e,t){let i,r=t,n=e.x,a=e.y,s=-1/0;if(lh(e,r))return r;do{if(lh(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>s&&(s=e,i=r.x<r.next.x?r:r.next,e===n))return i}r=r.next}while(r!==t);if(!i)return null;let o=i,l=i.x,h=i.y,u=1/0;r=i;do{if(n>=r.x&&r.x>=l&&n!==r.x&&nh(a<h?n:s,a,l,h,a<h?s:n,a,r.x,r.y)){let t=Math.abs(a-r.y)/(n-r.x);dh(r,e)&&(t<u||t===u&&(r.x>i.x||r.x===i.x&&th(i,r)))&&(i=r,u=t)}r=r.next}while(r!==o);return i}(e,t);if(!i)return t;let r=ph(i,e);return Wl(r,r.next),Wl(i,i.next)}function th(e,t){return oh(e.prev,e,t.prev)<0&&oh(t.next,e,e.next)<0}function ih(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function rh(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 nh(e,t,i,r,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(a-o)>=(n-s)*(r-o)}function ah(e,t,i,r,n,a,s,o){return!(e===s&&t===o)&&nh(e,t,i,r,n,a,s,o)}function sh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(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&&hh(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(dh(e,t)&&dh(t,e)&&function(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}(e,t)&&(oh(e.prev,e,t.prev)||oh(e,t.prev,t))||lh(e,t)&&oh(e.prev,e,e.next)>0&&oh(t.prev,t,t.next)>0)}function oh(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function lh(e,t){return e.x===t.x&&e.y===t.y}function hh(e,t,i,r){let n=ch(oh(e,t,i)),a=ch(oh(e,t,r)),s=ch(oh(i,r,e)),o=ch(oh(i,r,t));return n!==a&&s!==o||!(0!==n||!uh(e,i,t))||!(0!==a||!uh(e,r,t))||!(0!==s||!uh(i,e,r))||!(0!==o||!uh(i,t,r))}function uh(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 ch(e){return e>0?1:e<0?-1:0}function dh(e,t){return oh(e.prev,e,e.next)<0?oh(e,t,e.next)>=0&&oh(e,e.prev,t)>=0:oh(e,t,e.prev)<0||oh(e,e.next,t)<0}function ph(e,t){let i=gh(e.i,e.x,e.y),r=gh(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 fh(e,t,i,r){let n=gh(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 mh(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 gh(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class _h{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){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class yh{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}yh.noSubdivision=new yh({fill:new _h(0,0),line:new _h(0,0),tile:new _h(0,0),stencil:new _h(0,0),circle:1}),fa("SubdivisionGranularityExpression",_h),fa("SubdivisionGranularitySetting",yh);let vh,xh,bh=-32768,wh=32767;class Th{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=M/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_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=0|Math.round(e),r=0|Math.round(t),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 function(e,t){let i=[];for(let r=0;r<t.length;r+=3){let n=t[r],a=t[r+1],s=t[r+2],o=e[2*n],l=e[2*n+1];(e[2*a]-o)*(e[2*s+1]-l)-(e[2*a+1]-l)*(e[2*s]-o)>0?(i.push(n),i.push(s),i.push(a)):(i.push(n),i.push(a),i.push(s))}return i}(this._vertexBuffer,e);let t=[],i=e.length;for(let r=0;r<i;r+=3){let i=[e[r+0],e[r+1],e[r+2]],n=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]],a=1/0,s=1/0,o=-1/0,l=-1/0;for(let e=0;e<3;e++){let t=n[2*e],i=n[2*e+1];a=Math.min(a,t),o=Math.max(o,t),s=Math.min(s,i),l=Math.max(l,i)}if(a===o||s===l)continue;let h=Math.floor(a/this._granularityCellSize),u=Math.ceil(o/this._granularityCellSize),c=Math.floor(s/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(h!==u||c!==d)for(let e=c;e<d;e++){let r=this._scanlineGenerateVertexRingForCellRow(e,n,i);Ph(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,n=r+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let s=t[2*e],o=t[2*e+1],l=t[2*(e+1)%6],h=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],c=t[(2*(e+2)+1)%6],d=l-s,p=h-o,f=0===d,m=0===p,g=(r-o)/p,_=(n-o)/p,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(o<r||o>n)){h>=r&&h<=n&&a.push(i[(e+1)%3]);continue}!m&&y>0&&a.push(this._vertexToIndex(s+d*y,o+p*y));let x=s+d*Math.max(y,0),b=s+d*Math.min(v,1);f||this._generateIntraEdgeVertices(a,s,o,l,h,x,b),!m&&v<1&&a.push(this._vertexToIndex(s+d*v,o+p*v)),(m||h>=r&&h<=n)&&a.push(i[(e+1)%3]),!m&&(h<=r||h>=n)&&this._generateInterEdgeVertices(a,s,o,l,h,u,c,b,r,n)}return a}_generateIntraEdgeVertices(e,t,i,r,n,a,s){let o=r-t,l=n-i,h=0===l,u=h?Math.min(t,r):Math.min(a,s),c=h?Math.max(t,r):Math.max(a,s),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(c/this._granularityCellSize)-1;if(h?t<r:a<s)for(let r=d;r<=p;r++){let n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/o))}else for(let r=p;r>=d;r--){let n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/o))}}_generateInterEdgeVertices(e,t,i,r,n,a,s,o,l,h){let u=n-i,c=a-r,d=s-n,p=(l-n)/d,f=(h-n)/d,m=Math.min(p,f),g=Math.max(p,f),_=r+c*m,y=Math.floor(Math.min(_,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,o)/this._granularityCellSize)-1,x=o<_,b=0===d;if(b&&(s===l||s===h))return;if(b||m>=1||g<=0){let e=i-s,r=a+(t-a)*Math.min((l-s)/e,(h-s)/e);y=Math.floor(Math.min(r,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,o)/this._granularityCellSize)-1,x=o<r}let w=u>0?h:l;if(x)for(let t=y;t<=v;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,w));else for(let t=v;t>=y;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,w))}_generateOutline(e){let t=[];for(let i of e){let e=Ih(i,this._granularity,!0),r=this._pointArrayToIndices(e),n=[];for(let e=1;e<r.length;e++)n.push(r[e-1]),n.push(r[e]);t.push(n)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(0===this._canonical.y&&(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===bh&&(e[t+1]=-32767),i===wh&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,r,n,a){r>n!=(a===bh)?(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=M,a=e.length;for(let s=2;s<a;s+=3){let a=e[s-2],o=e[s-1],l=e[s],h=r[2*a],u=r[2*a+1],c=r[2*o],d=r[2*o+1],p=r[2*l],f=r[2*l+1];t&&(0===u&&0===d&&this._generatePoleQuad(e,a,o,h,c,bh),0===d&&0===f&&this._generatePoleQuad(e,o,l,c,p,bh),0===f&&0===u&&this._generatePoleQuad(e,l,a,p,h,bh)),i&&(u===n&&d===n&&this._generatePoleQuad(e,a,o,h,c,wh),d===n&&f===n&&this._generatePoleQuad(e,o,l,c,p,wh),f===n&&u===n&&this._generatePoleQuad(e,l,a,p,h,wh))}}_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 i,{flattened:r,holeIndices:n}=function(e){let t=[],i=[];for(let r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(let e of r)i.push(e.x),i.push(e.y)}return{flattened:i,holeIndices:t}}(e);this._initializeVertices(r);try{let e=function(e,t,i=2){let r,n,a,s=t&&t.length,o=s?t[0]*i:e.length,l=ql(e,0,o,i,!0),h=[];if(!l||l.next===l.prev)return h;if(s&&(l=function(e,t,i,r){let n=[];for(let i=0,a=t.length;i<a;i++){let s=ql(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1);s===s.next&&(s.steiner=!0),n.push(rh(s))}n.sort(Ql);for(let e=0;e<n.length;e++)i=eh(n[e],i);return i}(e,t,l,i)),e.length>80*i){r=e[0],n=e[1];let t=r,s=n;for(let a=i;a<o;a+=i){let i=e[a],o=e[a+1];i<r&&(r=i),o<n&&(n=o),i>t&&(t=i),o>s&&(s=o)}a=Math.max(t-r,s-n),a=0!==a?32767/a:0}return Hl(l,h,i,r,n,a,0),h}(r,n),t=this._convertIndices(r,e);i=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:a}}_convertIndices(e,t){let i=[];for(let r of t)i.push(this._vertexToIndex(e[2*r],e[2*r+1]));return i}_pointArrayToIndices(e){let t=[];for(let i of e)t.push(this._vertexToIndex(i.x,i.y));return t}}function Sh(e,t,i,r=!0){return new Th(i,t).subdividePolygonInternal(e,r)}function Ih(e,t,r=!1){if(!e||e.length<1)return[];if(e.length<2)return[];let n=e[0],a=e[e.length-1],s=r&&(n.x!==a.x||n.y!==a.y);if(t<2)return s?[...e,e[0]]:[...e];let o=Math.floor(M/t),l=[];l.push(new i(e[0].x,e[0].y));let h=e.length,u=s?h:h-1;for(let t=0;t<u;t++){let r=e[t],n=t<h-1?e[t+1]:e[0],a=r.x,s=r.y,u=n.x,c=n.y,d=a!==u,p=s!==c;if(!d&&!p)continue;let f=u-a,m=c-s,g=Math.abs(f),_=Math.abs(m),y=a,v=s;for(;;){let e=f>0?(Math.floor(y/o)+1)*o:(Math.ceil(y/o)-1)*o,t=m>0?(Math.floor(v/o)+1)*o:(Math.ceil(v/o)-1)*o,r=Math.abs(y-e),n=Math.abs(v-t),a=Math.abs(y-u),s=Math.abs(v-c),h=d?r/g:Number.POSITIVE_INFINITY,x=p?n/_:Number.POSITIVE_INFINITY;if((a<=r||!d)&&(s<=n||!p))break;if(h<x&&d||!p){y=e,v+=m*h;let t=new i(y,Math.round(v));l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}else{y+=f*x,v=t;let e=new i(Math.round(y),v);l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}}let x=new i(u,c);l[l.length-1].x===x.x&&l[l.length-1].y===x.y||l.push(x)}return l}function Ph(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[2*t[0]];for(let i=1;i<t.length;i++){let a=e[2*t[i]];a<n&&(n=a,r=i)}let a=t.length,s=r,o=(s+1)%a;for(;;){let r=s-1>=0?s-1:a-1,n=(o+1)%a,l=e[2*t[r]],h=e[2*t[n]],u=e[2*t[s]],c=e[2*t[s]+1],d=e[2*t[o]+1],p=!1;if(l<h)p=!0;else if(l>h)p=!1;else{let i=d-c,a=-(e[2*t[o]]-u),s=c<d?1:-1;((l-u)*i+(e[2*t[r]+1]-c)*a)*s>((h-u)*i+(e[2*t[n]+1]-c)*a)*s&&(p=!0)}if(p){let e=t[r],n=t[s],l=t[o];e!==n&&e!==l&&n!==l&&i.push(l,n,e),s--,s<0&&(s=a-1)}else{let e=t[n],r=t[s],l=t[o];e!==r&&e!==l&&r!==l&&i.push(l,r,e),o++,o>=a&&(o=0)}if(r===n)break}}function Ch(e,t,i,r,n,a,s,o,l){let h=n.length/2,u=s&&o&&l;if(h<lo.MAX_VERTEX_ARRAY_LENGTH){let c,d,p=t.prepareSegment(h,i,r),f=p.vertexLength;for(let e=0;e<a.length;e+=3)r.emplaceBack(f+a[e],f+a[e+1],f+a[e+2]);p.vertexLength+=h,p.primitiveLength+=a.length/3,u&&(d=s.prepareSegment(h,i,o),c=d.vertexLength,d.vertexLength+=h);for(let t=0;t<n.length;t+=2)e(n[t],n[t+1]);if(u)for(let e of l){for(let t=1;t<e.length;t+=2)o.emplaceBack(c+e[t-1],c+e[t]);d.primitiveLength+=e.length/2}}else(function(e,t,i,r,n,a){let s=[];for(let e=0;e<r.length/2;e++)s.push(-1);let o={count:0},l=0,h=e.getOrCreateLatestSegment(t,i),u=h.vertexLength;for(let c=2;c<n.length;c+=3){let d=n[c-2],p=n[c-1],f=n[c],m=s[d]<l,g=s[p]<l,_=s[f]<l;h.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>lo.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,m=!0,g=!0,_=!0,u=0);let y=Eh(s,r,a,o,d,m,h),v=Eh(s,r,a,o,p,g,h),x=Eh(s,r,a,o,f,_,h);i.emplaceBack(u+y-l,u+v-l,u+x-l),h.primitiveLength++}})(t,i,r,n,a,e),u&&function(e,t,i,r,n,a){let s=[];for(let e=0;e<r.length/2;e++)s.push(-1);let o={count:0},l=0,h=e.getOrCreateLatestSegment(t,i),u=h.vertexLength;for(let c of n)for(let n=1;n<c.length;n+=2){let d=c[n-1],p=c[n],f=s[d]<l,m=s[p]<l;h.vertexLength+((f?1:0)+(m?1:0))>lo.MAX_VERTEX_ARRAY_LENGTH&&(h=e.createNewSegment(t,i),l=o.count,f=!0,m=!0,u=0);let g=Eh(s,r,a,o,d,f,h),_=Eh(s,r,a,o,p,m,h);i.emplaceBack(u+g-l,u+_-l),h.primitiveLength++}}(s,i,o,n,l,e),t.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Eh(e,t,i,r,n,a,s){if(a){let a=r.count;return i(t[2*n],t[2*n+1]),e[n]=r.count,r.count++,s.vertexLength++,a}return e[n]}class Mh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new no,this.indexArray2=new ao,this.programConfigurations=new Bo(e.layers,e.zoom),this.segments=new lo,this.segments2=new lo,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=Zl("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),a=[];for(let{feature:s,id:o,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=$o(s,e);if(!this.layers[0]._featureFilter.filter(new Ra(this.zoom),u,i))continue;let c=n?r.evaluate(u,{},i,t.availableImages):void 0,d={id:o,properties:s.properties,type:s.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:Zo(s),patterns:{},sortKey:c};a.push(d)}n&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let r of a){let{geometry:n,index:a,sourceLayerIndex:s}=r;if(this.hasDependencies){let e=$l("fill",this.layers,r,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(r,n,a,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[a].feature,n,a,s,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}addFeatures(e,t,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ul),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 e of ir(t,500)){let t=Sh(e,r,a.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;Ch((e,t)=>{i.emplaceBack(e,t)},this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,canonical:r})}}fa("FillBucket",Mh,{omit:["layers","patternFeatures"]});var Ah={get paint(){return xh=xh||new Ka({"fill-antialias":new qa(be.paint_fill["fill-antialias"]),"fill-opacity":new Wa(be.paint_fill["fill-opacity"]),"fill-color":new Wa(be.paint_fill["fill-color"]),"fill-outline-color":new Wa(be.paint_fill["fill-outline-color"]),"fill-translate":new qa(be.paint_fill["fill-translate"]),"fill-translate-anchor":new qa(be.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ha(be.paint_fill["fill-pattern"])})},get layout(){return vh=vh||new Ka({"fill-sort-key":new Wa(be.layout_fill["fill-sort-key"])})}};class kh extends ts{constructor(e,t){super(e,Ah,t)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Mh(e)}queryRadius(){return hl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return Qo(ul(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}let Lh=os([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fh=os([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Dh}=Lh;class Rh{constructor(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(zh,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t,r=e.readVarint()+e.pos,n=[],a=1,s=0,o=0,l=0;for(;e.pos<r;){if(s<=0){let t=e.readVarint();a=7&t,s=t>>3}if(s--,1===a||2===a)o+=e.readSVarint(),l+=e.readSVarint(),1===a&&(t&&n.push(t),t=[]),t&&t.push(new i(o,l));else{if(7!==a)throw new Error(`unknown command ${a}`);t&&t.push(t[0].clone())}}return t&&n.push(t),n}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,i=1,r=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,h=-1/0;for(;e.pos<t;){if(r<=0){let t=e.readVarint();i=7&t,r=t>>3}if(r--,1===i||2===i)n+=e.readSVarint(),a+=e.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>h&&(h=a);else if(7!==i)throw new Error(`unknown command ${i}`)}return[s,l,o,h]}toGeoJSON(e,t,i){let r,n=this.extent*Math.pow(2,i),a=this.extent*e,s=this.extent*t,o=this.loadGeometry();function l(e){return[360*(e.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/n)*Math.PI))-90]}function h(e){return e.map(l)}if(1===this.type){let e=[];for(let t of o)e.push(t[0]);let t=h(e);r=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){let e=o.map(h);r=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{let e=Nh(o),t=[];for(let i of e)t.push(i.map(h));r=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}let u={type:"Feature",geometry:r,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function zh(e,t,i){1===e?t.id=i.readVarint():2===e?function(e,t){let i=e.readVarint()+e.pos;for(;e.pos<i;){let i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}(i,t):3===e?t.type=i.readVarint():4===e&&(t._geometry=i.pos)}function Nh(e){let t=e.length;if(t<=1)return[e];let i,r,n=[];for(let a=0;a<t;a++){let t=Oh(e[a]);0!==t&&(void 0===r&&(r=t<0),r===t<0?(i&&n.push(i),i=[e[a]]):i&&i.push(e[a]))}return i&&n.push(i),n}function Oh(e){let t=0;for(let i,r,n=0,a=e.length,s=a-1;n<a;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}Rh.types=["Unknown","Point","LineString","Polygon"];class Bh{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(jh,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new Rh(this._pbf,t,this.extent,this._keys,this._values)}}function jh(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){let i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(i))}class Vh{constructor(e,t){this.layers=e.readFields(Gh,{},t)}}function Gh(e,t,i){if(3===e){let e=new Bh(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}let Uh,Zh=Math.pow(2,13);function $h(e,t,i,r,n,a,s,o){e.emplaceBack(t,i,2*Math.floor(r*Zh)+s,n*Zh*2,a*Zh*2,Math.round(o))}class qh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Hs,this.centroidVertexArray=new $s,this.indexArray=new no,this.programConfigurations=new Bo(e.layers,e.zoom),this.segments=new lo,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.features=[],this.hasDependencies=Zl("fill-extrusion",this.layers,t);for(let{feature:r,id:n,index:a,sourceLayerIndex:s}of e){let e=this.layers[0]._featureFilter.needGeometry,o=$o(r,e);if(!this.layers[0]._featureFilter.filter(new Ra(this.zoom),o,i))continue;let l={id:n,sourceLayerIndex:s,index:a,geometry:e?o.geometry:Zo(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push($l("fill-extrusion",this.layers,l,{zoom:this.zoom},t)):this.addFeature(l,l.geometry,a,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,a,s,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,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dh),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Fh.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 i of ir(t,500)){let t={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,a);let s=this.layoutVertexArray.length-n,o=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<s;e++)this.centroidVertexArray.emplaceBack(o,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,canonical:r})}processPolygon(e,t,i,r,n){if(r.length<1||Xh(r[0]))return;for(let t of r)0!==t.length&&Wh(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(t.z),o="Polygon"===Rh.types[i.type];for(let e of r){if(0===e.length||Xh(e))continue;let t=Ih(e,s,o);this._generateSideFaces(t,a)}if(!o)return;let l=Sh(r,t,s,!1),h=this.layoutVertexArray;Ch((e,t)=>{$h(h,e,t,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(Hh(n,a))continue;t.segment.vertexLength+4>lo.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);i+o>32768&&(i=0),$h(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),$h(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=o,$h(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,i),$h(this.layoutVertexArray,a.x,a.y,s.x,s.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 Wh(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++)}}function Hh(e,t){return e.x===t.x&&(e.x<0||e.x>M)||e.y===t.y&&(e.y<0||e.y>M)}function Xh(e){return e.every(e=>e.x<0)||e.every(e=>e.x>M)||e.every(e=>e.y<0)||e.every(e=>e.y>M)}fa("FillExtrusionBucket",qh,{omit:["layers","features"]});var Yh={get paint(){return Uh=Uh||new Ka({"fill-extrusion-opacity":new qa(be["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wa(be["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qa(be["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qa(be["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ha(be["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wa(be["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wa(be["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qa(be["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Kh extends ts{constructor(e,t){super(e,Yh,t)}createBucket(e){return new qh(e)}queryRadius(){return hl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:a,pixelsToTileUnits:s,pixelPosMatrix:o}){let l=ul(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,s),h=this.paint.get("fill-extrusion-height").evaluate(t,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),c=function(e,t){let r=[];for(let n of e){let e=[n.x,n.y,0,1];S(e,e,t),r.push(new i(e[0]/e[3],e[1]/e[3]))}return r}(l,o),d=function(e,t,r,n){let a=[],s=[],o=n[8]*t,l=n[9]*t,h=n[10]*t,u=n[11]*t,c=n[8]*r,d=n[9]*r,p=n[10]*r,f=n[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,s=a.y,m=n[0]*t+n[4]*s+n[12],g=n[1]*t+n[5]*s+n[13],_=n[2]*t+n[6]*s+n[14],y=n[3]*t+n[7]*s+n[15],v=_+h,x=y+u,b=m+c,w=g+d,T=_+p,S=y+f,I=new i((m+o)/x,(g+l)/x);I.z=v/x,e.push(I);let P=new i(b/S,w/S);P.z=T/S,r.push(P)}a.push(e),s.push(r)}return[a,s]}(n,u,h,o);return function(e,t,i){let r=1/0;Qo(i,t)&&(r=Qh(i,t[0]));for(let n=0;n<t.length;n++){let a=t[n],s=e[n];for(let e=0;e<a.length-1;e++){let t=a[e],n=[t,a[e+1],s[e+1],s[e],t];Ko(i,n)&&(r=Math.min(r,Qh(i,n)))}}return r!==1/0&&r}(d[0],d[1],c)}}function Jh(e,t){return e.x*t.x+e.y*t.y}function Qh(e,t){if(1===e.length){let i,r=0,n=t[r++];for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r<t.length;r++){let a=t[r],s=e[0],o=i.sub(n),l=a.sub(n),h=s.sub(n),u=Jh(o,o),c=Jh(o,l),d=Jh(l,l),p=Jh(h,o),f=Jh(h,l),m=u*d-c*c,g=(d*p-c*f)/m,_=(u*f-c*p)/m,y=n.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(y))return y}return 1/0}{let e=1/0;for(let i of t)e=Math.min(e,i.z);return e}}let eu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class tu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");let r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);let n=eu[15&i];if(!n)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new tu(s,a,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let n=eu.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+o,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+s+o),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+o,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return iu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:s}=this,o=[0,n.length-1,0],l=[];for(;o.length;){let h=o.pop()||0,u=o.pop()||0,c=o.pop()||0;if(u-c<=s){for(let s=c;s<=u;s++){let o=a[2*s],h=a[2*s+1];o>=e&&o<=i&&h>=t&&h<=r&&l.push(n[s])}continue}let d=c+u>>1,p=a[2*d],f=a[2*d+1];p>=e&&p<=i&&f>=t&&f<=r&&l.push(n[d]),(0===h?e<=p:t<=f)&&(o.push(c),o.push(d-1),o.push(1-h)),(0===h?i>=p:r>=f)&&(o.push(d+1),o.push(u),o.push(1-h))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:r,coords:n,nodeSize:a}=this,s=[0,r.length-1,0],o=[],l=i*i;for(;s.length;){let h=s.pop()||0,u=s.pop()||0,c=s.pop()||0;if(u-c<=a){for(let i=c;i<=u;i++)su(n[2*i],n[2*i+1],e,t)<=l&&o.push(r[i]);continue}let d=c+u>>1,p=n[2*d],f=n[2*d+1];su(p,f,e,t)<=l&&o.push(r[d]),(0===h?e-i<=p:t-i<=f)&&(s.push(c),s.push(d-1),s.push(1-h)),(0===h?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-h))}return o}}function iu(e,t,i,r,n,a){if(n-r<=i)return;let s=r+n>>1;ru(e,t,s,r,n,a),iu(e,t,i,r,s-1,1-a),iu(e,t,i,s+1,n,1-a)}function ru(e,t,i,r,n,a){for(;n>r;){if(n-r>600){let s=n-r+1,o=i-r+1,l=Math.log(s),h=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*h*(s-h)/s)*(o-s/2<0?-1:1);ru(e,t,i,Math.max(r,Math.floor(i-o*h/s+u)),Math.min(n,Math.floor(i+(s-o)*h/s+u)),a)}let s=t[2*i+a],o=r,l=n;for(nu(e,t,r,i),t[2*n+a]>s&&nu(e,t,r,n);o<l;){for(nu(e,t,o,l),o++,l--;t[2*o+a]<s;)o++;for(;t[2*l+a]>s;)l--}t[2*r+a]===s?nu(e,t,r,l):(l++,nu(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function nu(e,t,i,r){au(e,i,r),au(t,2*i,2*r),au(t,2*i+1,2*r+1)}function au(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function su(e,t,i,r){let n=e-i,a=t-r;return n*n+a*a}function ou(e,t,i,r){let n,a=r,s=t+(i-t>>1),o=i-t,l=e[t],h=e[t+1],u=e[i],c=e[i+1];for(let r=t+3;r<i;r+=3){let t=lu(e[r],e[r+1],l,h,u,c);if(t>a)n=r,a=t;else if(t===a){let e=Math.abs(r-s);e<o&&(n=r,o=e)}}a>r&&(n-t>3&&ou(e,t,n,r),e[n+2]=a,i-n>3&&ou(e,n,i,r))}function lu(e,t,i,r,n,a){let s=n-i,o=a-r;if(0!==s||0!==o){let l=((e-i)*s+(t-r)*o)/(s*s+o*o);l>1?(i=n,r=a):l>0&&(i+=s*l,r+=o*l)}return s=e-i,o=t-r,s*s+o*o}function hu(e,t,i,r){let n={type:t,geom:i},a={id:e??null,type:n.type,geometry:n.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":cu(a,n.geom);break;case"LineString":cu(a,n.geom.points);break;case"Polygon":cu(a,n.geom[0].points);break;case"MultiLineString":for(let e of n.geom)cu(a,e.points);break;case"MultiPolygon":for(let e of n.geom)cu(a,e[0].points)}return a}function uu(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function cu(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function du(e,t){let i=[];switch(e.type){case"FeatureCollection":for(let r=0;r<e.features.length;r++)pu(i,e.features[r],t,r);break;case"Feature":pu(i,e,t);break;default:pu(i,{geometry:e,properties:void 0},t)}return i}function pu(e,t,i,r){if(!t.geometry)return;if("GeometryCollection"===t.geometry.type)return void function(e,t,i,r,n){for(let a of i.geometries)pu(e,{id:t.id,geometry:a,properties:t.properties},r,n)}(e,t,t.geometry,i,r);if(!t.geometry.coordinates?.length)return;let n=(s=t,l=r,(o=i).promoteId?s.properties?.[o.promoteId]:o.generateId?l||0:s.id),a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);var s,o,l;switch(t.geometry.type){case"Point":return void function(e,t,i,r){let n=[];n.push(gu(i.coordinates[0]),_u(i.coordinates[1]),0),e.push(hu(t,"Point",n,r))}(e,n,t.geometry,t.properties);case"MultiPoint":return void function(e,t,i,r){let n=[];for(let e of i.coordinates)n.push(gu(e[0]),_u(e[1]),0);e.push(hu(t,"MultiPoint",n,r))}(e,n,t.geometry,t.properties);case"LineString":return void function(e,t,i,r,n){let a={points:[]};fu(i.coordinates,a,r,!1),e.push(hu(t,"LineString",a,n))}(e,n,t.geometry,a,t.properties);case"MultiLineString":return void function(e,t,i,r,n,a){if(n.lineMetrics)for(let n of i.coordinates){let i={points:[]};fu(n,i,r,!1),e.push(hu(t,"LineString",i,a))}else{let n=[];mu(i.coordinates,n,r,!1),e.push(hu(t,"MultiLineString",n,a))}}(e,n,t.geometry,a,i,t.properties);case"Polygon":return void function(e,t,i,r,n){let a=[];mu(i.coordinates,a,r,!0),e.push(hu(t,"Polygon",a,n))}(e,n,t.geometry,a,t.properties);case"MultiPolygon":return void function(e,t,i,r,n){let a=[];for(let e of i.coordinates){let t=[];mu(e,t,r,!0),a.push(t)}e.push(hu(t,"MultiPolygon",a,n))}(e,n,t.geometry,a,t.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function fu(e,t,i,r){let n,a,s=0;for(let i=0;i<e.length;i++){let o=gu(e[i][0]),l=_u(e[i][1]);t.points.push(o,l,0),i>0&&(s+=r?(n*l-o*a)/2:Math.sqrt(Math.pow(o-n,2)+Math.pow(l-a,2))),n=o,a=l}let o=t.points.length-3;t.points[2]=1,i>0&&ou(t.points,0,o,i),t.points[o+2]=1,uu(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function mu(e,t,i,r){for(let n=0;n<e.length;n++){let a={points:[]};fu(e[n],a,i,r),t.push(a)}}function gu(e){return e/360+.5}function _u(e){let t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function yu(e){let t={type:"Feature",geometry:vu(e),properties:e.tags};return null!=e.id&&(t.id=e.id),t}function vu(e){let{type:t,geometry:i}=e;switch(t){case"Point":return{type:t,coordinates:bu(i[0],i[1])};case"MultiPoint":return{type:t,coordinates:xu(i)};case"LineString":return{type:t,coordinates:xu(i.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:i.map(e=>xu(e.points))};case"MultiPolygon":return{type:t,coordinates:i.map(e=>e.map(e=>xu(e.points)))}}}function xu(e){let t=[];for(let i=0;i<e.length;i+=3)t.push(bu(e[i],e[i+1]));return t}function bu(e,t){return[wu(e),Tu(t)]}function wu(e){return 360*(e-.5)}function Tu(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Su;function Iu(e,t,i,r,n,a,s,o){if(r/=t,a>=(i/=t)&&s<r)return e;if(s<i||a>=r)return null;let l=[];for(let t of e){let e=n===Su.X?t.minX:t.minY,a=n===Su.X?t.maxX:t.maxY;if(e>=i&&a<r)l.push(t);else if(!(a<i||e>=r))switch(t.type){case"Point":case"MultiPoint":Pu(t,l,i,r,n);continue;case"LineString":Cu(t,l,i,r,n,o);continue;case"MultiLineString":Eu(t,l,i,r,n);continue;case"Polygon":Mu(t,l,i,r,n);continue;case"MultiPolygon":Au(t,l,i,r,n);continue}}return l.length?l:null}function Pu(e,t,i,r,n){let a=[];(function(e,t,i,r,n){for(let a=0;a<e.length;a+=3){let s=e[a+n];s>=i&&s<=r&&Du(t,e[a],e[a+1],e[a+2])}})(e.geometry,a,i,r,n),a.length&&t.push(hu(e.id,3===a.length?"Point":"MultiPoint",a,e.tags))}function Cu(e,t,i,r,n,a){let s=[];if(ku(e.geometry,s,i,r,n,!1,a.lineMetrics),s.length)if(a.lineMetrics)for(let i of s)t.push(hu(e.id,"LineString",i,e.tags));else t.push(s.length>1?hu(e.id,"MultiLineString",s,e.tags):hu(e.id,"LineString",s[0],e.tags))}function Eu(e,t,i,r,n){let a=[];Fu(e.geometry,a,i,r,n,!1),a.length&&t.push(1!==a.length?hu(e.id,"MultiLineString",a,e.tags):hu(e.id,"LineString",a[0],e.tags))}function Mu(e,t,i,r,n){let a=[];Fu(e.geometry,a,i,r,n,!0),a.length&&t.push(hu(e.id,"Polygon",a,e.tags))}function Au(e,t,i,r,n){let a=[];for(let t of e.geometry){let e=[];Fu(t,e,i,r,n,!0),e.length&&a.push(e)}a.length&&t.push(hu(e.id,"MultiPolygon",a,e.tags))}function ku(e,t,i,r,n,a,s){let o,l,h=Lu(e),u=n===Su.X?Ru:zu,c=e.start;for(let d=0;d<e.points.length-3;d+=3){let p=e.points[d],f=e.points[d+1],m=e.points[d+2],g=e.points[d+3],_=e.points[d+4],y=n===Su.X?p:f,v=n===Su.X?g:_,x=!1;s&&(o=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-_,2))),y<i?v>i&&(l=u(h,p,f,g,_,i),s&&(h.start=c+o*l)):y>r?v<r&&(l=u(h,p,f,g,_,r),s&&(h.start=c+o*l)):Du(h.points,p,f,m),v<i&&y>=i&&(l=u(h,p,f,g,_,i),x=!0),v>r&&y<=r&&(l=u(h,p,f,g,_,r),x=!0),!a&&x&&(s&&(h.end=c+o*l),t.push(h),h=Lu(e)),s&&(c+=o)}let d=e.points.length-3,p=e.points[d],f=e.points[d+1],m=n===Su.X?p:f;m>=i&&m<=r&&Du(h.points,p,f,e.points[d+2]),d=h.points.length-3,a&&d>=3&&(h.points[d]!==h.points[0]||h.points[d+1]!==h.points[1])&&Du(h.points,h.points[0],h.points[1],h.points[2]),h.points.length&&(uu(h),t.push(h))}function Lu(e){return{points:[],size:e.size,start:e.start,end:e.end}}function Fu(e,t,i,r,n,a){for(let s of e)ku(s,t,i,r,n,a,!1)}function Du(e,t,i,r){e.push(t,i,r)}function Ru(e,t,i,r,n,a){let s=(a-t)/(r-t);return Du(e.points,a,i+(n-i)*s,1),s}function zu(e,t,i,r,n,a){let s=(a-i)/(n-i);return Du(e.points,t+(r-t)*s,a,1),s}function Nu(e,t){let i=t.buffer/t.extent,r=e,n=Iu(e,1,-1-i,i,Su.X,-1,2,t),a=Iu(e,1,1-i,2+i,Su.X,-1,2,t);return(n||a)&&(r=Iu(e,1,-i,1+i,Su.X,-1,2,t)||[],n&&(r=Ou(n,1).concat(r)),a&&(r=r.concat(Ou(a,-1)))),r}function Ou(e,t){let i=[];for(let r of e)switch(r.type){case"Point":case"MultiPoint":{let e=Bu(r.geometry,t);i.push(hu(r.id,r.type,e,r.tags));continue}case"LineString":{let e=ju(r.geometry,t);i.push(hu(r.id,r.type,e,r.tags));continue}case"MultiLineString":case"Polygon":{let e=[];for(let i of r.geometry)e.push(ju(i,t));i.push(hu(r.id,r.type,e,r.tags));continue}case"MultiPolygon":{let e=[];for(let i of r.geometry){let r=[];for(let e of i)r.push(ju(e,t));e.push(r)}i.push(hu(r.id,r.type,e,r.tags));continue}}return i}function Bu(e,t){let i=[];for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function ju(e,t){let i={points:[],size:e.size};void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.points.length;r+=3)i.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return uu(i),i}function Vu(e,t,i){let r=!!t.newGeometry,n=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(r){let r=e[0],a=du({type:"FeatureCollection",features:[{type:"Feature",id:r.id,geometry:t.newGeometry,properties:n?Gu(r.tags,t):r.tags}]},i);return a=Nu(a,i),a}if(n){let i=[];for(let r of e){let e={...r};e.tags=Gu(e.tags,t),i.push(e)}return i}return e}function Gu(e,t){if(t.removeAllProperties)return{};let i={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete i[e];if(t.addOrUpdateProperties)for(let{key:e,value:r}of t.addOrUpdateProperties)i[e]=r;return i}!function(e){e[e.X=0]="X",e[e.Y=1]="Y"}(Su||(Su={}));let Uu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class Zu{constructor(e){this.options=Object.assign(Object.create(Uu),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let i of e){if(!i.geometry)continue;let[e,r]=i.geometry.coordinates,[n,a]=[gu(e),_u(r)];t.push({id:i.id,type:"Point",geometry:[n,a],tags:i.properties})}this.createIndex(t)}initialize(e){let t=[];for(let i of e)"Point"===i.type&&t.push(i);this.createIndex(t)}updateIndex(e,t,i){this.options=Object.assign(Object.create(Uu),i.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");let n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;let a=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i?.geometry)continue;let[r,n]=i.geometry;r=Math.fround(r),n=Math.fround(n),a.push(r,n,1/0,t,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[r+1]=this.createTree(a);t&&console.timeEnd(n);for(let e=r;e>=i;e--){let i=Date.now();s=this.trees[e]=this.createTree(this.cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-i)}t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(e=>yu(e))}getClustersInternal(e,t){let i=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){let e=this.getClustersInternal([i,r,180,a],t),s=this.getClustersInternal([-180,r,n,a],t);return e.concat(s)}let s=this.trees[this.limitZoom(t)],o=s.range(gu(i),_u(a),gu(n),_u(r)),l=s.flatData,h=[];for(let e of o){let t=this.stride*e;h.push(l[t+5]>1?$u(l,t,this.clusterProps):this.points[l[t+3]])}return h}getChildren(e){let t=this.getOriginId(e),i=this.getOriginZoom(e),r=new Error("No cluster with the specified id: "+e),n=this.trees[i];if(!n)throw r;let a=n.flatData;if(t*this.stride>=a.length)throw r;let s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),o=n.within(a[t*this.stride],a[t*this.stride+1],s),l=[];for(let t of o){let i=t*this.stride;a[i+4]===e&&l.push(a[i+5]>1?qu(a,i,this.clusterProps):yu(this.points[a[i+3]]))}if(0===l.length)throw r;return l}getLeaves(e,t,i){let r=[];return this.appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){let r=this.trees[this.limitZoom(e)];if(!r)return null;let n=Math.pow(2,e),{extent:a,radius:s}=this.options,o=s/a,l=(i-o)/n,h=(i+1+o)/n,u={transformed:!0,features:[],source:null,x:t,y:i,z:e};return this.addTileFeatures(r.range((t-o)/n,l,(t+1+o)/n,h),r.flatData,t,i,n,u),0===t&&this.addTileFeatures(r.range(1-o/n,l,1,h),r.flatData,n,i,n,u),t===n-1&&this.addTileFeatures(r.range(0,l,o/n,h),r.flatData,-1,i,n,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,i,r,n){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a?.cluster?n+a.point_count<=r?n+=a.point_count:n=this.appendLeaves(e,a.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}createTree(e){let t=new tu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,i,r,n,a){for(let s of e){let e,o,l,h=s*this.stride,u=t[h+5]>1;if(u)e=Wu(t,h,this.clusterProps),o=t[h],l=t[h+1];else{let i=this.points[t[h+3]];e=i.tags,[o,l]=i.geometry}let c,d={type:1,geometry:[[Math.round(this.options.extent*(o*n-i)),Math.round(this.options.extent*(l*n-r))]],tags:e};c=u||this.options.generateId?t[h+3]:this.points[t[h+3]].id,void 0!==c&&(d.id=c),a.features.push(d)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:i,extent:r,reduce:n,minPoints:a}=this.options,s=i/(r*Math.pow(2,t)),o=e.flatData,l=[],h=this.stride;for(let i=0;i<o.length;i+=h){if(o[i+2]<=t)continue;o[i+2]=t;let r=o[i],u=o[i+1],c=e.within(o[i],o[i+1],s),d=o[i+5],p=d;for(let e of c){let i=e*h;o[i+2]>t&&(p+=o[i+5])}if(p>d&&p>=a){let e,a=r*d,s=u*d,f=-1,m=(i/h<<5)+(t+1)+this.points.length;for(let r of c){let l=r*h;if(o[l+2]<=t)continue;o[l+2]=t;let u=o[l+5];a+=o[l]*u,s+=o[l+1]*u,o[l+4]=m,n&&(e||(e=this.map(o,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this.map(o,l)))}o[i+4]=m,l.push(a/p,s/p,1/0,m,-1,p),n&&l.push(f)}else{for(let e=0;e<h;e++)l.push(o[i+e]);if(p>1)for(let e of c){let i=e*h;if(!(o[i+2]<=t)){o[i+2]=t;for(let e=0;e<h;e++)l.push(o[i+e])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,i){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}let r=this.points[e[t+3]].tags,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function $u(e,t,i){return{id:e[t+3],type:"Point",tags:Wu(e,t,i),geometry:[e[t],e[t+1]]}}function qu(e,t,i){return{type:"Feature",id:e[t+3],properties:Wu(e,t,i),geometry:{type:"Point",coordinates:[wu(e[t]),Tu(e[t+1])]}}}function Wu(e,t,i){let r=e[t+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,a=e[t+6],s=-1===a?{}:Object.assign({},i[a]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:n})}let Hu="geojsonvt_clip_start",Xu="geojsonvt_clip_end";function Yu(e,t,i,r,n){let a=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={transformed:!1,features:[],source:null,x:i,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)Ku(s,t,a,n);return s}function Ku(e,t,i,r){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":return void function(e,t){let i=[];for(let r=0;r<t.geometry.length;r+=3)i.push(t.geometry[r],t.geometry[r+1]),e.numPoints++,e.numSimplified++;if(!i.length)return;let r={type:1,tags:t.tags||null,geometry:i};null!==t.id&&(r.id=t.id),e.features.push(r)}(e,t);case"LineString":return void function(e,t,i,r){let n=[];if(Ju(n,t.geometry,e,i,!1,!1),!n.length)return;let a=t.tags||null;if(r.lineMetrics){a={};for(let e in t.tags)a[e]=t.tags[e];a[Hu]=t.geometry.start/t.geometry.size,a[Xu]=t.geometry.end/t.geometry.size}let s={type:2,tags:a,geometry:n};null!==t.id&&(s.id=t.id),e.features.push(s)}(e,t,i,r);case"MultiLineString":case"Polygon":return void function(e,t,i){let r=[];for(let n=0;n<t.geometry.length;n++)Ju(r,t.geometry[n],e,i,"Polygon"===t.type,0===n);if(!r.length)return;let n={type:"Polygon"===t.type?3:2,tags:t.tags||null,geometry:r};null!==t.id&&(n.id=t.id),e.features.push(n)}(e,t,i);case"MultiPolygon":return void function(e,t,i){let r=[];for(let n=0;n<t.geometry.length;n++){let a=t.geometry[n];for(let t=0;t<a.length;t++)Ju(r,a[t],e,i,!0,0===t)}if(!r.length)return;let n={type:3,tags:t.tags||null,geometry:r};null!==t.id&&(n.id=t.id),e.features.push(n)}(e,t,i)}}function Ju(e,t,i,r,n,a){let s=r*r;if(r>0&&t.size<(n?s:r))return void(i.numPoints+=t.points.length/3);let o=[];for(let e=0;e<t.points.length;e+=3)(0===r||t.points[e+2]>s)&&(i.numSimplified++,o.push(t.points[e],t.points[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){let r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(o,a),e.push(o)}function Qu(e,t){if(e.transformed)return e;let i=1<<e.z,r=e.x,n=e.y;for(let a of e.features)1===a.type?ec(a,t,i,r,n):tc(a,t,i,r,n);return e.transformed=!0,e}function ec(e,t,i,r,n){let a=e,s=e.geometry,o=[];for(let e=0;e<s.length;e+=2)o.push(ic(s[e],s[e+1],t,i,r,n));return a.geometry=o,a}function tc(e,t,i,r,n){let a=e,s=e.geometry,o=[];for(let e of s){let a=[];for(let s=0;s<e.length;s+=2)a.push(ic(e[s],e[s+1],t,i,r,n));o.push(a)}return a.geometry=o,a}function ic(e,t,i,r,n,a){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-a))]}class rc{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,i){i.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),i.debug>1&&console.timeEnd("invalidating");let[r,n,a]=[0,0,0],s=Yu(e,r,n,a,i);s.source=e;let o=nc(r,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:r,x:n,y:a,id:o}),i.debug){let e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,i){return null}getTile(e,t,i){let{extent:r,debug:n}=this.options,a=1<<e,s=nc(e,t=t+a&a-1,i);if(this.tiles[s])return Qu(this.tiles[s],r);n>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let o,l=e,h=t,u=i;for(;!o&&l>0;)l--,h>>=1,u>>=1,o=this.tiles[nc(l,h,u)];return o?.source?(n>1&&(console.log("found parent tile z%d-%d-%d",l,h,u),console.time("drilling down")),this.splitTile(o.source,l,h,u,e,t,i),n>1&&console.timeEnd("drilling down"),this.tiles[s]?Qu(this.tiles[s],r):null):null}splitTile(e,t,i,r,n,a,s){let o=[e,t,i,r],l=this.options,h=l.debug;for(;o.length;){r=o.pop(),i=o.pop(),t=o.pop(),e=o.pop();let u=1<<t,c=nc(t,i,r),d=this.tiles[c];if(!d&&(h>1&&console.time("creation"),d=this.tiles[c]=Yu(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r,id:c}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){let e=n-t;if(i!==a>>e||r!==s>>e)continue}}if(d.source=null,!e.length)continue;h>1&&console.time("clipping");let p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p,_=null,y=null,v=null,x=null,b=Iu(e,u,i-p,i+m,Su.X,d.minX,d.maxX,l),w=Iu(e,u,i+f,i+g,Su.X,d.minX,d.maxX,l);b&&(_=Iu(b,u,r-p,r+m,Su.Y,d.minY,d.maxY,l),y=Iu(b,u,r+f,r+g,Su.Y,d.minY,d.maxY,l)),w&&(v=Iu(w,u,r-p,r+m,Su.Y,d.minY,d.maxY,l),x=Iu(w,u,r+f,r+g,Su.Y,d.minY,d.maxY,l)),h>1&&console.timeEnd("clipping"),o.push(_||[],t+1,2*i,2*r),o.push(y||[],t+1,2*i,2*r+1),o.push(v||[],t+1,2*i+1,2*r),o.push(x||[],t+1,2*i+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:i}=t,r=1/0,n=-1/0,a=1/0,s=-1/0;for(let t of e)r=Math.min(r,t.minX),n=Math.max(n,t.maxX),a=Math.min(a,t.minY),s=Math.max(s,t.maxY);let o=t.buffer/t.extent,l=new Set;for(let t in this.tiles){let h=this.tiles[t],u=1<<h.z,c=(h.x-o)/u,d=(h.x+1+o)/u,p=(h.y-o)/u,f=(h.y+1+o)/u;if(n<c||r>=d||s<p||a>=f)continue;let m=!1;for(let t of e)if(t.maxX>=c&&t.minX<d&&t.maxY>=p&&t.minY<f){m=!0;break}if(m){if(i){i>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let e=`z${h.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter(e=>!l.has(e.id)))}}function nc(e,t,i){return 32*((1<<e)*i+t)+e}let ac,sc,oc={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Uu,debug:0},lc=os([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:hc}=lc,uc=os([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cc}=uc,dc=Math.cos(Math.PI/180*37.5),pc=Math.pow(2,14)/.5;class fc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Xs,this.layoutVertexArray2=new Ys,this.indexArray=new no,this.programConfigurations=new Bo(e.layers,e.zoom),this.segments=new lo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=Zl("line",this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),a=[];for(let{feature:t,id:s,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,h=$o(t,e);if(!this.layers[0]._featureFilter.filter(new Ra(this.zoom),h,i))continue;let u=n?r.evaluate(h,{},i):void 0,c={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?h.geometry:Zo(t),patterns:{},dashes:{},sortKey:u};a.push(c)}n&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let r of a){let{geometry:n,index:a,sourceLayerIndex:s}=r;this.hasDependencies?(Zl("line",this.layers,t)?$l("line",this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,n,a,i,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[a].feature,n,a,s,this.index)}}update(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures(e,t,i,r){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,r,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,cc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hc),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.hasOwn(e.properties,Hu)&&Object.hasOwn(e.properties,Xu))return{start:+e.properties[Hu],end:+e.properties[Xu]}}addFeature(e,t,i,r,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),h=o.get("line-cap").evaluate(e,{}),u=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let i of t)this.addLine(i,e,l,h,u,c,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:n,dashPositions:a,canonical:r})}addLine(e,t,i,r,n,a,s,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Ih(e,s?o.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let l="Polygon"===Rh.types[t.type],h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let u=0;for(;u<h-1&&e[u].equals(e[u+1]);)u++;if(h<(l?3:2))return;"bevel"===i&&(n=1.05);let c,d,p,f,m,g=this.overscaling<=16?122880/(512*this.overscaling):0,_=this.segments.prepareSegment(10*h,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,l&&(c=e[h-2],m=e[u].sub(c)._unit()._perp());for(let t=u;t<h;t++){if(p=t===h-1?l?e[u+1]:void 0:e[t+1],p&&e[t].equals(p))continue;m&&(f=m),c&&(d=c),c=e[t],m=p?p.sub(c)._unit()._perp():f,f||(f=m);let s=f.add(m);0===s.x&&0===s.y||s._unit();let o=f.x*m.x+f.y*m.y,y=s.x*m.x+s.y*m.y,v=0!==y?1/y:1/0,x=2*Math.sqrt(2-2*y),b=y<dc&&d&&p,w=f.x*m.y-f.y*m.x>0;if(b&&t>u){let e=c.dist(d);if(e>2*g){let t=c.sub(c.sub(d)._mult(g/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,_),d=t}}let T=d&&p,S=T?i:l?"butt":r;if(T&&"round"===S&&(v<a?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>n&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<n&&(S="miter")),d&&this.updateDistance(d,c),"miter"===S)s._mult(v),this.addCurrentVertex(c,s,0,0,_);else if("flipbevel"===S){if(v>100)s=m.mult(-1);else{let e=v*f.add(m).mag()/f.sub(m).mag();s._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(c,s,0,0,_),this.addCurrentVertex(c,s.mult(-1),0,0,_)}else if("bevel"===S||"fakeround"===S){let e=-Math.sqrt(v*v-1),t=w?e:0,i=w?0:e;if(d&&this.addCurrentVertex(c,f,t,i,_),"fakeround"===S){let e=Math.round(180*x/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){let e=i-.5;i+=i*e*(i-1)*((1.0904+o*(o*(3.55645-1.43519*o)-3.2452))*e*e+(.848013+o*(.215638*o-1.06021)))}let r=m.sub(f)._mult(i)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(c,r.x,r.y,!1,w,0,_)}}p&&this.addCurrentVertex(c,m,-t,-i,_)}else if("butt"===S)this.addCurrentVertex(c,s,0,0,_);else if("square"===S){let e=d?1:-1;this.addCurrentVertex(c,s,e,e,_)}else"round"===S&&(d&&(this.addCurrentVertex(c,f,0,0,_),this.addCurrentVertex(c,f,1,1,_,!0)),p&&(this.addCurrentVertex(c,m,-1,-1,_,!0),this.addCurrentVertex(c,m,0,0,_)));if(b&&t<h-1){let e=c.dist(p);if(e>2*g){let t=c.add(p.sub(c)._mult(g/e)._round());this.updateDistance(c,t),this.addCurrentVertex(t,m,0,0,_),c=t}}}}addCurrentVertex(e,t,i,r,n,a=!1){let s=t.y*r-t.x,o=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,a,!1,i,n),this.addHalfVertex(e,s,o,a,!0,-r,n),this.distance>pc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,a))}addHalfVertex({x:e,y:t},i,r,n,a,s,o){let l=.5*(this.lineClips?this.scaledDistance*(pc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(a?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let h=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,h,this.e2),o.primitiveLength++),a?this.e2=h:this.e1=h}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()}hasLineDasharray(e){for(let t of e){let e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,r){for(let n of e){let e=n.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;let a="round"===n.layout.get("line-cap").evaluate(t,{}),s={dasharray:e.value.evaluate({zoom:i-1},t,{}),round:a},o={dasharray:e.value.evaluate({zoom:i},t,{}),round:a},l={dasharray:e.value.evaluate({zoom:i+1},t,{}),round:a},h=`${s.dasharray.join(",")},${s.round}`,u=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[h]=s,r.dashDependencies[u]=o,r.dashDependencies[c]=l,t.dashes[n.id]={min:h,mid:u,max:c}}}}fa("LineBucket",fc,{omit:["layers","patternFeatures"]});var mc={get paint(){return sc=sc||new Ka({"line-opacity":new Wa(be.paint_line["line-opacity"]),"line-color":new Wa(be.paint_line["line-color"]),"line-translate":new qa(be.paint_line["line-translate"]),"line-translate-anchor":new qa(be.paint_line["line-translate-anchor"]),"line-width":new Wa(be.paint_line["line-width"]),"line-gap-width":new Wa(be.paint_line["line-gap-width"]),"line-offset":new Wa(be.paint_line["line-offset"]),"line-blur":new Wa(be.paint_line["line-blur"]),"line-dasharray":new Ha(be.paint_line["line-dasharray"]),"line-pattern":new Ha(be.paint_line["line-pattern"]),"line-gradient":new Ya(be.paint_line["line-gradient"])})},get layout(){return ac=ac||new Ka({"line-cap":new Wa(be.layout_line["line-cap"]),"line-join":new Wa(be.layout_line["line-join"]),"line-miter-limit":new Wa(be.layout_line["line-miter-limit"]),"line-round-limit":new Wa(be.layout_line["line-round-limit"]),"line-sort-key":new Wa(be.layout_line["line-sort-key"])})}};class gc extends Wa{possiblyEvaluate(e,t){return t=new Ra(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=B({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let _c;class yc extends ts{constructor(e,t){super(e,mc,t),this.gradientVersion=0,_c||(_c=new gc(mc.paint.properties["line-width"].specification),_c.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this.gradientExpression();this.stepInterpolant=!(void 0===e._styleExpression)&&e._styleExpression.expression instanceof hi,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"]=_c.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new fc(e)}queryRadius(e){let t=e,i=vc(ll("line-width",this,t),ll("line-gap-width",this,t)),r=ll("line-offset",this,t);return i/2+Math.abs(r)+hl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:a,pixelsToTileUnits:s}){let o=ul(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,s),l=s/2*vc(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),h=this.paint.get("line-offset").evaluate(t,r);return h&&(n=function(e,t){let r=[];for(let n of e){let e=cl(n),a=[];for(let r=0;r<e.length;r++){let n=e[r],s=e[r-1],o=e[r+1],l=0===r?new i(0,0):n.sub(s)._unit()._perp(),h=r===e.length-1?new i(0,0):o.sub(n)._unit()._perp(),u=l._add(h)._unit(),c=u.x*h.x+u.y*h.y;0!==c&&u._mult(1/c),a.push(u._mult(t)._add(n))}r.push(a)}return r}(n,h*s)),function(e,t,i){for(let r of t){if(e.length>=3)for(let t of r)if(sl(e,t))return!0;if(el(e,r,i))return!0}return!1}(o,n,l)}isTileClipped(){return!0}}function vc(e,t){return t>0?t+2*e:e}let xc=os([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),bc=os([{name:"a_projected_pos",components:3,type:"Float32"}],4);os([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let wc=os([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);os([{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"}]);let Tc=os([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Sc=os([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ic(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Da.applyArabicShaping&&(e=Da.applyArabicShaping(e)),e}function Pc(e,t,i){for(let r of e.sections)r.text=Ic(r.text,t,i);return e}os([{name:"triangle",components:3,type:"Uint16"}]),os([{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"}]),os([{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"}]),os([{type:"Float32",name:"offsetX"}]),os([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),os([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Cc=24;let Ec={"!":"︕","#":"＃",$:"＄","%":"％","&":"＆","(":"︵",")":"︶","*":"＊","+":"＋",",":"︐","-":"︲",".":"・","/":"／",":":"︓",";":"︔","<":"︿","=":"＝",">":"﹀","?":"︖","@":"＠","[":"﹇","\\":"＼","]":"﹈","^":"＾",_:"︳","`":"｀","{":"︷","|":"―","}":"︸","~":"～","¢":"￠","£":"￡","¥":"￥","¦":"￤","¬":"￢","¯":"￣","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"￦","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","！":"︕","（":"︵","）":"︶","，":"︐","－":"︲","．":"・","：":"︓","；":"︔","＜":"︿","＞":"﹀","？":"︖","［":"﹇","］":"﹈","＿":"︳","｛":"︷","｜":"―","｝":"︸","｟":"︵","｠":"︶","｡":"︒","｢":"﹁","｣":"﹂"},Mc={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},Ac={40:!0};function kc(e,t,i,r,n,a){if("fontStack"in t){let r=i[t.fontStack],a=r?.[e];return a?a.metrics.advance*t.scale+n:0}{let e=r[t.imageName];return e?e.displaySize[0]*t.scale*Cc/a+n:0}}function Lc(e,t,i,r){let n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function Fc(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function Dc(e,t,i,r,n,a){let s=null,o=Lc(t,i,n,a);for(let e of r){let r=Lc(t-e.x,i,n,a)+e.badness;r<=o&&(s=e,o=r)}return{index:e,x:t,priorBreak:s,badness:o}}function Rc(e){return e?Rc(e.priorBreak).concat(e.index):[]}class zc{constructor(e="",t=[],i=[]){this.text=e,this.sections=t,this.sectionIndex=i,this.imageSectionID=null}static fromFeature(e,t){let i=new zc;for(let r of e.sections)r.image?i.addImageSection(r):i.addTextSection(r,t);return i}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",i={premature:!0,value:void 0},r=e[Symbol.iterator](),n=r.next(),a=e[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)t+=!s.done&&Ma(s.value.codePointAt(0))&&!Ec[s.value]||!i.premature&&Ma(i.value.codePointAt(0))&&!Ec[i.value]||!Ec[n.value]?n.value:Ec[n.value],i={value:n.value,premature:!1},n=r.next(),s=a.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let e=this.text.match(/^\s*/),t=e?e[0].length:0,i=this.text.match(/\S\s*$/),r=i?i[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){let i=[...this.text].slice(e,t).join(""),r=this.sectionIndex.slice(e,t);return new zc(i,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r<this.length();r++){let n=this.getSection(r);if("imageName"in n){let r=e[n.imageName];if(!r)continue;let a=r.displaySize;t=Math.max(t,a[0]),i=Math.max(i,a[1])}}return{maxImageWidth:t,maxImageHeight:i}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});let i=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>i))}addImageSection(e){let t=e.image?e.image.name:"";if(0===t.length)return void $("Can't add FormattedSection with an empty image.");let i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):$("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,i,r,n){let a=[],s=this.determineAverageLineWidth(e,t,i,r,n),o=this.hasZeroWidthSpaces(),l=0,h=0,u=this.text[Symbol.iterator](),c=u.next(),d=this.text[Symbol.iterator]();d.next();let p=d.next(),f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!c.done;){let t=this.getSection(h),g=c.value.codePointAt(0);if(Ta(g)||(l+=kc(g,t,i,r,e,n)),!p.done){let e=ba(g),i=p.value.codePointAt(0);(Mc[g]||e||"imageName"in t||!m.done&&Ac[i])&&a.push(Dc(h+1,l,s,a,Fc(g,i,e&&o),!1))}h++,c=u.next(),p=d.next(),m=f.next()}return Rc(Dc(this.length(),l,s,a,0,!0))}determineAverageLineWidth(e,t,i,r,n){let a=0,s=0;for(let t of this.text){let o=this.getSection(s);a+=kc(t.codePointAt(0),o,i,r,e,n),s++}return a/Math.max(1,Math.ceil(a/t))}}let Nc=4294967296,Oc=1/Nc,Bc=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class jc{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){let i=this.readVarint(),r=i>>3,n=this.pos;this.type=7&i,e(r,t,this),this.pos===n&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Nc;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Nc;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t,i,r=this.buf;return i=r[this.pos++],t=127&i,i<128?t:(i=r[this.pos++],t|=(127&i)<<7,i<128?t:(i=r[this.pos++],t|=(127&i)<<14,i<128?t:(i=r[this.pos++],t|=(127&i)<<21,i<128?t:(i=r[this.pos],t|=(15&i)<<28,function(e,t,i){let r,n,a=i.buf;if(n=a[i.pos++],r=(112&n)>>4,n<128||(n=a[i.pos++],r|=(127&n)<<3,n<128)||(n=a[i.pos++],r|=(127&n)<<10,n<128)||(n=a[i.pos++],r|=(127&n)<<17,n<128)||(n=a[i.pos++],r|=(127&n)<<24,n<128)||(n=a[i.pos++],r|=(1&n)<<31,n<128))return function(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Bc?Bc.decode(this.buf.subarray(t,e)):function(e,t,i){let r="",n=t;for(;n<i;){let t,a,s,o=e[n],l=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h>i)break;1===h?o<128&&(l=o):2===h?(t=e[n+1],128==(192&t)&&(l=(31&o)<<6|63&t,l<=127&&(l=null))):3===h?(t=e[n+1],a=e[n+2],128==(192&t)&&128==(192&a)&&(l=(15&o)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(t=e[n+1],a=e[n+2],s=e[n+3],128==(192&t)&&128==(192&a)&&128==(192&s)&&(l=(15&o)<<18|(63&t)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=h}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){let t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Oc),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Oc),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(i=~(-e%4294967296),r=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");var n,a;t.realloc(10),n=i,(a=t).buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,a.buf[a.pos]=127&(n>>>=7),function(e,t){let i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,i){for(let r,n,a=0;a<t.length;a++){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!n){r>56319||a+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);let i=this.pos-t;i>=128&&Vc(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;let i=this.pos;e(t,this);let r=this.pos-i;r>=128&&Vc(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Gc,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Uc,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,qc,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Zc,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,$c,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Wc,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Hc,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Xc,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Yc,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Vc(e,t,i){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(let t=i.pos-1;t>=e;t--)i.buf[t+r]=i.buf[t]}function Gc(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function Uc(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function Zc(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function $c(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function qc(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function Wc(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function Hc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Xc(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function Yc(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Kc(e,t,i){1===e&&i.readMessage(Jc,t)}function Jc(e,t,i){if(3===e){let{id:e,bitmap:r,width:n,height:a,left:s,top:o,advance:l}=i.readMessage(Qc,{});t.push({id:e,bitmap:new Pl({width:n+6,height:a+6},r),metrics:{width:n,height:a,left:s,top:o,advance:l}})}}function Qc(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function ed(e){let t=0,i=0;for(let r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort((e,t)=>t.h-e.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 t of e)for(let e=r.length-1;e>=0;e--){let i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,a=Math.max(a,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){let t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}class td{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:a,textFitWidth:s,textFitHeight:o}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=a,this.version=i,this.textFitWidth=s,this.textFitHeight=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class id{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(e,i,n),this.addImages(t,r,n);let{w:a,h:s}=ed(n),o=new Cl({width:a||1,height:s||1});for(let t in e){let r=e[t],n=i[t].paddedRect;Cl.copy(r.data,o,{x:0,y:0},{x:n.x+1,y:n.y+1},r.data)}for(let e in t){let i=t[e],n=r[e].paddedRect,a=n.x+1,s=n.y+1,l=i.data.width,h=i.data.height;Cl.copy(i.data,o,{x:0,y:0},{x:a,y:s},i.data),Cl.copy(i.data,o,{x:0,y:h-1},{x:a,y:s-1},{width:l,height:1}),Cl.copy(i.data,o,{x:0,y:0},{x:a,y:s+h},{width:l,height:1}),Cl.copy(i.data,o,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:h}),Cl.copy(i.data,o,{x:0,y:0},{x:a+l,y:s},{width:1,height:h})}this.image=o,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,h:n.data.height+2};i.push(a),t[r]=new td(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})}}var rd;function nd(t,i,r,n,a,s,o,l,h,u,c,d,p,f,m){let g,_=zc.fromFeature(t,a);d===e.ax.vertical&&_.verticalizePunctuation();let y=_.determineLineBreaks(u,s,i,n,f),{processBidirectionalText:v,processStyledBidirectionalText:x}=Da;if(v&&1===_.sections.length){g=[],y=y.map(e=>_.toCodeUnitIndex(e));let e=v(_.toString(),y);for(let t of e){let e=[...t].map(()=>0);g.push(new zc(t,_.sections,e))}}else if(x){g=[],y=y.map(e=>_.toCodeUnitIndex(e));let e=0,t=[];for(let i of _.text)t.push(...Array(i.length).fill(_.sectionIndex[e])),e++;let i=x(_.text,t,y);for(let e of i){let t=[],i="";for(let r of e[0])t.push(e[1][i.length]),i+=r;g.push(new zc(e[0],_.sections,t))}}else g=function(e,t){let i=[],r=0;for(let n of t)i.push(e.substring(r,n)),r=n;return r<e.length()&&i.push(e.substring(r,e.length())),i}(_,y);let b=[],w={positionedLines:b,text:_.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,t,i,r,n,a,s,o,l,h,u,c){let d=0,p=0,f=0,m=0,g="right"===o?1:"left"===o?0:.5,_=Cc/c,y=0;for(let s of n){s.trim();let n=s.getMaxScale(),o={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=o;let c=o.positionedGlyphs,v=0;if(!s.length()){p+=a,++y;continue}let x=sd(r,s,_),b=0;for(let a of s.text){let o,f=s.getSection(b),m=a.codePointAt(0),g=ld(l,u,m),y={glyph:m,imageName:null,x:d,y:p+-17,vertical:g,scale:1,fontStack:"",sectionIndex:s.getSectionIndex(b),metrics:null,rect:null};if("fontStack"in f){if(o=hd(f,m,g,x,t,i),!o)continue;y.fontStack=f.fontStack}else{if(e.iconsInText=!0,f.scale*=_,o=ud(f,g,n,x,r),!o)continue;v=Math.max(v,o.imageOffset),y.imageName=f.imageName}let{rect:w,metrics:T,baselineOffset:S}=o;y.y+=S,y.scale=f.scale,y.metrics=T,y.rect=w,c.push(y),g?(e.verticalizable=!0,d+=("imageName"in f?T.advance:Cc)*f.scale+h):d+=T.advance*f.scale+h,b++}0!==c.length&&(f=Math.max(d-h,f),cd(c,0,c.length-1,g)),d=0,o.lineOffset=Math.max(v,(n-1)*Cc);let w=a*n+v;p+=w,m=Math.max(w,m),++y}let{horizontalAlign:v,verticalAlign:x}=ad(s);(function(e,t,i,r,n,a,s,o,l){let h=(t-i)*n,u=0;u=a!==s?-o*r- -17:-r*l*s+.5*s;for(let t of e)for(let e of t.positionedGlyphs)e.x+=h,e.y+=u})(e.positionedLines,g,v,x,f,m,a,p,n.length),e.top+=-x*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(w,i,r,n,g,o,l,h,d,u,p,m),!function(e){for(let t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(b)&&w}function ad(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}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function sd(e,t,i){let r=t.getMaxScale()*Cc,{maxImageWidth:n,maxImageHeight:a}=t.getMaxImageSize(e),s=Math.max(r,a*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:s}}function od(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function ld(t,i,r){return!(t===e.ax.horizontal||!i&&!wa(r)||i&&(Ta(r)||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function hd(e,t,i,r,n,a){let s,o=a[e.fontStack],l=function(e,t,i,r){if(e?.rect)return e;let n=t[i.fontStack],a=n?.[r];return a?{rect:null,metrics:a.metrics}:null}(o?.[t],n,e,t);if(null===l)return null;if(i)s=r.verticalLineContentWidth-e.scale*Cc;else{let t=od(e.verticalAlign);s=(r.horizontalLineContentHeight-e.scale*Cc)*t}return{rect:l.rect,metrics:l.metrics,baselineOffset:s}}function ud(e,t,i,r,n){let a=n[e.imageName];if(!a)return null;let s,o=a.paddedRect,l=a.displaySize,h={width:l[0],height:l[1],left:1,top:-3,advance:t?l[1]:l[0]};if(t)s=r.verticalLineContentWidth-l[1]*e.scale;else{let t=od(e.verticalAlign);s=(r.horizontalLineContentHeight-l[1]*e.scale)*t}return{rect:o,metrics:h,baselineOffset:s,imageOffset:(t?l[0]:l[1])*e.scale-Cc*i}}function cd(e,t,i,r){if(0===r)return;let n=e[i],a=(e[i].x+n.metrics.advance*n.scale)*r;for(let r=t;r<=i;r++)e[r].x-=a}function dd(e,t,i){let{horizontalAlign:r,verticalAlign:n}=ad(i),a=t[0]-e.displaySize[0]*r,s=t[1]-e.displaySize[1]*n;return{image:e,top:s,bottom:s+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function pd(e){var t,i;let r=e.left,n=e.top,a=e.right-r,s=e.bottom-n,o=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(i=e.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",h=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===o&&a/s<h||"proportional"===o){let e=Math.ceil(s*h);r*=e/a,a=e}}else if("proportional"===o&&"stretchOnly"===l&&0!==h&&a/s>h){let e=Math.ceil(a/h);n*=e/s,s=e}return{x1:r,y1:n,x2:r+a,y2:n+s}}function fd(e,t,i,r,n,a){let s,o=e.image;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let l,h,u,c,d=t.left*a,p=t.right*a;"width"===i||"both"===i?(c=n[0]+d-r[3],h=n[0]+p+r[1]):(c=n[0]+(d+p-o.displaySize[0])/2,h=c+o.displaySize[0]);let f=t.top*a,m=t.bottom*a;return"height"===i||"both"===i?(l=n[1]+f-r[0],u=n[1]+m+r[2]):(l=n[1]+(f+m-o.displaySize[1])/2,u=l+o.displaySize[1]),{image:o,top:l,right:h,bottom:u,left:c,collisionPadding:s}}fa("ImagePosition",td),fa("ImageAtlas",id),e.ax=void 0,(rd=e.ax||(e.ax={}))[rd.none=0]="none",rd[rd.horizontal=1]="horizontal",rd[rd.vertical=2]="vertical",rd[rd.horizontalOnly=3]="horizontalOnly";let md=128,gd=32640;function _d(e,t){let{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Ra(e+1))};if("source"===i.kind)return{kind:"source"};{let{zoomStops:t,interpolationType:r}=i,n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let a=n;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let s=t[n],o=t[a];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:o,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:o,minSize:i.evaluate(new Ra(s)),maxSize:i.evaluate(new Ra(o)),interpolationType:r}}}function yd(e,t,i){let r="never",n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}let vd,xd,bd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function wd(e,t,i,r,n,a,s,o,l,h,u,c,d){let p=o?Math.min(gd,Math.round(o[0])):0,f=o?Math.min(gd,Math.round(o[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),a,s,(p<<1)+(l?1:0),f,16*h,16*u,256*c,256*d)}function Td(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 Sd(e){for(let t of e.sections)if(Fa(t.text))return!0;return!1}class Id{constructor(e){this.layoutVertexArray=new Qs,this.indexArray=new no,this.programConfigurations=e,this.segments=new lo,this.dynamicLayoutVertexArray=new eo,this.opacityVertexArray=new to,this.hasVisibleVertices=!1,this.placedSymbolArray=new zs}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,bc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,bd,!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())}}fa("SymbolBuffers",Id);class Pd{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new lo,this.collisionVertexArray=new ro}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,wc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}fa("CollisionBuffers",Pd);class Cd{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=_d(this.zoom,i["text-size"]),this.iconSizeData=_d(this.zoom,i["icon-size"]);let r=this.layers[0].layout,n=r.get("symbol-sort-key"),a=r.get("symbol-z-order");this.canOverlap="never"!==yd(r,"text-overlap","text-allow-overlap")||"never"!==yd(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(t=>e.ax[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new Id(new Bo(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new Id(new Bo(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new Bs,this.lineVertexArray=new js,this.symbolInstances=new Os,this.textAnchorOffsets=new Gs}calculateGlyphDependencies(e,t,i,r,n){for(let a of e)if(t[a.codePointAt(0)]=!0,(i||r)&&n){let e=Ec[a];e&&(t[e.codePointAt(0)]=!0)}}populate(t,i,r){var n;let a=this.layers[0],s=a.layout,o=s.get("text-font"),l=s.get("text-field"),h=s.get("icon-image"),u=("constant"!==l.value.kind||l.value.value instanceof Ft&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,d=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let p=i.iconDependencies,f=i.glyphDependencies,m=i.availableImages,g=new Ra(this.zoom);for(let{feature:i,id:l,index:h,sourceLayerIndex:_}of t){let t,y,v=a._featureFilter.needGeometry,x=$o(i,v);if(!a._featureFilter.filter(g,x,r))continue;if(v||(x.geometry=Zo(i)),u){let e=a.getValueAndResolveTokens("text-field",x,r,m),i=Ft.factory(e);this.hasRTLText||(this.hasRTLText=Sd(i)),(!this.hasRTLText||"unavailable"===Da.getRTLTextPluginStatus()||this.hasRTLText&&Da.isParsed())&&(t=Pc(i,a,x))}if(c){let e=a.getValueAndResolveTokens("icon-image",x,r,m);y=e instanceof jt?e:jt.fromString(e)}if(!t&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(x,{},r):void 0;if(this.features.push({id:l,text:t,icon:y,index:h,sourceLayerIndex:_,geometry:x.geometry,properties:i.properties,type:Rh.types[i.type],sortKey:b}),y&&(p[y.name]=!0),t){let i=o.evaluate(x,{},r).join(","),a="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=null===(n=this.writingModes)||void 0===n?void 0:n.includes(e.ax.vertical);for(let e of t.sections)if(e.image)p[e.image.name]=!0;else{let r=Sa(t.toString()),n=e.fontStack||i;f[n]||(f[n]={}),this.calculateGlyphDependencies(e.text,f[n],a,this.allowVerticalPlacement,r)}}}"line"===s.get("symbol-placement")&&(this.features=function(e){let t={},i={},r=[],n=0;function a(t){r.push(e[t]),n++}function s(e,t,n){let a=i[e];return delete i[e],i[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(n[0]),a}function o(e,i,n){let a=t[i];return delete t[i],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=n[0].concat(r[a].geometry[0]),a}function l(e,t,i){let r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let h=0;h<e.length;h++){let u=e[h],c=u.geometry,d=u.text?u.text.toString():null;if(!d){a(h);continue}let p=l(d,c),f=l(d,c,!0);if(p in i&&f in t&&i[p]!==t[f]){let e=o(p,f,c),n=s(p,f,r[e].geometry);delete t[p],delete i[f],i[l(d,r[n].geometry,!0)]=n,r[e].geometry=null}else p in i?s(p,f,c):f in t?o(p,f,c):(a(h),t[p]=n-1,i[f]=n-1)}return r.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}))}isEmpty(){return 0===this.symbolInstances.length&&!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(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),n={};for(let r=e.segment+1;r<t.length;r++)n[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r<t.length-1&&(i+=t[r+1].dist(t[r]));for(let i=e.segment||0;i>=0;i--)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e<t.length;e++){let t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,i,r,n,a,s,o,l,h,u,c,d){let p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*i.length,f,p,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&o===e.ax.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let e=0;e<i.length;e++){let{tl:n,tr:a,bl:o,br:h,tex:u,pixelOffsetTL:c,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:T}=i[e],S=m.vertexLength,I=b[1];wd(f,l.x,l.y,n.x,I+n.y,u.x,u.y,r,w,c.x,c.y,_,x),wd(f,l.x,l.y,a.x,I+a.y,u.x+u.w,u.y,r,w,g.x,c.y,_,x),wd(f,l.x,l.y,o.x,I+o.y,u.x,u.y+u.h,r,w,c.x,g.y,_,x),wd(f,l.x,l.y,h.x,I+h.y,u.x+u.w,u.y+u.h,r,w,g.x,g.y,_,x),Td(t.dynamicLayoutVertexArray,l,y),p.emplaceBack(S,S+2,S+1),p.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),e!==i.length-1&&T===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,s,s.index,{imagePositions:{},canonical:d,formattedSection:v?.[T]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,h,u,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],o,0,!1,0,c)}_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,r,n,a,s,o){let l=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),h=l.vertexLength,u=a.layoutVertexArray,c=a.collisionVertexArray,d=o.anchorX,p=o.anchorY;this._addCollisionDebugVertex(u,c,s,d,p,new i(e,t)),this._addCollisionDebugVertex(u,c,s,d,p,new i(r,t)),this._addCollisionDebugVertex(u,c,s,d,p,new i(r,n)),this._addCollisionDebugVertex(u,c,s,d,p,new i(e,n)),l.vertexLength+=4;let f=a.indexArray;f.emplaceBack(h,h+1),f.emplaceBack(h+1,h+2),f.emplaceBack(h+2,h+3),f.emplaceBack(h+3,h),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){let e=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Pd(io,Tc.members,ao),this.iconCollisionBox=new Pd(io,Tc.members,ao);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,s,o,l){let h={};for(let r=t;r<i;r++){let t=e.get(r);h.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},h.textFeatureIndex=t.featureIndex;break}for(let t=r;t<n;t++){let i=e.get(t);h.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalTextFeatureIndex=i.featureIndex;break}for(let t=a;t<s;t++){let i=e.get(t);h.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.iconFeatureIndex=i.featureIndex;break}for(let t=o;t<l;t++){let i=e.get(t);h.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},h.verticalIconFeatureIndex=i.featureIndex;break}return h}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+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let s=this.symbolInstances.get(e);r.push(0|Math.round(t*s.anchorX+i*s.anchorY)),n.push(s.featureIndex)}return a.sort((e,t)=>r[e]-r[t]||n[t]-n[e]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];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 e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let i=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<i.length;e++){let t=i[e];t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}fa("SymbolBucket",Cd,{omit:["layers","collisionBoxArray","features","compareText"]}),Cd.MAX_GLYPHS=65535,Cd.addDynamicAttributes=Td;var Ed={get paint(){return xd=xd||new Ka({"icon-opacity":new Wa(be.paint_symbol["icon-opacity"]),"icon-color":new Wa(be.paint_symbol["icon-color"]),"icon-halo-color":new Wa(be.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wa(be.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wa(be.paint_symbol["icon-halo-blur"]),"icon-translate":new qa(be.paint_symbol["icon-translate"]),"icon-translate-anchor":new qa(be.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wa(be.paint_symbol["text-opacity"]),"text-color":new Wa(be.paint_symbol["text-color"],{runtimeType:Ve,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Wa(be.paint_symbol["text-halo-color"]),"text-halo-width":new Wa(be.paint_symbol["text-halo-width"]),"text-halo-blur":new Wa(be.paint_symbol["text-halo-blur"]),"text-translate":new qa(be.paint_symbol["text-translate"]),"text-translate-anchor":new qa(be.paint_symbol["text-translate-anchor"])})},get layout(){return vd=vd||new Ka({"symbol-placement":new qa(be.layout_symbol["symbol-placement"]),"symbol-spacing":new qa(be.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qa(be.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wa(be.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qa(be.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qa(be.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qa(be.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qa(be.layout_symbol["icon-ignore-placement"]),"icon-optional":new qa(be.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qa(be.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wa(be.layout_symbol["icon-size"]),"icon-text-fit":new qa(be.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qa(be.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wa(be.layout_symbol["icon-image"]),"icon-rotate":new Wa(be.layout_symbol["icon-rotate"]),"icon-padding":new Wa(be.layout_symbol["icon-padding"]),"icon-keep-upright":new qa(be.layout_symbol["icon-keep-upright"]),"icon-offset":new Wa(be.layout_symbol["icon-offset"]),"icon-anchor":new Wa(be.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qa(be.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qa(be.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qa(be.layout_symbol["text-rotation-alignment"]),"text-field":new Wa(be.layout_symbol["text-field"]),"text-font":new Wa(be.layout_symbol["text-font"]),"text-size":new Wa(be.layout_symbol["text-size"]),"text-max-width":new Wa(be.layout_symbol["text-max-width"]),"text-line-height":new qa(be.layout_symbol["text-line-height"]),"text-letter-spacing":new Wa(be.layout_symbol["text-letter-spacing"]),"text-justify":new Wa(be.layout_symbol["text-justify"]),"text-radial-offset":new Wa(be.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qa(be.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Wa(be.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Wa(be.layout_symbol["text-anchor"]),"text-max-angle":new qa(be.layout_symbol["text-max-angle"]),"text-writing-mode":new qa(be.layout_symbol["text-writing-mode"]),"text-rotate":new Wa(be.layout_symbol["text-rotate"]),"text-padding":new qa(be.layout_symbol["text-padding"]),"text-keep-upright":new qa(be.layout_symbol["text-keep-upright"]),"text-transform":new Wa(be.layout_symbol["text-transform"]),"text-offset":new Wa(be.layout_symbol["text-offset"]),"text-allow-overlap":new qa(be.layout_symbol["text-allow-overlap"]),"text-overlap":new qa(be.layout_symbol["text-overlap"]),"text-ignore-placement":new qa(be.layout_symbol["text-ignore-placement"]),"text-optional":new qa(be.layout_symbol["text-optional"])})}};class Md{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Ne,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(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){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}fa("FormatSectionOverride",Md,{omit:["defaultValue"]});class Ad extends ts{constructor(e,t){super(e,Ed,t)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let i of e)t.includes(i)||t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){let n=this.layout.get(e).evaluate(t,{},i,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||nn(a.value)||!n?n:(s=t.properties,n.replace(/{([^{}]+)}/g,(e,t)=>s&&t in s?String(s[t]):""));var s}createBucket(e){return new Cd(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ed.paint.overridableProperties){if(!Ad.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new Md(t),r=new rn(i,t.property.specification),n=null;n="constant"===t.value.kind||"source"===t.value.kind?new sn("source",r):new on("composite",r,t.value.zoomStops),this.paint._values[e]=new Za(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&Ad.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),r=Ed.paint.properties[t],n=!1,a=e=>{var t;for(let i of e)if(null!==(t=r.overrides)&&void 0!==t&&t.hasOverride(i))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof Ft)a(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){let e=t=>{n||(t instanceof qt&&Zt(t.value)===qe?a(t.value.sections):t instanceof Ai?a(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let kd;var Ld={get paint(){return kd=kd||new Ka({"background-color":new qa(be.paint_background["background-color"]),"background-pattern":new Xa(be.paint_background["background-pattern"]),"background-opacity":new qa(be.paint_background["background-opacity"])})}};class Fd extends ts{constructor(e,t){super(e,Ld,t)}}class Dd extends ts{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Rd{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,null===(e=this._channel)||void 0===e||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let zd={once:!0},Nd=6371008.8;class Od{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Od(O(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Nd*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Od)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Od(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Od(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>]")}}let Bd=2*Math.PI*Nd;function jd(e){return Bd*Math.cos(e*Math.PI/180)}function Vd(e){return(180+e)/360}function Gd(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ud(e,t){return e/jd(t)}function Zd(e){return 360*e-180}function $d(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function qd(e,t){return e*jd($d(t))}class Wd{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=Od.convert(e);return new Wd(Vd(i.lng),Gd(i.lat),Ud(t,i.lat))}toLngLat(){return new Od(Zd(this.x),$d(this.y))}toAltitude(){return qd(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bd*(e=$d(this.y),1/Math.cos(e*Math.PI/180));var e}}function Hd(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Xd{constructor(e,t,i){if(n=t,a=i,(r=e)<0||r>25||a<0||a>=Math.pow(2,r)||n<0||n>=Math.pow(2,r))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);var r,n,a;this.z=e,this.x=t,this.y=i,this.key=Jd(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=(a=this.y,s=this.z,o=Hd(256*(n=this.x),256*(a=Math.pow(2,s)-a-1),s),l=Hd(256*(n+1),256*(a+1),s),o[0]+","+o[1]+","+l[0]+","+l[1]);var n,a,s,o,l;let h=function(e,t,i){let r="";for(let n=e;n>0;n--){let e=1<<n-1;r+=(t&e?1:0)+(i&e?2:0)}return r}(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("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,h).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 i((e.x*t-this.x)*M,(e.y*t-this.y)*M)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Yd{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Jd(e,t.z,t.z,t.x,t.y)}}class Kd{constructor(e,t,i,r,n){if(this.terrainRttPosMatrix32f=null,e<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Xd(i,+r,+n),this.key=Jd(t,e,i,r,n)}clone(){return new Kd(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 t=this.canonical.z-e;return e>this.canonical.z?new Kd(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Kd(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Jd(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Kd(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Kd(t,this.wrap,t,i,r),new Kd(t,this.wrap,t,i+1,r),new Kd(t,this.wrap,t,i,r+1),new Kd(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Kd(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Kd(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 Yd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Wd(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,i=8192){if(e>=0&&e<i&&t>=0&&t<i)return{tileID:this,x:e,y:t};let r=Math.floor(e/i),n=Math.floor(t/i),a=e-r*i,s=t-n*i,o=this.canonical.z,l=1<<o,h=this.canonical.y+n;if(h<0||h>=l)return null;let u=this.canonical.x+r,c=this.wrap;return u<0?(c-=Math.ceil(-u/l),u=(u%l+l)%l):u>=l&&(c+=Math.floor(u/l),u%=l),{tileID:new Kd(this.overscaledZ,c,o,u,h),x:a,y:s}}}function Jd(e,t,i,r,n){(e*=2)<0&&(e=-1*e-1);let a=1<<i;return(a*a*e+a*n+r).toString(36)+i.toString(36)+t.toString(36)}fa("CanonicalTileID",Xd),fa("OverscaledTileID",Kd,{omit:["terrainRttPosMatrix32f"]});class Qd{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 t=new Qd;return t.extend(e(new i(this.minX,this.minY))),t.extend(e(new i(this.maxX,this.minY))),t.extend(e(new i(this.minX,this.maxY))),t.extend(e(new i(this.maxX,this.maxY))),t}static fromPoints(e){let t=new Qd;for(let i of e)t.extend(i);return t}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}}class ep{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]}}class tp{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=r,this._z=t,this.properties=e.properties,this.id=n}projectPoint(e,t,i,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+i)/r)*Math.PI))-90]}projectLine(e,t,i,r){return e.map(e=>this.projectPoint(e,t,i,r))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*Math.pow(2,this._z),i=e.extent*this._x,r=e.extent*this._y,n=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of n)e.push(t[0]);let a=this.projectLine(e,i,r,t);this._geometry=1===e.length?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a};break}case 2:{let e=n.map(e=>this.projectLine(e,i,r,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{let e=Nh(n),a=[];for(let n of e)a.push(n.map(e=>this.projectLine(e,i,r,t)));this._geometry=1===a.length?{type:"Polygon",coordinates:a[0]}:{type:"MultiPolygon",coordinates:a};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}}class ip{constructor(e,t,i){this._name=e,this.dataBuffer=t,"number"==typeof i?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class rp extends ip{}class np extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class ap extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class sp extends ip{constructor(e,t,i,r){super(e,t,r),this.delta=i}}class op extends sp{constructor(e,t,i,r){super(e,Int32Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class lp extends ip{constructor(e,t,i,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}class hp{constructor(e,t,i,r,n=4096){this._name=e,this._geometryVector=t,this._idVector=i,this._propertyVectors=r,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let e=this.idVector.getValue(i);r=this.containsMaxSafeIntegerValues(this.idVector)&&null!==e?Number(e):e}let n={coordinates:t[i],type:this.geometryVector.geometryType(i)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,r=e.getValue(i);null!==r&&(a[t]=r)}e.push({id:r,geometry:n,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof np||e instanceof lp||e instanceof op||e instanceof ap}}class up{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var cp,dp;(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"})(cp||(cp={})),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(dp||(dp={}));let pp=new Uint32Array(33);pp[0]=0;for(let e=1;e<=32;e++)pp[e]=32===e?4294967295:4294967295>>>32-e;let fp=pp,mp=256;function gp(e,t){return e-e%t}function _p(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}let yp=function(){if(!Number.isFinite(65536))return 65536;let e=gp(Math.floor(65536),mp);return 0===e?mp:e}(),vp=3*yp/mp+yp|0;function xp(){let e=new Uint8Array(vp);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function bp(e,t,i,r,n){switch(n){case 1:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;i[n++]=t>>>0&1,i[n++]=t>>>1&1,i[n++]=t>>>2&1,i[n++]=t>>>3&1,i[n++]=t>>>4&1,i[n++]=t>>>5&1,i[n++]=t>>>6&1,i[n++]=t>>>7&1,i[n++]=t>>>8&1,i[n++]=t>>>9&1,i[n++]=t>>>10&1,i[n++]=t>>>11&1,i[n++]=t>>>12&1,i[n++]=t>>>13&1,i[n++]=t>>>14&1,i[n++]=t>>>15&1,i[n++]=t>>>16&1,i[n++]=t>>>17&1,i[n++]=t>>>18&1,i[n++]=t>>>19&1,i[n++]=t>>>20&1,i[n++]=t>>>21&1,i[n++]=t>>>22&1,i[n++]=t>>>23&1,i[n++]=t>>>24&1,i[n++]=t>>>25&1,i[n++]=t>>>26&1,i[n++]=t>>>27&1,i[n++]=t>>>28&1,i[n++]=t>>>29&1,i[n++]=t>>>30&1,i[n++]=t>>>31&1}}(e,t,i,r);break;case 2:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0;i[n++]=t>>>0&3,i[n++]=t>>>2&3,i[n++]=t>>>4&3,i[n++]=t>>>6&3,i[n++]=t>>>8&3,i[n++]=t>>>10&3,i[n++]=t>>>12&3,i[n++]=t>>>14&3,i[n++]=t>>>16&3,i[n++]=t>>>18&3,i[n++]=t>>>20&3,i[n++]=t>>>22&3,i[n++]=t>>>24&3,i[n++]=t>>>26&3,i[n++]=t>>>28&3,i[n++]=t>>>30&3,i[n++]=r>>>0&3,i[n++]=r>>>2&3,i[n++]=r>>>4&3,i[n++]=r>>>6&3,i[n++]=r>>>8&3,i[n++]=r>>>10&3,i[n++]=r>>>12&3,i[n++]=r>>>14&3,i[n++]=r>>>16&3,i[n++]=r>>>18&3,i[n++]=r>>>20&3,i[n++]=r>>>22&3,i[n++]=r>>>24&3,i[n++]=r>>>26&3,i[n++]=r>>>28&3,i[n++]=r>>>30&3}}(e,t,i,r);break;case 3:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0;i[n++]=t>>>0&7,i[n++]=t>>>3&7,i[n++]=t>>>6&7,i[n++]=t>>>9&7,i[n++]=t>>>12&7,i[n++]=t>>>15&7,i[n++]=t>>>18&7,i[n++]=t>>>21&7,i[n++]=t>>>24&7,i[n++]=t>>>27&7,i[n++]=7&(t>>>30|(1&r)<<2),i[n++]=r>>>1&7,i[n++]=r>>>4&7,i[n++]=r>>>7&7,i[n++]=r>>>10&7,i[n++]=r>>>13&7,i[n++]=r>>>16&7,i[n++]=r>>>19&7,i[n++]=r>>>22&7,i[n++]=r>>>25&7,i[n++]=r>>>28&7,i[n++]=7&(r>>>31|(3&s)<<1),i[n++]=s>>>2&7,i[n++]=s>>>5&7,i[n++]=s>>>8&7,i[n++]=s>>>11&7,i[n++]=s>>>14&7,i[n++]=s>>>17&7,i[n++]=s>>>20&7,i[n++]=s>>>23&7,i[n++]=s>>>26&7,i[n++]=s>>>29&7}}(e,t,i,r);break;case 4:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0;i[n++]=t>>>0&15,i[n++]=t>>>4&15,i[n++]=t>>>8&15,i[n++]=t>>>12&15,i[n++]=t>>>16&15,i[n++]=t>>>20&15,i[n++]=t>>>24&15,i[n++]=t>>>28&15,i[n++]=r>>>0&15,i[n++]=r>>>4&15,i[n++]=r>>>8&15,i[n++]=r>>>12&15,i[n++]=r>>>16&15,i[n++]=r>>>20&15,i[n++]=r>>>24&15,i[n++]=r>>>28&15,i[n++]=s>>>0&15,i[n++]=s>>>4&15,i[n++]=s>>>8&15,i[n++]=s>>>12&15,i[n++]=s>>>16&15,i[n++]=s>>>20&15,i[n++]=s>>>24&15,i[n++]=s>>>28&15,i[n++]=o>>>0&15,i[n++]=o>>>4&15,i[n++]=o>>>8&15,i[n++]=o>>>12&15,i[n++]=o>>>16&15,i[n++]=o>>>20&15,i[n++]=o>>>24&15,i[n++]=o>>>28&15}}(e,t,i,r);break;case 5:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0;i[n++]=t>>>0&31,i[n++]=t>>>5&31,i[n++]=t>>>10&31,i[n++]=t>>>15&31,i[n++]=t>>>20&31,i[n++]=t>>>25&31,i[n++]=31&(t>>>30|(7&r)<<2),i[n++]=r>>>3&31,i[n++]=r>>>8&31,i[n++]=r>>>13&31,i[n++]=r>>>18&31,i[n++]=r>>>23&31,i[n++]=31&(r>>>28|(1&s)<<4),i[n++]=s>>>1&31,i[n++]=s>>>6&31,i[n++]=s>>>11&31,i[n++]=s>>>16&31,i[n++]=s>>>21&31,i[n++]=s>>>26&31,i[n++]=31&(s>>>31|(15&o)<<1),i[n++]=o>>>4&31,i[n++]=o>>>9&31,i[n++]=o>>>14&31,i[n++]=o>>>19&31,i[n++]=o>>>24&31,i[n++]=31&(o>>>29|(3&l)<<3),i[n++]=l>>>2&31,i[n++]=l>>>7&31,i[n++]=l>>>12&31,i[n++]=l>>>17&31,i[n++]=l>>>22&31,i[n++]=l>>>27&31}}(e,t,i,r);break;case 6:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,h=e[a++]>>>0;i[n++]=t>>>0&63,i[n++]=t>>>6&63,i[n++]=t>>>12&63,i[n++]=t>>>18&63,i[n++]=t>>>24&63,i[n++]=63&(t>>>30|(15&r)<<2),i[n++]=r>>>4&63,i[n++]=r>>>10&63,i[n++]=r>>>16&63,i[n++]=r>>>22&63,i[n++]=63&(r>>>28|(3&s)<<4),i[n++]=s>>>2&63,i[n++]=s>>>8&63,i[n++]=s>>>14&63,i[n++]=s>>>20&63,i[n++]=s>>>26&63,i[n++]=o>>>0&63,i[n++]=o>>>6&63,i[n++]=o>>>12&63,i[n++]=o>>>18&63,i[n++]=o>>>24&63,i[n++]=63&(o>>>30|(15&l)<<2),i[n++]=l>>>4&63,i[n++]=l>>>10&63,i[n++]=l>>>16&63,i[n++]=l>>>22&63,i[n++]=63&(l>>>28|(3&h)<<4),i[n++]=h>>>2&63,i[n++]=h>>>8&63,i[n++]=h>>>14&63,i[n++]=h>>>20&63,i[n++]=h>>>26&63}}(e,t,i,r);break;case 7:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,h=e[a++]>>>0,u=e[a++]>>>0;i[n++]=t>>>0&127,i[n++]=t>>>7&127,i[n++]=t>>>14&127,i[n++]=t>>>21&127,i[n++]=127&(t>>>28|(7&r)<<4),i[n++]=r>>>3&127,i[n++]=r>>>10&127,i[n++]=r>>>17&127,i[n++]=r>>>24&127,i[n++]=127&(r>>>31|(63&s)<<1),i[n++]=s>>>6&127,i[n++]=s>>>13&127,i[n++]=s>>>20&127,i[n++]=127&(s>>>27|(3&o)<<5),i[n++]=o>>>2&127,i[n++]=o>>>9&127,i[n++]=o>>>16&127,i[n++]=o>>>23&127,i[n++]=127&(o>>>30|(31&l)<<2),i[n++]=l>>>5&127,i[n++]=l>>>12&127,i[n++]=l>>>19&127,i[n++]=127&(l>>>26|(1&h)<<6),i[n++]=h>>>1&127,i[n++]=h>>>8&127,i[n++]=h>>>15&127,i[n++]=h>>>22&127,i[n++]=127&(h>>>29|(15&u)<<3),i[n++]=u>>>4&127,i[n++]=u>>>11&127,i[n++]=u>>>18&127,i[n++]=u>>>25&127}}(e,t,i,r);break;case 8:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,h=e[a++]>>>0,u=e[a++]>>>0,c=e[a++]>>>0;i[n++]=t>>>0&255,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=r>>>0&255,i[n++]=r>>>8&255,i[n++]=r>>>16&255,i[n++]=r>>>24&255,i[n++]=s>>>0&255,i[n++]=s>>>8&255,i[n++]=s>>>16&255,i[n++]=s>>>24&255,i[n++]=o>>>0&255,i[n++]=o>>>8&255,i[n++]=o>>>16&255,i[n++]=o>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255}}(e,t,i,r);break;case 16:!function(e,t,i,r){let n=r,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;i[n++]=65535&t,i[n++]=t>>>16&65535}}(e,t,i,r);break;default:!function(e,t,i,r,n){let a=fp[n]>>>0,s=t,o=0,l=e[s]>>>0,h=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(o+n<=32)i[h+t]=l>>>o&a,o+=n,32===o&&(o=0,s++,31!==t&&(l=e[s]>>>0));else{let r=32-o,u=l>>>o;s++,l=e[s]>>>0;let c=n-r;i[h+t]=(u|(l&-1>>>32-c>>>0)<<r)&a,o=c}h+=32,o=0,t<7&&(l=e[s]>>>0)}}(e,t,i,r,n)}return t+(n<<3)|0}function wp(e,t,i,r){if(i+2>t)throw new Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t})`);let n=e[i++],a=e[i++];if(n>32)throw new Error(`FastPFOR decode: invalid bitWidth=${n} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:i}}function Tp(e,t,i,r,n,a,s,o,l){let{maxBits:h,exceptionBitWidth:u,bytePosIn:c}=function(e,t,i,r,n,a){if(i+1>t)throw new Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t})`);let s=e[i++];if(s<r||s>32)throw new Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${r}, expected ${r}..32)`);let o=s-r|0;if(o<1||o>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${r}, maxBits=${s})`);if(i+n>t)throw new Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${t-i})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:i}}(n,a,s,i,r,l);if(s=c,1===u){let a=1<<i;for(let i=0;i<r;i=i+1|0)e[n[s++]+t|0]|=a;return s}let d=o.dataToBePacked[u];if(!d)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${h}) at block ${l}`);let p=o.dataPointers,f=0|p[u],m=0|o.exceptionSizes[u];if(f+r>m)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${f}, need ${r}, size=${m}) at block ${l}`);for(let a=0;a<r;a=a+1|0){let r=n[s++],a=0|d[f++];e[r+t|0]|=a<<i}return p[u]=f,s}function Sp(e,t,i,r,n,a){let s=0|i,o=0|e[s];if(o<=0||s+o>e.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+1|0,h=s+o|0,u=e[h]>>>0,c=u+3>>>2,d=h+1,p=d+c;if(p>=e.length)throw new Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${c}, pageStart=${s}, packedEnd=${h}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=function(e,t,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(2*i),r.byteContainerI32=void 0);let n=r.byteContainer,a=i>>>2;if(3&n.byteOffset)for(let i=0;i<a;i=i+1|0){let r=0|e[t+i|0],a=i<<2;n[a]=255&r,n[a+1|0]=r>>>8&255,n[a+2|0]=r>>>16&255,n[a+3|0]=r>>>24&255}else{let i=r.byteContainerI32;(!i||i.buffer!==n.buffer||i.byteOffset!==n.byteOffset||i.length<a)&&(i=r.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),i.set(e.subarray(t,t+a))}let s=3&i;if(s>0){let i=0|e[t+a|0],r=a<<2;for(let e=0;e<s;e=e+1|0)n[r+e|0]=i>>>(e<<3)&255}return n}(e,d,u,a),m=u,g=function(e,t,i){let r=0|e[t++],n=i.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(r>>>a-1&1))continue;if(t>=e.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let s=e[t++]>>>0,o=gp(s+31,32),l=s*a+31>>>5;if(t+l>e.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let h=n[a];(!h||h.length<o)&&(h=n[a]=new Uint32Array(o));let u=0;for(;u<s;u=u+32|0)Ip(e,t,h,u,a),t=t+a|0;t=t-((u-s|0)*a>>>5)|0,i.exceptionSizes[a]=s}return t}(e,p,a);return a.dataPointers.fill(0),function(e,t,i,r,n,a,s,o,l,h){let u=0|i,c=0;for(let t=0;t<s;t=t+1|0){let i=wp(o,l,c,t);c=i.bytePosIn;let r=i.bitWidth,s=i.exceptionCount,d=a+t*mp|0;switch(r){case 0:n.fill(0,d,d+mp);break;case 32:for(let t=0;t<mp;t=t+1|0)n[d+t|0]=0|e[u+t|0];u=u+mp|0;break;default:u=bp(e,u,n,d,r)}s>0&&(c=Tp(n,d,r,s,o,l,c,h,t))}if(u!==r)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${i}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}(e,s,l,h,t,0|r,n/mp|0,f,m,a),g}function Ip(e,t,i,r,n){switch(n){case 2:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0;i[n++]=a>>>0&3,i[n++]=a>>>2&3,i[n++]=a>>>4&3,i[n++]=a>>>6&3,i[n++]=a>>>8&3,i[n++]=a>>>10&3,i[n++]=a>>>12&3,i[n++]=a>>>14&3,i[n++]=a>>>16&3,i[n++]=a>>>18&3,i[n++]=a>>>20&3,i[n++]=a>>>22&3,i[n++]=a>>>24&3,i[n++]=a>>>26&3,i[n++]=a>>>28&3,i[n++]=a>>>30&3,i[n++]=s>>>0&3,i[n++]=s>>>2&3,i[n++]=s>>>4&3,i[n++]=s>>>6&3,i[n++]=s>>>8&3,i[n++]=s>>>10&3,i[n++]=s>>>12&3,i[n++]=s>>>14&3,i[n++]=s>>>16&3,i[n++]=s>>>18&3,i[n++]=s>>>20&3,i[n++]=s>>>22&3,i[n++]=s>>>24&3,i[n++]=s>>>26&3,i[n++]=s>>>28&3,i[n]=s>>>30&3}(e,t,i,r);case 3:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;i[n++]=a>>>0&7,i[n++]=a>>>3&7,i[n++]=a>>>6&7,i[n++]=a>>>9&7,i[n++]=a>>>12&7,i[n++]=a>>>15&7,i[n++]=a>>>18&7,i[n++]=a>>>21&7,i[n++]=a>>>24&7,i[n++]=a>>>27&7,i[n++]=7&(a>>>30|(1&s)<<2),i[n++]=s>>>1&7,i[n++]=s>>>4&7,i[n++]=s>>>7&7,i[n++]=s>>>10&7,i[n++]=s>>>13&7,i[n++]=s>>>16&7,i[n++]=s>>>19&7,i[n++]=s>>>22&7,i[n++]=s>>>25&7,i[n++]=s>>>28&7,i[n++]=7&(s>>>31|(3&o)<<1),i[n++]=o>>>2&7,i[n++]=o>>>5&7,i[n++]=o>>>8&7,i[n++]=o>>>11&7,i[n++]=o>>>14&7,i[n++]=o>>>17&7,i[n++]=o>>>20&7,i[n++]=o>>>23&7,i[n++]=o>>>26&7,i[n]=o>>>29&7}(e,t,i,r);case 4:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;i[n++]=a>>>0&15,i[n++]=a>>>4&15,i[n++]=a>>>8&15,i[n++]=a>>>12&15,i[n++]=a>>>16&15,i[n++]=a>>>20&15,i[n++]=a>>>24&15,i[n++]=a>>>28&15,i[n++]=s>>>0&15,i[n++]=s>>>4&15,i[n++]=s>>>8&15,i[n++]=s>>>12&15,i[n++]=s>>>16&15,i[n++]=s>>>20&15,i[n++]=s>>>24&15,i[n++]=s>>>28&15,i[n++]=o>>>0&15,i[n++]=o>>>4&15,i[n++]=o>>>8&15,i[n++]=o>>>12&15,i[n++]=o>>>16&15,i[n++]=o>>>20&15,i[n++]=o>>>24&15,i[n++]=o>>>28&15,i[n++]=l>>>0&15,i[n++]=l>>>4&15,i[n++]=l>>>8&15,i[n++]=l>>>12&15,i[n++]=l>>>16&15,i[n++]=l>>>20&15,i[n++]=l>>>24&15,i[n]=l>>>28&15}(e,t,i,r);case 5:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0;i[n++]=a>>>0&31,i[n++]=a>>>5&31,i[n++]=a>>>10&31,i[n++]=a>>>15&31,i[n++]=a>>>20&31,i[n++]=a>>>25&31,i[n++]=31&(a>>>30|(7&s)<<2),i[n++]=s>>>3&31,i[n++]=s>>>8&31,i[n++]=s>>>13&31,i[n++]=s>>>18&31,i[n++]=s>>>23&31,i[n++]=31&(s>>>28|(1&o)<<4),i[n++]=o>>>1&31,i[n++]=o>>>6&31,i[n++]=o>>>11&31,i[n++]=o>>>16&31,i[n++]=o>>>21&31,i[n++]=o>>>26&31,i[n++]=31&(o>>>31|(15&l)<<1),i[n++]=l>>>4&31,i[n++]=l>>>9&31,i[n++]=l>>>14&31,i[n++]=l>>>19&31,i[n++]=l>>>24&31,i[n++]=31&(l>>>29|(3&h)<<3),i[n++]=h>>>2&31,i[n++]=h>>>7&31,i[n++]=h>>>12&31,i[n++]=h>>>17&31,i[n++]=h>>>22&31,i[n]=h>>>27&31}(e,t,i,r);case 6:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0;i[n++]=a>>>0&63,i[n++]=a>>>6&63,i[n++]=a>>>12&63,i[n++]=a>>>18&63,i[n++]=a>>>24&63,i[n++]=63&(a>>>30|(15&s)<<2),i[n++]=s>>>4&63,i[n++]=s>>>10&63,i[n++]=s>>>16&63,i[n++]=s>>>22&63,i[n++]=63&(s>>>28|(3&o)<<4),i[n++]=o>>>2&63,i[n++]=o>>>8&63,i[n++]=o>>>14&63,i[n++]=o>>>20&63,i[n++]=o>>>26&63,i[n++]=l>>>0&63,i[n++]=l>>>6&63,i[n++]=l>>>12&63,i[n++]=l>>>18&63,i[n++]=l>>>24&63,i[n++]=63&(l>>>30|(15&h)<<2),i[n++]=h>>>4&63,i[n++]=h>>>10&63,i[n++]=h>>>16&63,i[n++]=h>>>22&63,i[n++]=63&(h>>>28|(3&u)<<4),i[n++]=u>>>2&63,i[n++]=u>>>8&63,i[n++]=u>>>14&63,i[n++]=u>>>20&63,i[n]=u>>>26&63}(e,t,i,r);case 7:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0;i[n++]=a>>>0&127,i[n++]=a>>>7&127,i[n++]=a>>>14&127,i[n++]=a>>>21&127,i[n++]=127&(a>>>28|(7&s)<<4),i[n++]=s>>>3&127,i[n++]=s>>>10&127,i[n++]=s>>>17&127,i[n++]=s>>>24&127,i[n++]=127&(s>>>31|(63&o)<<1),i[n++]=o>>>6&127,i[n++]=o>>>13&127,i[n++]=o>>>20&127,i[n++]=127&(o>>>27|(3&l)<<5),i[n++]=l>>>2&127,i[n++]=l>>>9&127,i[n++]=l>>>16&127,i[n++]=l>>>23&127,i[n++]=127&(l>>>30|(31&h)<<2),i[n++]=h>>>5&127,i[n++]=h>>>12&127,i[n++]=h>>>19&127,i[n++]=127&(h>>>26|(1&u)<<6),i[n++]=u>>>1&127,i[n++]=u>>>8&127,i[n++]=u>>>15&127,i[n++]=u>>>22&127,i[n++]=127&(u>>>29|(15&c)<<3),i[n++]=c>>>4&127,i[n++]=c>>>11&127,i[n++]=c>>>18&127,i[n]=c>>>25&127}(e,t,i,r);case 8:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0;i[n++]=a>>>0&255,i[n++]=a>>>8&255,i[n++]=a>>>16&255,i[n++]=a>>>24&255,i[n++]=s>>>0&255,i[n++]=s>>>8&255,i[n++]=s>>>16&255,i[n++]=s>>>24&255,i[n++]=o>>>0&255,i[n++]=o>>>8&255,i[n++]=o>>>16&255,i[n++]=o>>>24&255,i[n++]=l>>>0&255,i[n++]=l>>>8&255,i[n++]=l>>>16&255,i[n++]=l>>>24&255,i[n++]=h>>>0&255,i[n++]=h>>>8&255,i[n++]=h>>>16&255,i[n++]=h>>>24&255,i[n++]=u>>>0&255,i[n++]=u>>>8&255,i[n++]=u>>>16&255,i[n++]=u>>>24&255,i[n++]=c>>>0&255,i[n++]=c>>>8&255,i[n++]=c>>>16&255,i[n++]=c>>>24&255,i[n++]=d>>>0&255,i[n++]=d>>>8&255,i[n++]=d>>>16&255,i[n]=d>>>24&255}(e,t,i,r);case 9:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0;i[n++]=a>>>0&511,i[n++]=a>>>9&511,i[n++]=a>>>18&511,i[n++]=511&(a>>>27|(15&s)<<5),i[n++]=s>>>4&511,i[n++]=s>>>13&511,i[n++]=s>>>22&511,i[n++]=511&(s>>>31|(255&o)<<1),i[n++]=o>>>8&511,i[n++]=o>>>17&511,i[n++]=511&(o>>>26|(7&l)<<6),i[n++]=l>>>3&511,i[n++]=l>>>12&511,i[n++]=l>>>21&511,i[n++]=511&(l>>>30|(127&h)<<2),i[n++]=h>>>7&511,i[n++]=h>>>16&511,i[n++]=511&(h>>>25|(3&u)<<7),i[n++]=u>>>2&511,i[n++]=u>>>11&511,i[n++]=u>>>20&511,i[n++]=511&(u>>>29|(63&c)<<3),i[n++]=c>>>6&511,i[n++]=c>>>15&511,i[n++]=511&(c>>>24|(1&d)<<8),i[n++]=d>>>1&511,i[n++]=d>>>10&511,i[n++]=d>>>19&511,i[n++]=511&(d>>>28|(31&p)<<4),i[n++]=p>>>5&511,i[n++]=p>>>14&511,i[n]=p>>>23&511}(e,t,i,r);case 10:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0;i[n++]=a>>>0&1023,i[n++]=a>>>10&1023,i[n++]=a>>>20&1023,i[n++]=1023&(a>>>30|(255&s)<<2),i[n++]=s>>>8&1023,i[n++]=s>>>18&1023,i[n++]=1023&(s>>>28|(63&o)<<4),i[n++]=o>>>6&1023,i[n++]=o>>>16&1023,i[n++]=1023&(o>>>26|(15&l)<<6),i[n++]=l>>>4&1023,i[n++]=l>>>14&1023,i[n++]=1023&(l>>>24|(3&h)<<8),i[n++]=h>>>2&1023,i[n++]=h>>>12&1023,i[n++]=h>>>22&1023,i[n++]=u>>>0&1023,i[n++]=u>>>10&1023,i[n++]=u>>>20&1023,i[n++]=1023&(u>>>30|(255&c)<<2),i[n++]=c>>>8&1023,i[n++]=c>>>18&1023,i[n++]=1023&(c>>>28|(63&d)<<4),i[n++]=d>>>6&1023,i[n++]=d>>>16&1023,i[n++]=1023&(d>>>26|(15&p)<<6),i[n++]=p>>>4&1023,i[n++]=p>>>14&1023,i[n++]=1023&(p>>>24|(3&f)<<8),i[n++]=f>>>2&1023,i[n++]=f>>>12&1023,i[n]=f>>>22&1023}(e,t,i,r);case 11:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;i[n++]=a>>>0&2047,i[n++]=a>>>11&2047,i[n++]=2047&(a>>>22|(1&s)<<10),i[n++]=s>>>1&2047,i[n++]=s>>>12&2047,i[n++]=2047&(s>>>23|(3&o)<<9),i[n++]=o>>>2&2047,i[n++]=o>>>13&2047,i[n++]=2047&(o>>>24|(7&l)<<8),i[n++]=l>>>3&2047,i[n++]=l>>>14&2047,i[n++]=2047&(l>>>25|(15&h)<<7),i[n++]=h>>>4&2047,i[n++]=h>>>15&2047,i[n++]=2047&(h>>>26|(31&u)<<6),i[n++]=u>>>5&2047,i[n++]=u>>>16&2047,i[n++]=2047&(u>>>27|(63&c)<<5),i[n++]=c>>>6&2047,i[n++]=c>>>17&2047,i[n++]=2047&(c>>>28|(127&d)<<4),i[n++]=d>>>7&2047,i[n++]=d>>>18&2047,i[n++]=2047&(d>>>29|(255&p)<<3),i[n++]=p>>>8&2047,i[n++]=p>>>19&2047,i[n++]=2047&(p>>>30|(511&f)<<2),i[n++]=f>>>9&2047,i[n++]=f>>>20&2047,i[n++]=2047&(f>>>31|(1023&m)<<1),i[n++]=m>>>10&2047,i[n]=m>>>21&2047}(e,t,i,r);case 12:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;i[n++]=a>>>0&4095,i[n++]=a>>>12&4095,i[n++]=4095&(a>>>24|(15&s)<<8),i[n++]=s>>>4&4095,i[n++]=s>>>16&4095,i[n++]=4095&(s>>>28|(255&o)<<4),i[n++]=o>>>8&4095,i[n++]=o>>>20&4095,i[n++]=l>>>0&4095,i[n++]=l>>>12&4095,i[n++]=4095&(l>>>24|(15&h)<<8),i[n++]=h>>>4&4095,i[n++]=h>>>16&4095,i[n++]=4095&(h>>>28|(255&u)<<4),i[n++]=u>>>8&4095,i[n++]=u>>>20&4095,i[n++]=c>>>0&4095,i[n++]=c>>>12&4095,i[n++]=4095&(c>>>24|(15&d)<<8),i[n++]=d>>>4&4095,i[n++]=d>>>16&4095,i[n++]=4095&(d>>>28|(255&p)<<4),i[n++]=p>>>8&4095,i[n++]=p>>>20&4095,i[n++]=f>>>0&4095,i[n++]=f>>>12&4095,i[n++]=4095&(f>>>24|(15&m)<<8),i[n++]=m>>>4&4095,i[n++]=m>>>16&4095,i[n++]=4095&(m>>>28|(255&g)<<4),i[n++]=g>>>8&4095,i[n]=g>>>20&4095}(e,t,i,r);case 16:return void function(e,t,i,r){let n=r,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,h=e[t+4]>>>0,u=e[t+5]>>>0,c=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,y=e[t+13]>>>0,v=e[t+14]>>>0,x=e[t+15]>>>0;i[n++]=a>>>0&65535,i[n++]=a>>>16&65535,i[n++]=s>>>0&65535,i[n++]=s>>>16&65535,i[n++]=o>>>0&65535,i[n++]=o>>>16&65535,i[n++]=l>>>0&65535,i[n++]=l>>>16&65535,i[n++]=h>>>0&65535,i[n++]=h>>>16&65535,i[n++]=u>>>0&65535,i[n++]=u>>>16&65535,i[n++]=c>>>0&65535,i[n++]=c>>>16&65535,i[n++]=d>>>0&65535,i[n++]=d>>>16&65535,i[n++]=p>>>0&65535,i[n++]=p>>>16&65535,i[n++]=f>>>0&65535,i[n++]=f>>>16&65535,i[n++]=m>>>0&65535,i[n++]=m>>>16&65535,i[n++]=g>>>0&65535,i[n++]=g>>>16&65535,i[n++]=_>>>0&65535,i[n++]=_>>>16&65535,i[n++]=y>>>0&65535,i[n++]=y>>>16&65535,i[n++]=v>>>0&65535,i[n++]=v>>>16&65535,i[n++]=x>>>0&65535,i[n]=x>>>16&65535}(e,t,i,r);case 32:for(let n=0;n<32;n=n+1|0)i[r+n|0]=0|e[t+n|0];return}let a=fp[n]>>>0,s=t,o=0,l=e[s]>>>0;for(let t=0;t<32;t++)if(o+n<=32)i[r+t]=l>>>o&a,o+=n,32===o&&(o=0,s++,31!==t&&(l=e[s]>>>0));else{let h=32-o,u=l>>>o;s++,l=e[s]>>>0,i[r+t]=(u|(l&fp[n-h]>>>0)<<h)&a,o=n-h}}function Pp(e,t,i){let r=new Uint32Array(i),n=0,a=t.get();for(let t=0;t<r.length;t++){let t=e[a++],i=127&t;t<128||(t=e[a++],i|=(127&t)<<7,t<128||(t=e[a++],i|=(127&t)<<14,t<128||(t=e[a++],i|=(127&t)<<21,t<128||(t=e[a++],i|=(15&t)<<28)))),r[n++]=i}return t.set(a),r}function Cp(e,t,i){let r=new BigUint64Array(i);for(let i=0;i<r.length;i++)r[i]=Ep(e,t);return r}function Ep(e,t){let i=0n,r=0,n=t.get();for(;n<e.length;){let t=e[n++];if(i|=BigInt(127&t)<<BigInt(r),!(128&t))break;if(r+=7,r>=64)throw new Error("Varint too long")}return t.set(n),i}function Mp(e,t){let i,r;return r=e[t.get()],t.increment(),i=127&r,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<7,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<14,r<128?i:(r=e[t.get()],t.increment(),i|=(127&r)<<21,r<128?i:(r=e[t.get()],i|=(15&r)<<28,function(e,t,i){let r,n;if(n=t[i.get()],i.increment(),r=(112&n)>>4,n<128||(n=t[i.get()],i.increment(),r|=(127&n)<<3,n<128)||(n=t[i.get()],i.increment(),r|=(127&n)<<10,n<128)||(n=t[i.get()],i.increment(),r|=(127&n)<<17,n<128)||(n=t[i.get()],i.increment(),r|=(127&n)<<24,n<128)||(n=t[i.get()],i.increment(),r|=(1&n)<<31,n<128))return 4294967296*r+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(i,e,t)))))}function Ap(e){return e>>>1^-(1&e)}function kp(e){return e>>1n^-(1n&e)}function Lp(e){return e%2==1?(e+1)/-2:e/2}function Fp(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}let r=new Uint32Array(i),n=0;for(let i=0;i<t;i++){let a=e[i];r.fill(e[i+t],n,n+a),n+=a}return r}function Dp(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}let r=new BigUint64Array(i),n=0;for(let i=0;i<t;i++){let a=Number(e[i]);r.fill(e[i+t],n,n+a),n+=a}return r}function Rp(e,t,i){let r=new Float64Array(i),n=0;for(let i=0;i<t;i++){let a=e[i];r.fill(e[i+t],n,n+a),n+=a}return r}function zp(e){let t=new Int32Array(e.length);t[0]=Ap(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],n=e[r+2],a=e[r+3];t[r]=Ap(e[r])+t[r-1],t[r+1]=Ap(i)+t[r],t[r+2]=Ap(n)+t[r+1],t[r+3]=Ap(a)+t[r+2]}for(;r!==e.length;++r)t[r]=Ap(e[r])+t[r-1];return t}function Np(e){let t=new BigInt64Array(e.length);t[0]=kp(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],n=e[r+2],a=e[r+3];t[r]=kp(e[r])+t[r-1],t[r+1]=kp(i)+t[r],t[r+2]=kp(n)+t[r+1],t[r+3]=kp(a)+t[r+2]}for(;r!==t.length;++r)t[r]=kp(e[r])+t[r-1];return t}function Op(e){let t=e.length/4*4,i=1;if(t>=4)for(let r=e[0];i<t-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}var Bp,jp,Vp,Gp,Up,Zp,$p,qp;function Wp(e,t){let i=function(e,t){let i=e[t.get()],r=Object.values(Bp)[i>>4],n=null;switch(r){case Bp.DATA:n={dictionaryType:Object.values(jp)[15&i]};break;case Bp.OFFSET:n={offsetType:Object.values(Vp)[15&i]};break;case Bp.LENGTH:n={lengthType:Object.values(Gp)[15&i]}}t.increment();let a=e[t.get()],s=Object.values(cp)[a>>5],o=Object.values(cp)[a>>2&7],l=Object.values(dp)[3&a];t.increment();let h=Pp(e,t,2),u=h[0];return{physicalStreamType:r,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:u,byteLength:h[1],decompressedCount:u}}(e,t);return i.logicalLevelTechnique1===cp.MORTON?function(e,t,i){let r=Pp(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(i,e,t):cp.RLE!==i.logicalLevelTechnique1&&cp.RLE!==i.logicalLevelTechnique2||dp.NONE===i.physicalLevelTechnique?i:function(e,t,i){let r=Pp(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(i,e,t)}(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(Bp||(Bp={})),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(jp||(jp={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(Vp||(Vp={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(Gp||(Gp={})),function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Up||(Up={}));class Hp{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8);return 1==(this.values[t]>>e%8&1)}set(e,t){let i=Math.floor(e/8);this.values[i]=this.values[i]|(t?1:0)<<e%8}getInt(e){let t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Xp(e,t,i){if(!t)return e;let r=t.size(),n=new e.constructor(r),a=0;for(let s=0;s<r;s++)n[s]=t.get(s)?e[a++]:i;return n}function Yp(e,t,i,r,n){return function(e,t,i,r){let n;switch(t.logicalLevelTechnique1){case cp.DELTA:if(t.logicalLevelTechnique2===cp.RLE){let i=t;if(!r)return function(e,t,i){let r=new Int32Array(i),n=0,a=0;for(let i=0;i<t;i++){let s=e[i],o=Ap(e[i+t]);for(let e=0;e<s;e++)a+=o,r[n++]=a}return r}(e,i.runs,i.numRleValues);n=zp(e=Fp(e,i.runs,i.numRleValues))}else n=zp(e);break;case cp.RLE:n=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=e[r]}let r=new Int32Array(i),n=0;for(let i=0;i<t;i++){let a=e[i],s=e[i+t];s=Ap(s),r.fill(s,n,n+a),n+=a}return r}(e,t.runs,t.numRleValues);break;case cp.MORTON:Op(e),n=new Int32Array(e);break;case cp.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=Ap(e[0]),t[1]=Ap(e[1]);let i=e.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let i=e[r+1],n=e[r+2],a=e[r+3];t[r]=Ap(e[r])+t[r-2],t[r+1]=Ap(i)+t[r-1],t[r+2]=Ap(n)+t[r],t[r+3]=Ap(a)+t[r+1]}for(;r!==e.length;r+=2)t[r]=Ap(e[r])+t[r-2],t[r+1]=Ap(e[r+1])+t[r-1];return t}(e);break;case cp.NONE:n=function(e){let t=new Int32Array(e.length);for(let i=0;i<e.length;i++)t[i]=Ap(e[i]);return t}(e);break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Xp(n,r,0):n}(Qp(e,t,i),i,0,n)}function Kp(e,t,i,r,n){return function(e,t,i,r){let n;switch(t.logicalLevelTechnique1){case cp.DELTA:n=function(e){let t=new Uint32Array(e.length);t[0]=Ap(e[0])>>>0;for(let i=1;i<e.length;i++)t[i]=t[i-1]+Ap(e[i])>>>0;return t}(t.logicalLevelTechnique2===cp.RLE?Fp(e,t.runs,t.numRleValues):e);break;case cp.RLE:n=Fp(e,t.runs,t.numRleValues);break;case cp.MORTON:Op(e),n=e;break;case cp.COMPONENTWISE_DELTA:n=function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=Ap(e[0])>>>0,t[1]=Ap(e[1])>>>0;for(let i=2;i<e.length;i+=2)t[i]=t[i-2]+Ap(e[i])>>>0,t[i+1]=t[i-1]+Ap(e[i+1])>>>0;return t}(e);break;case cp.NONE:n=e;break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Xp(n,r,0):n}(Qp(e,t,i),i,0,n)}function Jp(e,t,i){return function(e,t){if(t.logicalLevelTechnique1===cp.DELTA&&t.logicalLevelTechnique2===cp.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=Ap(e[0]);let i=t[1];for(let r=2;r!==t.length;++r)i+=Ap(e[r-1]),t[r]=t[r-1]+i;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===cp.RLE&&t.logicalLevelTechnique2===cp.NONE)return function(e,t,i){let r=new Uint32Array(i+1);r[0]=0;let n=1,a=r[0];for(let i=0;i<t;i++){let s=e[i],o=e[i+t];for(let e=n;e<n+s;e++)r[e]=o+a,a=r[e];n+=s}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===cp.NONE&&t.logicalLevelTechnique2===cp.NONE){!function(e){let t=0;for(let i=0;i<e.length;i++)e[i]+=t,t=e[i]}(e);let i=new Uint32Array(t.numValues+1);return i[0]=0,i.set(e,1),i}if(t.logicalLevelTechnique1===cp.DELTA&&t.logicalLevelTechnique2===cp.RLE){let i=function(e,t,i){let r=new Int32Array(i+1);r[0]=0;let n=1,a=r[0];for(let i=0;i<t;i++){let s=e[i],o=e[i+t];o=Ap(o);for(let e=n;e<n+s;e++)r[e]=o+a,a=r[e];n+=s}return r}(e,t.runs,t.numRleValues);return Op(i),new Uint32Array(i)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Qp(e,t,i),i)}function Qp(e,t,i){let r=i.physicalLevelTechnique;switch(r){case dp.FAST_PFOR:return n=e,a=i.numValues,s=i.byteLength,function(e,t,i,r,n){let a=r.get();if(3&i)throw new Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=i>>>2,o=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let i=new Uint32Array(Math.max(16,2*t));return e.encodedWords=i,i}(n,s);!function(e,t,i,r){if(t<0||i<0||t+i>e.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${i}, bytes.length=${e.length})`);let n=Math.floor(i/4),a=i%4!=0,s=a?n+1:n;if(r.length<s)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${s}`);if(n>0){let i=e.byteOffset+t;if(3&i)for(let i=0;i<n;i++){let n=t+4*i;r[i]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]}else{let t=new Uint32Array(e.buffer,i,n);for(let e=0;e<n;e++)r[e]=0|_p(t[e])}}if(a){let a=t+4*n,s=i-4*n,o=0;for(let t=0;t<s;t++)o|=e[a+t]<<24-8*t;r[n]=0|o}}(e,a,i,o);let l=function(e,t,i){let r=0,n=0,a=new Uint32Array(t),s=i??xp();if(e.length>0){let t=0|e[r];if(r=r+1|0,255&t)throw new Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(n+t>a.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${t}, out.length=${a.length})`);r=function(e,t,i,r,n,a){let s=r+gp(n,mp),o=r,l=i;for(;o!==s;){let i=Math.min(yp,s-o);l=Sp(e,t,l,o,i,a),o=o+i|0}return l}(e,a,r,n,t,s),n=n+t|0}return function(e,t,i,r,n,a){if(0===a)return t;let s=0,o=t,l=t+i,h=n,u=n,c=n+a,d=0,p=0;for(;o<l&&u<c;){let t=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,d|=(127&t)<<p,128&t)r[u++]=0|d,d=0,p=0;else if(p+=7,p>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${u-h}/${a}, inPos=${o}, inEnd=${l})`)}if(u!==c)throw new Error(`FastPFOR VByte: truncated stream (decoded=${u-h}, expected=${a}, consumedWords=${o-t}/${i}, vbyteStart=${t}, vbyteEnd=${l})`)}(e,r,e.length-r|0,a,n,t-n|0),a}(o.subarray(0,s),t,n.decoderWorkspace);return r.add(i),l}(n,a,s,t,function(e=16){if(e<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:xp()}}(s>>>2));case dp.VARINT:return Pp(e,t,i.numValues);case dp.NONE:{let r=t.get();t.add(i.byteLength);let n=e.subarray(r,t.get());return new Uint32Array(n)}default:throw new Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}var n,a,s}function ef(e,t,i){let r=Qp(e,t,i);return 1===r.length?r[0]:r[1]}function tf(e,t,i){return function(e){if(2===e.length){let t=Ap(e[1]);return[t,t]}return[Ap(e[2]),Ap(e[3])]}(Qp(e,t,i))}function rf(e,t,i){return function(e){if(2===e.length){let t=kp(e[1]);return[t,t]}return[kp(e[2]),kp(e[3])]}(Cp(e,t,i.numValues))}function nf(e,t,i,r){return function(e,t,i){let r;switch(t.logicalLevelTechnique1){case cp.DELTA:r=function(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,kp(e[0]));for(let i=1;i<e.length;i++)t[i]=BigInt.asUintN(64,t[i-1]+kp(e[i]));return t}(t.logicalLevelTechnique2===cp.RLE?Dp(e,t.runs,t.numRleValues):e);break;case cp.RLE:r=Dp(e,t.runs,t.numRleValues);break;case cp.NONE:r=e;break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Xp(r,i,0n):r}(Cp(e,t,i.numValues),i,r)}function af(e,t,i){let r=Cp(e,t,i.numValues);return 1===r.length?r[0]:r[1]}function sf(e,t,i,r,n="int32"){let a=e.logicalLevelTechnique1;if(a===cp.RLE)return 1===e.runs?Up.CONST:Up.FLAT;if(a!==cp.DELTA||e.logicalLevelTechnique2!==cp.RLE)return 1===e.numValues?Up.CONST:Up.FLAT;let s=t instanceof Hp?t.size():t;if(e.numRleValues!==s)return Up.FLAT;if(1===e.runs)return Up.SEQUENCE;if(2!==e.runs)return 1===e.numValues?Up.CONST:Up.FLAT;let o=r.get();if(e.physicalLevelTechnique===dp.VARINT)return function(e,t,i){let r=new up(t.get());if("int64"===i){let t=Cp(e,r,4);return 2n===t[2]&&2n===t[3]}let n=Pp(e,r,4);return 2===n[2]&&2===n[3]}(i,r,n)?Up.SEQUENCE:1===e.numValues?Up.CONST:Up.FLAT;let l=r.get(),h=new Int32Array(i.buffer,i.byteOffset+l,4);return r.set(o),2===h[2]&&2===h[3]?Up.SEQUENCE:1===e.numValues?Up.CONST:Up.FLAT}class of extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class lf extends sp{constructor(e,t,i,r){super(e,BigInt64Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function hf(e,t,i){return{x:uf(e,t)-i,y:uf(e>>1,t)-i}}function uf(e,t){let i=0;for(let r=0;r<t;r++)i|=(e&1<<2*r)>>r;return i}function cf(e,t,r,n,a,s,o){return e===qp.MORTON?function(e,t,r,n,a,s){let o=new Array(a?n+1:n);for(let a=0;a<n;a++){let n=hf(e[t[r+a]],s.numBits,s.coordinateShift);o[a]=new i(n.x,n.y)}return a&&(o[o.length-1]=o[0]),o}(t,r,n,a,s,o):function(e,t,r,n,a){let s=new Array(a?n+1:n);for(let a=0;a<2*n;a+=2){let n=2*t[r+a/2];s[a/2]=new i(e[n],e[n+1])}return a&&(s[s.length-1]=s[0]),s}(t,r,n,a,s)}function df(e,t,r,n){let a=new Array(n?r+1:r);for(let n=0;n<2*r;n+=2)a[n/2]=new i(e[t+n],e[t+n+1]);return n&&(a[a.length-1]=a[0]),a}(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(Zp||(Zp={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}($p||($p={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(qp||(qp={}));class pf{constructor(e,t,i,r,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=hf(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=new Array(e.numGeometries),r=1,n=1,a=1,s=0,o=0,l=0,h=e.mortonSettings,u=e.topologyVector,c=u.geometryOffsets,d=u.partOffsets,p=u.ringOffsets,f=e.vertexOffsets,m=!f||0===f.length,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++)switch(e.geometryType(u)){case Zp.POINT:{let u,g;if(m)u=_[o++],g=_[o++];else if(e.vertexBufferType===qp.MORTON){let e=hf(_[f[l++]],h.numBits,h.coordinateShift);u=e.x,g=e.y}else{let e=2*f[l++];u=_[e],g=_[e+1]}t[s++]=[[new i(u,g)]],c&&a++,d&&r++,p&&n++}break;case Zp.MULTIPOINT:{let e=c[a]-c[a-1];a++;let h=new Array(e);if(m)for(let t=0;t<e;t++){let e=_[o++],r=_[o++];h[t]=new i(e,r)}else for(let t=0;t<e;t++){let e=2*f[l++];h[t]=new i(_[e],_[e+1])}t[s++]=h.map(e=>[e]),r+=e,n+=e}break;case Zp.LINESTRING:{let i,u;g?(i=p[n]-p[n-1],n++):i=d[r]-d[r-1],r++,m?(u=df(_,o,i,!1),o+=2*i):(u=cf(e.vertexBufferType,_,f,l,i,!1,h),l+=i),t[s++]=[u],c&&a++}break;case Zp.POLYGON:{let i=d[r]-d[r-1];r++;let u,g=new Array(i-1),y=p[n]-p[n-1];if(n++,m){u=df(_,o,y,!0),o+=2*y;for(let e=0;e<g.length;e++)y=p[n]-p[n-1],n++,g[e]=df(_,o,y,!0),o+=2*y}else{u=cf(e.vertexBufferType,_,f,l,y,!0,h),l+=y;for(let t=0;t<g.length;t++)y=p[n]-p[n-1],n++,g[t]=cf(e.vertexBufferType,_,f,l,y,!0,h),l+=y}t[s++]=[u].concat(g),c&&a++}break;case Zp.MULTILINESTRING:{let i=c[a]-c[a-1];a++;let u=new Array(i);for(let t=0;t<i;t++){let i;if(g?(i=p[n]-p[n-1],n++):i=d[r]-d[r-1],r++,m)u[t]=df(_,o,i,!1),o+=2*i;else{let r=cf(e.vertexBufferType,_,f,l,i,!1,h);u[t]=r,l+=i}}t[s++]=u}break;case Zp.MULTIPOLYGON:{let i=c[a]-c[a-1];a++;let u=new Array(i);for(let t=0;t<i;t++){let i,a=d[r]-d[r-1];r++;let s=new Array(a-1),c=p[n]-p[n-1];n++,m?(i=df(_,o,c,!0),o+=2*c):(i=cf(e.vertexBufferType,_,f,l,c,!0,h),l+=c);for(let t=0;t<s.length;t++){let i=p[n]-p[n-1];n++,m?(s[t]=df(_,o,i,!0),o+=2*i):(s[t]=cf(e.vertexBufferType,_,f,l,i,!0,h),l+=i)}u[t]=[i].concat(s)}t[s++]=u.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return t}(this)}get mortonSettings(){return this._mortonSettings}}class ff extends pf{constructor(e,t,i,r,n,a,s){super(i,r,n,a,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Zp.POLYGON||this._geometryType===Zp.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class mf extends pf{constructor(e,t,i,r,n,a){super(e,i,r,n,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Zp.POLYGON||this.geometryType(e)===Zp.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class gf{constructor(e,t,i,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");let e=new Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,n=t.ringOffsets,a=t.geometryOffsets,s=0,o=1,l=1,h=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case Zp.POLYGON:{let u=r[o]-r[o-1];o++;let c=[];for(let e=0;e<u;e++){let e=n[l]-n[l-1];l++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[s++],r=this._vertexBuffer[s++];t.push(new i(e,r))}t.length>0&&t.push(t[0]),c.push(t)}e[t]=c,a&&h++}break;case Zp.MULTIPOLYGON:{let u=a[h]-a[h-1];h++;let c=[];for(let e=0;e<u;e++){let e=r[o]-r[o-1];o++;for(let t=0;t<e;t++){let e=n[l]-n[l-1];l++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[s++],r=this._vertexBuffer[s++];t.push(new i(e,r))}t.length>0&&t.push(t[0]),c.push(t)}}e[t]=c}}return e}[Symbol.iterator](){return null}}function _f(e,t,i,r,n,a){return new yf(e,t,i,r,n,a)}class yf extends gf{constructor(e,t,i,r,n,a){super(i,r,n,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function vf(e,t,i,r,n){return new xf(e,t,i,r,n)}class xf extends gf{constructor(e,t,i,r,n){super(t,i,r,n),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function bf(e,t,i,r,n){let a,s,o,l,h=Wp(e,i);if(sf(h,r,e,i)===Up.CONST){let n,p,f,m,g=ef(e,i,h);for(let r=0;r<t-1;r++){let t=Wp(e,i);switch(t.physicalStreamType){case Bp.LENGTH:switch(t.logicalStreamType.lengthType){case Gp.GEOMETRIES:n=Jp(e,i,t);break;case Gp.PARTS:p=Jp(e,i,t);break;case Gp.RINGS:f=Jp(e,i,t);break;case Gp.TRIANGLES:m=Jp(e,i,t)}break;case Bp.OFFSET:switch(t.logicalStreamType.offsetType){case Vp.VERTEX:a=Kp(e,i,t);break;case Vp.INDEX:l=Kp(e,i,t)}break;case Bp.DATA:jp.VERTEX===t.logicalStreamType.dictionaryType?s=Yp(e,i,t):(o={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Kp(e,i,t))}}return l?void 0!==n||void 0!==p?_f(r,g,m,l,s,{geometryOffsets:n,partOffsets:p,ringOffsets:f}):_f(r,g,m,l,s):void 0===o?(u={geometryOffsets:n,partOffsets:p,ringOffsets:f},c=a,d=s,new ff(r,g,qp.VEC_2,u,c,d)):function(e,t,i,r,n,a){return new ff(e,t,qp.MORTON,i,r,n,a)}(r,g,{geometryOffsets:n,partOffsets:p,ringOffsets:f},a,s,o)}var u,c,d;let p,f,m,g,_,y,v,x=Kp(e,i,h);for(let r=0;r<t-1;r++){let t=Wp(e,i);switch(t.physicalStreamType){case Bp.LENGTH:switch(t.logicalStreamType.lengthType){case Gp.GEOMETRIES:p=Kp(e,i,t);break;case Gp.PARTS:f=Kp(e,i,t);break;case Gp.RINGS:m=Kp(e,i,t);break;case Gp.TRIANGLES:g=Jp(e,i,t)}break;case Bp.OFFSET:switch(t.logicalStreamType.offsetType){case Vp.VERTEX:a=Kp(e,i,t);break;case Vp.INDEX:l=Kp(e,i,t)}break;case Bp.DATA:jp.VERTEX===t.logicalStreamType.dictionaryType?s=Yp(e,i,t):(o={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Kp(e,i,t))}}return p?(_=wf(x,p,2),f&&m?(y=Tf(x,_,f,!1),v=function(e,t,i,r){let n=new Uint32Array(i[i.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let h=0;h<e.length;h++){let u=e[h],c=t[h+1]-t[h];if(0!==u&&3!==u)for(let e=0;e<c;e++){let e=i[s]-i[s-1];s++;for(let t=0;t<e;t++)a=n[o++]=a+r[l++]}else for(let e=0;e<c;e++)n[o++]=++a,s++}return n}(x,_,y,m)):f&&(y=function(e,t,i){let r=new Uint32Array(t[t.length-1]+1),n=0;r[0]=n;let a=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],h=t[o+1]-t[o];if(4===l||1===l)for(let e=0;e<h;e++)n=r[a++]=n+i[s++];else for(let e=0;e<h;e++)r[a++]=++n}return r}(x,_,f))):f&&m?(y=wf(x,f,1),v=Tf(x,y,m,!0)):f&&(y=wf(x,f,0)),l&&!y?vf(x,g,l,s):l?vf(x,g,l,s,{geometryOffsets:_,partOffsets:y,ringOffsets:v}):void 0===o?(b=x,w={geometryOffsets:_,partOffsets:y,ringOffsets:v},T=a,S=s,new mf(qp.VEC_2,b,w,T,S)):function(e,t,i,r,n){return new mf(qp.MORTON,e,t,i,r,n)}(x,{geometryOffsets:_,partOffsets:y,ringOffsets:v},a,s,o);var b,w,T,S}function wf(e,t,i){let r=new Uint32Array(e.length+1),n=0;r[0]=n;let a=0;for(let s=0;s<e.length;s++)n=r[s+1]=n+(e[s]>i?t[a++]:1);return r}function Tf(e,t,i,r){let n=new Uint32Array(t[t.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<e.length;l++){let h=e[l],u=t[l+1]-t[l];if(5===h||2===h||r&&(4===h||1===h))for(let e=0;e<u;e++)a=n[s++]=a+i[o++];else for(let e=0;e<u;e++)n[s++]=++a}return n}class Sf extends ip{constructor(e,t,i){super(e,t.getBuffer(),i),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class If extends rp{getValueFromBuffer(e){return this.dataBuffer[e]}}class Pf extends ip{constructor(e,t,i,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Cf(e,t,i,r,n){let a=function(e,t,i,r){let n=new Uint8Array(t),a=0,s=r.get()+i;for(;a<t&&!(r.get()>=s);){let i=e[r.increment()];if(i<=127){let s=i+3,o=e[r.increment()],l=Math.min(a+s,t);n.fill(o,a,l),a=l}else{let s=256-i;for(let i=0;i<s&&a<t;i++)n[a++]=e[r.increment()]}}return r.set(s),n}(e,Math.ceil(t/8),i,r);return n?function(e,t,i){if(!i)return e;let r=i.size(),n=new Hp(e,t),a=new Hp(new Uint8Array(Math.ceil(r/8)),r),s=0;for(let e=0;e<r;e++){let t=!!i.get(e)&&n.get(s++);a.set(e,t)}return a.getBuffer()}(a,t,n):a}let Ef=new TextDecoder;function Mf(e,t,i){return i-t>=12?Ef.decode(e.subarray(t,i)):function(e,t,i){let r="",n=t;for(;n<i;){let t,a,s,o=e[n],l=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h>i)break;1===h?o<128&&(l=o):2===h?(t=e[n+1],128==(192&t)&&(l=(31&o)<<6|63&t,l<=127&&(l=null))):3===h?(t=e[n+1],a=e[n+2],128==(192&t)&&128==(192&a)&&(l=(15&o)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===h&&(t=e[n+1],a=e[n+2],s=e[n+3],128==(192&t)&&128==(192&a)&&128==(192&s)&&(l=(15&o)<<18|(63&t)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=h}return r}(e,t,i)}class Af extends ip{constructor(e,t,i,r){super(e,i,r),this.offsetBuffer=t}}class kf extends Af{constructor(e,t,i,r){super(e,t,i,r??t.length-1)}getValueFromBuffer(e){return Mf(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Lf extends Af{constructor(e,t,i,r,n){super(e,i,r,n??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e];return Mf(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class Ff extends Af{constructor(e,t,i,r,n,a,s){super(e,i,r,s),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(e,t,i){let r=[],n=new Array(t.length).fill(0);for(let e=1;e<t.length;e++)n[e]=n[e-1]+t[e-1];for(let a=0;a<i.length;a++)if(255===i[a])r.push(i[++a]);else{let s=t[i[a]],o=n[i[a]];for(let t=0;t<s;t++)r.push(e[o+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let t=this.indexBuffer[e];return Mf(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),i=e[0];for(let r=1;r<e.length;r++){let n=e[r];t[r-1]=n-i,i=n}return t}}function Df(e,t,i,r,n,a){return"scalarType"===i.type?function(e,t,i,r,n,a){let s=null;if(0===e)return null;if(a.nullable){let e=Wp(t,i),r=e.numValues,n=i.get(),a=Cf(t,r,e.byteLength,i);i.set(n+e.byteLength),s=new Hp(a,e.numValues)}let o=s??r;switch(n.physicalType){case 4:case 3:return function(e,t,i,r,n){let a=Wp(e,t),s=sf(a,n,e,t),o=3===r.physicalType;if(s===Up.FLAT){let r=Rf(n)?n:void 0,s=o?Yp(e,t,a,0,r):Kp(e,t,a,0,r);return new np(i.name,s,n)}if(s===Up.SEQUENCE){let r=tf(e,t,a);return new op(i.name,r[0],r[1],a.numRleValues)}let l=o?function(e,t,i){let r=Qp(e,t,i);return 1===r.length?Ap(r[0]):Ap(r[1])}(e,t,a):ef(e,t,a);return new lp(i.name,l,n,o)}(t,i,a,n,o);case 9:return function(e,t,i,r,n){let a=null,s=null,o=null,l=null,h=null,u=n??null,c=null,d=null;for(let e=0;e<r;e++){let e=Wp(t,i);switch(e.physicalStreamType){case Bp.PRESENT:{let r=Cf(t,e.numValues,e.byteLength,i),a=new Hp(r,e.numValues);u=n??a;break}case Bp.OFFSET:s=Kp(t,i,e,0,u);break;case Bp.LENGTH:{let r=Jp(t,i,e);Gp.DICTIONARY===e.logicalStreamType.lengthType?a=r:Gp.SYMBOL===e.logicalStreamType.lengthType?l=r:c=r;break}case Bp.DATA:{let r=t.subarray(i.get(),i.get()+e.byteLength);i.add(e.byteLength);let n=e.logicalStreamType.dictionaryType;jp.FSST===n?h=r:jp.SINGLE===n||jp.SHARED===n?o=r:jp.NONE===n&&(d=r);break}}}return p=e,m=s,g=a,_=o,y=l,v=u,((f=h)?new Ff(p,m,g,_,y,f,v):null)??function(e,t,i,r,n){return t?n?new Lf(e,i,r,t,n):new Lf(e,i,r,t):null}(e,o,s,a,u)??function(e,t,i,r,n){if(!t||!i)return null;if(r)return n?new Lf(e,r,t,i,n):new Lf(e,r,t,i);if(n&&n.size()!==t.length-1){let r=new Uint32Array(n.size()),a=0;for(let e=0;e<n.size();e++)r[e]=n.get(e)?a++:0;return new Lf(e,r,t,i,n)}return n?new kf(e,t,i,n):new kf(e,t,i)}(e,c,d,s,u);var p,f,m,g,_,y,v}(a.name,t,i,a.nullable?e-1:e,s);case 0:return function(e,t,i,r,n){let a=Wp(e,t),s=a.numValues,o=t.get(),l=Rf(n)?n:void 0,h=Cf(e,s,a.byteLength,t,l);t.set(o+a.byteLength);let u=new Hp(h,s);return new Sf(i.name,u,n)}(t,i,a,0,o);case 6:case 5:return function(e,t,i,r,n){let a=Wp(e,t),s=sf(a,r,e,t,"int64"),o=5===n.physicalType;if(s===Up.FLAT){let n=Rf(r)?r:void 0,s=o?(h=n,function(e,t,i){let r;switch(t.logicalLevelTechnique1){case cp.DELTA:if(t.logicalLevelTechnique2===cp.RLE){let n=t;if(!i)return function(e,t,i){let r=new BigInt64Array(i),n=0,a=0n;for(let i=0;i<t;i++){let s=Number(e[i]),o=kp(e[i+t]);for(let e=0;e<s;e++)a+=o,r[n++]=a}return r}(e,n.runs,n.numRleValues);r=Np(e=Dp(e,n.runs,n.numRleValues))}else r=Np(e);break;case cp.RLE:r=function(e,t,i){if(void 0===i){i=0;for(let r=0;r<t;r++)i+=Number(e[r])}let r=new BigInt64Array(i),n=0;for(let i=0;i<t;i++){let a=Number(e[i]),s=e[i+t];s=kp(s),r.fill(s,n,n+a),n+=a}return r}(e,t.runs,t.numRleValues);break;case cp.NONE:r=function(e){let t=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t[i]=kp(e[i]);return t}(e);break;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Xp(r,i,0n):r}(Cp(e,t,(l=a).numValues),l,h)):nf(e,t,a,n);return new of(i.name,s,r)}var l,h;if(s===Up.SEQUENCE){let r=rf(e,t,a);return new lf(i.name,r[0],r[1],a.numRleValues)}let u=o?function(e,t,i){let r=Cp(e,t,i.numValues);return 1===r.length?kp(r[0]):function(e){return kp(e[1])}(r)}(e,t,a):af(e,t,a);return new Pf(i.name,u,r,o)}(t,i,a,o,n);case 7:return function(e,t,i,r){let n=Wp(e,t),a=Rf(r)?r:void 0,s=function(e,t,i,r){let n=t.get(),a=n+i*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,a)).buffer,o=new Float32Array(s);return t.set(a),r?Xp(o,r,0):o}(e,t,n.numValues,a);return new If(i.name,s,r)}(t,i,a,o);case 8:return function(e,t,i,r){let n=Wp(e,t),a=Rf(r)?r:void 0,s=function(e,t,i,r){let n=t.get(),a=n+i*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(n,a)).buffer,o=new Float64Array(s);return t.set(a),r?Xp(o,r,0):o}(e,t,n.numValues,a);return new ap(i.name,s,r)}(t,i,a,o);default:throw new Error(`The specified data type for the field is currently not supported: ${n}`)}}(r,e,t,n,i.scalarType,i):0===r?null:function(e,t,i,r){let n=null,a=null,s=null,o=null,l=!1;for(;!l;){let i=Wp(e,t);switch(i.physicalStreamType){case Bp.LENGTH:Gp.DICTIONARY===i.logicalStreamType.lengthType?n=Jp(e,t,i):s=Jp(e,t,i);break;case Bp.DATA:jp.SINGLE===i.logicalStreamType.dictionaryType||jp.SHARED===i.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+i.byteLength),l=!0):o=e.subarray(t.get(),t.get()+i.byteLength),t.add(i.byteLength)}}let h=i.complexType.children,u=[],c=0;for(let l of h){let h=Pp(e,t,1)[0];if(0===h)continue;let d=l.name?`${i.name}${l.name}`:i.name;if(2!==h||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");let p=Wp(e,t),f=Cf(e,p.numValues,p.byteLength,t),m=Wp(e,t),g=Kp(e,t,m,0,m.decompressedCount!==r?new Hp(f,p.numValues):void 0);u[c++]=o?new Ff(d,g,n,a,s,o,new Hp(f,p.numValues)):new Lf(d,g,n,a,new Hp(f,p.numValues))}return u}(e,t,i,n)}function Rf(e){return e instanceof Hp}function zf(e){switch(e){case 0:case 1:case 2:case 3:{let t={};t.nullable=!!(1&e),t.columnScope=0;let i={type:"logicalType",logicalType:0};return i.longID=!!(2&e),t.scalarType=i,t.type="scalarType",t}case 4:{let e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=t,e}case 30:{let e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=t,e}default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}let i={};i.nullable=!!(1&e),i.columnScope=0;let r={type:"physicalType"};return r.physicalType=t,i.type="scalarType",i.scalarType=r,i}(e)}}function Nf(e){return e>=10}function Of(e){return 30===e}function Bf(e){if("scalarType"===e.type){let t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===t.type)return!1}else if("complexType"===e.type){let t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function jf(e){return"complexType"===e.type&&"physicalType"===e.complexType?.type&&0===e.complexType.physicalType}let Vf=new TextDecoder;function Gf(e,t){let i=Pp(e,t,1)[0];if(0===i)return"";let r=t.get(),n=e.subarray(r,r+i);return t.add(i),Vf.decode(n)}function Uf(e,t){let i=Pp(e,t,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);let r=zf(i);if(Nf(i)&&(r.name=Gf(e,t)),Of(i)){let i=Pp(e,t,1)[0]>>>0;r.complexType.children=new Array(i);for(let n=0;n<i;n++)r.complexType.children[n]=Uf(e,t)}return{name:(n=r).name,nullable:n.nullable,scalarField:n.scalarType,complexField:n.complexType,type:"scalarType"===n.type?"scalarField":"complexField"};var n}function Zf(e,t){let i=Pp(e,t,1)[0]>>>0,r=zf(i);if(!r)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(Nf(i)?r.name=Gf(e,t):i>=0&&i<=3?r.name="id":4===i&&(r.name="geometry"),Of(i)){let i=Pp(e,t,1)[0]>>>0,n=r.complexType;n.children=new Array(i);for(let r=0;r<i;r++)n.children[r]=Uf(e,t)}return r}function $f(e,t){let i={featureTables:[]},r={};r.name=Gf(e,t);let n=Pp(e,t,1)[0]>>>0,a=Pp(e,t,1)[0]>>>0;r.columns=new Array(a);for(let i=0;i<a;i++)r.columns[i]=Zf(e,t);return i.featureTables.push(r),[i,n]}function qf(e,t,i,r,n,a,s=!1){let o=t.scalarType;if(!o||"logicalType"!==o.type||0!==o.logicalType)throw new Error(`ID column must be a logical ID scalar type: ${r}`);let l=o.longID?6:4,h="number"==typeof a?void 0:a,u=sf(n,a,e,i,6===l?"int64":"int32");if(4===l)switch(u){case Up.FLAT:{let t=Kp(e,i,n,0,h);return new np(r,t,a)}case Up.SEQUENCE:{let t=tf(e,i,n);return new op(r,t[0],t[1],n.numRleValues)}case Up.CONST:{let t=ef(e,i,n);return new lp(r,t,a,!1)}}switch(u){case Up.FLAT:{if(s){let t=function(e,t){switch(t.logicalLevelTechnique1){case cp.DELTA:return t.logicalLevelTechnique2===cp.RLE&&(e=Rp(e,t.runs,t.numRleValues)),function(e){e[0]=Lp(e[0]);let t=e.length/4*4,i=1;if(t>=4)for(;i<t-4;i+=4){let t=e[i+1],r=e[i+2],n=e[i+3];e[i]=Lp(e[i])+e[i-1],e[i+1]=Lp(t)+e[i],e[i+2]=Lp(r)+e[i+1],e[i+3]=Lp(n)+e[i+2]}for(;i!==e.length;++i)e[i]=Lp(e[i])+e[i-1]}(e),e;case cp.RLE:return Rp(e,(i=t).runs,i.numRleValues);case cp.NONE:return e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}var i}(function(e,t,i){let r=new Float64Array(i);for(let n=0;n<i;n++)r[n]=Mp(e,t);return r}(e,i,(c=n).numValues),c);return new ap(r,t,a)}let t=nf(e,i,n,h);return new of(r,t,a)}case Up.SEQUENCE:{let t=rf(e,i,n);return new lf(r,t[0],t[1],n.numRleValues)}case Up.CONST:{let t=af(e,i,n);return new Pf(r,t,a,!1)}}var c;throw new Error("Vector type not supported for id column.")}class Wf{constructor(e,t){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},null===(i=this._featureData.geometry)||void 0===i?void 0:i.type){case Zp.POINT:case Zp.MULTIPOINT:this.type=1;break;case Zp.LINESTRING:case Zp.MULTILINESTRING:this.type=2;break;case Zp.POLYGON:case Zp.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let e of t)r.push(new i(e.x,e.y));e.push(r)}return e}}class Hf{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Wf(this.features[e],this.extent)}}class Xf{constructor(e){this.layers={};let t=function(e,t,i=!0){let r=new up(0),n=[];for(;r.get()<e.length;){let t=Pp(e,r,1)[0]>>>0,s=r.get()+t;if(s>e.length)throw new Error(`Block overruns tile: ${s} > ${e.length}`);if(Pp(e,r,1)[0]>>>0!=1){r.set(s);continue}let[o,l]=$f(e,r),h=o.featureTables[0],u=null,c=null,d=[],p=0;for(let t of h.columns){let n=t.name;if("scalarType"===(a=t).type&&"logicalType"===a.scalarType?.type&&0===a.scalarType.logicalType){let a=null;if(t.nullable){let t=Wp(e,r),i=r.get(),n=Cf(e,t.numValues,t.byteLength,r);r.set(i+t.byteLength),a=new Hp(n,t.numValues)}let s=Wp(e,r);p=a?a.size():s.decompressedCount,u=qf(e,t,r,n,s,a??p,i)}else if(jf(t)){let t=Pp(e,r,1)[0];if(0===p){let t=r.get();p=Wp(e,r).decompressedCount,r.set(t)}c=bf(e,t,r,p)}else{let i=Bf(t)?Pp(e,r,1)[0]:1;if(0===i)continue;let n=Df(e,r,t,i,p);if(n)if(Array.isArray(n))for(let e of n)d.push(e);else d.push(n)}}let f=new hp(h.name,c,u,d,l);n.push(f),r.set(s)}var a;return n}(new Uint8Array(e));this.layers=t.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new Hf(t)}),{})}}class Yf{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(let r of t){let t=[];for(let e of r)t.push(new i(e[0],e[1]));e.push(t)}return e}}let Kf="_geojsonTileLayer";function Jf(e,t,i=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,Qf,r);let n=r.keys;for(let e of n)t.writeStringField(3,e);let a=r.values;for(let e of a)t.writeMessage(4,nm,e)}function Qf(e,t){if(!e.feature)return;let i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,em,e),t.writeVarintField(3,i.type),t.writeMessage(4,rm,i)}function em(e,t){for(let i in e.feature?.properties){let r=e.feature.properties[i],n=e.keycache[i];if(null==r)continue;void 0===n&&(e.keys.push(i),n=e.keys.length-1,e.keycache[i]=n),t.writeVarint(n),"string"!=typeof r&&"boolean"!=typeof r&&"number"!=typeof r&&(r=e.jsonPrefix+JSON.stringify(r));let a=typeof r+":"+r,s=e.valuecache[a];void 0===s&&(e.values.push(r),s=e.values.length-1,e.valuecache[a]=s),t.writeVarint(s)}}function tm(e,t){return(t<<3)+(7&e)}function im(e){return e<<1^e>>31}function rm(e,t){let i=e.loadGeometry(),r=e.type,n=0,a=0;for(let s of i){let i=1;1===r&&(i=s.length),t.writeVarint(tm(1,i));let o=3===r?s.length-1:s.length;for(let e=0;e<o;e++){1===e&&1!==r&&t.writeVarint(tm(2,o-1));let i=s[e].x-n,l=s[e].y-a;t.writeVarint(im(i)),t.writeVarint(im(l)),n+=i,a+=l}3===e.type&&t.writeVarint(tm(7,1))}}function nm(e,t){let i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}class am{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new da(M,16,0),this.grid3D=new da(M,16,0),this.featureIndexArray=new Zs,this.promoteId=t}insert(e,t,i,r,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let o=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)t[0]=Math.min(t[0],i.x),t[1]=Math.min(t[1],i.y),t[2]=Math.max(t[2],i.x),t[3]=Math.max(t[3],i.y);t[0]<M&&t[1]<M&&t[2]>=0&&t[3]>=0&&o.insert(s,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Vh(new jc(this.rawTileData)).layers:new Xf(this.rawTileData).layers,this.sourceLayerCoder=new ep(this.vtLayers?Object.keys(this.vtLayers).sort():[Kf])),this.vtLayers}query(e,t,r,n){this.loadVTLayers();let a=e.params,s=M/e.tileSize/e.scale,o=mn(a.filter,a.globalState),l=e.queryGeometry,h=e.queryPadding*s,u=Qd.fromPoints(l),c=this.grid.query(u.minX-h,u.minY-h,u.maxX+h,u.maxY+h),d=Qd.fromPoints(e.cameraQueryGeometry).expandBy(h),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,(t,r,n,a)=>function(e,t,r,n,a){for(let i of e)if(t<=i.x&&r<=i.y&&n>=i.x&&a>=i.y)return!0;let s=[new i(t,r),new i(t,a),new i(n,a),new i(n,r)];if(e.length>2)for(let t of s)if(sl(e,t))return!0;for(let t=0;t<e.length-1;t++)if(ol(e[t],e[t+1],s))return!0;return!1}(e.cameraQueryGeometry,t-h,r-h,n+h,a+h));for(let e of p)c.push(e);c.sort(om);let f,m={};for(let i of c){if(i===f)continue;f=i;let h=this.featureIndexArray.get(i),u=null;this.loadMatchingFeature(m,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,o,a.layers,a.availableImages,t,r,n,(t,i,r)=>(u||(u=Zo(t)),i.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:r,geometry:u,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return m}loadMatchingFeature(e,t,i,r,n,a,s,o,l,h,u){let c=this.bucketLayerIDs[t];if(a&&!c.some(e=>a.has(e)))return;let d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(n.needGeometry){let e=$o(p,!0);if(!n.filter(new Ra(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Ra(this.tileID.overscaledZ),p))return;let f=this.getId(p,d);for(let t of c){if(a&&!a.has(t))continue;let i=o[t];if(!i)continue;let n={};f&&h&&(n=h.getState(i.sourceLayer||Kf,f));let c=B({},l[t]);c.paint=sm(c.paint,i.paint,p,n,s),c.layout=sm(c.layout,i.layout,p,n,s);let d=!u||u(p,i,n);if(!d)continue;let m=new tp(p,this.z,this.x,this.y,f);m.layer=c;let g=e[t];void 0===g&&(g=e[t]=[]),g.push({featureIndex:r,feature:m,intersectionZ:d})}}lookupSymbolFeatures(e,t,i,r,n,a,s,o){let l={};this.loadVTLayers();let h=mn(n.filterSpec,n.globalState);for(let n of e)this.loadMatchingFeature(l,i,r,n,h,a,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){var i;let r=e.id;return this.promoteId&&(r=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&!(null===(i=e.properties)||void 0===i)&&i.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function sm(e,t,i,r,n){return V(e,(e,a)=>{let s=t instanceof $a?t.get(a):null;return s?.evaluate?s.evaluate(i,r,n):s})}function om(e,t){return t-e}function lm(e,t,r,n,a){let s=[];for(let o of e){let e;for(let l=0;l<o.length-1;l++){let h=o[l],u=o[l+1];h.x<t&&u.x<t||(h.x<t?h=new i(t,h.y+(t-h.x)/(u.x-h.x)*(u.y-h.y))._round():u.x<t&&(u=new i(t,h.y+(t-h.x)/(u.x-h.x)*(u.y-h.y))._round()),h.y<r&&u.y<r||(h.y<r?h=new i(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round():u.y<r&&(u=new i(h.x+(r-h.y)/(u.y-h.y)*(u.x-h.x),r)._round()),h.x>=n&&u.x>=n||(h.x>=n?h=new i(n,h.y+(n-h.x)/(u.x-h.x)*(u.y-h.y))._round():u.x>=n&&(u=new i(n,h.y+(n-h.x)/(u.x-h.x)*(u.y-h.y))._round()),h.y>=a&&u.y>=a||(h.y>=a?h=new i(h.x+(a-h.y)/(u.y-h.y)*(u.x-h.x),a)._round():u.y>=a&&(u=new i(h.x+(a-h.y)/(u.y-h.y)*(u.x-h.x),a)._round()),e&&h.equals(e[e.length-1])||(e=[h],s.push(e)),e.push(u)))))}}return s}function hm(e,t,i,r,n){switch(t){case 1:return function(e,t,i,r){let n=[];for(let a of e)for(let e of a){let a=0===r?e.x:e.y;a>=t&&a<=i&&n.push([e])}return n}(e,i,r,n);case 2:return cm(e,i,r,n,!1);case 3:return cm(e,i,r,n,!0)}return[]}function um(e,t,r,n,a){let s=0===n?dm:pm,o=[],l=[];for(let i=0;i<e.length-1;i++){let h=e[i],u=e[i+1],c=0===n?h.x:h.y,d=0===n?u.x:u.y,p=!1;c<t?d>t&&o.push(s(h,u,t)):c>r?d<r&&o.push(s(h,u,r)):o.push(h),d<t&&c>=t&&(o.push(s(h,u,t)),p=!0),d>r&&c<=r&&(o.push(s(h,u,r)),p=!0),!a&&p&&(l.push(o),o=[])}let h=e.length-1,u=0===n?e[h].x:e[h].y;return u>=t&&u<=r&&o.push(e[h]),a&&o.length>0&&!o[0].equals(o[o.length-1])&&o.push(new i(o[0].x,o[0].y)),o.length>0&&l.push(o),l}function cm(e,t,i,r,n){let a=[];for(let s of e){let e=um(s,t,i,r,n);e.length>0&&a.push(...e)}return a}function dm(e,t,r){return new i(r,e.y+(r-e.x)/(t.x-e.x)*(t.y-e.y))}function pm(e,t,r){return new i(e.x+(r-e.y)/(t.y-e.y)*(t.x-e.x),r)}fa("FeatureIndex",am,{omit:["rawTileData","sourceLayerCoder"]});class fm extends i{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new fm(this.x,this.y,this.angle,this.segment)}}function mm(e,t,i,r,n){if(void 0===t.segment||0===i)return!0;let a=t,s=t.segment+1,o=0;for(;o>-i/2;){if(s--,s<0)return!1;o-=e[s].dist(a),a=e[s]}o+=e[s].dist(e[s+1]),s++;let l=[],h=0;for(;o<i/2;){let t=e[s],i=e[s+1];if(!i)return!1;let a=e[s-1].angleTo(t)-t.angleTo(i);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:a}),h+=a;o-l[0].distance>r;)h-=l.shift().angleDelta;if(h>n)return!1;s++,o+=t.dist(i)}return!0}function gm(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function _m(e,t,i){return e?.6*t*i:0}function ym(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function vm(e,t,i,r,n,a){let s=_m(i,n,a),o=ym(i,r)*a,l=0,h=gm(e)/2;for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1],a=r.dist(n);if(l+a>h){let u=(h-l)/a,c=_i.number(r.x,n.x,u),d=_i.number(r.y,n.y,u),p=new fm(c,d,n.angleTo(r),i);return p._round(),!s||mm(e,p,o,s,t)?p:void 0}l+=a}}function xm(e,t,i,r,n,a,s,o,l){let h=_m(r,a,s),u=ym(r,n),c=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-c<t/4&&(t=c+t/4),bm(e,d?t/2*o%t:(u/2+2*a)*s*o%t,t,h,i,c,d,!1,l)}function bm(e,t,i,r,n,a,s,o,l){let h=a/2,u=gm(e),c=0,d=t-i,p=[];for(let t=0;t<e.length-1;t++){let s=e[t],o=e[t+1],f=s.dist(o),m=o.angleTo(s);for(;d+i<c+f;){d+=i;let g=(d-c)/f,_=_i.number(s.x,o.x,g),y=_i.number(s.y,o.y,g);if(_>=0&&_<l&&y>=0&&y<l&&d-h>=0&&d+h<=u){let i=new fm(_,y,m,t);i._round(),r&&!mm(e,i,a,r,n)||p.push(i)}}c+=f}return o||p.length||s||(p=bm(e,c/2,i,r,n,a,s,!0,l)),p}function wm(e,t,r,n){let a=[],s=e.image,o=s.pixelRatio,l=s.paddedRect.w-2,h=s.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},c=s.stretchX||[[0,l]],d=s.stretchY||[[0,h]],p=(e,t)=>e+t[1]-t[0],f=c.reduce(p,0),m=d.reduce(p,0),g=l-f,_=h-m,y=0,v=f,x=0,b=m,w=0,T=g,S=0,I=_;if(s.content&&n){let t=s.content,i=t[2]-t[0],r=t[3]-t[1];(s.textFitWidth||s.textFitHeight)&&(u=pd(e)),y=Tm(c,0,t[0]),x=Tm(d,0,t[1]),v=Tm(c,t[0],t[2]),b=Tm(d,t[1],t[3]),w=t[0]-y,S=t[1]-x,T=i-v,I=r-b}let P=u.x1,C=u.y1,E=u.x2-P,M=u.y2-C,A=(e,n,a,l)=>{let h=Im(e.stretch-y,v,E,P),u=Pm(e.fixed-w,T,e.stretch,f),c=Im(n.stretch-x,b,M,C),d=Pm(n.fixed-S,I,n.stretch,m),p=Im(a.stretch-y,v,E,P),g=Pm(a.fixed-w,T,a.stretch,f),_=Im(l.stretch-x,b,M,C),A=Pm(l.fixed-S,I,l.stretch,m),k=new i(h,c),L=new i(p,c),F=new i(p,_),D=new i(h,_),R=new i(u/o,d/o),z=new i(g/o,A/o),N=t*Math.PI/180;if(N){let e=Math.sin(N),t=Math.cos(N),i=[t,-e,e,t];k._matMult(i),L._matMult(i),D._matMult(i),F._matMult(i)}let O=e.stretch+e.fixed,B=n.stretch+n.fixed;return{tl:k,tr:L,bl:D,br:F,tex:{x:s.paddedRect.x+1+O,y:s.paddedRect.y+1+B,w:a.stretch+a.fixed-O,h:l.stretch+l.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:z,minFontScaleX:T/o/E,minFontScaleY:I/o/M,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){let e=Sm(c,g,f),t=Sm(d,_,m);for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)a.push(A(r,t[e],n,t[e+1]))}}else a.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:h+1}));return a}function Tm(e,t,i){let r=0;for(let n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function Sm(e,t,i){let r=[{fixed:-1,stretch:0}];for(let[t,i]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+1,stretch:i}),r}function Im(e,t,i,r){return e/t*i+r}function Pm(e,t,i,r){return e-t*i/r}fa("Anchor",fm);class Cm{constructor(e,t,r,n,a,s,o,l,h,u){var c;if(this.boxStartIndex=e.length,h){let e=s.top,t=s.bottom,i=s.collisionPadding;i&&(e-=i[1],t+=i[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let h=null!==(c=s.image)&&void 0!==c&&c.content&&(s.image.textFitWidth||s.image.textFitHeight)?pd(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};h.y1=h.y1*o-l[0],h.y2=h.y2*o+l[2],h.x1=h.x1*o-l[3],h.x2=h.x2*o+l[1];let d=s.collisionPadding;if(d&&(h.x1-=d[0]*o,h.y1-=d[1]*o,h.x2+=d[2]*o,h.y2+=d[3]*o),u){let e=new i(h.x1,h.y1),t=new i(h.x2,h.y1),r=new i(h.x1,h.y2),n=new i(h.x2,h.y2),a=u*Math.PI/180;e._rotate(a),t._rotate(a),r._rotate(a),n._rotate(a),h.x1=Math.min(e.x,t.x,r.x,n.x),h.x2=Math.max(e.x,t.x,r.x,n.x),h.y1=Math.min(e.y,t.y,r.y,n.y),h.y2=Math.max(e.y,t.y,r.y,n.y)}e.emplaceBack(t.x,t.y,h.x1,h.y1,h.x2,h.y2,r,n,a)}this.boxEndIndex=e.length}}class Em{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)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 r=1+(e<<1),a=r+1;if(a<this.length&&i(t[a],t[r])<0&&(r=a),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}function Mm(e,t=1){let r=Qd.fromPoints(e[0]),n=Math.min(r.width(),r.height()),a=n/2,s=new Em([],Am),{minX:o,minY:l,maxX:h,maxY:u}=r;if(0===n)return new i(o,l);for(let t=o;t<h;t+=n)for(let i=l;i<u;i+=n)s.push(new km(t+a,i+a,a,e));let c=function(e){let t=0,i=0,r=0,n=e[0];for(let e=0,a=n.length,s=a-1;e<a;s=e++){let a=n[e],o=n[s],l=a.x*o.y-o.x*a.y;i+=(a.x+o.x)*l,r+=(a.y+o.y)*l,t+=3*l}return new km(i/t,r/t,0,e)}(e),d=c;for(;s.length;){let i=s.pop();(i.d>d.d||!d.d)&&(d=i),i.max-d.d<=t||(a=i.h/2,s.push(new km(i.p.x-a,i.p.y-a,a,e)),s.push(new km(i.p.x+a,i.p.y-a,a,e)),s.push(new km(i.p.x-a,i.p.y+a,a,e)),s.push(new km(i.p.x+a,i.p.y+a,a,e)))}return c.d>0&&d.d-c.d<=t?c.p:d.p}function Am(e,t){return t.max-e.max}class km{constructor(e,t,r,n){this.p=new i(e,t),this.h=r,this.d=function(e,t){let i=!1,r=1/0;for(let n of t)for(let t=0,a=n.length,s=a-1;t<a;s=t++){let a=n[t],o=n[s];a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(i=!i),r=Math.min(r,nl(e,a,o))}return(i?1:-1)*Math.sqrt(r)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}var Lm;e.aM=void 0,(Lm=e.aM||(e.aM={}))[Lm.center=1]="center",Lm[Lm.left=2]="left",Lm[Lm.right=3]="right",Lm[Lm.top=4]="top",Lm[Lm.bottom=5]="bottom",Lm[Lm["top-left"]=6]="top-left",Lm[Lm["top-right"]=7]="top-right",Lm[Lm["bottom-left"]=8]="bottom-left",Lm[Lm["bottom-right"]=9]="bottom-right";let Fm=Number.POSITIVE_INFINITY;function Dm(e,t){return t[1]!==Fm?function(e,t,i){let r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);let n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=n-7;break;case"bottom-right":case"bottom-left":r=7-n;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function Rm(e,t,i){var r;let n=e.layout,a=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(t,{},i);if(a){let e=a.values,t=[];for(let i=0;i<e.length;i+=2){let r=t[i]=e[i],n=e[i+1].map(e=>e*Cc);r.startsWith("top")?n[1]-=7:r.startsWith("bottom")&&(n[1]+=7),t[i+1]=n}return new Bt(t)}let s=n.get("text-variable-anchor");if(s){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},i)*Cc,Fm]:n.get("text-offset").evaluate(t,{},i).map(e=>e*Cc);let a=[];for(let e of s)a.push(e,Dm(e,r));return new Bt(a)}return null}function zm(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"}function Nm(t,i,r,n,a,s,o,l,h,u,c,d){let p=s.textMaxSize.evaluate(i,{});void 0===p&&(p=o);let f,m=t.layers[0].layout,g=m.get("icon-offset").evaluate(i,{},c),_=Bm(r.horizontal),y=o/24,v=t.tilePixelRatio*y,x=t.tilePixelRatio*p/24,b=t.tilePixelRatio*l,w=t.tilePixelRatio*m.get("symbol-spacing"),T=m.get("text-padding")*t.tilePixelRatio,S=function(e,t,i,r=1){let n=e.get("icon-padding").evaluate(t,{},i),a=n?.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}(m,i,c,t.tilePixelRatio),I=m.get("text-max-angle")/180*Math.PI,P="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),C="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),E=m.get("symbol-placement"),A=w/2,k=m.get("icon-text-fit");n&&"none"!==k&&(t.allowVerticalPlacement&&r.vertical&&(f=fd(n,r.vertical,k,m.get("icon-text-fit-padding"),g,y)),_&&(n=fd(n,_,k,m.get("icon-text-fit-padding"),g,y)));let L=c?d.line.getGranularityForZoomLevel(c.z):1,F=(l,d)=>{d.x<0||d.x>=M||d.y<0||d.y>=M||function(t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I){let P,C,E,M,A=t.addToLineVertexArray(i,r),k=0,L=0,F=0,D=0,R=-1,z=-1,N={},O=xo("");if(t.allowVerticalPlacement&&n.vertical){let e=l.layout.get("text-rotate").evaluate(b,{},S)+90;E=new Cm(h,i,u,c,d,n.vertical,p,f,m,e),o&&(M=new Cm(h,i,u,c,d,o,_,y,m,e))}if(a){let r=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),s=wm(a,r,T,n),p=o?wm(o,r,T,n):void 0;C=new Cm(h,i,u,c,d,a,_,y,!1,r),k=4*s.length;let f=t.iconSizeData,m=null;"source"===f.kind?(m=[md*l.layout.get("icon-size").evaluate(b,{})],m[0]>gd&&$(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[md*w.compositeIconSizes[0].evaluate(b,{},S),md*w.compositeIconSizes[1].evaluate(b,{},S)],(m[0]>gd||m[1]>gd)&&$(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,s,m,x,v,b,e.ax.none,i,A.lineStartIndex,A.lineLength,-1,S),R=t.icon.placedSymbolArray.length-1,p&&(L=4*p.length,t.addSymbols(t.icon,p,m,x,v,b,e.ax.vertical,i,A.lineStartIndex,A.lineLength,-1,S),z=t.icon.placedSymbolArray.length-1)}let B=Object.keys(n.horizontal);for(let r of B){let a=n.horizontal[r];if(!P){O=xo(a.text);let e=l.layout.get("text-rotate").evaluate(b,{},S);P=new Cm(h,i,u,c,d,a,p,f,m,e)}let o=1===a.positionedLines.length;if(F+=Om(t,i,a,s,l,m,b,g,A,n.vertical?e.ax.horizontal:e.ax.horizontalOnly,o?B:[r],N,R,w,S),o)break}n.vertical&&(D+=Om(t,i,n.vertical,s,l,m,b,g,A,e.ax.vertical,["vertical"],N,z,w,S));let j=P?P.boxStartIndex:t.collisionBoxArray.length,V=P?P.boxEndIndex:t.collisionBoxArray.length,G=E?E.boxStartIndex:t.collisionBoxArray.length,U=E?E.boxEndIndex:t.collisionBoxArray.length,Z=C?C.boxStartIndex:t.collisionBoxArray.length,q=C?C.boxEndIndex:t.collisionBoxArray.length,W=M?M.boxStartIndex:t.collisionBoxArray.length,H=M?M.boxEndIndex:t.collisionBoxArray.length,X=-1,Y=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;X=Y(P,X),X=Y(E,X),X=Y(C,X),X=Y(M,X);let K=X>-1?1:0;K&&(X*=I/Cc),t.glyphOffsetArray.length>=Cd.MAX_GLYPHS&&$("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let J=Rm(l,b,S),[Q,ee]=function(t,i){let r=t.length,n=i?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let r=n[i+1];t.emplaceBack(e.aM[n[i]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,J);t.symbolInstances.emplaceBack(i.x,i.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical||-1,R,z,O,j,V,G,U,Z,q,W,H,u,F,D,k,L,K,0,p,X,Q,ee)}(t,d,l,r,n,a,f,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,v,[T,T,T,T],P,h,b,S,C,g,i,s,u,c,o)};if("line"===E)for(let e of lm(i.geometry,0,0,M,M)){let i=Ih(e,L),a=xm(i,w,I,r.vertical||_,n,24,x,t.overscaling,M);for(let e of a)_&&jm(t,_.text,A,e)||F(i,e)}else if("line-center"===E){for(let e of i.geometry)if(e.length>1){let t=Ih(e,L),i=vm(t,I,r.vertical||_,n,24,x);i&&F(t,i)}}else if("Polygon"===i.type)for(let e of ir(i.geometry,0)){let t=Mm(e,16);F(Ih(e[0],L,!0),new fm(t.x,t.y,0))}else if("LineString"===i.type)for(let e of i.geometry){let t=Ih(e,L);F(t,new fm(t[0].x,t[0].y,0))}else if("Point"===i.type)for(let e of i.geometry)for(let t of e)F([t],new fm(t.x,t.y,0))}function Om(e,t,r,n,a,s,o,l,h,u,c,d,p,f,m){let g=function(e,t,r,n,a,s,o,l){let h=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let n of e.positionedGlyphs){if(!n.rect)continue;let s=n.rect||{},c=4,d=!0,p=1,f=0,m=(a||l)&&n.vertical,g=n.metrics.advance*n.scale/2;if(l&&t.verticalizable&&(f=e.lineOffset/2-(n.imageName?-(Cc-n.metrics.width*n.scale)/2:(n.scale-1)*Cc)),n.imageName){let e=o[n.imageName];d=e.sdf,p=e.pixelRatio,c=1/p}let _=a?[n.x+g,n.y]:[0,0],y=a?[0,0]:[n.x+g+r[0],n.y+r[1]-f],v=[0,0];m&&(v=y,y=[0,0]);let x=n.metrics.isDoubleResolution?2:1,b=(n.metrics.left-c)*n.scale-g+y[0],w=(-n.metrics.top-c)*n.scale+y[1],T=b+s.w/x*n.scale/p,S=w+s.h/x*n.scale/p,I=new i(b,w),P=new i(T,w),C=new i(b,S),E=new i(T,S);if(m){let e=new i(-g,g- -17),t=-Math.PI/2,r=12-g,a=new i(22-r,-(n.imageName?r:0)),s=new i(...v);I._rotateAround(t,e)._add(a)._add(s),P._rotateAround(t,e)._add(a)._add(s),C._rotateAround(t,e)._add(a)._add(s),E._rotateAround(t,e)._add(a)._add(s)}if(h){let e=Math.sin(h),t=Math.cos(h),i=[t,-e,e,t];I._matMult(i),P._matMult(i),C._matMult(i),E._matMult(i)}let M=new i(0,0),A=new i(0,0);u.push({tl:I,tr:P,bl:C,br:E,tex:s,writingMode:t.writingMode,glyphOffset:_,sectionIndex:n.sectionIndex,isSDF:d,pixelOffsetTL:M,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,l,a,s,o,n,e.allowVerticalPlacement),_=e.textSizeData,y=null;"source"===_.kind?(y=[md*a.layout.get("text-size").evaluate(o,{})],y[0]>gd&&$(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[md*f.compositeTextSizes[0].evaluate(o,{},m),md*f.compositeTextSizes[1].evaluate(o,{},m)],(y[0]>gd||y[1]>gd)&&$(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,l,s,o,u,t,h.lineStartIndex,h.lineLength,p,m);for(let t of c)d[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function Bm(e){for(let t in e)return e[t];return null}function jm(e,t,i,r){let n=e.compareText;if(t in n){let e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}e.$=oe,e.A=p,e.B=Na,e.C=ca,e.D=qa,e.E=xe,e.F=sa,e.G=function([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)}},e.H=_i,e.I=td,e.J=Ra,e.K=la,e.L=function(e){if(null==H){let t=e.navigator?e.navigator.userAgent:null;H=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return H},e.M=ce,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Rd(()=>this.process()),this.subscription=ee(this.target,"message",e=>this.receive(e),!1),this.globalScope=W(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((i,r)=>{let n=Math.round(1e18*Math.random()).toString(36).substring(0,10),a=t?ee(t.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let t={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)},zd):null;this.resolveRejects[n]={resolve:e=>{a?.unsubscribe(),i(e)},reject:e=>{a?.unsubscribe(),r(e)}};let s=[],o=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:ya(e.data,s)});this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,i=t.id,r=["file://","resource://android","null"],n=[t.origin,location.origin],a=t.origin===location.origin,s=n.some(e=>r.includes(e));if((a||s)&&(!t.targetMapId||this.mapId===t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[i];let e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(W(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)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)}processTask(e,i){return t(this,void 0,void 0,function*(){if("<response>"===i.type){let t=this.resolveRejects[e];return delete this.resolveRejects[e],t?void(i.error?t.reject(k(va(i.error))):t.resolve(va(i.data))):void 0}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let t=va(i.data),r=new AbortController;this.abortControllers[e]=r;try{let n=yield this.messageHandlers[i.type](i.sourceMapId,t,r);this.completeTask(e,null,n)}catch(t){this.completeTask(e,k(t))}})}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?ya(t):null,data:ya(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new p(16);return p!=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},e.P=i,e.Q=function(e,t,i){var r,n,a,s,o,l,h,u,c,d,p,f,m=i[0],g=i[1],_=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(n=t[1],a=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=a,e[3]=s,e[4]=o,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e[9]=d,e[10]=p,e[11]=f,e[12]=r*m+o*g+c*_+t[12],e[13]=n*m+l*g+d*_+t[13],e[14]=a*m+h*g+p*_+t[14],e[15]=s*m+u*g+f*_+t[15]),e},e.R=Cl,e.S=function(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},e.T=Ol,e.U=function(e,t,i){var r=t[0],n=t[1],a=t[2],s=t[3],o=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*r+x*o+b*c+w*m,e[1]=v*n+x*l+b*d+w*g,e[2]=v*a+x*h+b*p+w*_,e[3]=v*s+x*u+b*f+w*y,e[4]=(v=i[4])*r+(x=i[5])*o+(b=i[6])*c+(w=i[7])*m,e[5]=v*n+x*l+b*d+w*g,e[6]=v*a+x*h+b*p+w*_,e[7]=v*s+x*u+b*f+w*y,e[8]=(v=i[8])*r+(x=i[9])*o+(b=i[10])*c+(w=i[11])*m,e[9]=v*n+x*l+b*d+w*g,e[10]=v*a+x*h+b*p+w*_,e[11]=v*s+x*u+b*f+w*y,e[12]=(v=i[12])*r+(x=i[13])*o+(b=i[14])*c+(w=i[15])*m,e[13]=v*n+x*l+b*d+w*g,e[14]=v*a+x*h+b*p+w*_,e[15]=v*s+x*u+b*f+w*y,e},e.V=function(e,t){let i={};for(let r of t)r in e&&(i[r]=e[r]);return i},e.W=Od,e.X=O,e.Y=Gd,e.Z=Vd,e._=t,e.a=se,e.a$=function(e){var t=new p(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=u,e.a1=c,e.a2=Q,e.a3=Kd,e.a4=Zd,e.a5=$d,e.a6=M,e.a7=Wd,e.a8=Qd,e.a9=25,e.aA=function(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.aD=Td,e.aE=S,e.aF=function(e,t,r,n){let a=t.y-e.y,s=t.x-e.x,o=n.y-r.y,l=n.x-r.x,h=o*s-l*a;if(0===h)return null;let u=(l*(e.y-r.y)-o*(e.x-r.x))/h;return new i(e.x+u*s,e.y+u*a)},e.aG=lm,e.aH=Ko,e.aI=function(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]},e.aJ=Cc,e.aK=A,e.aL=function(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let a=n?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[n?i[0]:A(t,i[0],e.zoom),n?i[1]:A(t,i[1],e.zoom)]},e.aN=yd,e.aO=zm,e.aP=ad,e.aQ=e=>"symbol"===e.type,e.aR=tu,e.aS=os,e.aT=yh,e.aU=$s,e.aV=lo,e.aW=no,e.aX=ie,e.aY=qd,e.aZ=x,e.a_=v,e.aa=Xd,e.ab=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(let i of e){let e=window.document.createElement("source");me(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}})},e.ac=Fe,e.ad=function(){return j++},e.ae=Ds,e.af=Cd,e.ag=Kf,e.ah=mn,e.ai=$o,e.aj=tp,e.ak=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,r,n)=>{let a=r||n;return t[i]=!a||a.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.al=N,e.am=85.051129,e.an=te,e.ao=function(e){return Math.pow(2,e)},e.ap=m,e.aq=Ud,e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],i=e[1];return t*t+i*i},e.at=function(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),i=1/0,r=-1/0,n=1/0,a=-1/0,s=[];for(let o of e){let{x:e,y:l,z:h}=o.canonical,u=Math.pow(2,t-h),c=e*u,d=l*u;s.push({id:o,x:c,y:d}),c<i&&(i=c),c>r&&(r=c),d<n&&(n=d),d>a&&(a=d)}let o=new Set;for(let e of s)e.x!==i&&e.x!==r&&e.y!==n&&e.y!==a||o.add(e.id);return o},e.au=function(e,t){let i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.av=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;void 0===this.data[r]&&(this.data[r]=[]);let n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout(()=>{this.remove(e,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}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),0===this.data[e].length&&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=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&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 e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}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 e of t)this.remove(e.value.tileID,e)}},e.aw=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){let{interpolationType:n,minZoom:a,maxZoom:s}=e,o=n?N(mi.interpolationFactor(n,t,a,s),0,1):0;"camera"===e.kind?r=_i.number(e.minSize,e.maxSize,o):i=o}return{uSizeT:i,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/md:"composite"===e.kind?_i.number(r/md,n/md,i):t},e.az=C,e.b=X,e.b$=Eo,e.b0=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.b1=function(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},e.b2=b,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=function(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},e.b5=_,e.b6=function(e,t,i){let r=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return 0===r?null:(-(e[0]*i[0]+e[1]*i[1]+e[2]*i[2])-i[3])/r},e.b7=T,e.b8=function(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},e.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=P,e.bB=function(e,t,i){var r=i[0],n=i[1],a=i[2],s=i[3],o=t[0],l=t[1],h=t[2],u=n*h-a*l,c=a*o-r*h,d=r*l-n*o;return e[0]=o+s*(u+=u)+n*(d+=d)-a*(c+=c),e[1]=l+s*c+a*u-r*d,e[2]=h+s*d+r*c-n*u,e},e.bC=function(e,t,i){let r=(n=[e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]])[0]*((u=n[8])*(s=n[4])-(o=n[5])*(h=n[7]))+n[1]*(-u*(a=n[3])+o*(l=n[6]))+n[2]*(h*a-s*l);var n,a,s,o,l,h,u;if(0===r)return null;let c=b([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),d=b([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),p=b([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),f=x([],c,-e[3]);return v(f,f,x([],d,-t[3])),v(f,f,x([],p,-i[3])),x(f,f,1/r),f},e.bD=Nd,e.bE=function(){return new Float64Array(4)},e.bF=function(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},e.bG=function(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},e.bH=function(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},e.bI=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],s=t[1],o=t[2],l=t[3],h=t[8],u=t[9],c=t[10],d=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-h*r,e[1]=s*n-u*r,e[2]=o*n-c*r,e[3]=l*n-d*r,e[8]=a*r+h*n,e[9]=s*r+u*n,e[10]=o*r+c*n,e[11]=l*r+d*n,e},e.bJ=function(e,t){let i=L(e,360),r=L(t,360),n=r-i,a=r>i?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(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 s=Math.acos(e*i+t*r);return-t*i+e*r>0?s:-s},e.bM=function(e,t){let i=L(e,2*Math.PI),r=L(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bN=function(){let e={},t=be.$version;for(let i in be.$root){let r=be.$root[i];if(r.required){let n=null;n="version"===i?t:"array"===r.type?[]:{},null!=n&&(e[i]=n)}}return e},e.bO=pe,e.bP=xa,e.bQ=function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i||Object.keys(t).length!==Object.keys(i).length)return!1;for(let r in t)if(!e(t[r],i[r]))return!1;return!0}return t===i},e.bR=le,e.bS=function(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]=Te(e[i],t[e[i].ref]));return e},e.bT=function(e,t){if("custom"===e.type)return new Dd(e,t);switch(e.type){case"background":return new Fd(e,t);case"circle":return new vl(e,t);case"color-relief":return new Vl(e,t);case"fill":return new kh(e,t);case"fill-extrusion":return new Kh(e,t);case"heatmap":return new Ll(e,t);case"hillshade":return new Dl(e,t);case"line":return new yc(e,t);case"raster":return new rs(e,t);case"symbol":return new Ad(e,t)}},e.bU=e=>"raster"===e.type,e.bV=U,e.bW=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Se(e.version,t.version))return[{command:"setStyle",args:[t]}];Se(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Se(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Se(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Se(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Se(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Se(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Se(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Se(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Se(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Se(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Se(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Se(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Se(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Se(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||Ce(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?Se(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Me(e,t,n)?Ie(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):Ee(n,t,i,r)):Pe(n,t,i))}(e.sources,t.sources,n,r);let a=[];e.layers&&e.layers.forEach(e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):a.push(e)}),i=i.concat(n),function(e,t,i){t=t||[];let r,n,a,s,o,l=(e=e||[]).map(ke),h=t.map(ke),u=e.reduce(Le,{}),c=t.reduce(Le,{}),d=l.slice(),p=Object.create(null);for(let e=0,t=0;e<l.length;e++)r=l[e],Object.prototype.hasOwnProperty.call(c,r)?t++:(Ie(i,{command:"removeLayer",args:[r]}),d.splice(d.indexOf(r,t),1));for(let e=0,t=0;e<h.length;e++)r=h[h.length-1-e],d[d.length-1-e]!==r&&(Object.prototype.hasOwnProperty.call(u,r)?(Ie(i,{command:"removeLayer",args:[r]}),d.splice(d.lastIndexOf(r,d.length-t),1)):t++,s=d[d.length-e],Ie(i,{command:"addLayer",args:[c[r],s]}),d.splice(d.length-e,0,r),p[r]=!0);for(let e=0;e<h.length;e++)if(r=h[e],n=u[r],a=c[r],!p[r]&&!Se(n,a))if(Se(n.source,a.source)&&Se(n["source-layer"],a["source-layer"])&&Se(n.type,a.type)){for(o in Ae(n.layout,a.layout,i,r,null,"setLayoutProperty"),Ae(n.paint,a.paint,i,r,null,"setPaintProperty"),Se(n.filter,a.filter)||Ie(i,{command:"setFilter",args:[r,a.filter]}),Se(n.minzoom,a.minzoom)&&Se(n.maxzoom,a.maxzoom)||Ie(i,{command:"setLayerZoomRange",args:[r,a.minzoom,a.maxzoom]}),n)Object.prototype.hasOwnProperty.call(n,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?Ae(n[o],a[o],i,r,o.slice(6),"setPaintProperty"):Se(n[o],a[o])||Ie(i,{command:"setLayerProperty",args:[r,o,a[o]]}));for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&!Object.prototype.hasOwnProperty.call(n,o)&&"layout"!==o&&"paint"!==o&&"filter"!==o&&"metadata"!==o&&"minzoom"!==o&&"maxzoom"!==o&&(0===o.indexOf("paint.")?Ae(n[o],a[o],i,r,o.slice(6),"setPaintProperty"):Se(n[o],a[o])||Ie(i,{command:"setLayerProperty",args:[r,o,a[o]]}))}else Ie(i,{command:"removeLayer",args:[r]}),s=d[d.lastIndexOf(r)+1],Ie(i,{command:"addLayer",args:[a,s]})}(a,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i},e.bX=function(e){let t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=V,e.bZ=G,e.b_=class extends Io{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=Yd,e.bb=Jd,e.bc=function(e,t,i,r,n){var a=1/Math.tan(t/2);if(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,null!=n&&n!==1/0){var s=1/(r-n);e[10]=(n+r)*s,e[14]=2*n*r*s}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new p(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},e.be=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],s=t[1],o=t[2],l=t[3],h=t[4],u=t[5],c=t[6],d=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+h*r,e[1]=s*n+u*r,e[2]=o*n+c*r,e[3]=l*n+d*r,e[4]=h*n-a*r,e[5]=u*n-s*r,e[6]=c*n-o*r,e[7]=d*n-l*r,e},e.bf=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],s=t[5],o=t[6],l=t[7],h=t[8],u=t[9],c=t[10],d=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+h*r,e[5]=s*n+u*r,e[6]=o*n+c*r,e[7]=l*n+d*r,e[8]=h*n-a*r,e[9]=u*n-s*r,e[10]=c*n-o*r,e[11]=d*n-l*r,e},e.bg=function(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4],o=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=i*o-r*s,v=i*l-n*s,x=i*h-a*s,b=r*l-n*o,w=r*h-a*o,T=n*h-a*l,S=u*m-c*f,I=u*g-d*f,P=u*_-p*f,C=c*g-d*m,E=c*_-p*m,M=d*_-p*g,A=y*M-v*E+x*C+b*P-w*I+T*S;return A?(e[0]=(o*M-l*E+h*C)*(A=1/A),e[1]=(n*E-r*M-a*C)*A,e[2]=(m*T-g*w+_*b)*A,e[3]=(d*w-c*T-p*b)*A,e[4]=(l*P-s*M-h*I)*A,e[5]=(i*M-n*P+a*I)*A,e[6]=(g*x-f*T-_*v)*A,e[7]=(u*T-d*x+p*v)*A,e[8]=(s*E-o*P+h*S)*A,e[9]=(r*P-i*E-a*S)*A,e[10]=(f*w-m*x+_*y)*A,e[11]=(c*x-u*w-p*y)*A,e[12]=(o*I-s*C-l*S)*A,e[13]=(i*C-r*I+n*S)*A,e[14]=(m*v-f*b-g*y)*A,e[15]=(u*b-c*v+d*y)*A,e):null},e.bh=function(){let e=new Float32Array(16);return m(e),e},e.bi=function(){let e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,i){let r=new Float64Array(4);return P(r,e,t-90,i),r},e.bl=function(e,t,i,r){var n,a,s,o,l,h=t[0],u=t[1],c=t[2],p=t[3],f=i[0],m=i[1],g=i[2],_=i[3];return(a=h*f+u*m+c*g+p*_)<0&&(a=-a,f=-f,m=-m,g=-g,_=-_),1-a>d?(n=Math.acos(a),s=Math.sin(n),o=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(o=1-r,l=r),e[0]=o*h+l*f,e[1]=o*u+l*m,e[2]=o*c+l*g,e[3]=o*p+l*_,e},e.bm=function(e){let t=new Float64Array(9);var i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y,v;c=(n=(r=e)[0])*(l=n+n),d=(a=r[1])*l,f=(s=r[2])*l,m=s*(h=a+a),_=(o=r[3])*l,y=o*h,v=o*(u=s+s),(i=t)[0]=1-(p=a*h)-(g=s*u),i[3]=d-v,i[6]=f+y,i[1]=d+v,i[4]=1-c-g,i[7]=m-_,i[2]=f-y,i[5]=m+_,i[8]=1-c-p;let x,b,w=ie(-Math.asin(N(t[2],-1,1)));return Math.hypot(t[5],t[8])<.001?(x=0,b=-ie(Math.atan2(t[3],t[4]))):(x=ie(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),b=ie(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:w+90,bearing:b}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=Mt,e.bp=Po,e.bq=bh,e.br=wh,e.bs=_h,e.bt=F,e.bu=D,e.bv=Vt,e.bw=function(e,t,i,r,n){return F(r,n,N((e-t)/(i-t),0,1))},e.bx=function(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},e.by=L,e.bz=function(){return new Float64Array(3)},e.c=he,e.c$=an,e.c0=class extends Io{constructor(e,t){super(e,t),this.current=Mo}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=Co,e.c2=class extends Io{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]))}},e.c3=class extends Io{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]))}},e.c4=f,e.c5=function(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},e.c6=function(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},e.c7=function(e,t,i,r,n,a,s){var o=1/(t-i),l=1/(r-n),h=1/(a-s);return e[0]=-2*o,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*h,e[11]=0,e[12]=(t+i)*o,e[13]=(n+r)*l,e[14]=(s+a)*h,e[15]=1,e},e.c8=class extends Io{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);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)}}},e.c9=class extends Io{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)}}},e.cA=function(e,t){return re[t]&&"touches"in e},e.cB=function(e){return re[e]||ne[e]},e.cC=function(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},e.cD=function(e,t){let{x:i,y:r}=Wd.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.cE=function(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},e.cF=class extends us{},e.cG=de,e.cH=function(e,t){he.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete he.REGISTERED_PROTOCOLS[e]},e.cJ=function(e,t){let i={};for(let r=0;r<e.length;r++){let n=t&&t[e[r].id]||Sn(e[r]);t&&(t[e[r].id]=n);let a=i[n];a||(a=i[n]=[]),a.push(e[r])}let r=[];for(let e in i)r.push(i[e]);return r},e.cK=fa,e.cL=ep,e.cM=am,e.cN=id,e.cO=function(t){var i,r;t.bucket.createArrays(),t.bucket.tilePixelRatio=M/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let n=t.bucket.layers[0],a=n.layout,s=n._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new Ra(t.bucket.zoom+1),t.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new Ra(t.bucket.zoom+1),t.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new Ra(18))};if("composite"===t.bucket.textSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new Ra(e),t.canonical),s["text-size"].possiblyEvaluate(new Ra(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){let{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new Ra(e),t.canonical),s["icon-size"].possiblyEvaluate(new Ra(i),t.canonical)]}let l=a.get("text-line-height")*Cc,h="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement"),u=a.get("text-keep-upright"),c=a.get("text-size");for(let s of t.bucket.features){let d,p=a.get("text-font").evaluate(s,{},t.canonical).join(","),f=c.evaluate(s,{},t.canonical),m=o.layoutTextSize.evaluate(s,{},t.canonical),g=o.layoutIconSize.evaluate(s,{},t.canonical),_={horizontal:{},vertical:void 0},y=s.text,v=[0,0];if(y){let i=y.toString(),r=a.get("text-letter-spacing").evaluate(s,{},t.canonical)*Cc,o=Ia(i)?r:0,c=a.get("text-anchor").evaluate(s,{},t.canonical),d=Rm(n,s,t.canonical);if(!d){let e=a.get("text-radial-offset").evaluate(s,{},t.canonical);v=e?Dm(c,[e*Cc,Fm]):a.get("text-offset").evaluate(s,{},t.canonical).map(e=>e*Cc)}let g=h?"center":a.get("text-justify").evaluate(s,{},t.canonical),x="point"===a.get("symbol-placement")?a.get("text-max-width").evaluate(s,{},t.canonical)*Cc:1/0,b=()=>{t.bucket.allowVerticalPlacement&&Sa(i)&&(_.vertical=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,x,l,c,"left",o,v,e.ax.vertical,!0,m,f))};if(!h&&d){let i=new Set;if("auto"===g)for(let e=0;e<d.values.length;e+=2)i.add(zm(d.values[e]));else i.add(g);let r=!1;for(let n of i)if(!_.horizontal[n])if(r)_.horizontal[n]=_.horizontal[0];else{let i=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,x,l,"center",n,o,v,e.ax.horizontal,!1,m,f);i&&(_.horizontal[n]=i,r=1===i.positionedLines.length)}b()}else{"auto"===g&&(g=zm(c));let r=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,x,l,c,g,o,v,e.ax.horizontal,!1,m,f);r&&(_.horizontal[g]=r),b(),Sa(i)&&h&&u&&(_.vertical=nd(y,t.glyphMap,t.glyphPositions,t.imagePositions,p,x,l,c,g,o,v,e.ax.vertical,!1,m,f))}}let x=!1;if(null!==(i=s.icon)&&void 0!==i&&i.name){let e=t.imageMap[s.icon.name];e&&(d=dd(t.imagePositions[s.icon.name],a.get("icon-offset").evaluate(s,{},t.canonical),a.get("icon-anchor").evaluate(s,{},t.canonical)),x=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&$("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==a.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}let b=Bm(_.horizontal)||_.vertical;(r=t.bucket).iconsInText||(r.iconsInText=!!b&&b.iconsInText),(b||d)&&Nm(t.bucket,s,_,d,t.imageMap,o,m,g,v,x,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=Mh,e.cQ=qh,e.cR=fc,e.cS=function(e,t=""){let i=new jc;return function(e,t,i=""){for(let r in e.layers)t.writeMessage(3,(e,t)=>Jf(e,t,i),e.layers[r])}(e,i,t),i.finish()},e.cT=function(e,t,i,r,n,a){let s=hm(e,t,i,n,0);return s=hm(s,t,r,a,1),s},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=Vh,e.cW=jc,e.cX=Xf,e.cY=function(e,i,r,n,a){return t(this,void 0,void 0,function*(){if(c())try{return yield Q(e,i,r,n,a)}catch{}return function(e,t,i,r,n){let a=e.width,s=e.height;Y&&K||(Y=new OffscreenCanvas(a,s),K=Y.getContext("2d",{willReadFrequently:!0})),Y.width=a,Y.height=s,K.drawImage(e,0,0,a,s);let o=K.getImageData(t,i,r,n);return K.clearRect(0,0,a,s),o.data}(e,i,r,n,a)})},e.cZ=Bl,e.c_=class{constructor(e,t){this.layers={[Kf]:this},this.name=Kf,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Yf(this.features[e],this.extent)}},e.ca=class extends ws{},e.cb=Sc,e.cc=class extends Ss{},e.cd=kl,e.ce=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.cf=Ml,e.cg=function(e,t,i){var r=t[0],n=t[1],a=t[2],s=i[3]*r+i[7]*n+i[11]*a+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/s,e},e.ch=class extends cs{},e.ci=class extends ks{},e.cj=function(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.ck=function(e,t){var i=e[0],r=e[1],n=e[2],a=e[3],s=e[4],o=e[5],l=e[6],h=e[7],u=e[8],c=e[9],p=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=t[0],x=t[1],b=t[2],w=t[3],T=t[4],S=t[5],I=t[6],P=t[7],C=t[8],E=t[9],M=t[10],A=t[11],k=t[12],L=t[13],F=t[14],D=t[15];return Math.abs(i-v)<=d*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-x)<=d*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-b)<=d*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-w)<=d*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-T)<=d*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(o-S)<=d*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(l-I)<=d*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(h-P)<=d*Math.max(1,Math.abs(h),Math.abs(P))&&Math.abs(u-C)<=d*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-E)<=d*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-M)<=d*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(f-A)<=d*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-k)<=d*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(g-L)<=d*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(_-F)<=d*Math.max(1,Math.abs(_),Math.abs(F))&&Math.abs(y-D)<=d*Math.max(1,Math.abs(y),Math.abs(D))},e.cl=function(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},e.cm=e=>"circle"===e.type,e.cn=e=>"heatmap"===e.type,e.co=e=>"line"===e.type,e.cp=e=>"fill"===e.type,e.cq=e=>"fill-extrusion"===e.type,e.cr=e=>"hillshade"===e.type,e.cs=e=>"color-relief"===e.type,e.ct=e=>"background"===e.type,e.cu=e=>"custom"===e.type,e.cv=R,e.cw=function(e,t,i){if(t<=0)return e;let r=1/t;return void 0===i||Math.abs(i)<1e-10?Math.round(e*r)/r:(i>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,i){let r=E(t.x-i.x,t.y-i.y),n=E(e.x-i.x,e.y-i.y);var a,s;return ie(Math.atan2(r[0]*n[1]-r[1]*n[0],(a=r)[0]*(s=n)[0]+a[1]*s[1]))},e.cy=z,e.cz=function(e,t){var i;if(!ne[t])return!1;let r=e?.target,n=(null===(i=r?.ownerDocument)||void 0===i?void 0:i.defaultView)||window;return e instanceof n.MouseEvent||e instanceof n.WheelEvent},e.d=k,e.d0=class{constructor(e,t){let i=(t=this.options=Object.assign({},oc,t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=du(e,t);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),r=Nu(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Zu(t.clusterOptions):new rc(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,i){return t=+t,i=+i,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,i)}updateData(e,t){let i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:n}=function(e,t,i){let r=(s=i,(a=t)?{removeAll:a.removeAll,remove:new Set(a.remove||[]),add:new Map(a.add?.map(e=>[s.promoteId?e.properties[s.promoteId]:e.id,e])),update:new Map(a.update?.map(e=>[e.id,e]))}:{remove:new Set,add:new Map,update:new Map}),n=[];var a,s;if(r.removeAll&&(n=e,e=[]),r.remove.size||r.add.size){let t=[];for(let i of e)(r.remove.has(i.id)||r.add.has(i.id))&&t.push(i);if(t.length){n.push(...t);let i=new Set(t.map(e=>e.id));e=e.filter(e=>!i.has(e.id))}if(r.add.size){let t=du({type:"FeatureCollection",features:Array.from(r.add.values())},i);t=Nu(t,i),n.push(...t),e.push(...t)}}if(r.update.size){let t=new Map,a=[];for(let i of e)r.update.has(i.id)?t.set(i.id,[...t.get(i.id)||[],i]):a.push(i);for(let[e,s]of r.update){let r=t.get(e);if(!r||0===r.length)continue;let o=Vu(r,s,i);n.push(...r,...o),a.push(...o)}e=a}return{affected:n,source:e}}(this.source,e,i);t&&({affected:r,source:n}=this.filterUpdate(n,r,t)),r.length&&(this.source=n,this.tileIndex.updateIndex(n,r,i))}filterUpdate(e,t,i){let r=new Set;for(let n of e)null!=n.id&&(i(yu(n))||(t.push(n),r.add(n.id)));return{affected:t,source:e=e.filter(e=>!r.has(e.id))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map(e=>yu(e))}}updateClusterOptions(e,t){let i=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,i!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,i){return this.tileIndex.getLeaves(e,t,i)}},e.d1=Da,e.e=B,e.f=me,e.g=ue,e.h=e=>t(void 0,void 0,void 0,function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw new Error(`Could not load image because of ${k(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.i=W,e.j=e=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>r.src=J)},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):J}),e.k=(e,t)=>fe(B(e,{type:"json"}),t),e.l=ve,e.m=fe,e.n=ye,e.o=(e,t)=>fe(B(e,{type:"arrayBuffer"}),t),e.p=ed,e.q=function(e){return new jc(e).readFields(Kc,[])},e.r=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.s=ee,e.t=Pl,e.u=Ka,e.v=aa,e.w=$,e.x=be,e.y=ja,e.z=oa}),i("worker",0,function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,i,r){for(let i of t){this._layerConfigs[i.id]=i;let t=this._layers[i.id]=e.bT(i,r);t._featureFilter=e.ah(t.filter,r),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let n=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(let t of n){let i=t.map(e=>this._layers[e.id]),r=i[0];if(r.isHidden())continue;let n=r.source||"",a=this.familiesBySource[n];a||(a=this.familiesBySource[n]={});let s=r.sourceLayer||e.ag,o=a[s];o||(o=a[s]=[]),o.push(i)}}}class i{constructor(t){let i={},r=[];for(let e in t){let n=t[e],a=i[e]={};for(let e in n){let t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;let i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),a[e]={rect:i,metrics:t.metrics}}}let{w:n,h:a}=e.p(r),s=new e.t({width:n||1,height:a||1});for(let r in t){let n=t[r];for(let t in n){let a=n[+t];if(!a||0===a.bitmap.width||0===a.bitmap.height)continue;let o=i[r][t].rect;e.t.copy(a.bitmap,s,{x:0,y:0},{x:o.x+1,y:o.y+1},a.bitmap)}}this.image=s,this.positions=i}}e.cK("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,a,s,o){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ae;let l=new e.cL(Object.keys(t.layers).sort()),h=new e.cM(this.tileID,this.promoteId);h.bucketLayerIDs=[];let u={},c={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:a,subdivisionGranularity:o},d=r.familiesBySource[this.source];for(let i in d){let r=t.layers[i];if(!r)continue;1===r.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let s=l.encode(i),o=[];for(let e=0;e<r.length;e++){let t=r.feature(e),n=h.getId(t,i);o.push({feature:t,id:n,index:e,sourceLayerIndex:s})}for(let t of d[i]){let i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.isHidden(this.zoom,!0)||(n(t,this.zoom,a),(u[i.id]=i.createBucket({index:h.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:s,sourceID:this.source})).populate(o,c,this.tileID.canonical),h.bucketLayerIDs.push(t.map(e=>e.id)))}}let p=e.bY(c.glyphDependencies,e=>Object.keys(e).map(Number));for(let e of this.inFlightDependencies)e?.abort();this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){let e=new AbortController;this.inFlightDependencies.push(e),f=s.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}let m=Object.keys(c.iconDependencies),g=Promise.resolve({});if(m.length){let e=new AbortController;this.inFlightDependencies.push(e),g=s.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}let _=Object.keys(c.patternDependencies),y=Promise.resolve({});if(_.length){let e=new AbortController;this.inFlightDependencies.push(e),y=s.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},e)}let v=c.dashDependencies,x=Promise.resolve({});if(Object.keys(v).length){let e=new AbortController;this.inFlightDependencies.push(e),x=s.sendAsync({type:"GDA",data:{dashes:v}},e)}let[b,w,T,S]=yield Promise.all([f,g,y,x]),I=new i(b),P=new e.cN(w,T);for(let t in u){let i=u[t];i instanceof e.af?(n(i.layers,this.zoom,a),e.cO({bucket:i,glyphMap:b,glyphPositions:I.positions,imageMap:w,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:c.subdivisionGranularity})):i.hasDependencies&&(i instanceof e.cP||i instanceof e.cQ||i instanceof e.cR)&&(n(i.layers,this.zoom,a),i.addFeatures(c,this.tileID.canonical,P.patternPositions,S))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:I.image,imageAtlas:P,dashPositions:S,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?I.positions:null}})}}function n(t,i,r){let n=new e.J(i);for(let e of t)e.recalculate(n,r)}class a{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];t?.abort&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){let t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class s{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return 0===e.length&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class o{constructor(e,t,i,r,n){this.type=e,this.properties=i||{},this.extent=n,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map(t=>t.map(t=>new e.P(t.x,t.y)))}}class l{constructor(e,t,i){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=i}feature(e){return this._myFeatures[e]}}class h{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let i=e.cS(t);return 0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),{vectorTile:t,rawData:i.buffer}}function c(t,i,r){let{extent:n}=t,a=Math.pow(2,r.z-i.z),s=(r.x-i.x*a)*n,h=(r.y-i.y*a)*n,u=[];for(let i=0;i<t.length;i++){let r=t.feature(i),l=r.loadGeometry();for(let e of l)for(let t of e)t.x=t.x*a-s,t.y=t.y*a-h;let c=128;l=e.cT(l,r.type,-c,-c,n+c,n+c),0!==l.length&&u.push(new o(r.type,l,r.properties,r.id,n))}return new l(u,t.name,n)}class d{constructor(t,i,r){this.actor=t,this.layerIndex=i,this.availableImages=r,this.tileState=new a,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,i){try{return{vectorTile:"mlt"!==t.encoding?new e.cV(new e.cW(i)):new e.cX(i),rawData:i}}catch(r){let n=new Uint8Array(i),a=`Unable to parse the tile at ${t.request.url}, `;throw a+=31===n[0]&&139===n[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.d(r).message}`,new Error(a)}}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:i,overzoomParameters:n}=t;n&&(t.request=n.overzoomRequest);let a=this._startRequestTiming(t),s=new r(t);this.tileState.startLoading(i,s);let o=new AbortController;s.abort=o;try{let r=yield e.o(t.request,o);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(i),this._getEtagUnmodifiedResult(r,a);let l=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(i),!l)return null;let{vectorTile:h,rawData:u}=l;n&&({vectorTile:h,rawData:u}=this._getOverzoomTile(t,h));let c=this._getExpiryData(r),d=this._finishRequestTiming(a);s.vectorTile=h,this.tileState.markLoaded(i,s);let p={rawData:u,cacheControl:c,resourceTiming:d};this.tileState.setParsing(i,p);try{return yield this._parseWorkerTile(s,t,p)}finally{this.tileState.clearParsing(i)}}catch(e){throw this.tileState.finishLoading(i),s.status="done",this.tileState.markLoaded(i,s),e}})}_getEtagUnmodifiedResult(t,i){let r=this._getExpiryData(t),n=this._finishRequestTiming(i);return e.e({etagUnmodified:!0},r,n)}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,function*(){let n=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){let{rawData:t,cacheControl:a,resourceTiming:s}=r;n=e.e({rawTileData:t.slice(0),encoding:i.encoding},n,a,s)}return n})}_getExpiryData({expires:e,cacheControl:t,etag:i}){let r={};return e&&(r.expires=e),t&&(r.cacheControl=t),i&&(r.etag=i),r}_startRequestTiming(e){var t;if(null!==(t=e.request)&&void 0!==t&&t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e){let t=e?.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){var i;let{tileID:r,source:n,overzoomParameters:a}=e,{maxZoomTileID:s}=a,o=`${s.key}_${r.key}_${null===(i=e.request)||void 0===i?void 0:i.url}`,l=this.overzoomedTileResultCache.get(o);if(l)return l;let d=new h,p=this.layerIndex.familiesBySource[n];for(let e in p){let i=t.layers[e];if(!i)continue;let n=c(i,s,r.canonical);n.length>0&&d.addLayer(n)}let f=u(d);return this.overzoomedTileResultCache.set(o,f),f}reloadTile(t){return e._(this,void 0,void 0,function*(){let e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)})}abortTile(t){return e._(this,void 0,void 0,function*(){this.tileState.abort(t.uid)})}removeTile(t){return e._(this,void 0,void 0,function*(){this.tileState.removeLoaded(t.uid)})}}class p{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:i,encoding:r,rawImageData:n,redFactor:a,greenFactor:s,blueFactor:o,baseShift:l}=t,h=n.width+2,u=n.height+2,c=e.b(n)?new e.R({width:h,height:u},yield e.cY(n,-1,-1,h,u)):n,d=new e.cZ(i,c,r,a,s,o,l);return this.loaded||(this.loaded={}),this.loaded[i]=d,d})}removeTile(e){let t=this.loaded,i=e.uid;t?.[i]&&delete t[i]}}class f{constructor(e,t,i,r=m){this.actor=e,this.layerIndex=t,this.availableImages=i,this.tileState=new a,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let{z:i,x:r,y:n}=t.tileID.canonical,a=this._geoJSONIndex.getTile(i,r,n);return a?u(new e.c_(a.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,function*(){let{uid:e}=t,i=new r(t);i.abort=new AbortController;try{let r=this.loadVectorTile(t);if(!r)return null;let{vectorTile:n,rawData:a}=r;i.vectorTile=n,this.tileState.markLoaded(e,i);let s={rawData:a};this.tileState.setParsing(e,s);try{return yield this._parseWorkerTile(i,t,s)}finally{this.tileState.clearParsing(e)}}catch(t){throw i.status="done",this.tileState.markLoaded(e,i),t}})}_reloadLoadedTile(t){return e._(this,void 0,void 0,function*(){let e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,r)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)})}_parseWorkerTile(t,i,r){return e._(this,void 0,void 0,function*(){let n=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(r){let{rawData:t}=r;n=e.e({rawTileData:t.slice(0),encoding:"mvt"},n)}return n})}abortTile(t){return e._(this,void 0,void 0,function*(){this.tileState.abort(t.uid)})}removeTile(t){return e._(this,void 0,void 0,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return e._(this,void 0,void 0,function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();let r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}})}_startRequestTiming(e){var t;if(null!==(t=e.request)&&void 0!==t&&t.collectResourceTiming)return new s(e.request.url)}_finishRequestTiming(e,t,i){let r=e?.finish();r&&(i.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,function*(){var r;if(t.request&&(t.data=(yield e.k(t.request,i)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return null!==(r=this._geoJSONIndex)&&void 0!==r||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,g(t)),null==this._geoJSONIndex)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)})}_filterGeoJSON(e,t){if("FeatureCollection"!==e.type)return e;let i=this._getFilterPredicate(t);return i?{type:"FeatureCollection",features:e.features.filter(e=>i(e))}:e}_getFilterPredicate(t){if("boolean"!=typeof t&&!t?.length)return;let i=e.c$(t,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return e=>i.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,function*(){var e;null===(e=this._pendingRequest)||void 0===e||e.abort()})}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function m(t,i){let r=e.e(i.geojsonVtOptions||{},{updateable:!0,clusterOptions:g(i)});return new e.d0(t,r)}function g({geojsonVtOptions:t,clusterProperties:i}){if(!i||!t.clusterOptions)return t.clusterOptions;let r={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(i);for(let t of o){let[a,s]=i[t],o=e.c$(s),l=e.c$("string"==typeof a?[a,["accumulated"],["get",t]]:a);r[t]=o.value,n[t]=l.value}return t.clusterOptions.map=e=>{s.properties=e;let t={};for(let e of o)t[e]=r[e].evaluate(a,s);return t},t.clusterOptions.reduce=(e,t)=>{s.properties=t;for(let t of o)a.accumulated=e[t],e[t]=n[t].evaluate(a,s)},t.clusterOptions}class _{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,this.actor.registerMessageHandler("LDT",(e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t)),this.actor.registerMessageHandler("RDT",(t,i)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})),this.actor.registerMessageHandler("GCEZ",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})),this.actor.registerMessageHandler("GCC",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})),this.actor.registerMessageHandler("GCL",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})),this.actor.registerMessageHandler("LD",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t)),this.actor.registerMessageHandler("LT",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t)),this.actor.registerMessageHandler("RT",(e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t)),this.actor.registerMessageHandler("AT",(e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t)),this.actor.registerMessageHandler("RMT",(e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t)),this.actor.registerMessageHandler("RS",(t,i)=>e._(this,void 0,void 0,function*(){var e,r;if(null===(r=null===(e=this.workerSources[t])||void 0===e?void 0:e[i.type])||void 0===r||!r[i.source])return;let n=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==n.removeSource&&n.removeSource(i)})),this.actor.registerMessageHandler("RM",t=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})),this.actor.registerMessageHandler("SR",(t,i)=>e._(this,void 0,void 0,function*(){this.referrer=i})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,i)=>e._(this,void 0,void 0,function*(){this.self.importScripts(i)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(i.layers,i.removedIds,this._getGlobalState(t))})),this.actor.registerMessageHandler("UGS",(t,i)=>e._(this,void 0,void 0,function*(){let e=this._getGlobalState(t);for(let t in i)e[t]=i[t]})),this.actor.registerMessageHandler("SL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(i,this._getGlobalState(t))}))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,i){return e._(this,void 0,void 0,function*(){this.availableImages[t]=i;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=i}})}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,function*(){return yield e.d1.syncState(i,this.self.importScripts)})}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){var r,n;if((r=this.workerSources)[e]||(r[e]={}),(n=this.workerSources[e])[t]||(n[t]={}),!this.workerSources[e][t][i]){let r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new d(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new f(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){var i,r;return(i=this.demWorkerSources)[e]||(i[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new _(self)),_}),i("index",0,function(e,t){var i="5.24.0";function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,a,s,o={frame(e,i,r,n){let a=n||window,s=a.requestAnimationFrame(e=>{o(),i(e)}),{unsubscribe:o}=t.s(e.signal,"abort",()=>{o(),a.cancelAnimationFrame(s),r(new t.a(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,r)=>{this.frame(e,i,r,t)})},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=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==s?s:!!matchMedia&&(null!=a||(a=matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},set prefersReducedMotion(e){s=e}},l=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function h(){return l.getCurrentTime()}var u,c;class d{static create(e,t,i){let r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]="none")}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",d.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",d.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){let n=i.boundingClientRect;return new t.P((r.clientX-n.left)/i.x-e.clientLeft,(r.clientY-n.top)/i.y-e.clientTop)}static mousePos(e,t){let i=d.getScale(e);return d.getPoint(e,i,t)}static touchPos(e,t){let i=[],r=d.getScale(e);for(let n of t)i.push(d.getPoint(e,r,n));return i}static sanitize(e){let t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),i=t.querySelectorAll("script");for(let e of i)e.remove();return d.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){let i=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!i.includes("javascript:")&&!i.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){let t=e.children;for(let e of t)d.removeAttributes(e),d.clean(e)}static removeAttributes(e){for(let{name:t,value:i}of e.attributes)d.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}d.docStyle=typeof window<"u"&&(null===(u=window.document)||void 0===u?void 0:u.documentElement.style),d.selectProp=!d.docStyle||"userSelect"in d.docStyle?"userSelect":"webkitUserSelect",function(e){let i,r,n,a;e.resetRequestQueue=()=>{i=[],r=0,n=0,a={}},e.addThrottleControl=e=>{let t=n++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],o()},e.getImage=(e,r,n=!0)=>new Promise((a,s)=>{e.headers||(e.headers={}),e.headers.accept="image/webp,*/*",t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{s(e)},onSuccess:e=>{a(e)}}),o()});let s=e=>t._(this,void 0,void 0,function*(){e.state="running";let{requestParameters:i,supportImageRefresh:n,onError:a,onSuccess:s,abortController:h}=e,u=!1===n&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce((e,t)=>e&&"accept"===t,!0));r++;let c=u?l(i,h):t.m(i,h);try{let i=yield c;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?s(i):i.data&&s({data:yield(d=i.data,"function"==typeof createImageBitmap?t.h(d):t.j(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(i){delete e.abortController,a(t.d(i))}finally{r--,o()}var d}),o=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&i.length>0;t++){let e=i.shift();e.abortController.signal.aborted?t--:s(e)}},l=(e,i)=>new Promise((r,n)=>{let a=new Image,s=e.url,o=e.credentials;o&&"include"===o?a.crossOrigin="use-credentials":(o&&"same-origin"===o||!t.f(s))&&(a.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{a.src="",n(new t.a(i.signal.reason))}),a.fetchPriority="high",a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,i.signal.aborted||n(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."))},a.src=s})}(c||(c={})),c.resetRequestQueue();class p{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function f(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:n}of e){let e=`${r}${n}`;i.includes(e)||(i.push(e),t.push({id:r,url:n}))}}return t}function m(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`)}}function g(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}class _ extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(let e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let i=this.images[e];if(i&&!i.data&&i.spriteData){let e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}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,i){let r=!0,n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n?.width)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n?.height)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.l(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_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(4!==e.length)return!1;let i=t.spriteData,r=i?.width||t.data.width,n=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){var t;let i=this.images[e];delete this.images[e],delete this.patterns[e],null!==(t=i.userImage)&&void 0!==t&&t.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){var i;let r={};for(let n of e){let e=this.getImage(n);e||(this.fire(new t.n("styleimagemissing",{id:n})),e=this.getImage(n)),e?r[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!(null===(i=e.userImage)||void 0===i||!i.render)}:t.w(`Image "${n}" 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 r}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{let i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.I(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:i,h:r}=t.p(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(let e in this.patterns){let{bin:i}=this.patterns[e],r=i.x+1,a=i.y+1,s=this.getImage(e).data,o=s.width,l=s.height;t.R.copy(s,n,{x:0,y:0},{x:r,y:a},{width:o,height:l}),t.R.copy(s,n,{x:0,y:l-1},{x:r,y:a-1},{width:o,height:1}),t.R.copy(s,n,{x:0,y:0},{x:r,y:a+l},{width:o,height:1}),t.R.copy(s,n,{x:o-1,y:0},{x:r-1,y:a},{width:1,height:l}),t.R.copy(s,n,{x:0,y:0},{x:r+o,y:a},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;let e=this.getImage(i);e||t.w(`Image with ID: "${i}" was not found`),g(e)&&this.updateImage(i,e)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return e}}let y=1e20,v=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-Math.pow(e/255,.45454545454545453);v[e]=t*Math.abs(t)}function x(e,t,i,r,n,a,s,o,l){for(let h=t;h<t+r;h++)b(e,i*a+h,a,n,s,o,l);for(let h=i;h<i+n;h++)b(e,h*a+t,1,r,s,o,l)}function b(e,t,i,r,n,a,s){a[0]=0,s[0]=-y,s[1]=y,n[0]=e[t];for(let o=1,l=0,h=0;o<r;o++){n[o]=e[t+o*i];let r=o*o;do{let e=a[l];h=(n[o]-n[e]+r-e*e)/(o-e)/2}while(h<=s[l]&&--l>-1);l++,a[l]=o,s[l]=h,s[l+1]=y}for(let o=0,l=0;o<r;o++){for(;s[l+1]<o;)l++;let r=a[l],h=o-r;e[t+o*i]=n[r]+h*h}}v[255]=-y;let w,T=t.v.layout_symbol["text-font"].default.join(",");class S{constructor(e,t,i){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,function*(){let t=[];for(let i in e)for(let r of e[i])t.push(this._getAndCacheGlyphsPromise(i,r));let i=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:n}of i)r[e]||(r[e]={}),r[e][t]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r})}_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,function*(){var t,r;null!==(t=(r=this.entries)[e])&&void 0!==t||(r[e]={glyphs:{},requests:{},ranges:{}});let n=this.entries[e],a=n.glyphs[i];return void 0!==a?{stack:e,id:i,glyph:a}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(a=n.glyphs[i]=this._drawGlyph(n,e,i),{stack:e,id:i,glyph:a}):yield this._downloadAndCacheRangePromise(e,i)})}_downloadAndCacheRangePromise(e,i){return t._(this,void 0,void 0,function*(){var r;let n=this.entries[e],a=Math.floor(i/256);if(n.ranges[a])return{stack:e,id:i,glyph:null};(r=n.requests)[a]||(r[a]=S.loadGlyphRange(e,a,this.url,this.requestManager));try{let t=yield n.requests[a];for(let e in t)n.glyphs[+e]=t[+e];return n.ranges[a]=!0,{stack:e,id:i,glyph:t[i]||null}}catch(r){let s=n.glyphs[i]=this._drawGlyph(n,e,i);return this._warnOnMissingGlyphRange(s,a,i,t.d(r)),{stack:e,id:i,glyph:s}}})}_warnOnMissingGlyphRange(e,i,r,n){let a=256*i,s=a+255,o=r.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${i}, ${a}-${s}. Rendering codepoint U+${o} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,i,r){let n=i===T&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r),a=n?"ideographTinySDF":"tinySDF";e[a]||(e[a]=this._createTinySDF(n?this.localIdeographFontFamily:i));let s=e[a].draw(String.fromCodePoint(r)),o=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({width:s.width||60,height:s.height||60},s.data),metrics:{width:o?0:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:o?0:s.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){let t=e?e.split(","):[];t.push("sans-serif");let i=t.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(",");return new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t,i={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};for(let[r,n]of Object.entries(i))new RegExp(`\\b${r}\\b`,"i").test(e)&&(t=`${n}`);return t}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}S.loadGlyphRange=function(e,i,r,n){return t._(this,void 0,void 0,function*(){let a=256*i,s=a+255,o=yield n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${a}-${s}`),"Glyphs"),l=yield t.o(o,new AbortController);if(!l?.data)throw new Error(`Could not load glyph range. range: ${i}, ${a}-${s}`);let h={};for(let e of t.q(l.data))h[e.id]=e;return h})},S.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:s="normal",lang:o=null}={}){this.buffer=t,this.radius=i,this.cutoff=r,this.lang=o;let l=this.size=e+4*t,h=this._createCanvas(l),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${a} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.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){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,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),s=Math.ceil(i),o=Math.floor(n),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-o)),h=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),u=l+2*this.buffer,c=h+2*this.buffer,d=Math.max(u*c,0),p=new Uint8ClampedArray(d),f={data:p,width:u,height:c,glyphWidth:l,glyphHeight:h,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(0===l||0===h)return f;let{ctx:m,buffer:g,gridInner:_,gridOuter:b}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,h),m.fillText(e,g-o,g+s);let w=m.getImageData(g,g,l,h);b.fill(y,0,d),_.fill(0,0,d);let T=3;for(let e=0;e<h;e++){let t=(e+g)*u+g;for(let e=0;e<l;e++,T+=4,t++){let e=w.data[T];if(0===e)continue;let i=v[e];b[t]=Math.max(0,i),_[t]=Math.max(0,-i)}}x(b,0,0,u,c,u,this.f,this.v,this.z),x(_,g,g,l,h,u,this.f,this.v,this.z);let S=255/this.radius,I=255*(1-this.cutoff);for(let e=0;e<d;e++){let t=Math.sqrt(b[e])-Math.sqrt(_[e]);p[e]=Math.round(I-S*t)}return f}};class I{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,i){return t.G(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.H.number(e.x,i.x,r),y:t.H.number(e.y,i.y,r),z:t.H.number(e.z,i.z,r)}}}class P extends t.E{constructor(e){super(),w||(w=new t.u({anchor:new t.D(t.x.light.anchor),position:new I,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)})),this._transitionable=new t.y(w,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.z,e,i))for(let i in e){let r=e[i];i.endsWith(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.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,i,r){return!1!==r?.validate&&t.C(this,e.call(t.F,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}let C=new t.u({"sky-color":new t.D(t.x.sky["sky-color"]),"horizon-color":new t.D(t.x.sky["horizon-color"]),"fog-color":new t.D(t.x.sky["fog-color"]),"fog-ground-blend":new t.D(t.x.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.x.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.x.sky["atmosphere-blend"])});class E extends t.E{constructor(e){super(),this._transitionable=new t.y(C,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,i={}){if(!this._validate(t.K,e,i)){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(t.B)?this._transitionable.setTransition(i.slice(0,-t.B.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,i,r={}){return!1!==r?.validate&&t.C(this,e.call(t.F,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class M{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){var i;let r=e.join(",")+String(t);return(i=this.dashEntry)[r]||(i[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,i){let r=[],n=e.length%2==1?-e[e.length-1]*i:0,a=e[0]*i,s=!0;r.push({left:n,right:a,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];n=o*i,o+=l,a=o*i,r.push({left:n,right:a,isDash:s,zeroLength:0===l})}return r}addRoundDash(e,t,i){let r=t/2;for(let t=-i;t<=i;t++){let n=this.width*(this.nextRow+i+t),a=0,s=e[a];for(let o=0;o<this.width;o++){o/s.right>1&&(s=e[++a]);let l,h=Math.abs(o-s.left),u=Math.abs(o-s.right),c=Math.min(h,u),d=t/i*(r+1);if(s.isDash){let e=r-Math.abs(d);l=Math.sqrt(c*c+e*e)}else l=r-Math.sqrt(c*c+d*d);this.data[n+o]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,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 t=0;t<this.width;t++){t/a.right>1&&(a=e[++n]);let i=Math.abs(t-a.left),s=Math.abs(t-a.right),o=Math.min(i,s);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?o:-o)+128))}}addDash(e,i){let r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let a=0;for(let t of e)a+=t;if(0!==a){let t=this.width/a,n=this.getDashRanges(e,this.width,t);i?this.addRoundDash(n,t,r):this.addRegularDash(n)}let s={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=n,this.dirty=!0,s}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))}}let A="maplibre_preloaded_worker_pool";class k{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<k.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],0===this.numActive()){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[A]}numActive(){return Object.keys(this.active).length}}let L,F,D=Math.floor(o.hardwareConcurrency/2);function R(){return L||(L=new k),L}k.workerCount=t.L(globalThis)?Math.max(Math.min(D,3),1):1;class z{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;let r=this.workerPool.acquire(i);for(let e=0;e<r.length;e++){let n=new t.N(r[e],i);n.name=`Worker ${e}`,this.actors.push(n)}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){for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(let t of this.actors)t.unregisterMessageHandler(e)}}function N(){return F||(F=new z(R(),t.M),F.registerMessageHandler("GR",(e,i,r)=>t.m(i,r))),F}function O(e,i){let r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}function B(e,t,i,r,n,a,s){var o;let l=function(e,t,i){if(e)for(let r of e){let e=t[r];if(e?.source===i&&"fill-extrusion"===e.type)return!0}else for(let e in t){let r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(o=n?.layers)&&void 0!==o?o:null,t,e.id),h=a.maxPitchScaleFactor(),u=e.tilesIn(r,h,l);u.sort(j);let c=[];for(let r of u)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,n,a,h,O(a,r.tileID),s?(e,t)=>s(r.tileID,e,t):void 0)});return function(e,t){for(let i in e)for(let r of e[i])V(r,t);return e}(function(e){let t={},i={};for(let{queryResults:r,wrappedTileID:n}of e){i[n]||(i[n]={});let e=i[n];for(let i in r){let n=r[i];e[i]||(e[i]={});let a=e[i];t[i]||(t[i]=[]);for(let e of n)a[e.featureIndex]||(a[e.featureIndex]=!0,t[i].push(e))}}return t}(c),e)}function j(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 V(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}function G(e,i,r,n){return t._(this,void 0,void 0,function*(){let a=e;if(e.url?a=(yield t.k(yield i.transformRequest(e.url,"Source"),r)).data:yield o.frameAsync(r,n),!a)return null;let s=t.V(t.e(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(s.vectorLayerIds=a.vector_layers.map(e=>e.id)),s})}class U{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){let i,r,n=this._sw,a=this._ne;if(e instanceof t.W)i=e,r=e;else{if(!(e instanceof U))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(U.convert(e)):this.extend(t.W.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.W.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return n||a?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new t.W(i.lng,i.lat),this._ne=new t.W(r.lng,r.lat)),this}getCenter(){return new t.W((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 t.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.W(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(e){let{lng:i,lat:r}=t.W.convert(e),n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}intersects(e){if(!((e=U.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(i>=360||r>=360)return!0;let n=t.X(this.getWest(),-180,180),a=t.X(this.getEast(),-180,180),s=t.X(e.getWest(),-180,180),o=t.X(e.getEast(),-180,180),l=n>a,h=s>o;return!(!l||!h)||(l?o>=n||s<=a:h?a>=s||n<=o:s<=a&&o>=n)}static convert(e){return e instanceof U?e:e&&new U(e)}static fromLngLat(e,i=0){let r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new U(new t.W(e.lng-n,e.lat-r),new t.W(e.lng+n,e.lat+r))}adjustAntiMeridian(){let e=new t.W(this._sw.lng,this._sw.lat),i=new t.W(this._ne.lng,this._ne.lat);return new U(e,e.lng>i.lng?new t.W(i.lng+360,i.lat):i)}}class Z{constructor(e,t,i){this.bounds=U.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let i=Math.pow(2,e.z),r=Math.floor(t.Z(this.bounds.getWest())*i),n=Math.floor(t.Y(this.bounds.getNorth())*i),a=Math.ceil(t.Z(this.bounds.getEast())*i),s=Math.ceil(t.Y(this.bounds.getSouth())*i);return e.x>=r&&e.x<a&&e.y>=n&&e.y<s}}class $ extends t.E{constructor(e,i,r,n){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.V(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let i=yield G(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new Z(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(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(!0)}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 t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:yield 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,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(e),etag:e.etag};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,i)=>{e.reloadPromise={resolve:t,reject:i}})}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let n={};return t?.etagUnmodified&&(n.unmodified=!0),n}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}})}_getOverzoomParameters(e){return t._(this,void 0,void 0,function*(){if(e.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}})}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class q extends t.E{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.V(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let i=yield G(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new Z(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}})}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 t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,function*(){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let r=yield c.getImage(yield this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(r?.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let i=this.map.painter.context,n=i.gl,a=r.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new t.T(i,a,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class W extends q{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,function*(){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=yield this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=yield c.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i?.data){let r=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let n=t.b(r)&&t.a0()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&"expired"!==e.state&&"reloading"!==e.state)return;e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:"LDT",data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}})}readImageNow(e){return t._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&t.a1()){let i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},yield t.a2(e,-1,-1,i,r))}catch{}}return o.getImageData(e,1)})}_getNeighboringTiles(e){let i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,a=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+r)%r,o=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.a3(e.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},l[new t.a3(e.overscaledZ,o,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.a3(e.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,o,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.a3(e.overscaledZ,a,i.z,n,i.y+1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.a3(e.overscaledZ,o,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,function*(){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&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}function H(e,t){return t?e.properties[t]:e.id}function X(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let i of t.removeProperties){let t=e.addOrUpdateProperties.findIndex(e=>e.key===i);t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function Y(e){var t,i;if(!e)return{};let r={};return r.removeAll=e.removeAll,r.remove=new Set(e.remove||[]),r.add=new Map(null===(t=e.add)||void 0===t?void 0:t.map(e=>[e.id,e])),r.update=new Map(null===(i=e.update)||void 0===i?void 0:i.map(e=>[e.id,e])),r}function K(e){return e&&0!==e.length?"number"==typeof e[0]?[e]:e.flatMap(e=>K(e)):[]}function J(e){return"GeometryCollection"===e.type?e.geometries.flatMap(e=>J(e)):K(e.coordinates)}function Q(e){let t,i=new U;switch(e.type){case"FeatureCollection":t=e.features.flatMap(e=>J(e.geometry));break;case"Feature":t=J(e.geometry);break;default:t=J(e)}if(0===t.length)return i;for(let e of t){let[t,r]=e;i.extend([t,r])}return i}class ee extends t.E{constructor(e,i,r,n){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._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=r.getActor(),this.setEventedParent(n),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:"string"==typeof i.promoteId?i.promoteId:void 0,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/this.tileSize)}_getClusterMaxZoom(e){let i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};let i=this._updateWorkerData();return t?i:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};let i=Y(e),r=Y(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let i of t.remove)e.add.delete(i),e.update.delete(i);for(let[i,r]of t.update){let n=e.update.get(i);n&&(t.update.set(i,X(n,r)),e.update.delete(i))}}(i,r);let n={};if((i.removeAll||r.removeAll)&&(n.removeAll=!0),n.remove=new Set([...i.remove,...r.remove]),n.add=new Map([...i.add,...r.add]),n.update=new Map([...i.update,...r.update]),n.remove.size&&n.add.size)for(let e of n.add.keys())n.remove.delete(e);return function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(n)}(this._pendingWorkerUpdate.diff,e);let i=this._updateWorkerData();return t?i:this}getData(){return t._(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return t._(this,void 0,void 0,function*(){return Q(yield this.getData())})}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,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}})}_updateWorkerData(){return t._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:i,updateCluster:r}=this._pendingWorkerUpdate,n=this._getLoadGeoJSONParameters(e,i,r);void 0!==e?this._pendingWorkerUpdate.data=void 0:i?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(n)})}_getLoadGeoJSONParameters(e,i,r){return t._(this,void 0,void 0,function*(){let n=t.e({type:this.type},this.workerOptions);return"string"==typeof e?(n.request=yield this.map._requestManager.transformRequest(o.resolveURL(e),"Source"),n.request.collectResourceTiming=this._collectResourceTiming,n):void 0!==e?(n.data=e,n):i?(n.dataDiff=i,n):r?(n.updateCluster=!0,n):void 0})}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new t.n("dataloading",{dataType:"source"}));try{let i=yield e,r=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n("dataabort",{dataType:"source"}));r.data&&(this._data={geojson:r.data});let n=this._applyDiffToSource(i.dataDiff),a=this._getShouldReloadTileOptions(n),s={dataType:"source"};this._applyResourceTiming(s,r),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new t.n("data",Object.assign(Object.assign({},s),{sourceDataType:"content",shouldReloadTileOptions:a})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n("dataabort",{dataType:"source"}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(e,i){var r;if(!this._collectResourceTiming)return;let n=null===(r=i.resourceTiming)||void 0===r?void 0:r[this.id];if(!n)return;let a=n.slice(0);a?.length&&t.e(e,{resourceTiming:a})}_applyDiffToSource(e){if(!e)return;let t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let i=new Map;if(null==e||null==e.type)return i;if("Feature"===e.type){let r=H(e,t);return null==r?void 0:(i.set(r,e),i)}if("FeatureCollection"===e.type){let r=new Set;for(let n of e.features){let e=H(n,t);if(null==e||r.has(e))return;r.add(e),i.set(e,n)}return i}}(this._data.geojson,t);if(!e)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let i=function(e,t,i){var r,n;let a=[];if(t.removeAll)e.clear();else if(t.remove)for(let i of t.remove){let t=e.get(i);t&&(a.push(t.geometry),e.delete(i))}if(t.add)for(let r of t.add){let t=H(r,i);if(null==t)continue;let n=e.get(t);n&&a.push(n.geometry),a.push(r.geometry),e.set(t,r)}if(t.update)for(let i of t.update){let t=e.get(i.id);if(!t)continue;let s=!!i.newGeometry,o=i.removeAllProperties||(null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0;if(!s&&!o)continue;a.push(t.geometry);let l=Object.assign({},t);if(e.set(i.id,l),s&&(a.push(i.newGeometry),l.geometry=i.newGeometry),o){if(l.properties=i.removeAllProperties?{}:Object.assign({},l.properties||{}),i.removeProperties)for(let e of i.removeProperties)delete l.properties[e];if(i.addOrUpdateProperties)for(let{key:e,value:t}of i.addOrUpdateProperties)l.properties[e]=t}}return a}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>Q(e))}}shouldReloadTile(e,{affectedBounds:i}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;let{buffer:r,extent:n}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:i,z:r},n=0){let a=t.a4((e-n)/Math.pow(2,r)),s=t.a5((i+1+n)/Math.pow(2,r)),o=t.a4((e+1+n)/Math.pow(2,r)),l=t.a5((i-n)/Math.pow(2,r));return new U([a,s],[o,l])}(e.tileID.canonical,r/n);for(let e of i)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,function*(){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};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),yield 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 t.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class te extends t.E{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}load(e){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=yield c.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t?.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}})}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 t.n("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 i=e.map(t.a7.fromLngLat);var r;return this.tileID=function(e){let i=t.a8.fromPoints(e),r=i.width(),n=i.height(),a=Math.max(r,n),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),o=Math.pow(2,s);return new t.aa(s,Math.floor((i.minX+i.maxX)/2*o),Math.floor((i.minY+i.maxY)/2*o))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(e=>this.tileID.getTilePoint(e)._round()),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new t.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,function*(){var t;null!==(t=this.tileID)&&void 0!==t&&t.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:i,minY:r,maxX:n,maxY:a}=t.a8.fromPoints(e),s={};for(let e=0;e<=t.a9;e++){let t=Math.pow(2,e),o=Math.floor(i*t),l=Math.floor(r*t),h=Math.floor(n*t),u=Math.floor(a*t),c=(o%t+t)%t,d=h%t,p=Math.floor(o/t),f=Math.floor(h/t);s[e]={minWrap:p,maxWrap:f,minTileXWrapped:c,maxTileXWrapped:d,minTileY:l,maxTileY:u}}return s}}class ie extends te{constructor(e,t,i,r){super(e,t,i,r),this._onPlayingHandler=()=>{var e;null===(e=this.map)||void 0===e||e.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((yield this.map._requestManager.transformRequest(t,"Source")).url);try{let e=yield t.ab(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.l(t.d(e)))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.l(new t.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.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)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.n("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}}class re extends te{constructor(e,i,r,n){super(e,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new t.l(new t.ac(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.l(new t.ac(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.l(new t.ac(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`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 t.l(new t.ac(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,function*(){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 t.l(new Error("Canvas dimensions cannot be less than or equal to zero."))):(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()||0===Object.keys(this.tiles).length)return;let i=this.map.painter.context,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(i,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let n=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new t.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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}}let ne={},ae=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return q;case"raster-dem":return W;case"vector":return $;case"video":return ie;case"canvas":return re}return ne[e]},se="RTLPluginLoaded";class oe extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=N()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=o.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return t._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.n(se))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let le=null;function he(){return le||(le=new oe),le}var ue,ce,de;(de=ue||(ue={}))[de.Base=0]="Base",de[de.Parent=1]="Parent",function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(ce||(ce={}));class pe{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=h(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let i={};if(!t)return i;for(let r of e){let e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)i[t.id]=r}}return i}(e.buckets,i?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let i=this.buckets[e];if(i instanceof t.af){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let i=this.buckets[e];if(i instanceof t.af&&i.hasRTLText){this.hasRTLText=!0,he().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state="loaded"}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let i=this.buckets[t];i.uploadPending()&&i.upload(e)}let i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,a,s,o,l,h,u){var c;return null!==(c=this.latestFeatureIndex)&&void 0!==c&&c.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:h,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let n=r.loadVTLayers(),a=i?.sourceLayer?i.sourceLayer:"",s=n[t.ag]||n[a];if(!s)return;let o=t.ah(i?.filter,i?.globalState),{z:l,x:h,y:u}=this.tileID.canonical,c={z:l,x:h,y:u};for(let i=0;i<s.length;i++){let n=s.feature(i);if(o.needGeometry){let e=t.ai(n,!0);if(!o.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new t.J(this.tileID.overscaledZ),n))continue;let d=r.getId(n,a),p=new t.aj(n,l,h,u,d);p.tile=c,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let i=this.expirationTime;if(e.cacheControl){let i=t.ak(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{let r=this.expirationTime-i;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(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,i){var r,n,a;if(null===(r=this.latestFeatureIndex)||void 0===r||!r.rawTileData||0===Object.keys(e).length)return;let s=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!i.style.hasLayer(r))continue;let o=this.buckets[r],l=o.layers[0].sourceLayer||t.ag,h=s[l],u=e[l];if(!h||!u||0===Object.keys(u).length)continue;o.update(u,h,(null===(n=this.imageAtlas)||void 0===n?void 0:n.patternPositions)||{},this.dashPositions||{});let c=null===(a=i?.style)||void 0===a?void 0:a.getLayer(r);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<h()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=h()+e}setDependencies(e,t){let i={};for(let e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let e=this.dependencies[i];if(e)for(let i of t)if(e[i])return!0}return!1}}class fe{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,i,r){var n,a,s,o,l;let h=String(i);if((o=this.stateChanges)[e]||(o[e]={}),(l=this.stateChanges[e])[h]||(l[h]={}),t.e(this.stateChanges[e][h],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])t!==h&&(this.deletedStates[e][t]=null)}else if(null===(null===(n=this.deletedStates[e])||void 0===n?void 0:n[h])){this.deletedStates[e][h]={};for(let t in this.state[e][h])r[t]||(this.deletedStates[e][h][t]=null)}else for(let t in r)null===(null===(s=null===(a=this.deletedStates[e])||void 0===a?void 0:a[h])||void 0===s?void 0:s[t])&&delete this.deletedStates[e][h][t]}removeFeatureState(e,t,i){var r,n,a;if(null===this.deletedStates[e])return;let s=String(t);if((n=this.deletedStates)[e]||(n[e]={}),i&&void 0!==t)null!==this.deletedStates[e][s]&&((a=this.deletedStates[e])[s]||(a[s]={}),this.deletedStates[e][s][i]=null);else if(void 0!==t)if(null!==(r=this.stateChanges[e])&&void 0!==r&&r[s])for(i in this.deletedStates[e][s]={},this.stateChanges[e][s])this.deletedStates[e][s][i]=null;else this.deletedStates[e][s]=null;else this.deletedStates[e]=null}getState(e,i){let r=String(i),n=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let t=this.deletedStates[e][i];if(null===t)return{};for(let e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){var r,n,a;let s={};for(let e in this.stateChanges){(r=this.state)[e]||(r[e]={});let i={};for(let r in this.stateChanges[e])(n=this.state[e])[r]||(n[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];s[e]=i}for(let e in this.deletedStates){(a=this.state)[e]||(a[e]={});let i={};if(null===this.deletedStates[e])for(let t in this.state[e])i[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(let i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}s[e]||(s[e]={}),t.e(s[e],i)}this.stateChanges={},this.deletedStates={},0!==Object.keys(s).length&&(this.revision++,e.setFeatureState(s,i))}}let me=89.25;function ge(e,i){let r=t.al(i.lat,-t.am,t.am);return new t.P(t.Z(i.lng)*e,t.Y(r)*e)}function _e(e,i){return new t.a7(i.x/e,i.y/e).toLngLat()}function ye(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(me-e.pitch)))}function ve(e,i){let r=e.canonical,n=i/t.ao(r.z),a=r.x+Math.pow(2,r.z)*e.wrap,s=t.ap(new Float64Array(16));return t.Q(s,s,[a*n,r.y*n,0]),t.S(s,s,[n/t.a6,n/t.a6,1]),s}function xe(e,i,r,n,a){let s=t.a7.fromLngLat(e,i),o=a*t.aq(1,e.lat),{x:l,y:h,z:u}=be(r,n);return new t.a7(s.x+o*-l,s.y+o*-h,s.z+o*-u)}function be(e,i){let r=t.an(e),n=t.an(i),a=Math.cos(-r),s=Math.sin(r);return{x:s*Math.sin(n),y:-s*Math.cos(n),z:a}}function we(e,t,i){let r=t.intersectsFrustum(e);if(!i||0===r)return r;let n=t.intersectsPlane(i);return 0===n?0:2===r&&2===n?2:1}function Te(e,t,i){let r=0,n=(i-t)/10;for(let a=0;a<10;a++)r+=n*Math.pow(Math.cos(t+(a+.5)/10*(i-t)),e);return r}function Se(e,i){return function(r,n,a,s,o){let l=2*((e-1)/t.ar(Math.cos(t.an(me-o))/Math.cos(t.an(me)))-1),h=Math.acos(a/s),u=2*Te(l-1,0,t.an(o/2)),c=Math.min(t.an(me),h+t.an(o/2)),d=Te(l-1,Math.min(c,h-t.an(o/2)),c),p=Math.atan(n/a),f=Math.hypot(n,a),m=r;return m+=t.ar(s/f/Math.max(.5,Math.cos(t.an(o/2)))),m+=l*t.ar(Math.cos(p))/2,m-=t.ar(Math.max(1,d/u/i))/2,m}}let Ie=Se(9.314,3);function Pe(e,i){let r=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/i.tileSize));return Math.max(0,r)}function Ce(e,i){let r=e.getCameraFrustum(),n=e.getClippingPlane(),a=e.screenPointToMercatorCoordinate(e.getCameraPoint()),s=t.a7.fromLngLat(e.center,e.elevation);a.z=s.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,i),h=Pe(e,i),u=i.minzoom||0,c=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,h),c),p=Math.pow(2,d),f=[p*a.x,p*a.y,0],m=[p*s.x,p*s.y,0],g=Math.hypot(s.x-a.x,s.y-a.y),_=Math.abs(s.z-a.z),y=Math.hypot(g,_),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),x=[],b=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let e=1;e<=3;e++)x.push(v(-e)),x.push(v(e));for(x.push(v(0));x.length>0;){let p=x.pop(),g=p.x,v=p.y,w=p.fullyVisible,T={x:g,y:v,z:p.zoom},S=o.getTileBoundingVolume(T,p.wrap,e.elevation,i);if(!w){let e=we(r,S,n);if(0===e)continue;w=2===e}let I=o.distanceToTile2d(a.x,a.y,T,S),P=h;l&&(P=(i.calculateTileZoom||Ie)(e.zoom+t.ar(e.tileSize/i.tileSize),I,_,y,e.fov)),P=(i.roundZoom?Math.round:Math.floor)(P),P=Math.max(0,P);let C=Math.min(P,c);if(p.wrap=o.getWrap(s,T,p.wrap),p.zoom>=C){if(p.zoom<u)continue;let e=d-p.zoom,r=f[0]-.5-(g<<e),n=f[1]-.5-(v<<e),a=i.reparseOverscaled?Math.max(p.zoom,P):p.zoom;b.push({tileID:new t.a3(p.zoom===c?a:p.zoom,p.wrap,p.zoom,g,v),distanceSq:t.as([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+n*n)})}else for(let e=0;e<4;e++)x.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return b.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}let Ee=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function Me(e){return"raster"===e||"image"===e||"video"===e}function Ae(e,t,i,r,n,a,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:h,fadingParentID:u}=t;if(l===ue.Base&&h===ce.Incoming&&u)return i[u.key]=u,!0;let c=Math.max(o.overscaledZ-n,a);for(let n=o.overscaledZ-1;n>=c;n--){let a=o.scaledTo(n),l=e.getLoadedTile(a);if(l)return t.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:ce.Incoming,fadingParentID:l.tileID,fadeEndTime:r+s}),l.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:ce.Departing,fadeEndTime:r+s}),i[a.key]=a,!0}return!1}function ke(e,t,i,r,n,a){if(!t.hasData())return!1;let s=t.tileID.children(n),o=Le(e,t,s,i,r,n,a);if(o)return!0;for(let l of s)Le(e,t,l.children(n),i,r,n,a)&&(o=!0);return o}function Le(e,t,i,r,n,a,s){if(i[0].overscaledZ>=a)return!1;let o=!1;for(let a of i){let i=e.getLoadedTile(a);if(!i)continue;let{fadingRole:l,fadingDirection:h,fadingParentID:u}=i;l===ue.Base&&h===ce.Departing&&u||(i.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:ce.Departing,fadingParentID:t.tileID,fadeEndTime:n+s}),t.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:ce.Incoming,fadeEndTime:n+s})),r[a.key]=a,o=!0}return o}function Fe(e,t,i,r){let n=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(n)&&(e.setSelfFadeLogic(i+r),!0)}function De(e,t){var i;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,n=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),s=t.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,n),null!==(i=e.neighboringTiles)&&void 0!==i&&i[s]&&(e.neighboringTiles[s].backfilled=!0)))}class Re{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(let i in this._tiles)this._tiles[i].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(t.au).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){var i;return null===(i=this.getTileById(e))||void 0===i?void 0:i.isRenderable(t)}getRenderableIds(e=0,i){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,i)&&r.push(this.getTileById(e));return i?r.sort((i,r)=>{let n=i.tileID,a=r.tileID,s=new t.P(n.canonical.x,n.canonical.y)._rotate(-e),o=new t.P(a.canonical.x,a.canonical.y)._rotate(-e);return n.overscaledZ-a.overscaledZ||o.y-s.y||o.x-s.x}).map(e=>e.tileID.key):r.map(e=>e.tileID).sort(t.au).map(e=>e.key)}}class ze extends t.E{constructor(e,i,r){super(),this.id=e,this.dispatcher=r,this.on("data",e=>{this._dataHandler(e)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,i,r)=>{let n=new(ae(t.type))(e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,i,r,this),this._inViewTiles=new Re,this._outOfViewCache=new t.av(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new fe,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,null!==(t=this._source)&&void 0!==t&&t.onAdd&&this._source.onAdd(e)}onRemove(e){var t;for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),!(null===(t=this._source)||void 0===t)&&t.onRemove&&this._source.onRemove(e),this._inViewTiles=new Re}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,function*(){try{let t=yield this._source.loadTile(e);this._tileLoaded(e,i,r,t)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.l(t.d(i),{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.n("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){var t;return this._inViewTiles.getRenderableIds(null===(t=this.transform)||void 0===t?void 0:t.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(i,"expired"):"errored"!==r.state&&this._reloadTile(i,"reloading"))}}}_reloadTile(e,i){return t._(this,void 0,void 0,function*(){let t=this._inViewTiles.getTileById(e);t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))})}_tileLoaded(e,i,r,n){e.timeAdded=h(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),n?.unmodified||("raster-dem"===this.getSource().type&&e.dem&&function(e,t){var i,r,n;let a=t.getRenderableIds();for(let s of a){if(null===(i=e.neighboringTiles)||void 0===i||!i[s])continue;let a=t.getTileById(s);e.neighboringTiles[s].backfilled||De(e,a),null!==(n=null===(r=a.neighboringTiles)||void 0===r?void 0:r[e.tileID.key])&&void 0!==n&&n.backfilled||De(a,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n("data",{dataType:"source",tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){let i=this._getLoadedDescendents(t),r=new Set;for(let n of t){let t=i[n.key];if(!t?.length){r.add(n);continue}let a=n.overscaledZ+ze.maxOverzooming,s=t.filter(e=>e.tileID.overscaledZ<=a);if(!s.length){r.add(n);continue}let o=Math.min(...s.map(e=>e.tileID.overscaledZ)),l=s.filter(e=>e.tileID.overscaledZ===o).map(e=>e.tileID);for(let t of l)e[t.key]=t;this._areDescendentsComplete(l,o,n.overscaledZ)||r.add(n)}return r}_getLoadedDescendents(e){var t;let i={};for(let r of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let n of e)r.tileID.isChildOf(n)&&(i[t=n.key]||(i[t]=[]),i[n.key].push(r));return i}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(r=Ce(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter(e=>this._source.hasTile(e)))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let n=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new t.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let a=Pe(e,this._source),s=this._updateRetainedTiles(r,a),o=Me(this._source.type);o&&this._rasterFadeDuration>0&&!i&&function(e,i,r,n,a,s,o){let l=h(),u=t.at(i);for(let t of i){let i=e.getTileById(t.key);i.fadingDirection!==ce.Departing&&0!==i.fadeOpacity||i.resetFadeLogic(),Ae(e,i,r,l,n,a,o)||ke(e,i,r,l,s,o)||Fe(i,u,l,o)||i.resetFadeLogic()}}(this._inViewTiles,r,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let i of e)if(i.canonical.z>this._source.minzoom){let e=i.scaledTo(i.canonical.z-1);t.push(e);let r=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;let r=new Set;for(let t of e)this._addTile(t).hasData()||r.add(t);let n=e.reduce((e,t)=>(e[t.key]=t,e),{}),a=this._retainLoadedChildren(n,r),s={},o=Math.max(t-ze.maxUnderzooming,this._source.minzoom);for(let e of a){let t=this._inViewTiles.getTileById(e.key),r=t?.wasRequested();for(let a=e.overscaledZ-1;a>=o;--a){let o=e.scaledTo(a);if(s[o.key])break;if(s[o.key]=!0,t=this.getTile(o),!t&&r&&(t=this._addTile(o)),t){let e=t.hasData();if((e||!(null!==(i=this.map)&&void 0!==i&&i.cancelPendingTileRequestsWhileZooming)||r)&&(n[o.key]=o),r=t.wasRequested(),e)break}}}return n}_addTile(e){let i=this._inViewTiles.getTileById(e.key);if(i)return i;i=this._outOfViewCache.getAndRemove(e),i&&(i.resetFadeLogic(),this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;return i||(i=new pe(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._inViewTiles.setTile(e.key,i),r||this._source.fire(new t.n("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some(e=>e.equals(i.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,i,r){let n=[],a=this.transform;if(!a)return n;let s=a.getCoveringTilesDetailsProvider().allowWorldCopies(),o=r?a.getCameraQueryGeometry(e):e,l=e=>a.screenPointToMercatorCoordinate(e,this.terrain),h=this.transformBbox(e,l,!s),u=this.transformBbox(o,l,!s),c=this.getIds(),d=t.a8.fromPoints(u);for(let e of c){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let o=s?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],l=Math.pow(2,a.zoom-r.tileID.overscaledZ),c=i*r.queryPadding*t.a6/r.tileSize/l;for(let e of o){let i=d.map(i=>e.getTilePoint(new t.a7(i.x,i.y)));if(i.expandBy(c),i.intersects(Ee)){let t=h.map(t=>e.getTilePoint(t)),i=u.map(t=>e.getTilePoint(t));n.push({tile:r,tileID:s?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:l})}}}return n}transformBbox(e,i,r){let n=e.map(i);if(r){let r=t.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let a=r.map(i);t.a8.fromPoints(n).covers(a)||(n=n.map(e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e))}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||Me(this._source.type)&&function(e,t){if(t<=0)return!1;let i=h();for(let t of e.getAllTiles())if(t.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,i,r){e||(e=t.ag),this._state.updateState(e,i,r)}removeFeatureState(e,i,r){e||(e=t.ag),this._state.removeFeatureState(e,i,r)}getFeatureState(e,i){return e||(e=t.ag),this._state.getState(e,i)}setDependencies(e,t,i){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}}ze.maxUnderzooming=10,ze.maxOverzooming=3;class Ne{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.al(e,0,1);let i=1,r=this._distances[i],n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];let a=i-1,s=this._distances[a],o=r-s,l=o>0?(n-s)/o:0;return this.points[a].mult(1-l).add(this.points[i].mult(l))}}function Oe(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class Be{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 e=0;e<this.xCellCount*this.yCellCount;e++)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,s){if(i<0||e>this.width||r<0||t>this.height)return[];let o=[];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 e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}}else this._forEachCell(e,t,i,r,this._queryCell,o,{hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}},s);return o}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,s=e+i,o=t-i,l=t+i;if(s<0||a>this.width||l<0||o>this.height)return!1;let h=[];return this._forEachCell(a,o,s,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),h.length>0}_queryCell(e,t,i,r,n,a,s,o){let{seenUids:l,hitTest:h,overlapMode:u}=s,c=this.boxCells[n],d=1e-6;if(null!==c){let n=this.bboxes;for(let s of c)if(!l.box[s]){l.box[s]=!0;let c=4*s,p=this.boxKeys[s];if(e<=n[c+2]+d&&t<=n[c+3]+d&&i>=n[c+0]-d&&r>=n[c+1]-d&&(!o||o(p))&&(!h||!Oe(u,p.overlapMode))&&(a.push({key:p,x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]}),h))return!0}}let p=this.circleCells[n];if(null!==p){let n=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let c=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(n[c],n[c+1],n[c+2],e,t,i,r)&&(!o||o(d))&&(!h||!Oe(u,d.overlapMode))){let e=n[c],t=n[c+1],i=n[c+2];if(a.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),h)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,a,s,o){let{circle:l,seenUids:h,overlapMode:u}=s,c=this.boxCells[n];if(null!==c){let e=this.bboxes;for(let t of c)if(!h.box[t]){h.box[t]=!0;let i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!o||o(r))&&!Oe(u,r.overlapMode))return a.push(!0),!0}}let d=this.circleCells[n];if(null!==d){let e=this.circles;for(let t of d)if(!h.circle[t]){h.circle[t]=!0;let i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!o||o(r))&&!Oe(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,r,n,a,s,o){let l=this._convertToXCellCoord(e),h=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let d=l;d<=u;d++)for(let l=h;l<=c;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+d,a,s,o))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 s=r-e,o=n-t,l=i+a;return l*l>s*s+o*o}_circleAndRectCollide(e,t,i,r,n,a,s){let o=(a-r)/2,l=Math.abs(e-(r+o));if(l>o+i)return!1;let h=(s-n)/2,u=Math.abs(t-(n+h));if(u>h+i)return!1;if(l<=o||u<=h)return!0;let c=l-o,d=u-h;return c*c+d*d<=i*i}}function je(e,t){let i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),n=t[0]*i,a=t[4]*i,s=t[8]*r,o=t[1]*i,l=t[5]*i,h=t[9]*r,u=t[2]*i,c=t[6]*i,d=t[10]*r;e[0]=n,e[1]=a,e[2]=s,e[4]=o,e[5]=l,e[6]=h,e[8]=u,e[9]=c,e[10]=d;let p=t[12],f=t[13],m=t[14];return e[12]=-n*p-o*f-u*m,e[13]=-a*p-l*f-c*m,e[14]=-s*p-h*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}let Ve=t.O();function Ge(e,i,n){let a=t.O();if(!e){let{vecSouth:e,vecEast:t}=Ze(i),n=r();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],s=n,(d=(l=(o=n)[0])*(c=o[3])-(u=o[2])*(h=o[1]))&&(s[0]=c*(d=1/d),s[1]=-h*d,s[2]=-u*d,s[3]=l*d),a[0]=n[0],a[1]=n[1],a[4]=n[2],a[5]=n[3]}var s,o,l,h,u,c,d;return t.S(a,a,[1/n,1/n,1]),a}function Ue(e,i,r,n){if(e){let e=t.O();if(!i){let{vecSouth:t,vecEast:i}=Ze(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[n,n,1]),e}return r.pixelsToClipSpaceMatrix}function Ze(e){let i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),o=t.az();o[0]=-a*n*r-s*i,o[1]=-s*n*r+a*i;let l=t.aA(o);l<1e-9?t.aB(o):t.aC(o,o,1/l);let h=t.az();h[0]=a*n*i-s*r,h[1]=s*n*i+a*r;let u=t.aA(h);return u<1e-9?t.aB(h):t.aC(h,h,1/u),{vecEast:h,vecSouth:o}}function $e(e,i,r,n){let a;n?(a=[e,i,n(e,i),1],t.aE(a,a,r)):(a=[e,i,0,1],lt(a,a,r));let s=a[3];return{point:new t.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}function qe(e,t){return.5+e/t*.5}function We(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function He(e,i,r,n,a,s,o,l,h,u,c,d,p){let f=r?e.textSizeData:e.iconSizeData,m=t.aw(f,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],_=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let y=e.lineVertexArray,v=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=i.transform.width/i.transform.height,b=!1;for(let r=0;r<v.length;r++){let w=v.get(r);if(w.hidden||w.writingMode===t.ax.vertical&&!b){ot(w.numGlyphs,_);continue}b=!1;let T=new t.P(w.anchorX,w.anchorY),S={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:h,width:u,height:c,translation:d},I=it(w.anchorX,w.anchorY,S);if(!We(I.point,g)){ot(w.numGlyphs,_);continue}let P=qe(i.transform.cameraToCenterDistance,I.signedDistanceFromCamera),C=t.ay(f,m,w),E=s?C*i.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,h)/P:C*P,M=Ke({projectionContext:S,pitchedLabelPlaneMatrixInverse:a,symbol:w,fontSize:E,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l});b=M.useVertical,(M.notEnoughRoom||b||M.needsFlipping&&Ke({projectionContext:S,pitchedLabelPlaneMatrixInverse:a,symbol:w,fontSize:E,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l}).notEnoughRoom)&&ot(w.numGlyphs,_)}r?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function Xe(e,t,i,r,n,a,s,o){let l=a.glyphStartIndex+a.numGlyphs,h=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,c=t.getoffsetX(a.glyphStartIndex),d=t.getoffsetX(l-1),p=at(e*c,i,r,n,a.segment,h,u,o,s);if(!p)return null;let f=at(e*d,i,r,n,a.segment,h,u,o,s);return f?o.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function Ye(e,i,r,n){return e===t.ax.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.ax.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function Ke(e){let i,{projectionContext:r,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:s,flip:o,keepUpright:l,glyphOffsetArray:h,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:d}=e,p=s/24,f=a.lineOffsetX*p,m=a.lineOffsetY*p;if(a.numGlyphs>1){let e=a.glyphStartIndex+a.numGlyphs,t=a.lineStartIndex,s=a.lineStartIndex+a.lineLength,u=Xe(p,h,f,m,o,a,d,r);if(!u)return{notEnoughRoom:!0};let g=tt(u.first.point.x,u.first.point.y,r,n),_=tt(u.last.point.x,u.last.point.y,r,n);if(l&&!o){let e=Ye(a.writingMode,g,_,c);if(e)return e}i=[u.first];for(let n=a.glyphStartIndex+1;n<e-1;n++){let e=at(p*h.getoffsetX(n),f,m,o,a.segment,t,s,r,d);if(!e)return{notEnoughRoom:!0};i.push(e)}i.push(u.last)}else{if(l&&!o){let e=et(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,i=a.lineStartIndex+a.segment+1,s=new t.P(r.lineVertexArray.getx(i),r.lineVertexArray.gety(i)),o=et(s.x,s.y,r),l=o.signedDistanceFromCamera>0?o.point:Je(r.tileAnchorPoint,s,e,1,r),h=tt(e.x,e.y,r,n),u=tt(l.x,l.y,r,n),d=Ye(a.writingMode,h,u,c);if(d)return d}let e=at(p*h.getoffsetX(a.glyphStartIndex),f,m,o,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,r,d);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};i=[e]}for(let e of i)t.aD(u,e.point,e.angle);return{}}function Je(e,t,i,r,n){let a=e.add(e.sub(t)._unit()),s=et(a.x,a.y,n).point,o=i.sub(s);return i.add(o._mult(r/o.mag()))}function Qe(e,i,r){let n=i.projectionCache;if(n.projections[e])return n.projections[e];let a=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),s=et(a.x,a.y,i);if(s.signedDistanceFromCamera>0)return n.projections[e]=s.point,n.anyProjectionOccluded||(n.anyProjectionOccluded=s.isOccluded),s.point;let o=e-r.direction;return Je(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function et(e,t,i){let r,n=e+i.translation[0],a=t+i.translation[1];return i.pitchWithMap?(r=$e(n,a,i.pitchedLabelPlaneMatrix,i.getElevation),r.isOccluded=!1):(r=i.transform.projectTileCoordinates(n,a,i.unwrappedTileID,i.getElevation),r.point.x=(.5*r.point.x+.5)*i.width,r.point.y=(.5*-r.point.y+.5)*i.height),r}function tt(e,i,r,n){if(r.pitchWithMap){let a=[e,i,0,1];return t.aE(a,a,n),r.transform.projectTileCoordinates(a[0]/a[3],a[1]/a[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-i/r.height*2}}function it(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function rt(e,t,i){return e._unit()._perp()._mult(t*i)}function nt(e,i,r,n,a,s,o,l,h){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];let u=r.add(i);if(e+h.direction<n||e+h.direction>=a)return l.projectionCache.offsets[e]=u,u;let c=Qe(e+h.direction,l,h),d=rt(c.sub(r),o,h.direction),p=r.add(d),f=c.add(d);return l.projectionCache.offsets[e]=t.aF(s,u,p,f)||u,l.projectionCache.offsets[e]}function at(e,t,i,r,n,a,s,o,l){let h=r?e-t:e+t,u=h>0?1:-1,c=0;r&&(u*=-1,c=Math.PI),u<0&&(c+=Math.PI);let d,p=u>0?a+n:a+n+1;o.projectionCache.cachedAnchorPoint?d=o.projectionCache.cachedAnchorPoint:(d=et(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=d);let f,m,g,_=d,y=d,v=0,x=0,b=Math.abs(h),w=[];for(;v+x<=b;){if(p+=u,p<a||p>=s)return null;v+=x,y=_,m=f;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:y};if(_=Qe(p,o,e),0===i)w.push(y),g=_.sub(y);else{let t,r=_.sub(y);t=0===r.mag()?rt(Qe(p+u,o,e).sub(_),i,u):rt(r,i,u),m||(m=y.add(t)),f=nt(p,t,_,a,s,m,i,o,e),w.push(m),g=f.sub(m)}x=g.mag()}let T=g._mult((b-v)/x)._add(m||y),S=c+Math.atan2(_.y-y.y,_.x-y.x);return w.push(T),{point:T,angle:l?S:0,path:w}}let st=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ot(e,t){for(let i=0;i<e;i++){let e=t.length;t.resize(e+4),t.float32.set(st,3*e)}}function lt(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}let ht=100;class ut{constructor(e,t=new Be(e.width+200,e.height+200,25),i=new Be(e.width+200,e.height+200,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+ht,this.screenBottomBoundary=e.height+ht,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,a,s,o,l,h,u,c){let d,p=this.projectAndGetPerspectiveRatio(e.anchorPointX+o[0],e.anchorPointY+o[1],n,h,c),f=i*p.perspectiveRatio;if(a||s)d=this._projectCollisionBox(e,f,r,n,a,s,o,p,h,u,c);else{let t=p.x+(u?u.x*f:0),i=p.y+(u?u.y*f:0);d={allPointsOccluded:!1,box:[t+e.x1*f,i+e.y1*f,t+e.x2*f,i+e.y2*f]}}let[m,g,_,y]=d.box,v=a?d.allPointsOccluded:p.isOccluded,x=v;return x||(x=p.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(m,g,_,y)),x||"always"!==t&&this.grid.hitTest(m,g,_,y,t,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(e,i,r,n,a,s,o,l,h,u,c,d,p,f){let m=[],g=new t.P(i.anchorX,i.anchorY),_=this.getPerspectiveRatio(g.x,g.y,s,f),y=(h?a*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,s)/_:a*_)/t.aJ,v={getElevation:f,pitchedLabelPlaneMatrix:o,lineVertexArray:r,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:p},x=Xe(y,n,i.lineOffsetX*y,i.lineOffsetY*y,!1,i,!1,v),b=!1,w=!1,T=!0;if(x){let i=.5*c*_+d,r=new t.P(-100,-100),n=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new Ne,s=x.first,o=x.last,p=[];for(let e=s.path.length-1;e>=1;e--)p.push(s.path[e]);for(let e=1;e<o.path.length;e++)p.push(o.path[e]);let f=2.5*i;if(h){let e=this.projectPathToScreenSpace(p,v);p=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(p.length>0){let e=p[0].clone(),i=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),i.x=Math.max(i.x,p[t].x),i.y=Math.max(i.y,p[t].y);g=e.x>=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[p]:i.x<r.x||e.x>n.x||i.y<r.y||e.y>n.y?[]:t.aG([p],r.x,r.y,n.x,n.y)}for(let t of g){a.reset(t,.25*i);let r=0;r=a.length<=.5*i?1:Math.ceil(a.paddedLength/f)+1;for(let t=0;t<r;t++){let n=t/Math.max(r-1,1),s=a.lerp(n),o=s.x+ht,h=s.y+ht;m.push(o,h,i,0);let c=o-i,d=h-i,p=o+i,f=h+i;if(T&&(T=this.isOffscreen(c,d,p,f)),w||(w=this.isInsideGrid(c,d,p,f)),"always"!==e&&this.grid.hitTestCircle(o,h,i,e,u)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:b}}projectPathToScreenSpace(e,t){return function(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)}(function(e,t){let i=Ve;return function(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(i,t.pitchedLabelPlaneMatrix),e.map(e=>{let r=$e(e.x,e.y,i,t.getElevation),n=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,t.getElevation);return n.point.x=(.5*n.point.x+.5)*t.width,n.point.y=(.5*-n.point.y+.5)*t.height,n})}(e,t))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let i=[],r=new t.a8;for(let n of e){let e=new t.P(n.x+ht,n.y+ht);r.extend(e),i.push(e)}let{minX:n,minY:a,maxX:s,maxY:o}=r,l=this.grid.query(n,a,s,o).concat(this.ignoredGrid.query(n,a,s,o)),h={},u={};for(let e of l){let r=e.key;if(void 0===h[r.bucketInstanceId]&&(h[r.bucketInstanceId]={}),h[r.bucketInstanceId][r.featureIndex])continue;let n=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aH(i,n)&&(h[r.bucketInstanceId][r.featureIndex]=!0,void 0===u[r.bucketInstanceId]&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,i,r,n,a){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,a){let s=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:n,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,i,r,n,a){if(a){let r;n?(r=[e,i,n(e,i),1],t.aE(r,r,a)):(r=[e,i,0,1],lt(r,r,a));let s=r[3];return{x:(r[0]/s+1)/2*this.transform.width+ht,y:(-r[1]/s+1)/2*this.transform.height+ht,perspectiveRatio:.5+this.transform.cameraToCenterDistance/s*.5,isOccluded:!1,signedDistanceFromCamera:s}}{let t=this.transform.projectTileCoordinates(e,i,r,n);return{x:(t.point.x+1)/2*this.transform.width+ht,y:(1-t.point.y)/2*this.transform.height+ht,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let n=this.transform.projectTileCoordinates(e,t,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,i,r){return i<ht||e>=this.screenRightBoundary||r<ht||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,r,n,a,s,o,l,h,u,c){let d=1,p=0,f=0,m=1,g=e.anchorPointX+o[0],_=e.anchorPointY+o[1];if(s&&!a){let e=this.projectAndGetPerspectiveRatio(g+1,_,n,h,c),t=e.x-l.x,i=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),r=Math.sin(i),a=Math.cos(i);d=a,p=r,f=-r,m=a}else if(!s&&a){let e=Ze(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let y=l.x,v=l.y,x=i;a&&(y=g,v=_,x=Math.pow(2,-(this.transform.zoom-r.overscaledZ)),x*=this.transform.getPitchedTextCorrection(g,_,n),u||(x*=t.al(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=d*u.x*x+f*u.y*x,v+=p*u.x*x+m*u.y*x);let b=e.x1*x,w=e.x2*x,T=(b+w)/2,S=e.y1*x,I=e.y2*x,P=(S+I)/2,C=[{offsetX:b,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:P},{offsetX:w,offsetY:I},{offsetX:T,offsetY:I},{offsetX:b,offsetY:I},{offsetX:b,offsetY:P}],E=[];for(let{offsetX:e,offsetY:i}of C)E.push(new t.P(y+d*e+f*i,v+p*e+m*i));let M=!1;if(a){let e=E.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,h,c));M=e.some(e=>!e.isOccluded),E=e.map(e=>new t.P(e.x,e.y))}else M=!0;return{box:t.aI(E),allPointsOccluded:!M}}}class ct{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class dt{constructor(e,t,i,r,n){this.text=new ct(e?e.text:null,t,i,n),this.icon=new ct(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class pt{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class ft{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class mt{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:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function gt(e,i,r,n,a){let{horizontalAlign:s,verticalAlign:o}=t.aP(e);return new t.P(-(s-.5)*i+n[0]*a,-(o-.5)*r+n[1]*a)}class _t{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new ut(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new mt(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,i,r,n){let a=r.getBucket(i),s=r.latestFeatureIndex;if(!a||!s||i.id!==a.layerIds[0])return;let o=r.collisionBoxArray,l=a.layers[0].layout,h=a.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/t.a6,d=r.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aK(r,1,this.transform.zoom),m=t.aL(this.collisionIndex.transform,r,h.get("text-translate"),h.get("text-translate-anchor")),g=t.aL(this.collisionIndex.transform,r,h.get("icon-translate"),h.get("icon-translate-anchor")),_=Ge(p,this.transform,f);this.retainedQueryData[a.bucketInstanceId]=new ft(a.bucketInstanceId,s,a.sourceLayerIndex,a.index,r.tileID);let y={bucket:a,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:c,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:t.aw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n)for(let t of a.sortKeyRanges){let{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y,v,x){var b,w,T;let S=t.aM[e.textAnchor],I=[e.textOffset0,e.textOffset1],P=gt(S,r,n,I,a),C=this.collisionIndex.placeCollisionBox(i,d,l,h,u,o,s,g,c.predicate,v,P,x);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,h,u,o,s,_,c.predicate,v,P,x).placeable)&&C.placeable){let e;if(!(null===(b=this.prevPlacement)||void 0===b)&&b.variableOffsets[p.crossTileID]&&!(null===(T=null===(w=this.prevPlacement)||void 0===w?void 0:w.placements[p.crossTileID])||void 0===T)&&T.text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:I,width:r,height:n,anchor:S,textBoxScale:a,prevAnchor:e},this.markUsedJustification(f,S,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:P,placedGlyphBoxes:C}}}placeLayerBucketPart(e,i,r){let{bucket:n,layout:a,translationText:s,translationIcon:o,unwrappedTileID:l,pitchedLabelPlaneMatrix:h,textPixelRatio:u,holdingForFade:c,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,m=a.get("text-optional"),g=a.get("icon-optional"),_=t.aN(a,"text-overlap","text-allow-overlap"),y="always"===_,v=t.aN(a,"icon-overlap","icon-allow-overlap"),x="always"===v,b="map"===a.get("text-rotation-alignment"),w="map"===a.get("text-pitch-alignment"),T="none"!==a.get("icon-text-fit"),S="viewport-y"===a.get("symbol-z-order"),I=y&&(x||!n.hasIconData()||g),P=x&&(y||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);let C=this.retainedQueryData[n.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(C),M=this.transform.getFastPathSimpleProjectionMatrix(C),A=(e,d,x)=>{var S,A;if(i[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new pt(!1,!1,!1));let k=!1,L=!1,F=!0,D=null,R={box:null,placeable:!1,offscreen:null,occluded:!1},z={placeable:!1},N=null,O=null,B=null,j=0,V=0,G=0;d.textFeatureIndex?j=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(j=e.featureIndex),d.verticalTextFeatureIndex&&(V=d.verticalTextFeatureIndex);let U=d.textBox;if(U){let i=i=>{let r=t.ax.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},a=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(let e of n.writingModes)if(e===t.ax.vertical?(R=r(),z=R):R=i(),R?.placeable)break}else R=i()},h=e.textAnchorOffsetStartIndex,c=e.textAnchorOffsetEndIndex;if(c===h){let r=(t,i)=>{let r=this.collisionIndex.placeCollisionBox(t,_,u,C,l,w,b,s,f.predicate,E,void 0,M);return r?.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};a(()=>r(U,t.ax.horizontal),()=>{let i=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ax.vertical):{box:null,offscreen:null}}),i(R?.placeable)}else{let p=t.aM[null===(A=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[e.crossTileID])||void 0===A?void 0:A.anchor],m=(t,i,a)=>{let d=t.x2-t.x1,m=t.y2-t.y1,g=e.textBoxScale,y=T&&"never"===v?i:null,x=null,S="never"===_?1:2,I="never";p&&S++;for(let i=0;i<S;i++){for(let i=h;i<c;i++){let r=n.textAnchorOffsets.get(i);if(p&&r.textAnchor!==p)continue;let h=this.attemptAnchorPlacement(r,t,d,m,g,b,w,u,C,l,f,I,e,n,a,s,o,y,E);if(h&&(x=h.placedGlyphBoxes,x?.placeable))return k=!0,D=h.shift,x}p?p=null:I=_}return r&&!x&&(x={box:this.collisionIndex.placeCollisionBox(U,"always",u,C,l,w,b,s,f.predicate,E,void 0,M).box,offscreen:!1,placeable:!1,occluded:!1}),x};a(()=>m(U,d.iconBox,t.ax.horizontal),()=>{let i=d.verticalTextBox;return n.allowVerticalPlacement&&!R?.placeable&&e.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}}),R&&(k=R.placeable,F=R.offscreen);let g=i(R?.placeable);if(!k&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(N=R,k=N?.placeable,F=N?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=t.ay(n.textSizeData,p,i),u=a.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,i,n.lineVertexArray,n.glyphOffsetArray,o,l,h,r,w,f.predicate,e.collisionCircleDiameter,u,s,E),O.circles.length&&O.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),k=y||O.circles.length>0&&!O.collisionDetected,F&&(F=O.offscreen)}if(d.iconFeatureIndex&&(G=d.iconFeatureIndex),d.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,v,u,C,l,w,b,o,f.predicate,E,T&&D?D:void 0,M);z&&z.placeable&&d.verticalIconBox?(B=e(d.verticalIconBox),L=B.placeable):(B=e(d.iconBox),L=B.placeable),F&&(F=B.offscreen)}let Z=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=g||0===e.numIconVertices;Z||$?$?Z||L&&(L=k):k=L&&k:L=k=L&&k;let q=L&&B.placeable;if(k&&N.placeable&&this.collisionIndex.insertCollisionBox(N.box,_,a.get("text-ignore-placement"),n.bucketInstanceId,z&&z.placeable&&V?V:j,f.ID),q&&this.collisionIndex.insertCollisionBox(B.box,v,a.get("icon-ignore-placement"),n.bucketInstanceId,G,f.ID),O&&k&&this.collisionIndex.insertCollisionCircles(O.circles,_,a.get("text-ignore-placement"),n.bucketInstanceId,j,f.ID),r&&this.storeCollisionData(n.bucketInstanceId,x,d,N,B,O),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new pt((k||I)&&!N?.occluded,(L||P)&&!B?.occluded,F||n.justReloaded),i[e.crossTileID]=!0};if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");let t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let i=t[e];A(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,i,r,n,a){if(i.textBox||i.iconBox){let a,s;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?s=a.get(t):(s={text:null,icon:null},a.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=n.box)}if(a){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-ht),t.push(a.circles[e+1]-ht),t.push(a.circles[e+2]),t.push(a.collisionDetected?1:0)}}markUsedJustification(e,i,r,n){let a;a=n===t.ax.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aO(i)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,i,r){let n=i===t.ax.horizontal||i===t.ax.horizontalOnly?i:0,a=i===t.ax.vertical?i:0,s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of s)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}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:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=n[e];a?(this.opacities[e]=new dt(a,r,t.text,t.icon),i||(i=t.text!==a.text.placed),i||(i=t.icon!==a.icon.placed)):(this.opacities[e]=new dt(null,r,t.text,t.icon,t.skipFade),i||(i=t.text||t.icon))}for(let e in n){let t=n[e];if(!this.opacities[e]){let n=new dt(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i||(i=t.text.placed),i||(i=t.icon.placed))}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,n){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 a=e.layers[0],s=a.layout,o=new dt(null,0,!1,!1,!0),l=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===s.get("text-rotation-alignment"),d="map"===s.get("text-pitch-alignment"),p="none"!==s.get("icon-text-fit"),f=new dt(null,0,l&&(h||!e.hasIconData()||s.get("icon-optional")),h&&(l||!e.hasTextData()||s.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);let m=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices||(e.hasVisibleVertices=i!==Ct)},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let i=0;i<e.symbolInstances.length;i++){let n=e.symbolInstances.get(i),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:s,crossTileID:l}=n,h=this.opacities[l];r[l]?h=o:h||(h=f,this.opacities[l]=h),r[l]=!0;let _=n.numIconVertices>0,y=this.placedOrientations[n.crossTileID],v=y===t.ax.vertical,x=y===t.ax.horizontal||y===t.ax.horizontalOnly;if(a>0||s>0){let t=Pt(h.text);m(e.text,a,v?Ct:t),m(e.text,s,x?Ct:t);let i=h.text.isHidden(),r=[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex];for(let t of r)t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0);n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);let o=this.variableOffsets[n.crossTileID];o&&this.markUsedJustification(e,o.anchor,n,y);let l=this.placedOrientations[n.crossTileID];l&&(this.markUsedJustification(e,"left",n,l),this.markUsedOrientation(e,l,n))}if(_){let t=Pt(h.icon),i=!(p&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(m(e.icon,n.numIconVertices,i?t:Ct),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=h.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,n.numVerticalIconVertices,i?Ct:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}let b=g?.has(i)?g.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[l];e?(i=gt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=x),yt(e.textCollisionBox.collisionVertexArray,h.text.placed,!t||n,b.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){let t,n=!(x||!r.verticalIconBox);r.iconBox&&(t=n),r.verticalIconBox&&(t=!n),yt(e.iconCollisionBox.collisionVertexArray,h.icon.placed,t,b.icon,p?i.x:0,p?i.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 0===this.fadeDuration?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 yt(e,t,i,r,n,a){r&&0!==r.length||(r=[0,0,0,0]);let s=r[0]-ht,o=r[1]-ht,l=r[2]-ht,h=r[3]-ht;e.emplaceBack(t?1:0,i?1:0,n||0,a||0,s,o),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,o),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,l,h),e.emplaceBack(t?1:0,i?1:0,n||0,a||0,s,h)}let vt=Math.pow(2,25),xt=Math.pow(2,24),bt=Math.pow(2,17),wt=Math.pow(2,16),Tt=Math.pow(2,9),St=Math.pow(2,8),It=Math.pow(2,1);function Pt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*vt+t*xt+i*bt+t*wt+i*Tt+t*St+i*It+t}let Ct=0;class Et{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!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;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class Mt{constructor(e,t,i,r,n,a,s,o){this.placement=new _t(e,t,a,s,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,i,r){let n=h(),a=()=>!this._forceFullPlacement&&h()-n>2;for(;this._currentPlacementIndex>=0;){let n=i[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(t.aQ(n)&&n.layout&&(!n.minzoom||n.minzoom<=s)&&(!n.maxzoom||n.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new Et(n)),this._inProgressLayer.continuePlacement(r[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let At=512/t.a6/2;class kt{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let n=new Map;for(let e=0;e<i.length;e++){let t=i.get(e),r=t.key,a=n.get(r);a?a.push(t):n.set(r,[t])}for(let[e,i]of n){let r={positions:i.map(e=>({x:Math.floor(e.anchorX*At),y:Math.floor(e.anchorY*At)})),crossTileIDs:i.map(e=>e.crossTileID)};if(r.positions.length>128){let e=new t.aR(r.positions.length,16,Uint16Array);for(let{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){let{x:r,y:n,z:a}=this.tileID.canonical,{x:s,y:o,z:l}=i.canonical,h=At/Math.pow(2,l-a),u=(o*t.a6+e.anchorY)*h,c=n*t.a6*At;return{x:Math.floor((s*t.a6+e.anchorX)*h-r*t.a6*At),y:Math.floor(u-c)}}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 s=this._symbolsByKey[a.key];if(!s)continue;let o=this.getScaledCoordinates(a,t);if(s.index){let e=s.index.range(o.x-r,o.y-r,o.x+r,o.y+r).sort();for(let t of e){let e=s.crossTileIDs[t];if(!i[e]){i[e]=!0,a.crossTileID=e;break}}}else if(s.positions)for(let e=0;e<s.positions.length;e++){let t=s.positions[e],n=s.crossTileIDs[e];if(Math.abs(t.x-o.x)<=r&&Math.abs(t.y-o.y)<=r&&!i[n]){i[n]=!0,a.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Lt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ft{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let i=this.indexes[e],r={};for(let e in i){let n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){var r,n,a;if(null!==(r=this.indexes[e.overscaledZ])&&void 0!==r&&r[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 e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;(n=this.usedCrossTileIDs)[a=e.overscaledZ]||(n[a]={});let s=this.usedCrossTileIDs[e.overscaledZ];for(let i in this.indexes){let r=this.indexes[i];if(Number(i)>e.overscaledZ)for(let i in r){let n=r[i];n.tileID.isChildOf(e)&&n.findMatches(t.symbolInstances,e,s)}else{let n=r[e.scaledTo(Number(i)).key];n&&n.findMatches(t.symbolInstances,e,s)}}for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=i.generate(),s[r.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new kt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let t of i)delete this.usedCrossTileIDs[e][t]}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}}class Dt{constructor(){this.layerIndexes={},this.crossTileIDs=new Lt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new Ft);let n=!1,a={};r.handleWrapJump(i);for(let i of t){let t=i.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||(this.maxBucketInstanceId+=1,t.bucketInstanceId=this.maxBucketInstanceId),r.addBucket(i.tileID,t,this.crossTileIDs)&&(n=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(e){let t={};for(let i of e)t[i]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Rt="void main() {fragColor=vec4(1.0);}";let zt={prelude:Nt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Nt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Nt("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:Nt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Nt("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Nt("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:Nt(Rt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Nt("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Nt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Nt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Nt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Nt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Nt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Nt(Rt,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Nt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Nt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Nt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Nt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:Nt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:Nt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:Nt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Nt("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Nt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Nt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Nt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Nt("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Nt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Nt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Nt("uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}"),symbolSDF:Nt("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:Nt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}"),terrain:Nt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Nt("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Nt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Nt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Nt("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Nt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Nt(e,t){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=a?a.concat(n):n,o={};return{fragmentSource:e=e.replace(i,(e,t,i,r,n)=>(o[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = u_${n};\n#endif\n`)),vertexSource:t=t.replace(i,(e,t,i,r,n)=>{let a="float"===r?"vec2":"vec4",s=n.match(/color/)?"color":a;return o[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${a} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n    ${n} = a_${n};\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n    ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${a} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = a_${n};\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n    ${i} ${r} ${n} = unpack_mix_${s}(a_${n}, u_${n}_t);\n#else\n    ${i} ${r} ${n} = u_${n};\n#endif\n`}),staticAttributes:r,staticUniforms:s}}class Ot{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Bt=t.aS([{name:"a_pos",type:"Int16",components:2}]);let jt="#define PROJECTION_MERCATOR",Vt="mercator";class Gt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Vt}get shaderDefine(){return jt}get shaderPreludeCode(){return zt.projectionMercator}get vertexShaderPreludeCode(){return zt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,n,a){if(this._cachedMesh)return this._cachedMesh;let s=new t.aU;s.emplaceBack(0,0),s.emplaceBack(t.a6,0),s.emplaceBack(0,t.a6),s.emplaceBack(t.a6,t.a6);let o=e.createVertexBuffer(s,Bt.members),l=t.aV.simpleSegment(0,0,4,2),h=new t.aW;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);let u=e.createIndexBuffer(h);return this._cachedMesh=new Ot(o,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Ut{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.H.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.H.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.H.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.H.number(e.right,i.right,r)),this}getCenter(e,i){let r=t.al((this.left+e-this.right)/2,0,e),n=t.al((this.top+i-this.bottom)/2,0,i);return new t.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Ut(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Zt(e,t){if(!e.renderWorldCopies||e.lngRange)return;let i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function $t(e){return Math.max(0,Math.floor(e))}class qt{constructor(e,i){var r;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===i?.renderWorldCopies||!!i?.renderWorldCopies,this._minZoom=i?.minZoom||0,this._maxZoom=i?.maxZoom||22,this._minPitch=null==i?.minPitch?0:i?.minPitch,this._maxPitch=null==i?.maxPitch?60:i?.maxPitch,this._constrainOverride=null!==(r=i?.constrainOverride)&&void 0!==r?r:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=$t(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ut,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=$t(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Ut(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let i=t.X(e,-180,180)*Math.PI/180;var n,a,s,o,l,h,u,c,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,s=-this._bearingInRadians,o=(a=this._rotationMatrix)[0],l=a[1],h=a[2],u=a[3],c=Math.sin(s),d=Math.cos(s),n[0]=o*d+h*c,n[1]=l*d+u*c,n[2]=o*-c+h*d,n[3]=l*-c+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let i=t.al(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aX(this._fovInRadians)}setFov(e){e=t.al(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.an(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let i=this.applyConstrain(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.ao(i),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t;return 2!==(null===(e=this._latRange)||void 0===e?void 0:e.length)||2!==(null===(t=this._lngRange)||void 0===t?void 0:t.length)?null:new U([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-t.am,t.am])}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let{minX:r,minY:n,maxX:a,maxY:s}=t.a8.fromPoints(i).extend(e);return[new t.P(r,n),new t.P(a,n),new t.P(a,s),new t.P(r,s),new t.P(r,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ap(new Float64Array(16));t.S(e,e,[this._width/2,-this._height/2,1]),t.Q(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ap(new Float64Array(16)),t.S(e,e,[1,-1,1]),t.Q(e,e,[-1,-1,0]),t.S(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,n){let a,s,o=void 0!==r?r:this.bearing,l=n=void 0!==n?n:this.pitch,{distanceToCenter:h,clampedElevation:u}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,l),{x:c,y:d}=be(l,o),p=t.a7.fromLngLat(e,i),f=t.aY(1,p.y),m=0;do{if(m+=1,m>10)break;s=h/f,a=new t.a7(p.x+c*s,p.y+d*s),f=1/a.meterInMercatorCoordinateUnits()}while(Math.abs(h-s*f)>1e-12);return{center:a.toLngLat(),elevation:u,zoom:t.ar(this.height/2/Math.tan(this.fovInRadians/2)/s/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;let i=1/this.worldSize,r=t.aq(1,this.center.lat)*this.worldSize,n=t.a7.fromLngLat(this.center,this.elevation),a=n.x/i,s=n.y/i,o=n.z/i,l=this.pitch,h=this.bearing,{x:u,y:c,z:d}=be(l,h),p=this.cameraToCenterDistance,f=a+p*-u,m=s+p*-c,g=o+p*d,{distanceToCenter:_,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(g/r,e,l),v=_*r,x=new t.a7((f+u*v)*i,(m+c*v)*i,0).toLngLat(),b=t.aq(1,x.lat),w=t.ar(this.height/2/Math.tan(this.fovInRadians/2)/_/b/this.tileSize);this._elevation=y,this._center=x,this.setZoom(w)}_distanceToCenterFromAltElevationPitch(e,i,r){let n,a=-Math.cos(t.an(r)),s=e-i,o=i;return a*s>=0||Math.abs(a)<.1?(n=1e4,o=e+n*a):n=-s/a,{distanceToCenter:n,clampedElevation:o}}getCameraPoint(){let e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=t.aq(1,this.center.lat)*this.worldSize;return xe(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/t.a6,1/i/t.a6]}}class Wt{constructor(e,i){this.min=e,this.max=i,this.center=t.aZ([],t.a_([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=t.a$(this.min),n=t.a$(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],n[e]=i[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Wt(r,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i of e.planes){let e=this.intersectsPlane(i);if(0===e)return 0;1===e&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class Ht{distanceToTile2d(e,t,i,r){let n=r,a=n.distanceX([e,t]),s=n.distanceY([e,t]);return Math.hypot(a,s)}getWrap(e,t,i){return i}getTileBoundingVolume(e,i,r,n){var a,s;let o=0,l=0;if(n?.terrain){let h=new t.a3(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(h);o=null!==(a=u.minElevation)&&void 0!==a?a:Math.min(0,r),l=null!==(s=u.maxElevation)&&void 0!==s?s:Math.max(0,r)}let h=1<<e.z;return new Wt([i+e.x/h,e.y/h,o],[i+(e.x+1)/h,(e.y+1)/h,l])}allowVariableZoom(e,i){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,n=t.al(78.5-r/2,0,60);return!!i.terrain||e.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class Xt{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0,n,a){let s=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],o=Math.pow(2,r),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(r=>function(e,i,r,n){let a=t.aE([],e,i),s=1/a[3]/r*n;return t.b4(a,a,[s,s,1/a[3],s])}(r,e,i,o));n&&function(e,i,r,n){let a=n?4:0,s=n?0:4,o=0,l=[],h=[];for(let i=0;i<4;i++){let r=t.b0([],e[i+s],e[i+a]),n=t.b5(r);t.aZ(r,r,1/n),l.push(n),h.push(r)}for(let i=0;i<4;i++){let n=t.b6(e[i+a],h[i],r);o=null!==n&&n>=0?Math.max(o,n):Math.max(o,l[i])}let u=function(e,i){let r=t.b0([],e[i[0]],e[i[1]]),n=t.b0([],e[i[2]],e[i[1]]),a=[0,0,0,0];return t.b1(a,t.b2([],r,n)),a[3]=-t.b3(a,e[i[0]]),a}(e,i),c=function(e,i){let r=t.b7(e),n=t.b8([],e,1/r),a=t.b0([],i,t.aZ([],n,t.b3(i,n))),s=t.b7(a);if(s>0){let e=Math.sqrt(1-n[3]*n[3]),r=t.aZ([],n,-n[3]),o=t.a_([],r,t.aZ([],a,e/s));return t.b9(i,o)}return null}(r,u);if(null!==c){let e=c/t.b3(h[0],u);o=Math.min(o,e)}for(let t=0;t<4;t++){let i=Math.min(o,l[t]);e[t+s]=[e[t+a][0]+h[t][0]*i,e[t+a][1]+h[t][1]*i,e[t+a][2]+h[t][2]*i,1]}}(l,s[0],n,a);let h=s.map(e=>{let i=t.b0([],l[e[0]],l[e[1]]),r=t.b0([],l[e[2]],l[e[1]]),n=t.b1([],t.b2([],i,r)),a=-t.b3(n,l[e[1]]);return n.concat(a)}),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],c=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let e of l)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),c[t]=Math.max(c[t],e[t]);return new Xt(l,h,new Wt(u,c))}}class Yt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,i)=>{i=t.al(+i,this.minZoom,this.maxZoom);let r={center:new t.W(e.lng,e.lat),zoom:i},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){let e=179.9999999999;n=[-e,e]}let a=this.tileSize*t.ao(r.zoom),s=0,o=a,l=0,h=a,u=0,c=0,{x:d,y:p}=this.size;if(this._helper._latRange){let e=this._helper._latRange;s=t.Y(e[1])*a,o=t.Y(e[0])*a,o-s<p&&(u=p/(o-s))}n&&(l=t.X(t.Z(n[0])*a,0,a),h=t.X(t.Z(n[1])*a,0,a),h<l&&(h+=a),h-l<d&&(c=d/(h-l)));let f,m,{x:g,y:_}=ge(a,e),y=Math.max(c||0,u||0);if(y){let e=new t.P(c?(h+l)/2:g,u?(o+s)/2:_);return r.center=_e(a,e).wrap(),r.zoom+=t.ar(y),r}if(this._helper._latRange){let e=p/2;_-e<s&&(m=s+e),_+e>o&&(m=o-e)}if(n){let e=(l+h)/2,i=g;this._helper._renderWorldCopies&&(i=t.X(g,e-a/2,e+a/2));let r=d/2;i-r<l&&(f=l+r),i+r>h&&(f=h-r)}if(void 0!==f||void 0!==m){let e=new t.P(f??g,m??_);r.center=_e(a,e).wrap()}return r},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Ht}clone(){let e=new Yt;return e.apply(this,!1),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let i=[new t.ba(0,e)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),o=Math.floor(Math.min(r.x,n.x,a.x,s.x)),l=Math.floor(Math.max(r.x,n.x,a.x,s.x)),h=1;for(let r=o-h;r<=l+h;r++)0!==r&&i.push(new t.ba(r,e))}return i}getCameraFrustum(){return Xt.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){let r=t.aq(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),s=t.a7.fromLngLat(e),o=new t.a7(s.x-(n.x-a.x),s.y-(n.y-a.y));this.setCenter(o?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.a7.fromLngLat(e),i.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a7.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){let r=i||0,n=[e.x,e.y,0,1],a=[e.x,e.y,1,1];t.aE(n,n,this._pixelMatrixInverse),t.aE(a,a,this._pixelMatrixInverse);let s=n[3],o=a[3],l=n[1]/s,h=a[1]/o,u=n[2]/s,c=a[2]/o,d=u===c?0:(r-u)/(c-u);return new t.a7(t.H.number(n[0]/s,a[0]/o,d)/this.worldSize,t.H.number(l,h,d)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.aE(n,n,r),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this._helper._height/2-ye(this));return(new U).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-ye(this)}calculatePosMatrix(e,i=!1,r){var n;let a=null!==(n=e.key)&&void 0!==n?n:t.bb(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(a)){let e=s.get(a);return r?e.f32:e.f64}let o=ve(e,this.worldSize);t.U(o,i?this._alignedProjMatrix:this._viewProjMatrix,o);let l={f64:o,f32:new Float32Array(o)};return s.set(a,l),r?l.f32:l.f64}calculateFogMatrix(e){let i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let n=ve(e,this.worldSize);return t.U(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-n*this._helper._pixelPerMeter/Math.cos(i),s=n<0?a:e,o=Math.PI/2+this.pitchInRadians,l=t.an(this.fov)*(Math.abs(Math.cos(t.an(this.roll)))*this.height+Math.abs(Math.sin(t.an(this.roll)))*this.width)/this.height*(.5+r.y/this.height),h=Math.sin(l)*s/Math.sin(t.al(Math.PI-o-l,.01,Math.PI-.01)),u=ye(this),c=Math.atan(u/this._helper.cameraToCenterDistance),d=t.an(.75),p=c>d?2*c*(.5+r.y/(2*u)):d,f=Math.sin(p)*s/Math.sin(t.al(Math.PI-o-p,.01,Math.PI-.01)),m=Math.min(h,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+s),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let e=this.centerOffset,i=ge(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=t.aq(1,this.center.lat)*this.worldSize;let a,s=t.an(Math.min(this.pitch,me)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(s));var l,h;this._calculateNearFarZIfNeeded(o,s,e),a=new Float64Array(16),t.bc(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(l=this._invProjMatrix)[0]=1/(h=a)[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1/h[5],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=0,l[11]=1/h[14],l[12]=0,l[13]=0,l[14]=-1,l[15]=h[10]/h[14],a[8]=2*-e.x/this._helper._width,a[9]=2*e.y/this._helper._height,this._projectionMatrix=t.bd(a),t.S(a,a,[1,-1,1]),t.Q(a,a,[0,0,-this._helper.cameraToCenterDistance]),t.be(a,a,-this.rollInRadians),t.bf(a,a,this.pitchInRadians),t.be(a,a,-this.bearingInRadians),t.Q(a,a,[-r,-n,0]),this._mercatorMatrix=t.S([],a,[this.worldSize,this.worldSize,this.worldSize]),t.S(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),t.Q(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=t.bg([],a);let u=[0,0,-1,1];t.aE(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),t.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.Q(this._fogMatrix,this._fogMatrix,[-r,-n,0]),t.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);let c=this._helper._width%2/2,d=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),f=Math.sin(-this.bearingInRadians),m=r-Math.round(r)+p*c+f*d,g=n-Math.round(n)+p*d+f*c,_=new Float64Array(a);if(t.Q(_,_,[m>.5?m-1:m,g>.5?g-1:g,0]),this._alignedProjMatrix=_,a=t.bg(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aE(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=t.aq(1,this.center.lat)*this.worldSize;return xe(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){let r=t.a7.fromLngLat(e),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.aE(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){let i,{overscaledTileID:r,aligned:n,applyTerrainMatrix:a}=e,s=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,n,!0):null;return i=r?.terrainRttPosMatrix32f&&a?r.terrainRttPosMatrix32f:o||t.bh(),{mainMatrix:i,tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.a$(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,r,n){let a,s=this.calculatePosMatrix(r);n?(a=[e,i,n(e,i),1],t.aE(a,a,s)):(a=[e,i,0,1],lt(a,a,s));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){let r=t.a7.fromLngLat(e,i),n=r.meterInMercatorCoordinateUnits(),a=t.bi();return t.Q(a,a,[r.x,r.y,r.z]),t.be(a,a,Math.PI),t.bf(a,a,Math.PI/2),t.S(a,a,[-n,n,n]),a}getProjectionDataForCustomLayer(e=!0){let i=new t.a3(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),n=ve(i,this.worldSize);t.U(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];let a=[t.a6,t.a6,this.worldSize/this._helper.pixelsPerMeter],s=t.bj();return t.S(s,n,a),r.fallbackMatrix=s,r.mainMatrix=s,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Kt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Jt(e){if(e.useSlerp)if(e.k<1){let i=t.bk(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.bk(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.bl(n,i,r,e.k);let a=t.bm(n);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.H.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.H.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.H.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Qt(e,i,r,n,a){let s=a.padding,o=ge(a.worldSize,r.getNorthWest()),l=ge(a.worldSize,r.getNorthEast()),h=ge(a.worldSize,r.getSouthEast()),u=ge(a.worldSize,r.getSouthWest()),c=t.an(-n),d=o.rotate(c),p=l.rotate(c),f=h.rotate(c),m=u.rotate(c),g=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),_=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=g.sub(_),v=(a.width-(s.left+s.right+i.left+i.right))/y.x,x=(a.height-(s.top+s.bottom+i.top+i.bottom))/y.y;if(x<0||v<0)return void Kt();let b=Math.min(t.ar(a.scale*Math.min(v,x)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.an(n)),S=w.add(T).mult(a.scale/t.ao(b));return{center:_e(a.worldSize,o.add(h).div(2).sub(S)),zoom:b,bearing:n}}class ei{get useGlobeControls(){return!1}handlePanInertia(e,t){let i=e.mag(),r=Math.abs(ye(t));return{easingOffset:e.mult(Math.min(.75*r/i,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return Qt(e,t,i,r,n)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.W.convert(i.center))}handleEaseTo(e,i){let r=e.zoom,n=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},o=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding),h=!1,u=o?+i.zoom:e.zoom,c=e.centerPoint.add(i.offsetAsPoint),d=e.screenPointToLocation(c),{center:p,zoom:f}=e.applyConstrain(t.W.convert(i.center||d),u??r);Zt(e,p);let m=ge(e.worldSize,d),g=ge(e.worldSize,p).sub(m),_=t.ao(f-r);return h=f!==r,{easeFunc:o=>{if(h&&e.setZoom(t.H.number(r,f,o)),t.bn(a,s)||Jt({startEulerAngles:a,endEulerAngles:s,tr:e,k:o,useSlerp:a.roll!=s.roll}),l&&(e.interpolatePadding(n,i.padding,o),c=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{let i=t.ao(e.zoom-r),n=f>r?Math.min(2,_):Math.max(.5,_),a=Math.pow(n,1-o),s=_e(e.worldSize,m.add(g.mult(o*a)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?s.wrap():s,c)}},isZooming:h,elevationCenter:p}}handleFlyTo(e,i){let r=void 0!==i.zoom,n=e.zoom,a=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),r?+i.zoom:n),s=a.center,o=a.zoom;Zt(e,s);let l,h=ge(e.worldSize,i.locationAtOffset),u=ge(e.worldSize,s).sub(h),c=u.mag(),d=t.ao(o-n);if(void 0!==i.minZoom){let r=Math.min(+i.minZoom,n,o),a=e.applyConstrain(s,r).zoom;l=t.ao(a-n)}return{easeFunc:(i,r,a,l)=>{e.setZoom(1===i?o:n+t.ar(r));let c=1===i?s:_e(e.worldSize,h.add(u.mult(a)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?c.wrap():c,l)},scaleOfZoom:d,targetCenter:s,scaleOfMinZoom:l,pixelPathLength:c}}}class ti{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}ti.Replace=[1,0],ti.disabled=new ti(ti.Replace,t.bo.transparent,[!1,!1,!1,!1]),ti.unblended=new ti(ti.Replace,t.bo.transparent,[!0,!0,!0,!0]),ti.alphaBlended=new ti([1,771],t.bo.transparent,[!0,!0,!0,!0]);let ii=2305;class ri{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}ri.disabled=new ri(!1,1029,ii),ri.backCCW=new ri(!0,1029,ii),ri.frontCCW=new ri(!0,1028,ii);class ni{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}ni.ReadOnly=!1,ni.ReadWrite=!0,ni.disabled=new ni(519,ni.ReadOnly,[0,1]);let ai=7680;class si{constructor(e,t,i,r,n,a){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=a}}function oi(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext}si.disabled=new si({func:519,mask:0},0,0,ai,ai,ai);class li{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;let i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let n=new t.aU;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);let a=new t.aW;a.emplaceBack(0,1,2),this._fullscreenTriangle=new Ot(i.createVertexBuffer(n,Bt.members),i.createIndexBuffer(a),t.aV.simpleSegment(0,0,n.length,a.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);let s=r.createTexture();r.bindTexture(r.TEXTURE_2D,s),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(s),oi(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){let e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){let i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){let r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,ni.disabled,si.disabled,ti.unblended,ri.disabled,{u_input:e,u_output_expected:i},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&oi(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);let e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&oi(e)){let i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=li._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}let hi=t.a6/128;function ui(e,i){let r=void 0!==e.granularity?Math.max(e.granularity,1):1,n=r+(e.generateBorders?2:0),a=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=n+1,o=a+1,l=e.generateBorders?-1:0,h=e.generateBorders||e.extendToNorthPole?-1:0,u=r+(e.generateBorders?1:0),c=r+(e.generateBorders||e.extendToSouthPole?1:0),d=s*o,p=n*a*6,f=s*o>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let m=f||"32bit"===i,g=new Int16Array(2*d),_=0;for(let i=h;i<=c;i++)for(let n=l;n<=u;n++){let a=n/r*t.a6;-1===n&&(a=-hi),n===r+1&&(a=t.a6+hi);let s=i/r*t.a6;-1===i&&(s=e.extendToNorthPole?t.bq:-hi),i===r+1&&(s=e.extendToSouthPole?t.br:t.a6+hi),g[_++]=a,g[_++]=s}let y=m?new Uint32Array(p):new Uint16Array(p),v=0;for(let e=0;e<a;e++)for(let t=0;t<n;t++){let i=t+1+e*s,r=t+(e+1)*s,n=t+1+(e+1)*s;y[v++]=t+e*s,y[v++]=r,y[v++]=i,y[v++]=i,y[v++]=r,y[v++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}let ci=new t.aT({fill:new t.bs(128,2),line:new t.bs(512,0),tile:new t.bs(128,32),stencil:new t.bs(128,1),circle:3});class di{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return zt.projectionGlobe}get vertexShaderPreludeCode(){return zt.projectionMercator.vertexSource}get subdivisionGranularity(){return ci}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new li(e));let i=t.Y(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(i,r),a=h();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=a);let s=Math.min(Math.max((a-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bu(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,n){let a=("stencil"===n?ci.stencil:ci.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:a,generateBorders:i,extendToNorthPole:0===t.y&&r,extendToSouthPole:t.y===(1<<t.z)-1&&r})}_getMesh(e,i){let r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];let n=function(e,i){let r=ui(i,"16bit"),n=t.aU.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),a=t.aW.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new Ot(e.createVertexBuffer(n,Bt.members),e.createIndexBuffer(a),t.aV.simpleSegment(0,0,n.length,a.length))}(e,i);return this._tileMeshCache[r]=n,n}recalculate(e){}hasTransition(){var e;let t=h(),i=!1;return i||(i=(t-this._errorMeasurementLastChangeTime)/1e3<.7),i||(i=null===(e=this._errorMeasurement)||void 0===e?void 0:e.awaitingQuery),i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}let pi=new t.u({type:new t.D(t.x.projection.type)});class fi extends t.E{constructor(e){super(),this._transitionable=new t.y(pi,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0)),this._mercatorProjection=new Gt,this._verticalPerspectiveProjection=new di}get transitionState(){let e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.bv){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function mi(e){let t=yi(e.worldSize,e.center.lat);return 2*Math.PI*t}function gi(e,i,r,n,a){let s=1/(1<<a),o=i/t.a6*s+n*s,l=t.by((e/t.a6*s+r*s)*Math.PI*2+Math.PI,2*Math.PI),h=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,u=Math.cos(h),c=new Float64Array(3);return c[0]=Math.sin(l)*u,c[1]=Math.sin(h),c[2]=Math.cos(l)*u,c}function _i(e){return function(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function yi(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function vi(e){let i=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let n=e[0]/r,a=Math.acos(e[2]/r),s=(n>0?a:-a)/Math.PI*180;return new t.W(t.X(s,-180,180),i)}return new t.W(0,i)}function xi(e){return Math.cos(e*Math.PI/180)}function bi(e,i){let r=xi(e),n=xi(i);return t.ar(n/r)}function wi(e,i){let r=e.rotate(i.bearingInRadians),n=i.zoom+bi(i.center.lat,0),a=t.bt(1/xi(i.center.lat),1/xi(Math.min(Math.abs(i.center.lat),60)),t.bw(n,7,3,0,1)),s=360/mi({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.W(i.center.lng-r.x*s*a,t.al(i.center.lat+r.y*s,-t.am,t.am))}function Ti(e){let t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function Si(e,i,r,n){let a=e.lat+r*n;if(Math.abs(r)>1){let s=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+r)*Math.PI/180,l=Ti(s+n*(o-s)),h=Ti(s),u=Ti(o);return new t.W(e.lng+i*((l-h)/(u-h)),a)}return new t.W(e.lng+i*n,a)}class Ii{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,r){let n=`${e.z}_${e.x}_${e.y}_${r?.terrain?"t":""}`,a=this._cache.get(n);if(a)return a;let s=this._cachePrevious.get(n);if(s)return this._cache.set(n,s),s;let o=this._boundingVolumeFactory(e,t,i,r);return this._cache.set(n,o),this._hadAnyChanges=!0,o}}class Pi{constructor(e,t,i,r){this.min=i,this.max=r,this.points=e,this.planes=t}static fromAabb(e,t){let i=[];for(let r=0;r<8;r++)i.push([1&~r?e[0]:t[0],1==(r>>1&1)?t[1]:e[1],1==(r>>2&1)?t[2]:e[2]]);return new Pi(i,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,i,r){let n=t.bA([],r[0],r[1],r[2]),a=t.bB([],[i[0],0,0],n),s=t.bB([],[0,i[1],0],n),o=t.bB([],[0,0,i[2]],n),l=[...e],h=[...e];for(let t=0;t<8;t++)for(let i=0;i<3;i++){let r=e[i]+a[i]*(1&~t?-1:1)+s[i]*(1==(t>>1&1)?1:-1)+o[i]*(1==(t>>2&1)?1:-1);l[i]=Math.min(l[i],r),h[i]=Math.max(h[i],r)}let u=[];for(let i=0;i<8;i++){let r=[...e];t.a_(r,r,t.aZ([],a,1&~i?-1:1)),t.a_(r,r,t.aZ([],s,1==(i>>1&1)?1:-1)),t.a_(r,r,t.aZ([],o,1==(i>>2&1)?1:-1)),u.push(r)}return new Pi(u,[[...a,-t.b3(a,u[0])],[...s,-t.b3(s,u[0])],[...o,-t.b3(o,u[0])],[-a[0],-a[1],-a[2],-t.b3(a,u[7])],[-s[0],-s[1],-s[2],-t.b3(s,u[7])],[-o[0],-o[1],-o[2],-t.b3(o,u[7])]],l,h)}intersectsFrustum(e){let t=!0,i=this.points.length,r=this.planes.length,n=e.planes.length,a=e.points.length;for(let r=0;r<n;r++){let n=e.planes[r],a=0;for(let e=0;e<i;e++){let t=this.points[e];n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0&&a++}if(0===a)return 0;a<i&&(t=!1)}if(t)return 2;for(let t=0;t<r;t++){let i=this.planes[t],r=0;for(let t=0;t<a;t++){let n=e.points[t];i[0]*n[0]+i[1]*n[1]+i[2]*n[2]+i[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(e){let t=this.points.length,i=0;for(let r=0;r<t;r++){let t=this.points[r];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:0===i?0:1}}function Ci(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function Ei(e,t,i,r,n){let a,s=e-i;return a=s<0?Math.min(-s,1+s-n):s>n?Math.min(Math.max(s-n,0),1-s):0,Math.max(a,Ci(t,r,n))}class Mi{constructor(){this._boundingVolumeCache=new Ii(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,r){let n=1<<i.z,a=1/n,s=i.x/n,o=i.y/n,l=2;return l=Math.min(l,Ei(e,t,s,o,a)),l=Math.min(l,Ei(e,t,s+.5,-o-a,a)),l=Math.min(l,Ei(e,t,s+.5,2-o-a,a)),l}getWrap(e,t,i){let r=1<<t.z,n=1/r,a=t.x/r,s=Ci(e.x,a,n),o=Ci(e.x,a-1,n),l=Ci(e.x,a+1,n),h=Math.min(s,o,l);return h===l?1:h===o?-1:0}allowVariableZoom(e,t){return Pe(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,i,r,n){var a,s;let o=0,l=0;if(n?.terrain){let h=new t.a3(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(h);o=null!==(a=u.minElevation)&&void 0!==a?a:Math.min(0,r),l=null!==(s=u.maxElevation)&&void 0!==s?s:Math.max(0,r)}if(o/=t.bD,l/=t.bD,o+=1,l+=1,e.z<=0)return Pi.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return Pi.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{let i=[gi(0,0,e.x,e.y,e.z),gi(t.a6,0,e.x,e.y,e.z),gi(t.a6,t.a6,e.x,e.y,e.z),gi(0,t.a6,e.x,e.y,e.z)],r=[];for(let e of i)r.push(t.aZ([],e,l));if(l!==o)for(let e of i)r.push(t.aZ([],e,o));0===e.y&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);let n=[1,1,1],a=[-1,-1,-1];for(let e of r)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),a[t]=Math.max(a[t],e[t]);let s=gi(t.a6/2,t.a6/2,e.x,e.y,e.z),h=t.b2([],[0,1,0],s);t.b1(h,h);let u=t.b2([],s,h);t.b1(u,u);let c=t.b2([],i[2],i[1]);t.b1(c,c);let d=t.b2([],i[0],i[3]);t.b1(d,d),r.push(t.aZ([],s,l)),e.y>=(1<<e.z)/2&&r.push(t.aZ([],gi(t.a6/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&r.push(t.aZ([],gi(t.a6/2,t.a6,e.x,e.y,e.z),l));let p=Ai(s,r),f=Ai(u,r),m=[-s[0],-s[1],-s[2],p.max],g=[s[0],s[1],s[2],-p.min],_=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],v=[...c,0],x=[...d,0],b=[];return 0===e.y?b.push(t.bC(x,v,m),t.bC(x,v,g)):b.push(t.bC(_,v,m),t.bC(_,v,g),t.bC(_,x,m),t.bC(_,x,g)),e.y===(1<<e.z)-1?b.push(t.bC(x,v,m),t.bC(x,v,g)):b.push(t.bC(y,v,m),t.bC(y,v,g),t.bC(y,x,m),t.bC(y,x,g)),new Pi(b,[m,g,_,y,v,x],n,a)}}}function Ai(e,i){let r=1/0,n=-1/0;for(let a of i){let i=t.b3(e,a);r=Math.min(r,i),n=Math.max(n,i)}return{min:r,max:n}}class ki{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bE(),this._projectionMatrix=t.bi(),this._globeViewProjMatrix32f=t.bh(),this._globeViewProjMatrixNoCorrection=t.bi(),this._globeViewProjMatrixNoCorrectionInverted=t.bi(),this._globeProjMatrixInverted=t.bi(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,i)=>{let r=t.al(e.lat,-t.am,t.am),n=t.al(+i,this.minZoom+bi(0,r),this.maxZoom);return{center:new t.W(e.lng,r),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Mi}clone(){let e=new ki;return e.apply(this,!1),e}apply(e,t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=t.bz();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let i=this.pitchInRadians,r=this.cameraToCenterDistance/e,n=Math.sin(i)*r,a=Math.cos(i)*r+1,s=1/Math.sqrt(n*n+a*a)*1,o=-n,l=a,h=Math.sqrt(o*o+l*l);o/=h,l/=h;let u=[0,o,l];t.bF(u,u,[0,0,0],-this.bearingInRadians),t.bG(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bH(u,u,[0,0,0],this.center.lng*Math.PI/180);let c=1/t.b5(u);return t.aZ(u,u,c),[...u,-s*c]}isLocationOccluded(e){return!this.isSurfacePointVisible(_i(e))}transformLightDirection(e){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),a=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],s=[a[2],0,-a[0]],o=[0,0,0];t.b2(o,s,a),t.b1(s,s),t.b1(o,o);let l=[0,0,0];return t.b1(l,[s[0]*e[0]+o[0]*e[1]+a[0]*e[2],s[1]*e[0]+o[1]*e[1]+a[1]*e[2],s[2]*e[0]+o[2]*e[1]+a[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,r){let n=function(e,i,r){let n=1/(1<<r.z);return new t.a7(e/t.a6*n+r.x*n,i/t.a6*n+r.y*n)}(e,i,r.canonical),a=(s=n.y,[t.by(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI]);var s;return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(e,i,r,n){let a=r.canonical,s=gi(e,i,a.x,a.y,a.z),o=1+(n?n(e,i):0)/t.bD,l=[s[0]*o,s[1]*o,s[2]*o,1];t.aE(l,l,this._globeViewProjMatrixNoCorrection);let h=this._cachedClippingPlane,u=h[0]*s[0]+h[1]*s[1]+h[2]*s[2]+h[3]<0;return{point:new t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=yi(this.worldSize,this.center.lat),i=t.bj(),r=t.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.bc(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let n=this.centerOffset;i[8]=2*-n.x/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=t.bd(i),this._globeProjMatrixInverted=t.bj(),t.bg(this._globeProjMatrixInverted,i),t.Q(i,i,[0,0,-this.cameraToCenterDistance]),t.be(i,i,this.rollInRadians),t.bf(i,i,-this.pitchInRadians),t.be(i,i,this.bearingInRadians),t.Q(i,i,[0,0,-e]);let a=t.bz();a[0]=e,a[1]=e,a[2]=e,t.bf(r,i,this.center.lat*Math.PI/180),t.bI(r,r,-this.center.lng*Math.PI/180),t.S(r,r,a),this._globeViewProjMatrixNoCorrection=r,t.bf(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bI(i,i,-this.center.lng*Math.PI/180),t.S(i,i,a),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),t.bg(this._globeViewProjMatrixNoCorrectionInverted,r);let s=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bF(this._cameraPosition,this._cameraPosition,s,-this.rollInRadians),t.bG(this._cameraPosition,this._cameraPosition,s,this.pitchInRadians),t.bF(this._cameraPosition,this._cameraPosition,s,-this.bearingInRadians),t.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bG(this._cameraPosition,this._cameraPosition,s,-this.center.lat*Math.PI/180),t.bH(this._cameraPosition,this._cameraPosition,s,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let o=t.bd(this._globeViewProjMatrixNoCorrectionInverted);t.S(o,o,[1,1,-1]),this._cachedFrustum=Xt.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");let i=t.bj();return t.ap(i),i}getVisibleUnwrappedCoordinates(e){return[new t.ba(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=_i(e);t.aZ(r,r,1+i/t.bD);let n=t.bE();return t.aE(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(e){}getBounds(){let e=.5*this.width,i=.5*this.height,r=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,i),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,i)],n=[];for(let e of r)n.push(this.unprojectScreenPoint(e));let a=0,s=0,o=0,l=0,h=this.center;for(let e of n){let i=t.bJ(h.lng,e.lng),r=t.bJ(h.lat,e.lat);i<s&&(s=i),i>a&&(a=i),r<l&&(l=r),r>o&&(o=r)}let u=[h.lng+s,h.lat+l,h.lng+a,h.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new U(u)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){let r=_i(this.unprojectScreenPoint(i)),n=_i(e),a=t.bz();t.bK(a);let s=t.bz();t.bH(s,r,a,-this.center.lng*Math.PI/180),t.bG(s,s,a,this.center.lat*Math.PI/180);let o=n[0]*n[0]+n[2]*n[2],l=s[0]*s[0];if(o<l)return;let h=Math.sqrt(o-l),u=-h,c=t.bL(n[0],n[2],s[0],h),d=t.bL(n[0],n[2],s[0],u),p=t.bz();t.bH(p,n,a,-c);let f=t.bL(p[1],p[2],s[1],s[2]),m=t.bz();t.bH(m,n,a,-d);let g,_,y=t.bL(m[1],m[2],s[1],s[2]),v=.5*Math.PI,x=f>=-v&&f<=v,b=y>=-v&&y<=v;if(x&&b){let e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bM(c,e)+t.bM(f,i)<t.bM(d,e)+t.bM(y,i)?(g=c,_=f):(g=d,_=y)}else if(x)g=c,_=f;else{if(!b)return;g=d,_=y}let w=g/Math.PI*180,T=_/Math.PI*180,S=this.center.lat;this.setCenter(new t.W(w,t.al(T,-90,90))),this.setZoom(this.zoom+bi(S,this.center.lat))}locationToScreenPoint(e,i){let r=_i(e);if(i){let n=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aZ(r,r,1+n/t.bD)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){let i=t.bE();return t.aE(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new t.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){let t=i.pointCoordinate(e);if(t)return t}return t.a7.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}isPointOnMapSurface(e,t){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(e){let i=t.bE();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.aE(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=t.bz();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let n=t.bz();return t.b1(n,r),n}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let i=t.bE();return t.aE(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){let r=t.b3(e,i),n=t.bz(),a=t.bz();t.aZ(a,i,r),t.b0(n,e,a);let s=1-t.b3(n,n);if(s<0)return null;let o=t.b3(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(s),h=o/l,u=l;return{tMin:Math.min(h,u),tMax:Math.max(h,u)}}unprojectScreenPoint(e){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(i,r);if(n){let e=t.bz();t.a_(e,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);let a=t.bz();return t.b1(a,e),vi(a)}let a=this._cachedClippingPlane,s=a[0]*r[0]+a[1]*r[1]+a[2]*r[2],o=-t.b9(a,i)/s,l=t.bz();if(o>0)t.a_(l,i,[r[0]*o,r[1]*o,r[2]*o]);else{let e=t.bz();t.a_(e,i,[2*r[0],2*r[1],2*r[2]]);let n=t.b9(this._cachedClippingPlane,e);t.b0(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}let h=function(e){let i=t.bz();return i[0]=e[0]*-e[3],i[1]=e[1]*-e[3],i[2]=e[2]*-e[3],{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(a);return vi(function(e,i,r){let n=t.bz();t.b0(n,r,e);let a=t.bz();return t.bx(a,e,n,i/t.b7(n)),a}(h.center,h.radius,l))}getMatrixForModel(e,i){let r=t.W.convert(e),n=1/t.bD,a=t.bi();return t.bI(a,a,r.lng/180*Math.PI),t.bf(a,a,-r.lat/180*Math.PI),t.Q(a,a,[0,0,1+i/t.bD]),t.bf(a,a,.5*Math.PI),t.S(a,a,[n,n,n]),a}getProjectionDataForCustomLayer(e=!0){let i=this.getProjectionData({overscaledTileID:new t.a3(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class Li{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new qt({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new Yt,this._verticalPerspectiveTransform=new ki}clone(){let e=new Li;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this,!1),e}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){let n=this._mercatorTransform.getPitchedTextCorrection(e,i,r),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bt(n,a,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Fi{get useGlobeControls(){return!0}handlePanInertia(e,i){let r=wi(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){let r=e.around,n=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);let a=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);let s=i.zoom-a;if(0===s)return;let o=t.bJ(i.center.lng,n.lng),l=o/(Math.abs(o/180)+1),h=t.bJ(i.center.lat,n.lat),u=i.getRayDirectionFromPixel(r),c=i.cameraPosition,d=-1*t.b3(c,u),p=t.bz();t.a_(p,c,[u[0]*d,u[1]*d,u[2]*d]);let f=t.b5(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=yi(i.worldSize,i.center.lat)/Math.min(i.width,i.height),_=t.bw(g,.9,.5,1,.25),y=(1-t.ao(-s))*Math.min(m,_),v=i.center.lat,x=i.zoom,b=new t.W(i.center.lng+l*y,t.al(i.center.lat+h*y,-t.am,t.am));i.setLocationAtPoint(n,r);let w=i.center,T=t.bw(Math.abs(o),45,85,0,1),S=t.bw(g,.75,.35,0,1),I=Math.pow(Math.max(T,S),.25),P=t.bJ(w.lng,b.lng),C=t.bJ(w.lat,b.lat);i.setCenter(new t.W(w.lng+P*I,w.lat+C*I).wrap()),i.setZoom(x+bi(v,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;let r=t.center.lat,n=t.zoom;t.setCenter(wi(e.panDelta,t).wrap()),t.setZoom(n+bi(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,n,a){let s=Qt(e,i,r,n,a),o=i.left/a.width*2-1,l=(a.width-i.right)/a.width*2-1,h=i.top/a.height*-2+1,u=(a.height-i.bottom)/a.height*-2+1,c=t.bJ(r.getWest(),r.getEast())<0,d=c?r.getEast():r.getWest(),p=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),g=d+.5*t.bJ(d,p),_=f+.5*t.bJ(f,m),y=a.clone();y.setCenter(s.center),y.setBearing(s.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(s.zoom);let v=y.modelViewProjectionMatrix,x=[_i(r.getNorthWest()),_i(r.getNorthEast()),_i(r.getSouthWest()),_i(r.getSouthEast()),_i(new t.W(p,_)),_i(new t.W(d,_)),_i(new t.W(g,f)),_i(new t.W(g,m))],b=_i(s.center),w=Number.POSITIVE_INFINITY;for(let e of x)o<0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,b,v,"x",o))),l>0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,b,v,"x",l))),h>0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,b,v,"y",h))),u<0&&(w=Fi.getLesserNonNegativeNonNull(w,Fi.solveVectorScale(e,b,v,"y",u)));if(Number.isFinite(w)&&0!==w)return s.zoom=Math.min(y.zoom+t.ar(w),e.maxZoom),s;Kt()}handleJumpToCenterZoom(e,i){let r=e.center.lat,n=e.applyConstrain(i.center?t.W.convert(i.center):e.center,e.zoom).center;e.setCenter(n.wrap());let a=void 0!==i.zoom?+i.zoom:e.zoom+bi(r,n.lat);e.zoom!==a&&e.setZoom(a)}handleEaseTo(e,i){let r=e.zoom,n=e.center,a=e.padding,s={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,h=!e.isPaddingEqual(i.padding),u=!1,c=i.center?t.W.convert(i.center):n,d=e.applyConstrain(c,r).center;Zt(e,d);let p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+bi(n.lat,c.lat)),p.setBearing(i.bearing);let f=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);let m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,g=l?+i.zoom:r+bi(n.lat,m.lat),_=r+bi(n.lat,0),y=g+bi(m.lat,0),v=t.bJ(n.lng,m.lng),x=t.bJ(n.lat,m.lat),b=t.ao(y-_);return u=g!==r,{easeFunc:r=>{if(t.bn(s,o)||Jt({startEulerAngles:s,endEulerAngles:o,tr:e,k:r,useSlerp:s.roll!=o.roll}),h&&e.interpolatePadding(a,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{let t=y>_?Math.min(2,b):Math.max(.5,b),i=Math.pow(t,1-r),a=Si(n,v,x,r*i);e.setCenter(a.wrap())}if(u){let i=t.H.number(_,y,r)+bi(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:m}}handleFlyTo(e,i){let r=void 0!==i.zoom,n=e.center,a=e.zoom,s=e.padding,o=!e.isPaddingEqual(i.padding),l=e.applyConstrain(t.W.convert(i.center||i.locationAtOffset),a).center,h=r?+i.zoom:e.zoom+bi(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(h),u.setBearing(i.bearing);let c=new t.P(t.al(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,c);let d=u.center;Zt(e,d);let p,f=function(e,i,r){let n=_i(i),a=_i(r),s=t.b3(n,a),o=Math.acos(s),l=mi(e);return o/(2*Math.PI)*l}(e,n,d),m=a+bi(n.lat,0),g=h+bi(d.lat,0),_=t.ao(g-m);if("number"==typeof i.minZoom){let r=+i.minZoom+bi(d.lat,0),n=Math.min(r,m,g)+bi(0,d.lat),a=e.applyConstrain(d,n).zoom+bi(d.lat,0);p=t.ao(a-m)}let y=t.bJ(n.lng,d.lng),v=t.bJ(n.lat,d.lat);return{easeFunc:(r,a,l,u)=>{let c=Si(n,y,v,l);o&&e.interpolatePadding(s,i.padding,r);let p=1===r?d:c;e.setCenter(p.wrap());let f=m+t.ar(a);e.setZoom(1===r?h:f+bi(0,p.lat))},scaleOfZoom:_,targetCenter:d,scaleOfMinZoom:p,pixelPathLength:f}}static solveVectorScale(e,t,i,r,n){let a="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],o=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],l=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],h=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return h+n*l===o+n*u||s[3]*(o-h)+a[3]*(u-l)+o*u==h*l?null:(h+a[3]-n*u-n*s[3])/(h-o-n*u+n*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}}class Di{constructor(e){this._globe=e,this._mercatorCameraHelper=new ei,this._verticalPerspectiveCameraHelper=new Fi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}let Ri=(e,i)=>t.C(e,i?.filter(e=>"source.canvas"!==e.identifier)),zi=t.bN();class Ni extends t.E{constructor(e,i={}){var r,n;super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new z(R(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new _,this.imageManager.setEventedParent(this);let a=(null===(r=e._container)||void 0===r?void 0:r.lang)||typeof document<"u"&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new S(e._requestManager,i.localIdeographFontFamily,a),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Dt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bO()),he().on(se,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.tileManagers[e.sourceId];if(!t)return;let i=t.getSource();if(i?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===i.id&&this._validateLayer(t)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,i){var r,n,a;this._checkLoaded();let s=null===i?null!==(a=null===(n=null===(r=this.stylesheet.state)||void 0===r?void 0:r[e])||void 0===n?void 0:n.default)&&void 0!==a?a:null:i;if(t.bQ(s,this._globalState[e]))return this;this._globalState[e]=s,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let i=[];for(let r in e)!t.bQ(this._globalState[r],e[r].default)&&(i.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(e){if(0===e.length)return;let t=new Set,i={};for(let r of e){i[r]=this._globalState[r];for(let e in this._layers){let i=this._layers[e],n=i.getLayoutAffectingGlobalStateRefs(),a=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(n.has(r)&&t.add(i.source),a.has(r))for(let{name:e,value:t}of a.get(r))this._updatePaintProperty(i,e,t);s?.has(r)&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}loadURL(e){return t._(this,arguments,void 0,function*(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let a=yield this.map._requestManager.transformRequest(e,"Style");t.bR(n.signal);let s=yield t.k(a,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(e){this._loadStyleRequest===n&&(this._loadStyleRequest=null),e&&!n.signal.aborted&&this.fire(new t.l(t.d(e)))}})}loadJSON(e,i={},r){this.fire(new t.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,o.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new t.n("dataloading",{dataType:"style"})),this._load(zi,{validate:!1})}_load(e,i,r){var n,a;let s=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!Ri(this,t.F(s))){s=Object.assign({},s),this._loaded=!0,this.stylesheet=s;for(let e in s.sources)this.addSource(e,s.sources[e],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this._createLayers(),this.light=new P(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new E(this.stylesheet.sky),this.map.setTerrain(null!==(a=this.stylesheet.terrain)&&void 0!==a?a:null),this.fire(new t.n("data",{dataType:"style"})),this.fire(new t.n("style.load"))}}_createLayers(){var e,i,r;let n=t.bS(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",n),this._order=n.map(e=>e.id),this._layers={},this._serializedLayers=null;for(let e of n){let n=t.bT(e,this._globalState);if(n.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=n,t.bU(n)&&this.tileManagers[n.source]){let t=null!==(r=null===(i=e.paint)||void 0===i?void 0:i["raster-fade-duration"])&&void 0!==r?r:n.paint.get("raster-fade-duration");this.tileManagers[n.source].setRasterFadeDuration(t)}}}_loadSprite(e,i=!1,r=void 0){this.imageManager.setLoaded(!1);let n,a=new AbortController;this._spriteRequest=a,function(e,i,r,n){return t._(this,void 0,void 0,function*(){let a=f(e),s=r>1?"@2x":"",l={},h={};for(let{id:e,url:r}of a){let a=yield i.transformRequest(m(r,s,".json"),"SpriteJSON");l[e]=t.k(a,n);let o=yield i.transformRequest(m(r,s,".png"),"SpriteImage");h[e]=c.getImage(o,n)}return yield Promise.all([...Object.values(l),...Object.values(h)]),function(e,i){return t._(this,void 0,void 0,function*(){let t={};for(let r in e){t[r]={};let n=o.getImageCanvasContext((yield i[r]).data),a=(yield e[r]).data;for(let e in a){let{width:i,height:s,x:o,y:l,sdf:h,pixelRatio:u,stretchX:c,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=a[e];t[r][e]={data:null,pixelRatio:u,sdf:h,stretchX:c,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:s,x:o,y:l,context:n}}}}return t})}(l,h)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(e=>{if(this._spriteRequest=null,e)for(let t in e){this._spritesImagesIds[t]=[];let r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter(t=>!(t in e)):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in e[t]){let n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}}).catch(e=>{this._spriteRequest=null,n=e,a.signal.aborted||this.fire(new t.l(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"})),r&&r(n)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}_validateLayer(e){let i=this.tileManagers[e.source];if(!i)return;let r=e.sourceLayer;if(!r)return;let n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(r))&&this.fire(new t.l(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,i=!1){let r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bV(r):r);let n=[];for(let a of e)if(r[a]){let e=i?t.bV(r[a]):r[a];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null!==(e=this.light)&&void 0!==e&&e.hasTransition()||null!==(t=this.sky)&&void 0!==t&&t.hasTransition()||null!==(i=this.projection)&&void 0!==i&&i.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let i=this._changed;if(i){let t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.tileManagers){let t=this.tileManagers[e];r[e]=t.used,t.used=!1}for(let t of this._order){let i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let e in r){let i=this.tileManagers[e];!!r[e]!=!!i.used&&i.fire(new t.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();let n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,(null===(r=i.validate)||void 0===r||r)&&Ri(this,t.F(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);let a=t.bW(n,e),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(0===s.operations.length)return!1;for(let e of s.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new t.n("style.load",{style:this})),!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":t.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":t.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":t.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":t.push(()=>{});break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.l(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.l(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){var n;if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(i.type)&&this._validate(t.F.source,`sources.${e}`,i,null,r))return;null!==(n=this.map)&&void 0!==n&&n._collectResourceTiming&&(i.collectResourceTiming=!0);let a=this.tileManagers[e]=new ze(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e})),a.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new t.l(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let i=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],i.fire(new t.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){var t;return null===(t=this.tileManagers[e])||void 0===t?void 0:t.getSource()}addLayer(e,i,r={}){this._checkLoaded();let n,a=e.id;if(this.getLayer(a))return void this.fire(new t.l(new Error(`Layer "${a}" already exists on this map.`)));if("custom"===e.type){if(Ri(this,t.bX(e)))return;n=t.bT(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(a,e.source),e=t.bV(e),e=t.e(e,{source:a})),this._validate(t.F.layer,`layers.${a}`,e,{arrayIndex:-1},r))return;n=t.bT(e,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:a}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.l(new Error(`Cannot add layer "${a}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,a),this._layerOrderChanged=!0,this._layers[a]=n,this._removedLayers[a]&&n.source&&"custom"!==n.type){let e=this._removedLayers[a];delete this._removedLayers[a],e.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.l(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;let r=this._order.indexOf(e);this._order.splice(r,1);let n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.l(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let i=this._layers[e];if(!i)return void this.fire(new t.l(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();let n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.l(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();let n=this.getLayer(e);if(n){if(!t.bQ(n.filter,i))return null==i?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(t.F.filter,`layers.${n.id}.filter`,i,null,r)||(n.setFilter(t.bV(i)),this._updateLayer(n)))}else this.fire(new t.l(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();let a=this.getLayer(e);a?t.bQ(a.getLayoutProperty(i),r)||(a.setLayoutProperty(i,r,n),this._updateLayer(a)):this.fire(new t.l(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){let r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.l(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();let a=this.getLayer(e);a?t.bQ(a.getPaintProperty(i),r)||this._updatePaintProperty(a,i,r,n):this.fire(new t.l(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,i,r,n={}){e.setPaintProperty(i,r,n)&&this._updateLayer(e),t.bU(e)&&"raster-fade-duration"===i&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();let r=e.source,n=e.sourceLayer,a=this.tileManagers[r];if(void 0===a)return void this.fire(new t.l(new Error(`The source '${r}' does not exist in the map's style.`)));let s=a.getSource().type;"geojson"===s&&n?this.fire(new t.l(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||n?(void 0===e.id&&this.fire(new t.l(new Error("The feature id parameter must be provided."))),a.setFeatureState(n,e.id,i)):this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();let r=e.source,n=this.tileManagers[r];if(void 0===n)return void this.fire(new t.l(new Error(`The source '${r}' does not exist in the map's style.`)));let a=n.getSource().type,s="vector"===a?e.sourceLayer:void 0;"vector"!==a||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.l(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(s,e.id,i):this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let i=e.source,r=e.sourceLayer,n=this.tileManagers[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.l(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.l(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.l(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){var e;return t.e({duration:300,delay:0},null===(e=this.stylesheet)||void 0===e?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=t.bY(this.tileManagers,e=>e.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bZ({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:e,layers:i,terrain:r},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){let a=this._order[n];if(t(a)){i[a]=n;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let s=this._order[a];if(t(s))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(i[t.layer.id]<a)break;n.push(t),r.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)n.push(t.feature)}}return n}queryRenderedFeatures(e,i,r){i?.filter&&this._validate(t.F.filter,"queryRenderedFeatures.filter",i.filter,null,i);let n={};if(i?.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.l(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let e of i.layers){let i=this._layers[e];if(!i)return this.fire(new t.l(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}let a=[];i.availableImages=this._availableImages;let s=this._serializedAllLayers(),o=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:o,globalState:this._globalState});for(let t in this.tileManagers)i.layers&&!n[t]||a.push(B(this.tileManagers[t],this._layers,s,e,l,r,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&a.push(function(e,t,i,r,n,a,s){let o={},l=a.queryRenderedSymbols(r),h=[];for(let e of Object.keys(l).map(Number))h.push(s[e]);h.sort(j);for(let i of h){let r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,e);for(let e in r){o[e]||(o[e]=[]);let t=r[e];t.sort((e,t)=>{let r=i.featureSortOrder;if(r){let i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex});for(let i of t)o[e].push(i)}}return function(e,t,i){for(let r in e)for(let n of e[r])V(n,i[t[r].source]);return e}(o,e,i)}(this._layers,s,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,i){i?.filter&&this._validate(t.F.filter,"querySourceFeatures.filter",i.filter,null,i);let r=this.tileManagers[e];return r?function(e,t){let i=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],n={};for(let e of i){let i=e.tileID.canonical.key;n[i]||(n[i]=!0,e.querySourceFeatures(r,t))}return r}(r,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();let r=this.light.getLight(),n=!1;for(let i in e)if(!t.bQ(e[i],r[i])){n=!0;break}if(!n)return;let a={now:h(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(a)}getProjection(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.sky}setSky(e,i={}){this._checkLoaded();let r=this.getSky(),n=!1;if(!e&&!r)return;if(e&&!r)n=!0;else if(!e&&r)n=!0;else for(let i in e)if(!t.bQ(e[i],r[i])){n=!0;break}if(!n)return;let a={now:h(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(a)}_setProjectionInternal(e){let i=function(e,i){let r={constrainOverride:i};if(Array.isArray(e)){let t=new fi({type:e});return{projection:t,transform:new Li(r),cameraHelper:new Di(t)}}switch(e){case"mercator":return{projection:new Gt,transform:new Yt(r),cameraHelper:new ei};case"globe":{let e=new fi({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Li(r),cameraHelper:new Di(e)}}case"vertical-perspective":return{projection:new di,transform:new ki(r),cameraHelper:new Fi};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Gt,transform:new Yt(r),cameraHelper:new ei}}}(e,this.map.transformConstrain);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,i,r,n,a={}){return!1!==a?.validate&&Ri(this,e.call(t.F,t.e({key:i,style:this.serialize(),value:r,styleSpec:t.x},n)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),he().off(se,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let a=!1,s=!1,o={};for(let t of this._order){let i=this._layers[t];if("symbol"!==i.type)continue;if(!o[i.source]){let e=this.tileManagers[i.source];o[i.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let r=this.crossTileSymbolIndex.addLayer(i,o[i.source],e.center.lng);a||(a=r)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||(n=this._layerOrderChanged||0===i),(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h(),e.zoom))&&(this.pauseablePlacement=new Mt(e,this.map.terrain,this._order,n,t,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,function*(){let e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e})}getGlyphs(e,i){return t._(this,void 0,void 0,function*(){let e=yield this.glyphManager.getGlyphs(i.stacks),t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.F.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,i){return t._(this,void 0,void 0,function*(){let e={};for(let[t,r]of Object.entries(i.dashes))e[t]=this.lineAtlas.getDash(r.dasharray,r.round);return e})}addSprite(e,i,r={},n){this._checkLoaded();let a=[{id:e,url:i}],s=[...f(this.stylesheet.sprite),...a];this._validate(t.F.sprite,"sprite",s,null,r)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,n))}removeSprite(e){this._checkLoaded();let i=f(this.stylesheet.sprite);if(i.find(t=>t.id===e)){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex(t=>t.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.n("data",{dataType:"style"}))}else this.fire(new t.l(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return f(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.F.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Oi=t.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Bi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,a,s,o,l){this.context=e;let h=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!h&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(h=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||h||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,a,s,o,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),n?.dynamicDraw&&n.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,i,r,n,a,s,o){let l=e.numAttributes,h=this.context,u=h.gl;this.vao&&this.destroy(),this.vao=h.createVertexArray(),h.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(u,e);for(let t of i)t.enableAttributes(u,e);a&&a.enableAttributes(u,e),s&&s.enableAttributes(u,e),o&&o.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);for(let t of i)t.bind(),t.setVertexAttribPointers(u,e,n);a&&(a.bind(),a.setVertexAttribPointers(u,e,n)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,e,n)),o&&(o.bind(),o.setVertexAttribPointers(u,e,n)),h.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let ji=(e,i,r,n,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.bo.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):t.bo.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:a?1:0}),Vi={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Gi(e){let t=[];for(let i of e){if(null===i)continue;let e=i.split(" ");t.push(e.pop())}return t}class Ui{constructor(e,i,r,n,a,s,o,l,h=[]){let u=e.gl;this.program=u.createProgram();let c=Gi(i.staticAttributes),d=r?r.getBinderAttributes():[],p=c.concat(d),f=zt.prelude.staticUniforms?Gi(zt.prelude.staticUniforms):[],m=o.staticUniforms?Gi(o.staticUniforms):[],g=i.staticUniforms?Gi(i.staticUniforms):[],_=r?r.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),v=[];for(let e of y)v.includes(e)||v.push(e);let x=r?r.defines():[];oi(u)&&x.unshift("#version 300 es"),a&&x.push("#define OVERDRAW_INSPECTOR;"),s&&x.push("#define TERRAIN3D;"),l&&x.push(l),h&&x.push(...h);let b=x.concat(zt.prelude.fragmentSource,o.fragmentSource,i.fragmentSource).join("\n"),w=x.concat(zt.prelude.vertexSource,o.vertexSource,i.vertexSource).join("\n");oi(u)||(b=b.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D("),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));let T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,b),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);let S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S),this.attributes={};let I={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(u.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(S),u.deleteShader(T);for(let e of v)if(e&&!I[e]){let t=u.getUniformLocation(this.program,e);t&&(I[e]=t)}this.fixedUniforms=n(e,I),this.terrainUniforms=((e,i)=>({u_depth:new t.b_(e,i.u_depth),u_terrain:new t.b_(e,i.u_terrain),u_terrain_dim:new t.bp(e,i.u_terrain_dim),u_terrain_matrix:new t.c0(e,i.u_terrain_matrix),u_terrain_unpack:new t.c1(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.bp(e,i.u_terrain_exaggeration)}))(e,I),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.c0(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,i.u_projection_clipping_plane),u_projection_transition:new t.bp(e,i.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,i.u_projection_fallback_matrix)}))(e,I),this.binderUniforms=r?r.getUniforms(e,I):[]}draw(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_,y){var v;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(a),o){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(o[e])}if(l)for(let e in l)this.projectionUniforms[Vi[e]].set(l[e]);if(s)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let b=0;switch(t){case x.LINES:b=2;break;case x.TRIANGLES:b=3;break;case x.LINE_STRIP:b=1}for(let i of d.get())i.vaos||(i.vaos={}),(v=i.vaos)[h]||(v[h]=new Bi),i.vaos[h].bind(e,this,u,m?m.getPaintVertexBuffers():[],c,i.vertexOffset,g,_,y),x.drawElements(t,i.primitiveLength*b,x.UNSIGNED_SHORT,i.primitiveOffset*b*2)}}function Zi(e,i,r){let n=1/t.aK(r,1,i.transform.tileZoom),a=Math.pow(2,r.tileID.overscaledZ),s=r.tileSize*Math.pow(2,i.transform.tileZoom)/a,o=s*(r.tileID.canonical.x+r.tileID.wrap*a),l=s*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,l>>16],u_pixel_coord_lower:[65535&o,65535&l]}}let $i=(e,i,r,n)=>{let a=e.style.light,s=a.properties.get("position"),o=[s.x,s.y,s.z],l=t.c4();"viewport"===a.properties.get("anchor")&&t.c5(l,e.transform.bearingInRadians),t.c6(o,o,l);let h=e.transform.transformLightDirection(o),u=a.properties.get("color");return{u_lightpos:o,u_lightpos_globe:h,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},qi=(e,i,r,n,a,s,o)=>t.e($i(e,i,r,n),Zi(s,e,o),{u_height_factor:-Math.pow(2,a.overscaledZ)/o.tileSize/8}),Wi=(e,i,r,n)=>t.e(Zi(i,e,r),{u_fill_translate:n}),Hi=(e,t)=>({u_world:e,u_fill_translate:t}),Xi=(e,i,r,n,a)=>t.e(Wi(e,i,r,a),{u_world:n}),Yi=(e,i,r,n,a)=>{let s,o,l=e.transform,h=0;if("map"===r.paint.get("circle-pitch-alignment")){let e=t.aK(i,1,l.zoom);s=!0,o=[e,e],h=e/(t.a6*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*a}else s=!1,o=l.pixelsToGLUnits;return{u_camera_to_center_distance:l.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o,u_globe_extrude_scale:h,u_translate:n}},Ki=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),Ji=e=>({u_viewport_size:[e.width,e.height]}),Qi=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),er=(e,i,r,n)=>{let a=t.aK(e,1,i)/(t.a6*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.aK(e,1,i),u_intensity:r,u_globe_extrude_scale:a}},tr=(e,i,r,n)=>{let a=t.O();t.c7(a,0,e.width,e.height,0,0,1);let s=e.context.gl;return{u_matrix:a,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},ir=(e,t,i)=>{let r,n=i.paint.get("hillshade-accent-color");switch(i.paint.get("hillshade-method")){case"basic":r=4;break;case"combined":r=1;break;case"igor":r=2;break;case"multidirectional":r=3;break;default:r=0}let a=i.getIlluminationProperties();for(let t=0;t<a.directionRadians.length;t++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:nr(0,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:n,u_method:r,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},rr=(e,i)=>{let r=i.stride,n=t.O();return t.c7(n,0,t.a6,-t.a6,0,0,1),t.Q(n,n,[0,-t.a6,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function nr(e,i){let r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.a7(0,n/r).toLngLat().lat,new t.a7(0,(n+1)/r).toLngLat().lat]}let ar=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),sr=(e,i,r,n)=>{let a=e.transform;return{u_translation:dr(e,i,r),u_ratio:n/t.aK(i,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},or=(e,i,r,n,a)=>t.e(sr(e,i,r,n),{u_image:0,u_image_height:a}),lr=(e,i,r,n,a)=>{let s=e.transform,o=cr(i,s);return{u_translation:dr(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/t.aK(i,1,s.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[o,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},hr=(e,i,r,n,a)=>{let s=cr(i,e.transform);return t.e(sr(e,i,r,n),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},ur=(e,i,r,n,a,s)=>{let o=cr(i,e.transform);return t.e(sr(e,i,r,n),{u_image:0,u_image_height:s,u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function cr(e,i){return 1/t.aK(e,1,i.tileZoom)}function dr(e,i,r){return t.aL(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let pr=(e,t,i,r,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(a=r.paint.get("raster-contrast"),a>0?1/(1-a):1+a),u_spin_weights:fr(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var a,s};function fr(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}let mr=(e,t,i,r,n,a,s,o,l,h,u,c,d)=>{let p=s.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:c,u_texture:0,u_translation:h,u_pitched_scale:d}},gr=(e,i,r,n,a,s,o,l,h,u,c,d,p,f)=>{let m=o.transform;return t.e(mr(e,i,r,n,a,s,o,l,h,u,c,d,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:p?1:0,u_is_plain:1})},_r=(e,i,r,n,a,s,o,l,h,u,c,d,p)=>t.e(gr(e,i,r,n,a,s,o,l,h,u,!0,c,!0,p),{u_texsize_icon:d,u_texture_icon:1}),yr=(e,t)=>({u_opacity:e,u_color:t}),vr=(e,i,r,n,a)=>t.e(function(e,i,r,n){let a=r.imageManager.getPattern(e.from.toString()),s=r.imageManager.getPattern(e.to.toString()),{width:o,height:l}=r.imageManager.getPixelSize(),h=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/h,c=u*(n.tileID.canonical.x+n.tileID.wrap*h),d=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[o,l],u_mix:i.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.aK(n,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,d>>16],u_pixel_coord_lower:[65535&c,65535&d]}}(r,a,i,n),{u_opacity:e}),xr=(e,t)=>{},br={fillExtrusion:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bp(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bp(e,i.u_vertical_gradient),u_height_factor:new t.bp(e,i.u_height_factor),u_opacity:new t.bp(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.c3(e,i.u_world),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,i.u_scale_with_map),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_extrude_scale:new t.c3(e,i.u_extrude_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale),u_translate:new t.c3(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.c3(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.c3(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.b$(e,i.u_color),u_overlay:new t.b_(e,i.u_overlay),u_overlay_scale:new t.bp(e,i.u_overlay_scale)}),depth:xr,clippingMask:xr,heatmap:(e,i)=>({u_extrude_scale:new t.bp(e,i.u_extrude_scale),u_intensity:new t.bp(e,i.u_intensity),u_globe_extrude_scale:new t.bp(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_color_ramp:new t.b_(e,i.u_color_ramp),u_opacity:new t.bp(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.b_(e,i.u_image),u_latrange:new t.c3(e,i.u_latrange),u_exaggeration:new t.bp(e,i.u_exaggeration),u_altitudes:new t.c9(e,i.u_altitudes),u_azimuths:new t.c9(e,i.u_azimuths),u_accent:new t.b$(e,i.u_accent),u_method:new t.b_(e,i.u_method),u_shadows:new t.c8(e,i.u_shadows),u_highlights:new t.c8(e,i.u_highlights)}),hillshadePrepare:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_image:new t.b_(e,i.u_image),u_dimension:new t.c3(e,i.u_dimension),u_zoom:new t.bp(e,i.u_zoom),u_unpack:new t.c1(e,i.u_unpack)}),colorRelief:(e,i)=>({u_image:new t.b_(e,i.u_image),u_unpack:new t.c1(e,i.u_unpack),u_dimension:new t.c3(e,i.u_dimension),u_elevation_stops:new t.b_(e,i.u_elevation_stops),u_color_stops:new t.b_(e,i.u_color_stops),u_color_ramp_size:new t.b_(e,i.u_color_ramp_size),u_opacity:new t.bp(e,i.u_opacity)}),line:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_texsize:new t.c3(e,i.u_texsize),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_image:new t.b_(e,i.u_image),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bp(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_mix:new t.bp(e,i.u_mix),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),lineGradientSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bp(e,i.u_ratio),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bp(e,i.u_image_height),u_tileratio:new t.bp(e,i.u_tileratio),u_crossfade_from:new t.bp(e,i.u_crossfade_from),u_crossfade_to:new t.bp(e,i.u_crossfade_to),u_image_dash:new t.b_(e,i.u_image_dash),u_mix:new t.bp(e,i.u_mix),u_lineatlas_width:new t.bp(e,i.u_lineatlas_width),u_lineatlas_height:new t.bp(e,i.u_lineatlas_height)}),raster:(e,i)=>({u_tl_parent:new t.c3(e,i.u_tl_parent),u_scale_parent:new t.bp(e,i.u_scale_parent),u_buffer_scale:new t.bp(e,i.u_buffer_scale),u_fade_t:new t.bp(e,i.u_fade_t),u_opacity:new t.bp(e,i.u_opacity),u_image0:new t.b_(e,i.u_image0),u_image1:new t.b_(e,i.u_image1),u_brightness_low:new t.bp(e,i.u_brightness_low),u_brightness_high:new t.bp(e,i.u_brightness_high),u_saturation_factor:new t.bp(e,i.u_saturation_factor),u_contrast_factor:new t.bp(e,i.u_contrast_factor),u_spin_weights:new t.c2(e,i.u_spin_weights),u_coords_top:new t.c1(e,i.u_coords_top),u_coords_bottom:new t.c1(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_is_plain:new t.b_(e,i.u_is_plain),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bp(e,i.u_size_t),u_size:new t.bp(e,i.u_size),u_camera_to_center_distance:new t.bp(e,i.u_camera_to_center_distance),u_pitch:new t.bp(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bp(e,i.u_aspect_ratio),u_fade_change:new t.bp(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texsize_icon:new t.c3(e,i.u_texsize_icon),u_texture:new t.b_(e,i.u_texture),u_texture_icon:new t.b_(e,i.u_texture_icon),u_gamma_scale:new t.bp(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bp(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_color:new t.b$(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.bp(e,i.u_opacity),u_image:new t.b_(e,i.u_image),u_pattern_tl_a:new t.c3(e,i.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,i.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,i.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,i.u_pattern_br_b),u_texsize:new t.c3(e,i.u_texsize),u_mix:new t.bp(e,i.u_mix),u_pattern_size_a:new t.c3(e,i.u_pattern_size_a),u_pattern_size_b:new t.c3(e,i.u_pattern_size_b),u_scale_a:new t.bp(e,i.u_scale_a),u_scale_b:new t.bp(e,i.u_scale_b),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bp(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_ele_delta:new t.bp(e,i.u_ele_delta),u_fog_matrix:new t.c0(e,i.u_fog_matrix),u_fog_color:new t.b$(e,i.u_fog_color),u_fog_ground_blend:new t.bp(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bp(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon_fog_blend:new t.bp(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.bp(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.bp(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_terrain_coords_id:new t.bp(e,i.u_terrain_coords_id),u_ele_delta:new t.bp(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.bp(e,i.u_input),u_output_expected:new t.bp(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.c2(e,i.u_sun_pos),u_atmosphere_blend:new t.bp(e,i.u_atmosphere_blend),u_globe_position:new t.c2(e,i.u_globe_position),u_globe_radius:new t.bp(e,i.u_globe_radius),u_inv_proj_matrix:new t.c0(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.b$(e,i.u_sky_color),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon:new t.c3(e,i.u_horizon),u_horizon_normal:new t.c3(e,i.u_horizon_normal),u_sky_horizon_blend:new t.bp(e,i.u_sky_horizon_blend),u_sky_blend:new t.bp(e,i.u_sky_blend)})};class wr{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Tr={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sr{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i of this.attributes){let r=t.attributes[i.name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r of this.attributes){let n=t.attributes[r.name];void 0!==n&&e.vertexAttribPointer(n,r.components,e[Tr[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ir{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Pr extends Ir{getDefault(){return t.bo.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Cr extends Ir{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Er extends Ir{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Mr extends Ir{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ar extends Ir{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class kr extends Ir{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Lr extends Ir{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Fr extends Ir{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Dr extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Rr extends Ir{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class zr extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Nr extends Ir{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Or extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Br extends Ir{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class jr extends Ir{getDefault(){return t.bo.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Vr extends Ir{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Gr extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Ur extends Ir{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Zr extends Ir{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class $r extends Ir{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class qr extends Ir{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Wr extends Ir{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Hr extends Ir{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Xr extends Ir{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Yr extends Ir{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Kr extends Ir{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Jr extends Ir{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Qr extends Ir{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let i=this.gl;oi(i)?i.bindVertexArray(e):null===(t=i.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class en extends Ir{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class tn extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class rn extends Ir{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class nn extends Ir{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class an extends nn{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class sn extends nn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class on extends nn{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}let ln,hn="Framebuffer is not complete";class un{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new an(e,s),r)this.depthAttachment=n?new on(e,s):new sn(e,s);else if(n)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error(hn)}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class cn{constructor(e){var t,i;if(this.gl=e,this.clearColor=new Pr(this),this.clearDepth=new Cr(this),this.clearStencil=new Er(this),this.colorMask=new Mr(this),this.depthMask=new Ar(this),this.stencilMask=new kr(this),this.stencilFunc=new Lr(this),this.stencilOp=new Fr(this),this.stencilTest=new Dr(this),this.depthRange=new Rr(this),this.depthTest=new zr(this),this.depthFunc=new Nr(this),this.blend=new Or(this),this.blendFunc=new Br(this),this.blendColor=new jr(this),this.blendEquation=new Vr(this),this.cullFace=new Gr(this),this.cullFaceSide=new Ur(this),this.frontFace=new Zr(this),this.program=new $r(this),this.activeTexture=new qr(this),this.viewport=new Wr(this),this.bindFramebuffer=new Hr(this),this.bindRenderbuffer=new Xr(this),this.bindTexture=new Yr(this),this.bindVertexBuffer=new Kr(this),this.bindElementBuffer=new Jr(this),this.bindVertexArray=new Qr(this),this.pixelStoreUnpack=new en(this),this.pixelStoreUnpackPremultiplyAlpha=new tn(this),this.pixelStoreUnpackFlipY=new rn(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),oi(e)){this.HALF_FLOAT=e.HALF_FLOAT;let r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:r?.RGBA16F_EXT,this.RGB16F=null!==(i=e.RGB16F)&&void 0!==i?i:r?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=t?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new wr(this,e,t)}createVertexBuffer(e,t,i){return new Sr(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new un(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bQ(e.blendFunction,ti.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return oi(this.gl)?this.gl.createVertexArray():null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;oi(this.gl)?this.gl.deleteVertexArray(e):null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t||t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}function dn(e,i,r,n,a){var s,o;let l=e.context,h=e.transform,u=l.gl,c=e.useProgram("collisionBox"),d=[],p=0,f=0;for(let t of n){let n=i.getTile(t).getBucket(r);if(!n)continue;let o=a?n.textCollisionBox:n.iconCollisionBox,m=n.collisionCircleArray;m.length>0&&(d.push({circleArray:m,circleOffset:f,coord:t}),p+=m.length/4,f=p),o&&c.draw(l,u.LINES,ni.disabled,si.disabled,e.colorModeForRenderPass(),ri.disabled,Ki(e.transform),null===(s=e.style.map.terrain)||void 0===s?void 0:s.getTerrainData(t),h.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,null,e.transform.zoom,null,null,o.collisionVertexBuffer)}if(!a||!d.length)return;let m=e.useProgram("collisionCircle"),g=new t.ca;g.resize(4*p),g._trim();let _=0;for(let e of d)for(let t=0;t<e.circleArray.length/4;t++){let i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],a=e.circleArray[i+2],s=e.circleArray[i+3];g.emplace(_++,r,n,a,s,0),g.emplace(_++,r,n,a,s,1),g.emplace(_++,r,n,a,s,2),g.emplace(_++,r,n,a,s,3)}(!ln||ln.length<2*p)&&(ln=function(e){let i=2*e,r=new t.cc;r.resize(i),r._trim();for(let e=0;e<i;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(p));let y=l.createIndexBuffer(ln,!0),v=l.createVertexBuffer(g,t.cb.members,!0);for(let i of d){let n=Ji(e.transform);m.draw(l,u.TRIANGLES,ni.disabled,si.disabled,e.colorModeForRenderPass(),ri.disabled,n,null===(o=e.style.map.terrain)||void 0===o?void 0:o.getTerrainData(i.coord),null,r.id,v,y,t.aV.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}v.destroy(),y.destroy()}let pn=t.ap(new Float32Array(16));function fn(e,i,r,n,a,s){let{horizontalAlign:o,verticalAlign:l}=t.aP(e);return new t.P((-(o-.5)*i/a+n[0])*s,(-(l-.5)*r/a+n[1])*s)}function mn(e,i,r,n,a,s){let o=i.tileAnchorPoint.add(new t.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let e=n.mult(s);r||(e=e.rotate(-a));let t=o.add(e);return $e(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){let t=et(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(e),r=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(n.rotate(r))}return e.add(n)}function gn(e,i,r,n,a,s,o,l,h,u,c,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<p.length;m++){let _=p.get(m),y=_.hidden||!_.crossTileID||e.allowVerticalPlacement&&!_.placedOrientation?null:n[_.crossTileID];if(y){let n=new t.P(_.anchorX,_.anchorY),p={getElevation:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:s,pitchWithMap:r,transform:a,tileAnchorPoint:n,translation:u,unwrappedTileID:c},m=r?it(n.x,n.y,p):et(n.x,n.y,p),v=qe(a.cameraToCenterDistance,m.signedDistanceFromCamera),x=t.ay(e.textSizeData,l,_)*v/t.aJ;r&&(x*=e.tilePixelRatio/o);let{width:b,height:w,anchor:T,textOffset:S,textBoxScale:I}=y,P=fn(T,b,w,S,I,x),C=a.getPitchedTextCorrection(n.x+u[0],n.y+u[1],c),E=mn(m.point,p,i,P,-a.bearingInRadians,C),M=e.allowVerticalPlacement&&_.placedOrientation===t.ax.vertical?Math.PI/2:0;for(let e=0;e<_.numGlyphs;e++)t.aD(f,E,M);h&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:E,angle:M})}else ot(_.numGlyphs,f)}if(h){m.clear();let i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.hidden)ot(r.numGlyphs,m);else{let i=g[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.aD(m,i.shiftedAnchor,i.angle);else ot(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function _n(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function yn(e,i,r,n,a,s,o,l,h,u,c,d,p){var f,m;let g=e.context,_=g.gl,y=e.transform,v="map"===l,x="map"===h,b="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),w=v&&!x&&!b,T=!r.layout.get("symbol-sort-key").isConstant(),S=!1,I=e.getDepthModeForSublayer(0,ni.ReadOnly),P=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=[],E=y.getCircleRadiusCorrection();for(let l of n){let n=i.getTile(l),h=n.getBucket(r);if(!h)continue;let c=a?h.text:h.icon;if(!c?.segments.get().length||!c.hasVisibleVertices)continue;let d,m,g,I,M=c.programConfigurations.get(r.id),A=a||h.sdfIcons,k=a?h.textSizeData:h.iconSizeData,L=x||0!==y.pitch,F=e.useProgram(_n(A,a,h),M),D=t.aw(k,y.zoom),R=null===(f=e.style.map.terrain)||void 0===f?void 0:f.getTerrainData(l),z=[0,0],N=null;if(a)m=n.glyphAtlasTexture,g=_.LINEAR,d=n.glyphAtlasTexture.size,h.iconsInText&&(z=n.imageAtlasTexture.size,N=n.imageAtlasTexture,I=L||e.options.rotating||e.options.zooming||"composite"===k.kind||"camera"===k.kind?_.LINEAR:_.NEAREST);else{let t=1!==r.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;m=n.imageAtlasTexture,g=A||e.options.rotating||e.options.zooming||t||L?_.LINEAR:_.NEAREST,d=n.imageAtlasTexture.size}let O=t.aK(n,1,e.transform.zoom),B=Ge(v,e.transform,O),j=Ue(x,v,e.transform,O),V=t.aL(y,n,s,o),G=y.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),U=P&&h.hasTextData(),Z="none"!==r.layout.get("icon-text-fit")&&U&&h.hasIconData();if(b){let i=t.O();je(i,B);let n=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,s="map"===r.layout.get("text-rotation-alignment");He(h,e,a,B,i,x,u,s,l.toUnwrapped(),y.width,y.height,V,n)}let $,q=a&&P||Z,W=b||q?pn:x?B:e.transform.clipSpaceToPixelsMatrix,H=A&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);$=A?h.iconsInText?_r(k.kind,D,w,x,b,q,e,W,j,V,d,z,E):gr(k.kind,D,w,x,b,q,e,W,j,V,a,d,H,E):mr(k.kind,D,w,x,b,q,e,W,j,V,a,d,E);let X={program:F,buffers:c,uniformValues:$,projectionData:G,atlasTexture:m,atlasTextureIcon:N,atlasInterpolation:g,atlasInterpolationIcon:I,isSDF:A,hasHalo:H};if(T&&h.canOverlap){S=!0;let e=c.segments.get();for(let i of e)C.push({segments:new t.aV([i]),sortKey:i.sortKey,state:X,terrainData:R})}else C.push({segments:c.segments,sortKey:0,state:X,terrainData:R})}S&&C.sort((e,t)=>e.sortKey-t.sortKey);let M=null!==(m=r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null))&&void 0!==m?m:1/0,A=r.layout.get("text-letter-spacing").constantOr(0)*t.aJ<0||M>1;for(let t of C){let i=t.state;g.activeTexture.set(_.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,_.CLAMP_TO_EDGE),i.atlasTextureIcon&&(g.activeTexture.set(_.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,_.CLAMP_TO_EDGE));let n=i.isSDF&&i.hasHalo;if(n){let n=i.uniformValues;n.u_is_halo=1,A&&(n.u_is_plain=0,vn(i.buffers,t.segments,r,e,i.program,I,c,d,n,i.projectionData,t.terrainData),n.u_is_halo=0,n.u_is_plain=1)}vn(i.buffers,t.segments,r,e,i.program,I,c,d,i.uniformValues,i.projectionData,t.terrainData),n&&!A&&(i.uniformValues.u_is_halo=0)}}function vn(e,t,i,r,n,a,s,o,l,h,u){let c=r.context;n.draw(c,c.gl.TRIANGLES,a,s,o,ri.backCCW,l,u,h,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function xn(e,i,r,n,a){let s=e.context,o=s.gl,l=si.disabled,h=new ti([o.ONE,o.ONE],t.bo.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;let c=n.key,d=r.heatmapFbos.get(c);d||(d=wn(s,i.tileSize,i.tileSize),r.heatmapFbos.set(c,d)),s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,i.tileSize,i.tileSize]),s.clear({color:t.bo.transparent});let p=u.programConfigurations.get(r.id),f=e.useProgram("heatmap",p,!a),m=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);f.draw(s,o.TRIANGLES,ni.disabled,l,h,ri.disabled,er(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),g,m,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function bn(e,t,i,r,n){let a=e.context,s=a.gl,o=e.transform;a.setColorMode(e.colorModeForRenderPass());let l=Tn(a,t),h=i.key,u=t.heatmapFbos.get(h);if(!u)return;a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let c=o.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(a,s.TRIANGLES,ni.disabled,si.disabled,e.colorModeForRenderPass(),ri.disabled,tr(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),u.destroy(),t.heatmapFbos.delete(h)}function wn(e,t,i){var r,n;let a=e.gl,s=a.createTexture();a.bindTexture(a.TEXTURE_2D,s),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);let o=null!==(r=e.HALF_FLOAT)&&void 0!==r?r:a.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:a.RGBA;a.texImage2D(a.TEXTURE_2D,0,l,t,i,0,a.RGBA,o,null);let h=e.createFramebuffer(t,i,!1,!1);return h.colorAttachment.set(s),h}function Tn(e,i){return i.colorRampTexture||(i.colorRampTexture=new t.T(e,i.colorRamp,e.gl.RGBA)),i.colorRampTexture}function Sn(e,i,r,n,a,s,o,l){let h=256;if(a.stepInterpolant){let n=i.getSource().maxzoom,a=o.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;h=t.al(t.ce(s.maxLineLength/t.a6*1024*a),256,r.maxTextureSize)}return l.gradient=t.cf({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:l.gradient||void 0,clips:s.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(r,l.gradient,n.RGBA),l.version=a.gradientVersion,l.texture}function In(e,t,i,r,n){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(n)}function Pn(e,t,i,r,n,a){(n||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(a)}function Cn(e,t,i,r,n,a,s){let o=a.gradients[n.id],l=o.texture;n.gradientVersion!==o.version&&(l=Sn(e,t,i,r,n,a,s,o)),i.activeTexture.set(r.TEXTURE0),l.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function En(e,t,i,r,n,a,s,o,l){let h=a.gradients[n.id],u=h.texture;n.gradientVersion!==h.version&&(u=Sn(e,t,i,r,n,a,s,h)),i.activeTexture.set(r.TEXTURE0),u.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}function Mn(e,t,i,r,n){if(!i||!r?.imageAtlas)return;let a=r.imageAtlas.patternPositions,s=a[i.to.toString()],o=a[i.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let e=n.getPaintProperty(t);s=a[e],o=a[e]}s&&o&&e.setConstantPatternPositions(s,o)}function An(e,i,r,n,a,s,o,l){var h;let u,c,d,p,f,m=e.context.gl,g="fill-pattern",_=r.paint.get(g),y=_?.constantOr(1),v=r.getCrossfadeParameters(),x=e.transform,b=r.paint.get("fill-translate"),w=r.paint.get("fill-translate-anchor");o?(c=y&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=m.LINES):(c=y?"fillPattern":"fill",u=m.TRIANGLES);let T=_.constantOr(null);for(let _ of n){let n=i.getTile(_);if(y&&!n.patternsLoaded())continue;let S=n.getBucket(r);if(!S)continue;let I=S.programConfigurations.get(r.id),P=e.useProgram(c,I),C=null===(h=e.style.map.terrain)||void 0===h?void 0:h.getTerrainData(_);y&&(e.context.activeTexture.set(m.TEXTURE0),n.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),I.updatePaintBuffers(v)),Mn(I,g,T,n,r);let E=x.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),M=t.aL(x,n,b,w);if(o){p=S.indexBuffer2,f=S.segments2;let t=[m.drawingBufferWidth,m.drawingBufferHeight];d="fillOutlinePattern"===c&&y?Xi(e,v,n,t,M):Hi(t,M)}else p=S.indexBuffer,f=S.segments,d=y?Wi(e,v,n,M):{u_fill_translate:M};let A=e.stencilModeForClipping(_);P.draw(e.context,u,a,A,s,ri.backCCW,d,C,E,r.id,S.layoutVertexBuffer,p,f,r.paint,e.transform.zoom,I)}}function kn(e,i,r,n,a,s,o,l){var h;let u=e.context,c=u.gl,d="fill-extrusion-pattern",p=r.paint.get(d),f=p.constantOr(1),m=r.getCrossfadeParameters(),g=r.paint.get("fill-extrusion-opacity"),_=p.constantOr(null),y=e.transform;for(let p of n){let n=i.getTile(p),v=n.getBucket(r);if(!v)continue;let x=null===(h=e.style.map.terrain)||void 0===h?void 0:h.getTerrainData(p),b=v.programConfigurations.get(r.id),w=e.useProgram(f?"fillExtrusionPattern":"fillExtrusion",b);f&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(m));let T=y.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});Mn(b,d,_,n,r);let S=t.aL(y,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),I=r.paint.get("fill-extrusion-vertical-gradient"),P=f?qi(e,I,g,S,p,m,n):$i(e,I,g,S);w.draw(u,u.gl.TRIANGLES,a,s,o,ri.backCCW,P,x,T,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,b,e.style.map.terrain&&v.centroidVertexBuffer)}}function Ln(e,t,i,r,n,a,s,o,l){var h;let u=e.style.projection,c=e.context,d=e.transform,p=c.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),g=!e.options.moving;for(let f of r){let r=t.getTile(f),_=r.fbo;if(!_)continue;let y=u.getMeshFromTileID(c,f.canonical,o,!0,"raster"),v=null===(h=e.style.map.terrain)||void 0===h?void 0:h.getTerrainData(f);c.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,_.colorAttachment.get());let x=d.getProjectionData({overscaledTileID:f,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(c,p.TRIANGLES,a,n[f.overscaledZ],s,ri.backCCW,ir(e,r,i),v,x,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}let Fn=0;function Dn(e,i,r,n,a,s,o,l,h){var u;let c=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),g=!e.options.moving,_="nearest"===r.paint.get("resampling")?f.NEAREST:f.LINEAR,y=!0,v=0;for(let x of n){let n=i.getTile(x),b=n.dem;if(y){Fn||(Fn=f.getParameter(f.MAX_TEXTURE_SIZE));let e=Fn,{elevationTexture:t,colorTexture:i}=r.getColorRampTextures(d,e,b.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),i.bind(f.LINEAR,f.CLAMP_TO_EDGE),y=!1,v=t.size[0]}if(!b?.data)continue;let w=b.stride,T=b.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture||(n.demTexture=e.getTileTexture(w)),n.demTexture){let e=n.demTexture;e.update(T,{premultiply:!1}),e.bind(_,f.CLAMP_TO_EDGE)}else n.demTexture=new t.T(d,T,f.RGBA,{premultiply:!1}),n.demTexture.bind(_,f.CLAMP_TO_EDGE);let S=c.getMeshFromTileID(d,x.canonical,l,!0,"raster"),I=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(x),P=p.getProjectionData({overscaledTileID:x,aligned:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,s,a[x.overscaledZ],o,ri.backCCW,ar(r,n.dem,v),I,P,r.id,S.vertexBuffer,S.indexBuffer,S.segments)}}let Rn=[new t.P(0,0),new t.P(t.a6,0),new t.P(t.a6,t.a6),new t.P(0,t.a6)];function zn(e,t,i,r,n,a,s,o,l=!1,h=!1){var u;let c=r[r.length-1].overscaledZ,d=e.context,p=d.gl,f=e.useProgram("raster"),m=e.transform,g=e.style.projection,_=e.colorModeForRenderPass(),y=!e.options.moving,v=i.paint.get("raster-opacity"),x="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?p.NEAREST:p.LINEAR,b=i.paint.get("raster-fade-duration"),w=!!e.style.map.terrain;for(let T of r){let r=e.getDepthModeForSublayer(T.overscaledZ-c,1===v?ni.ReadWrite:ni.ReadOnly,p.LESS),S=t.getTile(T);d.activeTexture.set(p.TEXTURE0),S.texture.bind(x,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(p.TEXTURE1);let{parentTile:I,parentScaleBy:P,parentTopLeft:C,fadeValues:E}=Nn(S,t,b,w);S.fadeOpacity=E.tileOpacity,I?(I.fadeOpacity=E.parentTileOpacity,I.texture.bind(x,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)):S.texture.bind(x,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),S.texture.useMipmap&&d.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let M=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(T),A=m.getProjectionData({overscaledTileID:T,aligned:y,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),k=pr(C,P,E.fadeMix,i,o),L=g.getMeshFromTileID(d,T.canonical,a,s,"raster");f.draw(d,p.TRIANGLES,r,n?n[T.overscaledZ]:si.disabled,_,l?ri.frontCCW:ri.backCCW,k,M,A,i.id,L.vertexBuffer,L.indexBuffer,L.segments)}}function Nn(e,i,r,n){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||n)return a;if(e.fadingParentID){let n=i.getLoadedTile(e.fadingParentID);if(!n)return a;let s=Math.pow(2,n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:s,parentTopLeft:[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],fadeValues:function(e,i,r){let n=h(),a=(n-i.timeAdded)/r,s=e.fadingDirection===ce.Incoming,o=t.al((n-e.timeAdded)/r,0,1),l=t.al(1-a,0,1),u=s?o:l;return{tileOpacity:u,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-u}}}(e,n,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(e,i){let r=(h()-e.timeAdded)/i,n=t.al(r,0,1);return{tileOpacity:n,fadeMix:{opacity:n,mix:0}}}(e,r)}:a}let On=new t.bo(1,0,0,1),Bn=new t.bo(0,1,0,1),jn=new t.bo(0,0,1,1),Vn=new t.bo(1,0,1,1),Gn=new t.bo(0,1,1,1);function Un(e,t,i,r){$n(e,0,t+i/2,e.transform.width,i,r)}function Zn(e,t,i,r){$n(e,t-i/2,0,i,e.transform.height,r)}function $n(e,t,i,r,n,a){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),s.clear({color:a}),o.disable(o.SCISSOR_TEST)}function qn(e,i,r){var n;let a=e.context,s=a.gl,o=e.useProgram("debug"),l=ni.disabled,h=si.disabled,u=e.colorModeForRenderPass(),c="$debug",d=null===(n=e.style.map.terrain)||void 0===n?void 0:n.getTerrainData(r);a.activeTexture.set(s.TEXTURE0);let p=i.getTileByID(r.key).latestRawTileData,f=Math.floor((p?.byteLength||0)/1024),m=i.getTile(r).tileSize,g=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5,_=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(_+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${_} ${f}kB`);let y=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(a,s.TRIANGLES,l,h,ti.alphaBlended,ri.disabled,Qi(t.bo.transparent,g),null,y,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),o.draw(a,s.LINE_STRIP,l,h,u,ri.disabled,Qi(t.bo.red),d,y,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Wn(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,s=a.gl,o=e.transform,l=e.colorModeForRenderPass(),h=e.getDepthModeFor3D(),u=e.useProgram("terrain");a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let r of i){let i=t.getTerrainMesh(r.tileID),c=e.renderToTexture.getTexture(r),d=t.getTerrainData(r.tileID);a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,c.texture);let p=t.getMeshFrameDelta(o.zoom),f=o.calculateFogMatrix(r.tileID.toUnwrapped()),m=ji(p,f,e.style.sky,o.pitch,n),g=o.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(a,s.TRIANGLES,h,si.disabled,l,ri.backCCW,m,d,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function Hn(e,i){if(!i.mesh){let r=new t.aU;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let n=new t.aW;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new Ot(e.createVertexBuffer(r,Bt.members),e.createIndexBuffer(n),t.aV.simpleSegment(0,0,r.length,n.length))}return i.mesh}let Xn={symbol:function(e,i,r,n,a,s){if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=s,l=si.disabled,h=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,r,n,a,s,o,l,h){var u;let c=i.transform,d=i.style.map.terrain,p="map"===a,f="map"===s;for(let a of e){let e=n.getTile(a),s=e.getBucket(r);if(null===(u=s?.text)||void 0===u||!u.segments.get().length)continue;let m=t.aw(s.textSizeData,c.zoom),g=t.aK(e,1,i.transform.zoom),_=Ge(p,i.transform,g),y="none"!==r.layout.get("icon-text-fit")&&s.hasIconData();if(m){let i=Math.pow(2,c.zoom-e.tileID.overscaledZ),r=d?(e,t)=>d.getElevation(a,e,t):null;gn(s,p,f,h,c,_,i,m,y,t.aL(c,e,o,l),a.toUnwrapped(),r)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&yn(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,h,o),0!==r.paint.get("text-opacity").constantOr(1)&&yn(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,h,o),i.map.showCollisionBoxes&&(dn(e,i,r,n,!0),dn(e,i,r,n,!1))},circle:function(e,i,r,n,a){var s;if("translucent"!==e.renderPass)return;let{isRenderingToTexture:o}=a,l=r.paint.get("circle-opacity"),h=r.paint.get("circle-stroke-width"),u=r.paint.get("circle-stroke-opacity"),c=!r.layout.get("circle-sort-key").isConstant();if(0===l.constantOr(1)&&(0===h.constantOr(1)||0===u.constantOr(1)))return;let d=e.context,p=d.gl,f=e.transform,m=e.getDepthModeForSublayer(0,ni.ReadOnly),g=si.disabled,_=e.colorModeForRenderPass(),y=[],v=f.getCircleRadiusCorrection();for(let a of n){let n=i.getTile(a),l=n.getBucket(r);if(!l)continue;let h=r.paint.get("circle-translate"),u=r.paint.get("circle-translate-anchor"),d=t.aL(f,n,h,u),p=l.programConfigurations.get(r.id),m=e.useProgram("circle",p),g=l.layoutVertexBuffer,_=l.indexBuffer,x=null===(s=e.style.map.terrain)||void 0===s?void 0:s.getTerrainData(a),b={programConfiguration:p,program:m,layoutVertexBuffer:g,indexBuffer:_,uniformValues:Yi(e,n,r,d,v),terrainData:x,projectionData:f.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!o,applyTerrainMatrix:!0})};if(c){let e=l.segments.get();for(let i of e)y.push({segments:new t.aV([i]),sortKey:i.sortKey,state:b})}else y.push({segments:l.segments,sortKey:0,state:b})}c&&y.sort((e,t)=>e.sortKey-t.sortKey);for(let t of y){let{programConfiguration:i,program:n,layoutVertexBuffer:a,indexBuffer:s,uniformValues:o,terrainData:l,projectionData:h}=t.state;n.draw(d,p.TRIANGLES,m,g,_,ri.backCCW,o,l,h,r.id,a,s,t.segments,r.paint,e.transform.zoom,i)}},heatmap:function(e,i,r,n,a){if(0===r.paint.get("heatmap-opacity"))return;let s=e.context,{isRenderingToTexture:o,isRenderingGlobe:l}=a;if(e.style.map.terrain){for(let t of n){let n=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?xn(e,n,r,t,l):"translucent"===e.renderPass&&bn(e,r,t,o,l))}s.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,r,n){let a=e.context,s=a.gl,o=e.transform,l=si.disabled,h=new ti([s.ONE,s.ONE],t.bo.transparent,[!0,!0,!0,!0]);(function(e,i,r){let n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let a=r.heatmapFbos.get(t.cd);a?(n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=wn(e,i.width/4,i.height/4),r.heatmapFbos.set(t.cd,a))})(a,e,r),a.clear({color:t.bo.transparent});for(let t of n){if(i.hasRenderableParent(t))continue;let n=i.getTile(t),u=n.getBucket(r);if(!u)continue;let c=u.programConfigurations.get(r.id),d=e.useProgram("heatmap",c),p=o.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),f=o.getCircleRadiusCorrection();d.draw(a,s.TRIANGLES,ni.disabled,l,h,ri.backCCW,er(n,o.zoom,r.paint.get("heatmap-intensity"),f),null,p,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,o.zoom,c)}a.viewport.set([0,0,e.width,e.height])}(e,i,r,n):"translucent"===e.renderPass&&function(e,i){let r=e.context,n=r.gl;r.setColorMode(e.colorModeForRenderPass());let a=i.heatmapFbos.get(t.cd);a&&(r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),Tn(r,i).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,ni.disabled,si.disabled,e.colorModeForRenderPass(),ri.disabled,tr(e,i,0,1),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom))}(e,r)},line:function(e,t,i,r,n){var a;if("translucent"!==e.renderPass)return;let{isRenderingToTexture:s}=n,o=i.paint.get("line-opacity"),l=i.paint.get("line-width");if(0===o.constantOr(1)||0===l.constantOr(1))return;let h,u=e.getDepthModeForSublayer(0,ni.ReadOnly),c=e.colorModeForRenderPass(),d=i.paint.get("line-dasharray"),p=d.constantOr(1),f=i.paint.get("line-pattern"),m=f.constantOr(1),g=i.paint.get("line-gradient"),_=i.getCrossfadeParameters();h=m?"linePattern":p&&g?"lineGradientSDF":p?"lineSDF":g?"lineGradient":"line";let y=e.context,v=y.gl,x=e.transform,b=!0;for(let n of r){let r=t.getTile(n);if(m&&!r.patternsLoaded())continue;let o=r.getBucket(i);if(!o)continue;let l=o.programConfigurations.get(i.id),w=e.context.program.get(),T=e.useProgram(h,l),S=b||T.program!==w,I=null===(a=e.style.map.terrain)||void 0===a?void 0:a.getTerrainData(n),P=f.constantOr(null),C=d?.constantOr(null);if(P&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[P.to.toString()],i=e.patternPositions[P.from.toString()];t&&i&&l.setConstantPatternPositions(t,i)}else if(C){let t="round"===i.layout.get("line-cap").constantOr(null),r=e.lineAtlas.getDash(C.to,t),n=e.lineAtlas.getDash(C.from,t);l.setConstantDashPositions(r,n)}let E,M=x.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),A=x.getPixelScale();m?(E=lr(e,r,i,A,_),In(y,v,r,l,_)):p&&g?(E=ur(e,r,i,A,_,o.lineClipsArray.length),En(e,t,y,v,i,o,n,l,_)):p?(E=hr(e,r,i,A,_),Pn(e,y,v,l,S,_)):g?(E=or(e,r,i,A,o.lineClipsArray.length),Cn(e,t,y,v,i,o,n)):E=sr(e,r,i,A);let k=e.stencilModeForClipping(n);T.draw(y,v.TRIANGLES,u,k,c,ri.disabled,E,I,M,i.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,i.paint,e.transform.zoom,l,o.layoutVertexBuffer2),b=!1}},fill:function(e,i,r,n,a){let s=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;let{isRenderingToTexture:l}=a,h=e.colorModeForRenderPass(),u=r.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===s.constantOr(t.bo.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){let t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?ni.ReadWrite:ni.ReadOnly);An(e,i,r,n,t,h,!1,l)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){let t=e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,ni.ReadOnly);An(e,i,r,n,t,h,!0,l)}},fillExtrusion:function(e,t,i,r,n){let a=i.paint.get("fill-extrusion-opacity");if(0===a)return;let{isRenderingToTexture:s}=n;if("translucent"===e.renderPass){let n=new ni(e.context.gl.LEQUAL,ni.ReadWrite,e.depthRangeFor3D);if(1!==a||i.paint.get("fill-extrusion-pattern").constantOr(1))kn(e,t,i,r,n,si.disabled,ti.disabled,s),kn(e,t,i,r,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);else{let a=e.colorModeForRenderPass();kn(e,t,i,r,n,si.disabled,a,s)}}},hillshade:function(e,i,r,n,a){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;let{isRenderingToTexture:s}=a,o=e.context,l=e.style.projection.useSubdivision,h=e.getDepthModeForSublayer(0,ni.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)(function(e,i,r,n,a,s,o){let l=e.context,h=l.gl,u="nearest"===n.paint.get("resampling")?h.NEAREST:h.LINEAR;for(let c of r){let r=i.getTile(c),d=r.dem;if(!d?.data||!r.needsHillshadePrepare)continue;let p=d.dim,f=d.stride,m=d.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||(r.demTexture=e.getTileTexture(f)),r.demTexture){let e=r.demTexture;e.update(m,{premultiply:!1}),e.bind(h.NEAREST,h.CLAMP_TO_EDGE)}else r.demTexture=new t.T(l,m,h.RGBA,{premultiply:!1}),r.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let g=r.fbo;if(!g){let e=new t.T(l,{width:p,height:p,data:null},h.RGBA);e.bind(u,h.CLAMP_TO_EDGE),g=r.fbo=l.createFramebuffer(p,p,!0,!1),g.colorAttachment.set(e.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,a,s,o,ri.disabled,rr(r.tileID,d),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(e,i,n,r,h,si.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){let[t,a,o]=e.stencilConfigForOverlapTwoPass(n);Ln(e,i,r,o,t,h,u,!1,s),Ln(e,i,r,o,a,h,u,!0,s)}else{let[t,a]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Ln(e,i,r,a,t,h,u,!1,s)}},colorRelief:function(e,t,i,r,n){if("translucent"!==e.renderPass||!r.length)return;let{isRenderingToTexture:a}=n,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,ni.ReadOnly),l=e.colorModeForRenderPass();if(s){let[n,s,h]=e.stencilConfigForOverlapTwoPass(r);Dn(e,t,i,h,n,o,l,!1,a),Dn(e,t,i,h,s,o,l,!0,a)}else{let[n,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Dn(e,t,i,s,n,o,l,!1,a)}},raster:function(e,t,i,r,n){if("translucent"!==e.renderPass||0===i.paint.get("raster-opacity")||!r.length)return;let{isRenderingToTexture:a}=n,s=t.getSource(),o=e.style.projection.useSubdivision;if(s instanceof te)zn(e,t,i,r,null,!1,!1,s.tileCoords,s.flippedWindingOrder,a);else if(o){let[n,s,o]=e.stencilConfigForOverlapTwoPass(r);zn(e,t,i,o,n,!1,!0,Rn,!1,a),zn(e,t,i,o,s,!0,!0,Rn,!1,a)}else{let[n,s]=e.getStencilConfigForOverlapAndUpdateStencilID(r);zn(e,t,i,s,n,!1,!0,Rn,!1,a)}},background:function(e,t,i,r,n){var a;let s=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;let{isRenderingToTexture:l}=n,h=e.context,u=h.gl,c=e.style.projection,d=e.transform,p=d.tileSize,f=i.paint.get("background-pattern");if(e.isPatternMissing(f))return;let m=!f&&1===s.a&&1===o&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==m)return;let g=si.disabled,_=e.getDepthModeForSublayer(0,"opaque"===m?ni.ReadWrite:ni.ReadOnly),y=e.colorModeForRenderPass(),v=e.useProgram(f?"backgroundPattern":"background"),x=r||Ce(d,{tileSize:p,terrain:e.style.map.terrain});f&&(h.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));let b=i.getCrossfadeParameters();for(let t of x){let r=d.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),n=f?vr(o,e,f,{tileID:t,tileSize:p},b):yr(o,s),m=null===(a=e.style.map.terrain)||void 0===a?void 0:a.getTerrainData(t),x=c.getMeshFromTileID(h,t.canonical,!1,!0,"raster");v.draw(h,u.TRIANGLES,_,g,y,ri.backCCW,n,m,r,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}},sky:function(e,t){let i=e.context,r=i.gl,n=((e,t,i)=>{let r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=ye(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*i,(t.height/2+a*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:s}})(t,e.style.map.transform,e.pixelRatio),a=new ni(r.LEQUAL,ni.ReadWrite,[0,1]),s=si.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),h=Hn(i,t);l.draw(i,r.TRIANGLES,a,s,o,ri.disabled,n,null,void 0,"sky",h.vertexBuffer,h.indexBuffer,h.segments)},atmosphere:function(e,i,r){let n=e.context,a=n.gl,s=e.useProgram("atmosphere"),o=new ni(a.LEQUAL,ni.ReadOnly,[0,1]),l=e.transform,h=function(e,i){let r=e.properties.get("position"),n=[-r.x,-r.y,-r.z],a=t.ap(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.be(a,a,i.rollInRadians),t.bf(a,a,-i.pitchInRadians),t.be(a,a,i.bearingInRadians),t.bf(a,a,i.center.lat*Math.PI/180),t.bI(a,a,-i.center.lng*Math.PI/180)),t.cg(n,n,a),n}(r,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),c=i.properties.get("atmosphere-blend")*u.projectionTransition;if(0===c)return;let d=yi(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,t.aE(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,t.aE(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;let m=(_=h,y=c,v=[f[0],f[1],f[2]],{u_sun_pos:_,u_atmosphere_blend:y,u_globe_position:v,u_globe_radius:d,u_inv_proj_matrix:p}),g=Hn(n,i);var _,y,v;s.draw(n,a.TRIANGLES,o,si.disabled,ti.alphaBlended,ri.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)},custom:function(e,t,i,r){let{isRenderingGlobe:n}=r,a=e.context,s=i.implementation,o=e.style.projection,l=e.transform,h=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:h},c=s.renderingMode?s.renderingMode:"2d";if("offscreen"===e.renderPass){let t=s.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(s,a.gl,u),a.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(si.disabled);let t="3d"===c?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ni.ReadOnly);a.setDepthMode(t),s.render(a.gl,u),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}},debug:function(e,t,i){for(let r of i)qn(e,t,r)},debugPadding:function(e){let t=e.transform.padding;Un(e,e.transform.height-(t.top||0),3,On),Un(e,t.bottom||0,3,Bn),Zn(e,t.left||0,3,jn),Zn(e,e.transform.width-(t.right||0),3,Vn);let i=e.transform.centerPoint;var r,n,a,s;r=e,n=i.x,a=e.transform.height-i.y,$n(r,n-1,a-10,2,20,s=Gn),$n(r,n-10,a-1,20,2,s)},terrainDepth:function(e,i){let r=e.context,n=r.gl,a=e.transform,s=ti.unblended,o=new ni(n.LEQUAL,ni.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),h=e.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1});for(let e of l){let t=i.getTerrainMesh(e.tileID),l=i.getTerrainData(e.tileID),u=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),c={u_ele_delta:i.getMeshFrameDelta(a.zoom)};h.draw(r,n.TRIANGLES,o,si.disabled,s,ri.backCCW,c,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])},terrainCoords:function(e,i){let r=e.context,n=r.gl,a=e.transform,s=ti.unblended,o=new ni(n.LEQUAL,ni.ReadWrite,[0,1]),l=i.getCoordsTexture(),h=i.tileManager.getRenderableTiles(),u=e.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1}),i.coordsIndex=[];for(let e of h){let t=i.getTerrainMesh(e.tileID),h=i.getTerrainData(e.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);let c={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(a.zoom)},d=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,n.TRIANGLES,o,si.disabled,s,ri.backCCW,c,h,d,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),i.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}};class Yn{constructor(e,i){this.drawFunctions=Xn,this.context=new cn(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:t.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ze.maxOverzooming+ze.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Dt}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,i=new t.aU;i.emplaceBack(0,0),i.emplaceBack(t.a6,0),i.emplaceBack(0,t.a6),i.emplaceBack(t.a6,t.a6),this.tileExtentBuffer=e.createVertexBuffer(i,Bt.members),this.tileExtentSegments=t.aV.simpleSegment(0,0,4,2);let r=new t.aU;r.emplaceBack(0,0),r.emplaceBack(t.a6,0),r.emplaceBack(0,t.a6),r.emplaceBack(t.a6,t.a6),this.debugBuffer=e.createVertexBuffer(r,Bt.members),this.debugSegments=t.aV.simpleSegment(0,0,4,5);let n=new t.ch;n.emplaceBack(0,0,0,0),n.emplaceBack(t.a6,0,t.a6,0),n.emplaceBack(0,t.a6,0,t.a6),n.emplaceBack(t.a6,t.a6,t.a6,t.a6),this.rasterBoundsBuffer=e.createVertexBuffer(n,Oi.members),this.rasterBoundsSegments=t.aV.simpleSegment(0,0,4,2);let a=new t.aU;a.emplaceBack(0,0),a.emplaceBack(t.a6,0),a.emplaceBack(0,t.a6),a.emplaceBack(t.a6,t.a6),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,Bt.members),this.rasterBoundsSegmentsPosOnly=t.aV.simpleSegment(0,0,4,5);let s=new t.aU;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(s,Bt.members),this.viewportSegments=t.aV.simpleSegment(0,0,4,2);let o=new t.ci;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let l=new t.aW;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let h=this.context.gl;this.stencilClearMode=new si({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new Ot(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=t.O();t.c7(r,0,this.width,this.height,0,0,1),t.S(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);let n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ni.disabled,this.stencilClearMode,ti.disabled,ri.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(ti.disabled),r.setDepthMode(ni.disabled);let n={};for(let e of t)n[e.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){var n;let a=this.context,s=a.gl,o=this.style.projection,l=this.transform,h=this.useProgram("clippingMask");for(let u of t){let t=e[u.key],c=null===(n=this.style.map.terrain)||void 0===n?void 0:n.getTerrainData(u),d=o.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),p=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});h.draw(a,s.TRIANGLES,ni.disabled,new si({func:s.ALWAYS,mask:0},t,255,s.KEEP,s.KEEP,s.REPLACE),ti.disabled,i?ri.disabled:ri.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){var e;let t=this.context,i=t.gl,r=this.style.projection,n=this.transform,a=this.useProgram("depth"),s=this.getDepthModeFor3D(),o=Ce(n,{tileSize:n.tileSize});for(let l of o){let o=null===(e=this.style.map.terrain)||void 0===e?void 0:e.getTerrainData(l),h=r.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),u=n.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(t,i.TRIANGLES,s,si.disabled,ti.disabled,ri.backCCW,null,o,u,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new si({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new si({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let i=0;i<n;i++)e[i+r]=new si({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,i]}return[{[r]:si.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let e={},a={};for(let i=0;i<n;i++)e[i+r]=new si({func:t.GREATER,mask:255},n+1+i,255,t.KEEP,t.KEEP,t.REPLACE),a[i+r]=new si({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,a,i]}return this.nextStencilID=3,[{[r]:new si({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new si({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new ti([e.CONSTANT_COLOR,e.ONE],new t.bo(.125,.125,.125,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?ti.unblended:ti.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ni.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ni(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new ni(this.context.gl.LEQUAL,ni.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var r,n,a;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(h()),this.imageManager.beginFrame();let s=this.style._order,o=this.style.tileManagers,l={},u={},c={},d={isRenderingToTexture:!1,isRenderingGlobe:(null===(r=e.projection)||void 0===r?void 0:r.transitionState)>0};for(let e in o){let t=o[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),u[e]=l[e].slice().reverse(),c[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<s.length;e++)if(this.style._layers[s[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let e of s){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let i=u[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,o[t.source],t,i,d)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.bo.black:t.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[s[this.currentLayer]],t=o[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,d)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){let e=this.style._layers[s[this.currentLayer]],t=o[e.source];if(null!==(a=this.renderToTexture)&&void 0!==a&&a.renderLayer(e,d))continue;this.opaquePassEnabledForLayer()||p||(p=!0,d.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let i=("symbol"===e.type?c:u)[e.source];this._renderTileClippingMasks(e,l[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,i,d)}if(d.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let i=null,r=Object.values(e._layers).flatMap(i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[]),n=r.filter(e=>"vector"===e.getSource().type),a=r.filter(e=>"vector"!==e.getSource().type),s=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};for(let e of n)s(e);if(!i)for(let e of a)s(e);return i}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(e){var i,r;if(null===(r=null===(i=this.style)||void 0===i?void 0:i.map)||void 0===r||!r.terrain)return;let n=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix,s=this.terrainFacilitator.depthDirty;s||(s=e?!t.cj(n,a):!t.ck(n,a)),s||(s=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),s&&(t.cl(n,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var e,t;null!==(t=null===(e=this.style)||void 0===e?void 0:e.map)&&void 0!==t&&t.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(e,i,r,n,a){if(r.isHidden(this.transform.zoom)||"background"!==r.type&&"custom"!==r.type&&!(n||[]).length)return;this.id=r.id;let s=this.drawFunctions;t.aQ(r)?s.symbol(e,i,r,n,this.style.placement.variableOffsets,a):t.cm(r)?s.circle(e,i,r,n,a):t.cn(r)?s.heatmap(e,i,r,n,a):t.co(r)?s.line(e,i,r,n,a):t.cp(r)?s.fill(e,i,r,n,a):t.cq(r)?s.fillExtrusion(e,i,r,n,a):t.cr(r)?s.hillshade(e,i,r,n,a):t.cs(r)?s.colorRelief(e,i,r,n,a):t.bU(r)?s.raster(e,i,r,n,a):t.ct(r)?s.background(e,i,r,n,a):t.cu(r)&&s.custom(e,i,r,a)}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.length<Yn.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?t.push(e):e.destroy():this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,r=[]){var n;this.cache||(this.cache={});let a=!!this.style.map.terrain,s=this.style.projection,o=i?zt.projectionMercator:s.shaderPreludeCode,l=i?jt:s.shaderDefine,h=e+(t?t.cacheKey:"")+`/${i?Vt:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(a?"/terrain":"")+(r?`/${r.join("/")}`:"");return(n=this.cache)[h]||(n[h]=new Ui(this.context,zt[e],t,br[e],this._showOverdrawInspector,a,o,l,r)),this.cache[h]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.indexBuffer)||void 0===t||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Kn(e,t){let i,r=!1,n=null,a=()=>{n=null,r&&(e(...i),n=setTimeout(a,t),r=!1)};return(...e)=>(r=!0,i=e,n||a(),n)}Yn.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Jn{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t,i=e.split("&").map(e=>e.split("="));for(let e of i)e[0]===this._hashName&&(t=e);return(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getCurrentHash();if(0===e.length)return;let t=e.join("/"),i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Kn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),a=Math.round(t.lng*n)/n,s=Math.round(t.lat*n)/n,o=this._map.getBearing(),l=this._map.getPitch(),h="";if(h+=e?`/${a}/${s}/${i}`:`${i}/${s}/${a}`,(o||l)&&(h+="/"+Math.round(10*o)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){let e=this._hashName,t=!1,i=window.location.hash.slice(1).split("&").map(i=>{let r=i.split("=")[0];return r===e?(t=!0,`${r}=${h}`):i}).filter(e=>e);return t||i.push(`${e}=${h}`),`#${i.join("&")}`}return`#${h}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.W(+e[2],+e[1])}catch{return!1}let i=+e[0],r=+(e[3]||0),n=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}let Qn={linearity:.3,easing:t.cv(0,0,.3,1)},ea=t.e({deceleration:2500,maxSpeed:1400},Qn),ta=t.e({deceleration:20,maxSpeed:1400},Qn),ia=t.e({deceleration:1e3,maxSpeed:360},Qn),ra=t.e({deceleration:1e3,maxSpeed:90},Qn),na=t.e({deceleration:1e3,maxSpeed:360},Qn);class aa{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=h();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){let a=oa(i.pan.mag(),r,t.e({},ea,e||{})),s=i.pan.mult(a.amount/i.pan.mag()),o=this._map.cameraHelper.handlePanInertia(s,this._map.transform);n.center=o.easingCenter,n.offset=o.easingOffset,sa(n,a)}if(i.zoom){let e=oa(i.zoom,r,ta);n.zoom=t.cw(this._map.transform.zoom+e.amount,this._map.getZoomSnap(),e.amount),sa(n,e)}if(i.bearing){let e=oa(i.bearing,r,ia);n.bearing=this._map.transform.bearing+t.al(e.amount,-179,179),sa(n,e)}if(i.pitch){let e=oa(i.pitch,r,ra);n.pitch=this._map.transform.pitch+e.amount,sa(n,e)}if(i.roll){let e=oa(i.roll,r,na);n.roll=this._map.transform.roll+t.al(e.amount,-179,179),sa(n,e)}if(n.zoom||n.bearing){let e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function sa(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function oa(e,i,r){let{maxSpeed:n,linearity:a,deceleration:s}=r,o=t.al(e*a/(i/1e3),-n,n),l=Math.abs(o)/(s*a);return{easing:r.easing,duration:1e3*l,amount:o*(l/2)}}class la extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r,n={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let a=d.mousePos(i.getCanvas(),r),s=i.unproject(a);super(e,t.e({point:a,lngLat:s,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class ha extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){let n="touchend"===e?r.changedTouches:r.touches,a=d.touchPos(i.getCanvasContainer(),n),s=a.map(e=>i.unproject(e)),o=a.reduce((e,t,i,r)=>e.add(t.div(r.length)),new t.P(0,0));super(e,{points:a,point:o,lngLats:s,lngLat:i.unproject(o),originalEvent:r}),this._defaultPrevented=!1}}class ua extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class ca{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new ua(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new la(e.type,this._map,e))}mouseup(e){this._map.fire(new la(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new la(e.type,this._map,e))}dblclick(e){return this._firePreventable(new la(e.type,this._map,e))}mouseover(e){this._map.fire(new la(e.type,this._map,e))}mouseout(e){this._map.fire(new la(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ha(e.type,this._map,e))}touchmove(e){this._map.fire(new ha(e.type,this._map,e))}touchend(e){this._map.fire(new ha(e.type,this._map,e))}touchcancel(e){this._map.fire(new ha(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class da{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new la(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new la("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new la(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class pa{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class fa{constructor(e,t){this._map=e,this._tr=new pa(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(d.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=d.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),a=Math.max(r.x,i.x),s=Math.min(r.y,i.y),o=Math.max(r.y,i.y);this._box.style.transform=`translate(${n}px,${s}px)`,this._box.style.width=a-n+"px",this._box.style.height=o-s+"px"}mouseupWindow(e,i){if(!this._active||0!==e.button)return;let r=this._startPos,n=i;if(this.reset(),d.suppressClick(),r.x!==n.x||r.y!==n.y)return this._map.fire(new t.n("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,r,n,e):{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),d.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.n(e,{originalEvent:i}))}}function ma(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class ga{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){let i=new t.P(0,0);for(let t of e)i._add(t);return i.div(e.length)}(i),this.touches=ma(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=ma(i,t);for(let e in this.touches){let t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class _a{constructor(e){this.singleTap=new ga(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let r=this.singleTap.touchend(e,t,i);if(r){let t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class ya{constructor(e){this._tr=new pa(e),this._zoomIn=new _a({numTouches:1,numTaps:2}),this._zoomOut=new _a({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,i,r){let n=this._zoomIn.touchend(e,i,r),a=this._zoomOut.touchend(e,i,r),s=this._tr;return n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom+1,i.getZoomSnap()),around:s.unproject(n)},{originalEvent:e})}):a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:t.cw(s.zoom-1,i.getZoomSnap()),around:s.unproject(a)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class va{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&d.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let xa=0,ba=2,wa={[xa]:1,[ba]:2};class Ta{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let i=wa[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}}class Sa{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Ia{constructor(e=new Ta({checkCorrectEvent:()=>!0}),t=new Sa){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}}let Pa=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Ca{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);let n=ma(r,i),a=new t.P(0,0),s=new t.P(0,0),o=0;for(let e in n){let t=n[e],i=this._touches[e];i&&(a._add(t),s._add(t.sub(i)),o++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(o)||!s.mag())return;let l=s.div(o);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(o),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ea{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,n]=this._firstTwoTouches,a=Ma(i,t,r),s=Ma(i,t,n);if(!a||!s)return;let o=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],o,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,a=Ma(i,t,r),s=Ma(i,t,n);a&&s||(this._active&&d.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Ma(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function Aa(e,t){return Math.log(e/t)/Math.LN2}class ka extends Ea{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Aa(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Aa(this._distance,i)*this._zoomRate,pinchAround:t}}}function La(e,t){return 180*e.angleWith(t)/Math.PI}class Fa extends Ea{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:La(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,i=La(e,this._startVector);return Math.abs(i)<t}}function Da(e){return Math.abs(e.y)>Math.abs(e.x)}class Ra extends Ea{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,Da(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;let r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return Da(e)&&Da(t)&&a}}let za={panStep:100,bearingStep:15,pitchStep:10};class Na{constructor(e){this._tr=new pa(e);let t=za;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,n=0,a=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,n=0),{cameraAnimation:o=>{let l=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:Oa,zoom:i?t.cw(l.zoom+i*(e.shiftKey?2:1),o.getZoomSnap()):l.zoom,bearing:l.bearing+r*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-a*this._panStep,-s*this._panStep],center:l.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Oa(e){return e*(2-e)}let Ba=4.000244140625,ja=1/450;class Va{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new pa(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ja}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=h(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%Ba==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=d.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.W.convert(r.center)):i,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>Ba?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);let n="number"!=typeof this._targetZoom?e.scale:t.ao(this._targetZoom),a=e.applyConstrain(e.getCameraLngLat(),t.ar(n*r)).zoom,s=this._map.getZoomSnap();if("wheel"===this._type&&s>0){let i=t.cw(e.zoom,s);this._targetZoom=t.cw(a,s,a-i)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let i,r="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,n=this._startZoom,a=this._easing,s=!1;if("wheel"===this._type&&n&&a){let e=h()-this._lastWheelEventTime,o=Math.min((e+5)/200,1),l=a(o);i=t.H.number(n,r,l),o<1?this._needsRerender=!0:s=!0}else i=r,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=i,{noInertia:!0,needsRenderFrame:!s,zoomDelta:i-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cy;if(this._prevEase){let e=this._prevEase,r=(h()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),a=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-a*a);i=t.cv(a,s,.25,1)}return this._prevEase={start:h(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ga{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ua{constructor(e){this._tr=new pa(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:t.cw(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Za{constructor(){this._tap=new _a({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){let r=t[0],n=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;n&&a?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class $a{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class qa{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Wa{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ha{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=d.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.n("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let Xa=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Ya extends t.n{}function Ka(e){var t;return(null===(t=e.panDelta)||void 0===t?void 0:t.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Ja{get _ownerDocument(){var e;return(null===(e=this._el)||void 0===e?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t;return(null===(t=null===(e=this._el)||void 0===e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView)||window}constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},a={},s={};for(let{handlerName:o,handler:l,allowed:h}of this._handlers){if(!l.isEnabled())continue;let u;if(this._blockedByActive(s,h,o))l.reset();else if(l[i||e.type]){if(t.cz(e,i||e.type)){let t=d.mousePos(this._map.getCanvas(),e);u=l[i||e.type](e,t)}else if(t.cA(e,i||e.type)){let t=this._getMapTouches(e.touches),r=d.touchPos(this._map.getCanvas(),t);u=l[i||e.type](e,r,t)}else t.cB(i||e.type)||(u=l[i||e.type](e));this.mergeHandlerResult(n,a,u,o,r),u?.needsRenderFrame&&this._triggerRenderFrame()}(u||l.isActive())&&(s[o]=l)}let o={};for(let e in this._previousActiveHandlers)s[e]||(o[e]=r);this._previousActiveHandlers=s,(Object.keys(o).length||Ka(n))&&(this._changes.push([n,a,o]),this._triggerRenderFrame()),(Object.keys(s).length||Ka(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=n;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new aa(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[e,t,i]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[e,t,i]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new ca(i,e));let n=i.boxZoom=new fa(i,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let a=i.cooperativeGestures=new Ha(i,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let s=new ya(i),o=new Ua(i);i.doubleClickZoom=new Ga(o,s),this._add("tapZoom",s),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();let l=new Za;this._add("tapDragZoom",l);let h=i.touchPitch=new Ra(i);this._add("touchPitch",h),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);let u=()=>i.project(i.getCenter()),c=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:a=.8},s){let o=new Ta({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey});return new va({clickTolerance:i,move:(e,i)=>{let o=s();if(r&&Math.abs(o.y-e.y)>n)return{bearingDelta:t.cx(new t.P(e.x,i.y),i,o)};let l=(i.x-e.x)*a;return r&&i.y<o.y&&(l=-l),{bearingDelta:l}},moveStateManager:o,enable:e,assignEvents:Pa})}(e,u),d=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){let r=new Ta({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button});return new va({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:r,enable:e,assignEvents:Pa})}(e),p=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){let n=new Ta({checkCorrectEvent:e=>2===e.button&&e.ctrlKey});return new va({clickTolerance:t,move:(e,t)=>{let n=r(),a=(t.x-e.x)*i;return t.y<n.y&&(a=-a),{rollDelta:a}},moveStateManager:n,enable:e,assignEvents:Pa})}(e,u);i.dragRotate=new qa(e,c,d,p),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();let f=function({enable:e,clickTolerance:t}){let i=new Ta({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey});return new va({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Pa})}(e),m=new Ca(e,i);i.dragPan=new $a(r,f,m),this._add("mousePan",f),this._add("touchPan",m,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);let g=new Fa,_=new ka;i.touchZoomRotate=new Wa(r,_,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new da(i));let y=i.scrollZoom=new Va(i,()=>this._triggerRenderFrame());this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);let v=i.keyboard=new Na(i);this._add("keyboard",v),e.interactive&&e.keyboard&&i.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Xa(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&!t?.includes(r))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,n,a){if(!r)return;t.e(e,r);let s={handlerName:n,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.rollDelta&&(i.roll=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){let e={},i={},r={};for(let[n,a,s]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,a),t.e(r,s);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){let r=this._map,n=r._getTransformForUpdate(),a=r.terrain;if(!(Ka(e)||a&&this._terrainMovement))return void this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:h,rollDelta:u,around:c,pinchAround:d}=e;void 0!==d&&(c=d),c||(c=r.transform.centerPoint),a&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let p={panDelta:s,zoomDelta:o,rollDelta:u,pitchDelta:h,bearingDelta:l,around:c};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(c)&&(c=n.centerPoint);let f=c.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(s?c.sub(s):c);this._handleMapControls({terrain:a,tr:n,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:s}),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:n,panDelta:a}){let s=this._map.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,t),e)return s.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void s.handleMapControlsPan(i,t,r)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&a?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(a))):s.handleMapControlsPan(i,t,r)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void s.handleMapControlsPan(i,t,r));s.handleMapControlsPan(i,t,r)}_fireEvents(e,i,r){let n=Xa(this._eventsInProgress),a=Xa(e),s={};for(let t in e){let{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&a&&this._fireEvent("movestart",a.originalEvent);for(let e in s)this._fireEvent(e,s[e]);a&&this._fireEvent("move",a.originalEvent);for(let t in e){let{originalEvent:i}=e[t];this._fireEvent(t,i)}let l,h={};for(let e in this._eventsInProgress){let{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||r,h[`${e}end`]=l)}for(let e in h)this._fireEvent(e,h[e]);let u=Xa(this._eventsInProgress),c=(n||a)&&!u;if(c&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&c){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&o.prefersReducedMotion?(this._map.fire(new t.n("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()):(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.n(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Ya("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Qa extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{let e=Math.min((h()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this._zoomSnap=i.zoomSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new t.W(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,i){return this.zoomTo(t.cw(this.getZoom()+1,this._zoomSnap),e,i),this}zoomOut(e,i){return this.zoomTo(t.cw(this.getZoom()-1,this._zoomSnap),e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.n("movestart",i)).fire(new t.n("move",i)).fire(new t.n("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=U.convert(e).adjustAntiMeridian();let i=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,i,r,n){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.e({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){let e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}let s=t.e(a,n.padding);n.padding=s;let o=this.transform,l=new U(e,i),h=this.cameraHelper.cameraForBoxAndBearing(n,s,l,r,o);return h&&this._zoomSnap&&(h.zoom=t.cw(h.zoom,this._zoomSnap,-1)),h}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,i,r,n,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(i)),r,n),n,a)}_fitInternal(e,i,r){return e?(delete(i=t.e(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop(),"zoom"in e&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));let r=this._getTransformForUpdate(),n=!1,a=!1,s=!1,o=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(e.center?t.W.convert(e.center):r.center,e.zoom||r.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(r,e);let l=r.zoom!==o;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(n=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(s=!0,r.setRoll(+e.roll)),null==e.padding||r.isPaddingEqual(e.padding)||r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new t.n("movestart",i)).fire(new t.n("move",i)),l&&this.fire(new t.n("zoomstart",i)).fire(new t.n("zoom",i)).fire(new t.n("zoomend",i)),n&&this.fire(new t.n("rotatestart",i)).fire(new t.n("rotate",i)).fire(new t.n("rotateend",i)),a&&this.fire(new t.n("pitchstart",i)).fire(new t.n("pitch",i)).fire(new t.n("pitchend",i)),s&&this.fire(new t.n("rollstart",i)).fire(new t.n("roll",i)).fire(new t.n("rollend",i)),this.fire(new t.n("moveend",i))}calculateCameraOptionsFromTo(e,i,r,n=0){let a=t.a7.fromLngLat(e,i),s=t.a7.fromLngLat(r,n),o=s.x-a.x,l=s.y-a.y,h=s.z-a.z,u=Math.hypot(o,l,h);if(0===u)throw new Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,l),d=t.ar(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(o,-l)/Math.PI,f=180*Math.acos(c/u)/Math.PI;return f=h<0?90-f:90+f,{center:s.toLngLat(),elevation:n,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,i){this._stop(!1,e.easeId),"zoom"in(e=t.e({offset:[0,0],duration:500,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&o.prefersReducedMotion)&&(e.duration=0);let r,n,a=this._getTransformForUpdate(),s=this.getBearing(),l=a.pitch,h=a.roll,u="bearing"in e?this._normalizeBearing(e.bearing,s):s,c="pitch"in e?+e.pitch:l,d="roll"in e?this._normalizeBearing(e.roll,h):h,p="padding"in e?e.padding:a.padding,f=t.P.convert(e.offset);e.around&&(r=t.W.convert(e.around),n=a.locationToScreenPoint(r));let m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(a,{bearing:u,pitch:c,roll:d,padding:p,around:r,aroundPoint:n,offsetAsPoint:f,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=s!==u),this._pitching||(this._pitching=c!==l),this._rolling||(this._rolling=d!==h),this._padding=!a.isPaddingEqual(p),this._zooming||(this._zooming=g.isZooming),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(a),this._fireMoveEvents(i)},t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)},e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.n("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.n("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.n("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.n("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.n("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){let t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(t.H.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<r){let i=this.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let i=e.clone();for(let e of t){let t=i.clone(),{center:r,zoom:n,roll:a,pitch:s,bearing:o,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==a&&t.setRoll(a),void 0!==s&&t.setPitch(s),void 0!==o&&t.setBearing(o),i.apply(t,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new t.n("move",e)),this._zooming&&this.fire(new t.n("zoom",e)),this._rotating&&this.fire(new t.n("rotate",e)),this._pitching&&this.fire(new t.n("pitch",e)),this._rolling&&this.fire(new t.n("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let r=this._zooming,n=this._rotating,a=this._pitching,s=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.n("zoomend",e)),n&&this.fire(new t.n("rotateend",e)),a&&this.fire(new t.n("pitchend",e)),s&&this.fire(new t.n("rollend",e)),this.fire(new t.n("moveend",e))}flyTo(e,i){if(!e.essential&&o.prefersReducedMotion){let r=t.V(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,i)}this.stop(),"zoom"in(e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));let r=this._getTransformForUpdate(),n=r.bearing,a=r.pitch,s=r.roll,l=r.padding,h="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:a,c="roll"in e?this._normalizeBearing(e.roll,s):s,d="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset),f=r.centerPoint.add(p),m=r.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(r,{bearing:h,pitch:u,roll:c,padding:d,locationAtOffset:m,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),_=e.curve,y=Math.max(r.width,r.height),v=y/g.scaleOfZoom,x=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/x*2));let b=_*_;function w(e){let t=(v*v-y*y+(e?-1:1)*b*b*x*x)/(2*(e?v:y)*b*x);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}let I=w(!1),P=function(e){return S(I)/S(I+_*e)},C=function(e){return y*((S(I)*(T(t=I+_*e)/S(t))-T(I))/b)/x;var t},E=(w(!0)-I)/_;if(Math.abs(x)<2e-6||!isFinite(E)){if(Math.abs(y-v)<1e-6)return this.easeTo(e,i);let t=v<y?-1:1;E=Math.abs(Math.log(v/y))/_,C=()=>0,P=e=>Math.exp(t*_*e)}return e.duration="duration"in e?+e.duration:1e3*E/("screenSpeed"in e?+e.screenSpeed/_:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==h,this._pitching=u!==a,this._rolling=c!==s,this._padding=!r.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(o=>{let m=o*E,_=1/P(m),y=C(m);this._rotating&&r.setBearing(t.H.number(n,h,o)),this._pitching&&r.setPitch(t.H.number(a,u,o)),this._rolling&&r.setRoll(t.H.number(s,c,o)),this._padding&&(r.interpolatePadding(l,d,o),f=r.centerPoint.add(p)),g.easeFunc(o,_,y,f),this.terrain&&!e.freezeElevation&&this._updateElevation(o),this._applyUpdatedTransform(r),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=h(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.X(e,-180,180);let r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(t.W.convert(e),this.transform):null}}let es={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ts{constructor(e=es){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=d.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=d.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=d.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let i in t){let r=t[i];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=d.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class is{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var t;this._map=e,this._compact=null===(t=this.options)||void 0===t?void 0:t.compact,this._container=d.create("div","maplibregl-ctrl");let i=d.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class rs{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(let t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ns=t.aS([{name:"a_pos3d",type:"Int16",components:3}]);class as extends t.E{constructor(e){super(),this._lastTilesetChange=h(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,i){this.tileManager.update(e,i),this._renderableTilesKeys=[];let r={};for(let n of Ce(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.c7(n.terrainRttPosMatrix32f,0,t.a6,t.a6,0,0,1),this._tiles[n.key]=new pe(n,this.tileSize),this._lastTilesetChange=h());for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID,a=e.clone(),s=t.bj();if(n.canonical.equals(e.canonical))t.c7(s,0,t.a6,t.a6,0,0,1);else if(n.canonical.isChildOf(e.canonical)){let i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),a=n.canonical.y-(n.canonical.y>>i<<i),o=t.a6>>i;t.c7(s,0,o,o,0,0,1),t.Q(s,s,[-r*o,-a*o,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{let i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),a=e.canonical.y-(e.canonical.y>>i<<i),o=t.a6>>i;t.c7(s,0,t.a6,t.a6,0,0,1),t.Q(s,s,[r*o,a*o,0]),t.S(s,s,[1/2**i,1/2**i,0])}}a.terrainRttPosMatrix32f=new Float32Array(s),i[r]=a}return i}_getTerrainCoordsForTileRanges(e,i){let r={};for(let n of this._renderableTilesKeys){let a=this._tiles[n].tileID;if(!this._isWithinTileRanges(a,i))continue;let s=e.clone(),o=t.bj();if(a.canonical.z===e.canonical.z){let i=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),r=e.canonical.y-a.canonical.y;t.c7(o,0,t.a6,t.a6,0,0,1),t.Q(o,o,[i*t.a6,r*t.a6,0])}else if(a.canonical.z>e.canonical.z){let i=a.canonical.z-e.canonical.z,r=a.canonical.x-(a.canonical.x>>i<<i)+e.wrap*(1<<a.canonical.z),n=a.canonical.y-(a.canonical.y>>i<<i),s=e.canonical.x-(a.canonical.x>>i),l=e.canonical.y-(a.canonical.y>>i),h=t.a6>>i;t.c7(o,0,h,h,0,0,1),t.Q(o,o,[-r*h+s*t.a6,-n*h+l*t.a6,0])}else{let i=e.canonical.z-a.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i)+e.wrap*(1<<e.canonical.z),n=e.canonical.y-(e.canonical.y>>i<<i),s=(e.canonical.x>>i)-a.canonical.x,l=(e.canonical.y>>i)-a.canonical.y,h=t.a6<<i;t.c7(o,0,h,h,0,0,1),t.Q(o,o,[r*t.a6+s*h,n*t.a6+l*h,0])}s.terrainRttPosMatrix32f=new Float32Array(o),r[n]=s}return r}getSourceTile(e,t){var i,r;let n=this.tileManager._source,a=e.overscaledZ-this.deltaZoom;if(a>n.maxzoom&&(a=n.maxzoom),a<n.minzoom)return;(i=this._sourceTileCache)[r=e.key]||(i[r]=e.scaledTo(a).key);let s=this.findTileInCaches(this._sourceTileCache[e.key]);if(!s?.dem&&t)for(;a>=n.minzoom&&!s?.dem;)s=this.findTileInCaches(e.scaledTo(a--).key);return s}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}}class ss{constructor(e,t,i){this._meshCache={},this.painter=e,this.tileManager=new as(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,i,r,n=t.a6){var a;let s=e.normalizeCoordinates(i,r,n);if(!s)return 0;let o=this.getTerrainData(s.tileID),l=null===(a=o.tile)||void 0===a?void 0:a.dem;if(!l)return 0;let h=t.cC([],[s.x/n*t.a6,s.y/n*t.a6],o.u_terrain_matrix),u=[h[0]*l.dim,h[1]*l.dim],c=Math.floor(u[0]),d=Math.floor(u[1]),p=u[0]-c,f=u[1]-d;return l.get(c,d)*(1-p)*(1-f)+l.get(c+1,d)*p*(1-f)+l.get(c,d+1)*(1-p)*f+l.get(c+1,d+1)*p*f}getElevationForLngLatZoom(e,i){if(!t.cD(i,e.wrap()))return 0;let{tileID:r,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,n%t.a6,a%t.a6,t.a6)}getElevationForLngLat(e,t){let i=Ce(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),r=0;for(let e of i)e.canonical.z>r&&(r=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,r)}getElevation(e,i,r,n=t.a6){return this.getDEMElevation(e,i,r,n)*this.exaggeration}getTerrainData(e){var i,r;if(!this._emptyDemTexture){let e=this.painter.context,i=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ap([])}let n=this.tileManager.getSourceTile(e,!0);if(n?.dem&&(!n.demTexture||n.needsTerrainPrepare)){let e=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new t.T(e,n.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),n.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let a=n&&n.toString()+n.tileID.key+e.key;if(a&&!this._demMatrixCache[a]){let i=this.tileManager.getSource().maxzoom,r=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?r=e.canonical.z-i:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),l=t.cE(new Float64Array(16),[1/(t.a6<<r),1/(t.a6<<r),0]);t.Q(l,l,[s*t.a6,o*t.a6,0]),this._demMatrixCache[a]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:(null===(i=n?.dem)||void 0===i?void 0:i.dim)||1,u_terrain_matrix:a?this._demMatrixCache[a].matrix:this._emptyDemMatrix,u_terrain_unpack:(null===(r=n?.dem)||void 0===r?void 0:r.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){let i=this.painter,r=i.width/devicePixelRatio,n=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===r&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(i.context,{width:r,height:n,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(i.context,{width:r,height:n,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(r,n,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,r,n))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let r=0;r<this._coordsTextureSize;r++,t+=4)i[t+0]=255&r,i[t+1]=255&e,i[t+2]=r>>8<<4|e>>8,i[t+3]=0;let r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new t.T(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let i=new Uint8Array(4),r=this.painter.context,n=r.gl,a=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),s=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),o=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(a,o-s-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);let l=i[0]+(i[2]>>4<<8),h=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],c=u&&this.tileManager.getTileByID(u);if(!c)return null;let d=this._coordsTextureSize,p=(1<<c.tileID.canonical.z)*d;return new t.a7((c.tileID.canonical.x*d+l)/p+c.tileID.wrap,(c.tileID.canonical.y*d+h)/p,this.getElevation(c.tileID,l,h,d))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var i;let r=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,n=r&&0===e.canonical.y,a=r&&e.canonical.y===(1<<e.canonical.z)-1,s=`m_${n?"n":""}_${a?"s":""}`;if(this._meshCache[s])return this._meshCache[s];let o=this.painter.context,l=new t.cF,h=new t.aW,u=this.meshSize,c=t.a6/u,d=u*u;for(let e=0;e<=u;e++)for(let t=0;t<=u;t++)l.emplaceBack(t*c,e*c,0);for(let e=0;e<d;e+=u+1)for(let t=0;t<u;t++)h.emplaceBack(t+e,u+t+e+1,u+t+e+2),h.emplaceBack(t+e,u+t+e+2,t+e+1);let p=l.length,f=p+(u+1),m=(u+1)*u,g=n?t.bq:0,_=n?0:1,y=a?t.br:t.a6,v=a?0:1;for(let e=0;e<=u;e++)l.emplaceBack(e*c,g,_);for(let e=0;e<=u;e++)l.emplaceBack(e*c,y,v);for(let e=0;e<u;e++)h.emplaceBack(m+e,f+e,f+e+1),h.emplaceBack(m+e,f+e+1,m+e+1),h.emplaceBack(0+e,p+e+1,p+e),h.emplaceBack(0+e,0+e+1,p+e+1);let x=l.length,b=x+2*(u+1);for(let e of[0,1])for(let i=0;i<=u;i++)for(let r of[0,1])l.emplaceBack(e*t.a6,i*c,r);for(let e=0;e<2*u;e+=2)h.emplaceBack(x+e,x+e+1,x+e+3),h.emplaceBack(x+e,x+e+3,x+e+2),h.emplaceBack(b+e,b+e+3,b+e+1),h.emplaceBack(b+e,b+e+2,b+e+3);let w=new Ot(o.createVertexBuffer(l,ns.members),o.createIndexBuffer(h),t.aV.simpleSegment(0,0,l.length,h.length));return this._meshCache[s]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var r;if(!t.cD(i,e.wrap()))return 0;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,i);return null!==(r=this.getMinMaxElevation(n).minElevation)&&void 0!==r?r:0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t?.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){let r=t.a7.fromLngLat(e.wrap()),n=(1<<i)*t.a6,a=r.x*n,s=r.y*n,o=Math.floor(a/t.a6),l=Math.floor(s/t.a6);return{tileID:new t.a3(i,0,i,o,l),mercatorX:a,mercatorY:s}}}class os{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new t.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(r.texture),{id:e,fbo:i,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(e=>!e.inUse)}}let ls={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class hs{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new os(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){var i,r,n;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={};for(let t in e.tileManagers){this._coordsAscending[t]={};let i=e.tileManagers[t].getVisibleCoordinates(),r=e.tileManagers[t].getSource(),a=r instanceof te?r.terrainTileRanges:null;for(let e of i){let i=this.terrain.tileManager.getTerrainCoords(e,a);for(let e in i)(n=this._coordsAscending[t])[e]||(n[e]=[]),this._coordsAscending[t][e].push(i[e])}}this._rttFingerprints={};for(let t of e._order){let n=e._layers[t],a=n.source;if(ls[n.type]&&!this._rttFingerprints[a]){this._rttFingerprints[a]={};let t=null!==(r=null===(i=e.tileManagers[a])||void 0===i?void 0:i.getState().revision)&&void 0!==r?r:0;for(let e in this._coordsAscending[a])this._rttFingerprints[a][e]=`${this._coordsAscending[a][e].map(e=>e.key).sort().join()}#${t}`}}for(let e of this._renderableTiles)for(let t in this._rttFingerprints){let i=this._rttFingerprints[t][e.tileID.key];i&&i!==e.rttFingerprint[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;let r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=e.type,a=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ls[n]&&(this._prevType&&ls[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!s))return!0;if(ls[this._prevType]||ls[n]&&s){this._prevType=n;let e=this._stacks.length-1,i=this._stacks[e]||[];for(let n of this._renderableTiles){if(this.pool.isFull()&&(Wn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){let t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}let s=this.pool.getOrCreateFreeObject();this.pool.useObject(s),this.pool.stampObject(s),n.rtt[e]={id:s.id,stamp:s.stamp},a.context.bindFramebuffer.set(s.fbo.framebuffer),a.context.clear({color:t.bo.transparent,stencil:0}),a.currentStencilSource=void 0;for(let e of i){let t=a.style._layers[e],i=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,s.fbo.width,s.fbo.height]),a._renderTileClippingMasks(t,i,!0),a.renderLayer(a,a.style.tileManagers[t.source],t,i,r),t.source&&(n.rttFingerprint[t.source]=this._rttFingerprints[t.source][n.tileID.key])}}return Wn(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),ls[n]}return!1}}let us,cs={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ds=i,ps={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:es,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},fs=class extends Qa{get _ownerWindow(){var e,t;return(null===(t=null===(e=this._container)||void 0===e?void 0:e.ownerDocument)||void 0===t?void 0:t.defaultView)||window}constructor(e){var i,r,n;let a=Object.assign(Object.assign(Object.assign({},ps),e),{canvasContextAttributes:Object.assign(Object.assign({},ps.canvasContextAttributes),e.canvasContextAttributes)});if(null!=a.minZoom&&null!=a.maxZoom&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=a.minPitch&&null!=a.maxPitch&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=a.minPitch&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=a.maxPitch&&a.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");let s=new Yt,l=new ei;void 0!==a.minZoom&&s.setMinZoom(a.minZoom),void 0!==a.maxZoom&&s.setMaxZoom(a.maxZoom),void 0!==a.minPitch&&s.setMinPitch(a.minPitch),void 0!==a.maxPitch&&s.setMaxPitch(a.maxPitch),void 0!==a.renderWorldCopies&&s.setRenderWorldCopies(a.renderWorldCopies),null!==a.transformConstrain&&s.setConstrainOverride(a.transformConstrain),super(s,l,{bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new rs,this._controls=[],this._mapId=t.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new t.n("webglcontextlost",{originalEvent:e}))}else this.fire(new t.n("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new t.n("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=!0===a.trackResize,this._bearingSnap=a.bearingSnap,this._zoomSnap=a.zoomSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=!0===a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=!0===a.crossSourceCollisions,this._collectResourceTiming=!0===a.collectResourceTiming,this._locale=Object.assign(Object.assign({},cs),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=a.transformCameraUpdate,this.transformConstrain=a.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===a.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),void 0!==a.reduceMotion&&(o.prefersReducedMotion=a.reduceMotion),this._imageQueueHandle=c.addThrottleControl(()=>this.isMoving()),this._requestManager=new p(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Ja(this,a),this._hash=a.hash?new Jn("string"==typeof a.hash&&a.hash||void 0).addTo(this):void 0,null!==(i=this._hash)&&void 0!==i&&i._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,t.e({},a.fitBoundsOptions,{duration:0}))));let h="string"==typeof a.style||"globe"!==(null===(n=null===(r=a.style)||void 0===r?void 0:r.projection)||void 0===n?void 0:n.type);this.resize(null,h),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new ts("boolean"==typeof a.attributionControl?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new is,a.logoPosition),this.on("style.load",()=>{if(h||this._resizeTransform(),this.transform.unmodified){let e=t.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.n(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new t.n(`${e.dataType}dataloading`,e))}),this.on("dataabort",e=>{this.fire(new t.n("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new t.l(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let n=this._controlPositions[i];return i.includes("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e?.onRemove)return this.fire(new t.l(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Ce(this.transform,e)}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);let r=!this._moving;return r&&(this.stop(),this.fire(new t.n("movestart",e)).fire(new t.n("move",e))),this.fire(new t.n("resize",e)),r&&this.fire(new t.n("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions(),r=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,r),this.painter.resize(t,i,r),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let r=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,r),this.painter.resize(t,i,r)}this._resizeTransform(e)}_resizeTransform(e=!0){var t;let[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,r,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,s=t*n;return Math.min(a>i?i/a:1,s>r?r/s:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(U.convert(e)),this._update()}setMinZoom(e){if((e=e??-2)>=-2&&e<=this.transform.maxZoom){let i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMinZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=e??22)>=this.transform.minZoom){let i=this.transform.zoom,r=this._getTransformForUpdate();return r.setMaxZoom(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.zoom&&this.fire(new t.n("zoomstart")).fire(new t.n("zoom")).fire(new t.n("zoomend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=e??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch){let i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMinPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=e??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch){let i=this.transform.pitch,r=this._getTransformForUpdate();return r.setMaxPitch(e),this._applyUpdatedTransform(r),this._update(),i!==this.transform.pitch&&this.fire(new t.n("pitchstart")).fire(new t.n("pitch")).fire(new t.n("pitchend")).fire(new t.n("movestart")).fire(new t.n("move")).fire(new t.n("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if((e=e??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.W.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(e=>this.getLayer(e)),s=0!==a.length?this.queryRenderedFeatures(n.point,{layers:a}):[];s.length?r||(r=!0,i.call(this,new la(e,this,n.originalEvent,{features:s}))):r=!1},mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;return{layers:t,listener:i,delegates:{mousemove:n=>{let a=t.filter(e=>this.getLayer(e));(0!==a.length?this.queryRenderedFeatures(n.point,{layers:a}):[]).length?r=!0:r&&(r=!1,i.call(this,new la(e,this,n.originalEvent)))},mouseout:t=>{r&&(r=!1,i.call(this,new la(e,this,t.originalEvent)))}}}}{let r=e=>{let r=t.filter(e=>this.getLayer(e)),n=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[e]||(i[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){var r;if(null===(r=this._delegatedListeners)||void 0===r||!r[e])return;let n=this._delegatedListeners[e];for(let e=0;e<n.length;e++){let r=n[e];if(r.listener===i&&r.layers.length===t.length&&r.layers.every(e=>t.includes(e))){for(let e in r.delegates)this.off(e,r.delegates[e]);return void n.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);let r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(let e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);let r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);for(let t in n.delegates){let a=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),a(...t)}}this._saveDelegatedListener(e,n);for(let e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r,n=e instanceof t.P||Array.isArray(e),a=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i||(i=(n?{}:e)||{}),a instanceof t.P||"number"==typeof a[0])r=[t.P.convert(a)];else{let e=t.P.convert(a[0]),i=t.P.convert(a[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r,n;if(null===(i=this._diffStyleRequest)||void 0===i||i.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let a=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Ni(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,a):this.style.loadJSON(e,t,a),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),null===(n=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===n||n.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ni(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){return t._(this,void 0,void 0,function*(){var r;if(null===(r=this._diffStyleRequest)||void 0===r||r.abort(),"string"==typeof e){let r=e;this._diffStyleRequest=new AbortController;let n=this._diffStyleRequest;try{let e=yield this._requestManager.transformRequest(r,"Style");if(n.signal.aborted)return void(this._diffStyleRequest=null);let a=yield t.k(e,n);this._diffStyleRequest=null,this._updateDiff(a.data,i)}catch(e){this._diffStyleRequest=null,t.$(e)||this.fire(new t.l(t.d(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,this._updateDiff(e,i))})}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${t.d(r).message}.  Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){var i;let r=null===(i=this.style)||void 0===i?void 0:i.tileManagers[e];if(void 0!==r)return r.loaded();this.fire(new t.l(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let i=this.style.tileManagers[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&i.reload();for(let i in this.style._layers){let r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===e.source&&t.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ss(this.painter,i,e),this.painter.renderToTexture=new hs(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.tileManager.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.n("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){var e;let t=null===(e=this.style)||void 0===e?void 0:e.tileManagers;for(let e of Object.values(t))if(!e.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=Se(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Se(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,i){let r=this.style.tileManagers[e];if(!r)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===i?r.reload(!0):r.refreshTiles(i.map(e=>new t.aa(e.z,e.x,e.y)))}addImage(e,i,r={}){let{pixelRatio:n=1,sdf:a=!1,stretchX:s,stretchY:l,content:h,textFitWidth:u,textFitHeight:c}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.l(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:r,height:o,data:d}=i,p=i;return this.style.addImage(e,{data:new t.R({width:r,height:o},new Uint8Array(d)),pixelRatio:n,stretchX:s,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:a,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{let{width:r,height:d,data:p}=o.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:d},p),pixelRatio:n,stretchX:s,stretchY:l,content:h,textFitWidth:u,textFitHeight:c,sdf:a,version:0})}}updateImage(e,i){let r=this.style.getImage(e);if(!r)return this.fire(new t.l(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let n=i instanceof HTMLImageElement||t.b(i)?o.getImageData(i):i,{width:a,height:s,data:l}=n;if(void 0===a||void 0===s)return this.fire(new t.l(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==r.data.width||s!==r.data.height)return this.fire(new t.l(new Error("The width and height of the updated image must be that same as the previous version of the image")));let h=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(l,h),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.l(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return t._(this,void 0,void 0,function*(){return c.getImage(yield this._requestManager.transformRequest(e,"Image"),new AbortController)})}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupResizeObserver(){var e;let t=!1,i=Kn(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),r=null!==(e=this._ownerWindow.ResizeObserver)&&void 0!==e?e:ResizeObserver;this._resizeObserver=new r(e=>{t?i(e):t=!0}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw new Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&"object"==typeof e&&1===e.nodeType)return e;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=d.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=d.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let n=this._controlContainer=d.create("div","maplibregl-control-container",e),a=this._controlPositions={};for(let e of["top-left","top-right","bottom-left","bottom-right"])a[e]=d.create("div",`maplibregl-ctrl-${e} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){let e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new Yn(i,this.transform)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t;return null!==(t=this.style)&&void 0!==t&&t._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,r,n,a,s,o;let l=this._idleTriggered?this._fadeDuration:0,u=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let c=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,i=h();this.style.zoomHistory.update(e,i);let r=new t.J(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(c=!0,this._crossFadingFactor=n),this.style.update(r)}let d=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==u;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(a=this.style.projection)||void 0===a?void 0:a.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||d)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=null===(o=this.style)||void 0===o?void 0:o._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,d),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new t.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.n("load"))),this.style&&(this.style.hasTransitions()||c)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.n("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e,i;this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),null===(e=this._diffStyleRequest)||void 0===e||e.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),c.removeThrottleControl(this._imageQueueHandle),null===(i=this._resizeObserver)||void 0===i||i.disconnect();let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r?.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new t.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,o.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!t.$(e)&&e.message!==hn)throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return ds}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},ms={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class gs{constructor(e,i,r=!1){this.mousedown=e=>{this.startMove(e,d.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,d.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;let n=new Ia;this._rotatePitchHandler=new va({clickTolerance:3,move:(e,n)=>{let a=i.getBoundingClientRect(),s=new t.P((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:t.cx(new t.P(e.x,n.y),n,s),pitchDelta:r?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),d.disableDrag()}move(e,t){let i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHandler.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){d.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}function _s(e,i,r,n=!1){if(n||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let a=new t.W(e.lng,e.lat);if(e=new t.W(e.lng,e.lat),i){let n=new t.W(e.lng-360,e.lat),a=new t.W(e.lng+360,e.lat),s=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(n).distSqr(i)<s?e=n:r.locationToScreenPoint(a).distSqr(i)<s&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==a.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:a}let ys={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function vs(e,t,i){let r=e.classList;for(let e in ys)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class xs extends t.E{constructor(e){if(super(),this._onClick=e=>{this.fire(new t.n("click",{originalEvent:e}))},this._onKeyPress=e=>{"Space"!==e.code&&"Enter"!==e.code||this.togglePopup()},this._onMapClick=e=>{let t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();("terrain"===e?.type||"render"===e?.type&&!t)&&this._map.once("render",this._update),this._lngLat=_s(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),this._element.style.transform=`${ys[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,o.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===e?.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.n("dragstart"))),this.fire(new t.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.n("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||"#3FB1CE",this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=t.P.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=d.create("div");let i=d.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);let a=d.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=d.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let o=d.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"transform","translate(3.0, 29.0)"),o.setAttributeNS(null,"fill","#000000");let l=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let e of l){let t=d.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),o.appendChild(t)}let h=d.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);let u=d.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(u);let c=d.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"opacity","0.25"),c.setAttributeNS(null,"fill","#000000");let p=d.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),c.appendChild(p);let f=d.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");let m=d.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");let g=d.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");let _=d.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),s.appendChild(o),s.appendChild(h),s.appendChild(c),s.appendChild(f),s.appendChild(m),i.appendChild(s),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),vs(this._element,this._anchor,"marker"),e?.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let t=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,r;let n=null===(i=this._map)||void 0===i?void 0:i.terrain,a=this._map.transform.isLocationOccluded(this._lngLat);if(!n||a){let e=a?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle("maplibregl-marker-covered",a)))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let s=this._map,o=s.terrain.depthAtPoint(this._pos),l=s.terrain.getElevationForLngLat(this._lngLat,s.transform);if(s.transform.lngLatToCameraDepth(this._lngLat,l)-o<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let h=-this._offset.y/s.transform.pixelsPerMeter,u=Math.sin(s.getPitch()*Math.PI/180)*h,c=s.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=s.transform.lngLatToCameraDepth(this._lngLat,l+u)-c>.006;!(null===(r=this._popup)||void 0===r)&&r.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}}let bs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ws=0,Ts=!1,Ss={maxWidth:100,unit:"metric"};function Is(e,t,i){let r=i?.maxWidth||100,n=e._container.clientHeight/2,a=e._container.clientWidth/2,s=e.unproject([a-r/2,n]),o=e.unproject([a+r/2,n]),l=Math.round(e.project(o).x-e.project(s).x),h=Math.min(r,l,e._container.clientWidth),u=s.distanceTo(o);if("imperial"===i?.unit){let i=3.2808*u;i>5280?Ps(t,h,i/5280,e._getUIString("ScaleControl.Miles")):Ps(t,h,i,e._getUIString("ScaleControl.Feet"))}else"nautical"===i?.unit?Ps(t,h,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Ps(t,h,u/1e3,e._getUIString("ScaleControl.Kilometers")):Ps(t,h,u,e._getUIString("ScaleControl.Meters"))}function Ps(e,t,i,r){let n=function(e){let t=Math.pow(10,`${Math.floor(e)}`.length-1),i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){let t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(i);e.style.width=t*(n/i)+"px",e.innerHTML=`${n}&nbsp;${r}`}let Cs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Es=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ms(e){if(e){if("number"==typeof e){let i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){let i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Ms(new t.P(0,0))}let As=i;e.AJAXError=t.cG,e.EXTENT=t.a6,e.Event=t.n,e.Evented=t.E,e.LngLat=t.W,e.MercatorCoordinate=t.a7,e.Point=t.P,e.addProtocol=t.cH,e.config=t.c,e.removeProtocol=t.cI,e.AttributionControl=ts,e.BoxZoomHandler=fa,e.CanvasSource=re,e.CooperativeGesturesHandler=Ha,e.DoubleClickZoomHandler=Ga,e.DragPanHandler=$a,e.DragRotateHandler=qa,e.EdgeInsets=Ut,e.FullscreenControl=class extends t.E{constructor(e={}){var i;super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null!==(e=t?.shadowRoot)&&void 0!==e&&e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!==(i=e.pseudo)&&void 0!==i&&i,e?.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=d.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);d.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=ee,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.n("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.n("geolocate",e)),this._finish()}},this._updateCamera=e=>{let i=new t.W(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),a=t.e({bearing:n},this.options.fitBoundsOptions),s=U.fromLngLat(i,r);this._map.fitBounds(s,a,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let i=new t.W(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Ts)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.n("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let i=e?.[0]instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.n("trackuserlocationend")),this.fire(new t.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>{e.preventDefault()}),this._geolocateButton=d.create("button","maplibregl-ctrl-geolocate",this._container),d.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xs({element:this._dotElement}),this._circleElement=d.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=t.e({},bs,e)}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==us&&!e)return us;if(void 0===window.navigator.permissions)return us=!!window.navigator.geolocation,us;try{us="denied"!==(yield window.navigator.permissions.query({name:"geolocation"})).state}catch{us=!!window.navigator.geolocation}return us})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,ws=0,Ts=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;let t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(i)/100,n=2*this._accuracy/r;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.n("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ws--,Ts=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.n("trackuserlocationstart")),this.fire(new t.n("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ws++,ws>1?(e={maximumAge:6e5,timeout:0},Ts=!0):(e=this.options.positionOptions,Ts=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;let t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=d.create("button","maplibregl-ctrl-globe",this._container),d.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Jn,e.ImageSource=te,e.KeyboardHandler=Na,e.LngLatBounds=U,e.LogoControl=is,e.Map=fs,e.MapLibreMap=fs,e.MapMouseEvent=la,e.MapTouchEvent=ha,e.MapWheelEvent=ua,e.Marker=xs,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},ms,e),this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),d.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),d.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=d.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new gs(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let i=d.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.n("close"))),this),this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=d.create("div","maplibregl-popup",this._map.getContainer()),this._tip=d.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let t;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=_s(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),e&&"point"in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;let i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor,n=Ms(this.options.offset);if(!r){let e,t=this._container.offsetWidth,u=this._container.offsetHeight,c=(a=this.options.padding)?{top:null!==(s=a.top)&&void 0!==s?s:0,right:null!==(o=a.right)&&void 0!==o?o:0,bottom:null!==(l=a.bottom)&&void 0!==l?l:0,left:null!==(h=a.left)&&void 0!==h?h:0}:{top:0,right:0,bottom:0,left:0};e=i.y+n.bottom.y<u+c.top?["top"]:i.y>this._map.transform.height-u-c.bottom?["bottom"]:[],i.x<t/2+c.left?e.push("left"):i.x>this._map.transform.width-t/2-c.right&&e.push("right"),r=0===e.length?"bottom":e.join("-")}var a,s,o,l,h;let u=i.add(n[r]);this.options.subpixelPositioning||(u=u.round()),this._container.style.transform=`${ys[r]} translate(${u.x}px,${u.y}px)`,vs(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Cs),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,i=document.createDocumentFragment(),r=document.createElement("body");for(r.innerHTML=e;t=r.firstChild,t;)i.appendChild(t);return this.setDOMContent(i)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=d.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=d.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(Es);e&&e.focus()}},e.RasterDEMTileSource=W,e.RasterTileSource=q,e.ScaleControl=class{constructor(e){this._onMove=()=>{Is(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Is(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ss),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=Va,e.Style=Ni,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=d.create("button","maplibregl-ctrl-terrain",this._container),d.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Ra,e.TwoFingersTouchRotateHandler=Fa,e.TwoFingersTouchZoomHandler=ka,e.TwoFingersTouchZoomRotateHandler=Wa,e.VectorTileSource=$,e.VideoSource=ie,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,function*(){if(ae(e))throw new Error(`A source type called "${e}" already exists.`);var t;t=i,ne[e]=t}),e.clearPrewarmedResources=function(){let e=L;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(A),L=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.createTileMesh=ui,e.getGlobalDispatcher=N,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return he().getRTLTextPluginStatus()},e.getVersion=function(){return As},e.getWorkerCount=function(){return k.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return N().broadcast("IS",e)},e.isTimeFrozen=function(){return l.isFrozen()},e.now=h,e.prewarm=function(){R().acquire(A)},e.restoreNow=function(){l.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){l.setNow(e)},e.setRTLTextPlugin=function(e,t){return he().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){k.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}}),e},"object"==typeof e&&typeof t<"u"?t.exports=r():"function"==typeof define&&define.amd?define(r):(i=typeof globalThis<"u"?globalThis:i||self).maplibregl=r()}),AP=Vl((e,t)=>{var i="Expected a function",r=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt,l="object"==typeof global&&global&&global.Object===Object&&global,h="object"==typeof self&&self&&self.Object===Object&&self,u=l||h||Function("return this")(),c=Object.prototype.toString,d=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e,t,r){var n,a,s,o,l,h,u=0,c=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError(i);function v(t){var i=n,r=a;return n=a=void 0,u=t,o=e.apply(r,i)}function x(e){var i=e-h;return void 0===h||i>=t||i<0||m&&e-u>=s}function b(){var e=f();if(x(e))return w(e);l=setTimeout(b,function(e){var i=t-(e-h);return m?p(i,s-(e-u)):i}(e))}function w(e){return l=void 0,y&&n?v(e):(n=a=void 0,o)}function T(){var e=f(),i=x(e);if(n=arguments,a=this,h=e,i){if(void 0===l)return function(e){return u=e,l=setTimeout(b,t),c?v(e):o}(h);if(m)return l=setTimeout(b,t),v(h)}return void 0===l&&(l=setTimeout(b,t)),o}return t=_(t)||0,g(r)&&(c=!!r.leading,s=(m="maxWait"in r)?d(_(r.maxWait)||0,t):s,y="trailing"in r?!!r.trailing:y),T.cancel=function(){void 0!==l&&clearTimeout(l),u=0,n=h=a=l=void 0},T.flush=function(){return void 0===l?o:w(f())},T}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==c.call(e)}(e))return NaN;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var i=a.test(e);return i||s.test(e)?o(e.slice(2),i?2:8):n.test(e)?NaN:+e}t.exports=function(e,t,r){var n=!0,a=!0;if("function"!=typeof e)throw new TypeError(i);return g(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),m(e,t,{leading:n,maxWait:t,trailing:a})}}),kP=Vl((e,t)=>{var i;i=e,"object"==typeof e&&typeof t<"u"?t.exports=function(e,t,i,r,n){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:n;return e===n?i:e}:"function"==typeof define&&define.amd?define(function(){return function(e,t,i,r,n){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:n;return e===n?i:e}}):i.dlv=function(e,t,i,r,n){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:n;return e===n?i:e}}),SI=Vl((e,t)=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}),MI=Vl((e,t)=>{"use strict";var i=SI();function r(){}function n(){}n.resetWarningCache=r,t.exports=function(){function e(e,t,r,n,a,s){if(s!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:n,resetWarningCache:r};return a.PropTypes=a,a}}),EI=Vl((e,t)=>{t.exports=MI()()});function Xf(){return Xf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Xf.apply(this,arguments)}function LS(e,t){if(null==e)return{};var i,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(i=a[r])>=0||(n[i]=e[i]);return n}var HE=["context","children"],qE=["useFragment"];function O_(e,t,i,r){function n(){var t,i=Reflect.construct(HTMLElement,[],n);return i._vdomComponent=e,r&&r.shadow?(i._root=i.attachShadow({mode:r.mode||"open",serializable:null!=(t=r.serializable)&&t}),r.adoptedStyleSheets&&(i._root.adoptedStyleSheets=r.adoptedStyleSheets)):i._root=i,i}return(n.prototype=Object.create(HTMLElement.prototype)).constructor=n,n.prototype.connectedCallback=function(){YE.call(this,r)},n.prototype.attributeChangedCallback=KE,n.prototype.disconnectedCallback=JE,i=i||e.observedAttributes||Object.keys(e.propTypes||{}),n.observedAttributes=i,e.formAssociated&&(n.formAssociated=!0),i.forEach(function(e){Object.defineProperty(n.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||(this._props={}),this._props[e]=t);var i=typeof t;null!=t&&"string"!==i&&"boolean"!==i&&"number"!==i||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,n),n}function XE(e){this.getChildContext=function(){return e.context};var t=e.children,i=LS(e,HE);return Co(t,i)}function YE(e){var t=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=Da(XE,Xf({},this._props,{context:t.detail.context}),DS(this,this._vdomComponent,e)),(this.hasAttribute("hydrate")?bw:Cf)(this._vdom,this._root)}function RS(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():""})}function KE(e,t,i){if(this._vdom){var r={};r[e]=i=i??void 0,r[RS(e)]=i,this._vdom=Co(this._vdom,r),Cf(this._vdom,this._root)}}function JE(){Cf(this._vdom=null,this._root)}function AS(e,t){var i=this,r=e.useFragment,n=LS(e,qE);return Da(r?Zt:"slot",Xf({},n,{ref:function(e){e?(i.ref=e,i._listener||(i._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener("_preact",i._listener))):i.ref.removeEventListener("_preact",i._listener)}}))}function DS(e,t,i){if(3===e.nodeType)return e.data;if(1!==e.nodeType)return null;var r=[],n={},a=0,s=e.attributes,o=e.childNodes;for(a=s.length;a--;)"slot"!==s[a].name&&(n[s[a].name]=s[a].value,n[RS(s[a].name)]=s[a].value);for(a=o.length;a--;){var l=DS(o[a],null,i),h=o[a].slot;h?n[h]=Da(AS,{name:h},l):r[a]=l}var u=!(!i||!i.shadow),c=t?Da(AS,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=""),Da(t||e.nodeName.toLowerCase(),n,c)}var QE=(e,t)=>{let i=new URL(e);return Object.entries(t||{}).forEach(([e,t])=>{null!=t&&i.searchParams.set(e,t)}),i},Pd=QE,eA=(e,t)=>{let i=e,r=t;return new URL(e).searchParams.size>0&&(i=e.split("?")[0]),i.endsWith("/")||(i=`${i}/`),r?.startsWith("/")&&(r=r.substring(1)),i+(r??"")},Yf=eA,tA=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},B_=class{constructor(e){this.url=e.url,this.apiKey=e.apiKey}fetch(e,t,i){return tA(this,void 0,void 0,function*(){if(!this.url)throw new Error(`No url defined for request to ${this.url}/${e}`);if(!(this.url||this.apiKey&&"public"!==this.apiKey||this.url.includes("key=")))throw new Error(`No apiKey defined for request to ${this.url}`);let r=Pd(Yf(this.url,e),Object.assign({key:this.apiKey&&"public"!==this.apiKey?this.apiKey:void 0},t||{})),n=yield(yield fetch(r.toString(),i)).json();if(n.error)throw new Error(n.error);return n})}},Ga=B_,kS=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},N_=class extends Ga{constructor(e){var t,i;super(Object.assign(Object.assign({},e),{url:e.url||"https://editor.mapset.io/api/v1/"})),this.tags=[],this.tenants=[],this.tags=null!==(t=e.tags)&&void 0!==t?t:[],this.tenants=null!==(i=e.tenants)&&void 0!==i?i:["geopstest"]}getPlanById(e){return kS(this,arguments,void 0,function*(e,t={}){return yield this.fetch(`meta/kml/${e}/`,{},Object.assign({method:"GET"},t))})}getPlans(e){return kS(this,arguments,void 0,function*(e,t={}){var i,r,n;let a=yield this.fetch("export/kml/",Object.assign({defaultplans:null!==(i=this.tags)&&void 0!==i&&i.toString()?"false":"true",key:this.apiKey,tags:null===(r=this.tags)||void 0===r?void 0:r.toString(),tenants:null===(n=this.tenants)||void 0===n?void 0:n.toString()},e||{}),t);if(a?.detail)throw new Error(a.detail);return a?.results||[]})}},FS=N_,zS=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},V_=class extends Ga{constructor(e){super(Object.assign(Object.assign({},e),{url:e.url||"https://moco.geops.io/api/v2/"})),this.tenant="geopstest",e.tenant&&(this.tenant=e.tenant)}export(){return zS(this,arguments,void 0,function*(e={},t={}){return yield this.fetch(`${this.tenant}/export/`,Object.assign({},e),t)})}exportById(e){return zS(this,arguments,void 0,function*(e,t={},i={}){var r,n;let a=yield this.fetch(`${this.tenant}/export/${e}`,t,i);return null===(n=null===(r=a?.paginatedSituations)||void 0===r?void 0:r.results)||void 0===n?void 0:n[0]})}},j_=V_,iA=(e,t,i=100)=>{let r={},n={},a=[];return s=>{let{content:o,source:l}=s;r[l]&&window.clearTimeout(r[l]),t?n[t(o)]=o:a.push(o),r[l]=window.setTimeout(()=>{let i=t?Object.values(n):a;e(i)},i)}},OS=iA,rA=(e,t)=>e===t.SCHEMATIC?"_schematic":"",Ro=rA,G_=class e{constructor(){this.defineProperties()}static getRequestString(e,t={}){let i=`${e} ${t.channel}`;return i+=t.args?` ${t.args}`:"",i+=t.id?` ${t.id}`:"",i.trim()}addEvents(e,t){this.websocket&&(this.websocket.addEventListener("message",e),t&&(this.websocket.addEventListener("error",t),this.websocket.addEventListener("close",t)))}close(){this.websocket&&(this.open||this.connecting)&&(this.websocket.onclose=()=>{},this.websocket.close(),this.messagesOnOpen=[])}connect(e,t=()=>{}){var i;if(e){if(this.websocket){if(this.websocket.url===e&&(this.open||this.connecting))return;this.websocket.url!==e&&(this.open||this.connecting)&&this.websocket.close()}this.websocket=new WebSocket(e),this.open?(t(),this.subscribePreviousSubscriptions()):this.websocket.addEventListener("open",()=>{t(),this.subscribePreviousSubscriptions()})}else null===(i=this.websocket)||void 0===i||i.close()}defineProperties(){Object.defineProperties(this,{closed:{get:()=>!this.websocket||this.websocket.readyState===this.websocket.CLOSED},closing:{get:()=>!(!this.websocket||this.websocket.readyState!==this.websocket.CLOSING)},connecting:{get:()=>!(!this.websocket||this.websocket.readyState!==this.websocket.CONNECTING)},messagesOnOpen:{value:[],writable:!0},open:{get:()=>!(!this.websocket||this.websocket.readyState!==this.websocket.OPEN)},subscribed:{value:{},writable:!0},subscriptions:{value:[],writable:!0}})}get(t,i,r){let n=e.getRequestString("GET",t);this.send(n);let a=e=>(...t)=>{e(...t);let r=this.requests.findIndex(e=>n===e.requestString&&i===e.cb);if(-1===r)return;let{onErrorCb:a,onMessageCb:s}=this.requests[r];this.removeEvents(s,a),this.requests.splice(r,1)},{onErrorCb:s,onMessageCb:o}=this.listen(t,a(i),r&&a(r));this.requests||(this.requests=[]);let l=this.requests.findIndex(e=>n===e.requestString&&i===e.cb),h={cb:i,errorCb:r,onErrorCb:s,onMessageCb:o,params:t,requestString:n};l>-1?this.requests[l]=h:this.requests.push(h)}listen(e,t,i){this.unlisten(e,t);let r=i=>{let r;try{r=JSON.parse(i.data)}catch(e){return void console.error("WebSocket: unable to parse JSON data",e,i.data)}let n,a=e.channel;a+=e.args?` ${e.args}`:"",n="buffer"===r.source?r.content:[r],n.forEach(i=>{i?.source===a&&(!e.id||e.id===r.client_reference)&&t(i)})};return this.addEvents(r,i),{onErrorCb:i,onMessageCb:r}}removeEvents(e,t){this.websocket&&(this.websocket.removeEventListener("message",e),t&&(this.websocket.removeEventListener("error",t),this.websocket.removeEventListener("close",t)))}send(e){if(!this.websocket||this.closed||this.closing)return;let t=()=>{var t;null===(t=this.websocket)||void 0===t||t.send(e)};this.open?this.messagesOnOpen.includes(e)||t():this.messagesOnOpen.includes(e)||(this.messagesOnOpen.push(e),this.websocket.addEventListener("open",()=>{this.messagesOnOpen=[],t()}),this.websocket.addEventListener("close",()=>{this.messagesOnOpen=[]}))}subscribe(t,i,r,n=!1){let{onErrorCb:a,onMessageCb:s}=this.listen(t,i,r),o=e.getRequestString("",t),l=this.subscriptions.findIndex(e=>t.channel===e.params.channel&&i===e.cb),h={cb:i,errorCb:r,onErrorCb:a,onMessageCb:s,params:t,quiet:n};l>-1?this.subscriptions[l]=h:this.subscriptions.push(h),this.subscribed[o]||(h.quiet||(this.send(`GET ${o}`),this.send(`SUB ${o}`)),this.subscribed[o]=!0)}subscribePreviousSubscriptions(){Object.keys(this.subscribed).forEach(e=>{this.subscribed[e]=!1}),[...this.subscriptions].forEach(e=>{this.subscribe(e.params,e.cb,e.errorCb,e.quiet)})}unlisten(e,t){[...this.subscriptions||[],...this.requests||[]].filter(i=>i.params.channel===e.channel&&(!t||i.cb===t)).forEach(({onErrorCb:e,onMessageCb:t})=>{this.removeEvents(t,e)})}unsubscribe(e,t){let i=this.subscriptions.filter(i=>i.params.channel===e&&(!t||i.cb===t));i.forEach(({onErrorCb:e,onMessageCb:t})=>{this.removeEvents(t,e)}),this.subscriptions=this.subscriptions.filter(i=>i.params.channel!==e||t&&i.cb!==t),e&&this.subscribed[e]&&!this.subscriptions.find(t=>t.params.channel===e)&&i.find(e=>!e.quiet)&&(this.send(`DEL ${e}`),this.subscribed[e]=!1)}},BS=G_,Xr={RAW:"raw",SCHEMATIC:"schematic",TOPOGRAPHIC:"topographic"},U_=class{get bbox(){return this._bbox}set bbox(e){JSON.stringify(e)!==JSON.stringify(this._bbox)&&(this._bbox=e,this.wsApi&&this._bbox&&this.wsApi.send(`BBOX ${this._bbox.join(" ")}`))}get buffer(){return this._buffer}set buffer(e){JSON.stringify(e)!==JSON.stringify(this._buffer)&&(this._buffer=e,this.wsApi&&this._buffer&&this.wsApi.send(`BUFFER ${this._buffer.join(" ")}`))}get url(){return this._url}set url(e){this._url!==e&&(this._url=e,(this.wsApi.open||this.wsApi.connecting)&&this.open())}constructor(e={}){this.version="2";let t=e;"string"==typeof e&&(t={url:e});let{apiKey:i}=t,{url:r}=t,n=new BS,a="";i&&!r?.includes("key=")&&(a=`?key=${i}`),this._url=(r||"wss://api.geops.io/tracker-ws/v1/")+a,this._buffer=t.buffer||[100,100],this._bbox=t.bbox,this.version=t.version||"2",this.pingIntervalMs=t.pingIntervalMs||1e4,this.reconnectTimeoutMs=t.reconnectTimeoutMs||100,this.wsApi=n}close(){this.wsApi.close()}get(e){let t=e;return"string"==typeof e&&(t={channel:e}),new Promise((e,i)=>{this.wsApi.get(t,e,i)})}getFullTrajectory(e,t,i){let r="";"1"===this.version&&(r=Ro(t,Xr));let n=[`full_trajectory${r}`];return e&&n.push(e),(!t||t===Xr.TOPOGRAPHIC)&&i&&n.push(`gen${i}`),this.get(n.join("_"))}getStation(e,t){let i={args:e,channel:`station${Ro(t,Xr)}`};return this.get(i)}getStations(e,t=100){return new Promise((i,r)=>{this.get(`station${Ro(e,Xr)}`).then(OS(i,void 0,t)).catch(r)})}getStopSequence(e){return this.get(`stopsequence_${e}`)}getTrajectory(e,t){return this.get(`partial_trajectory${Ro(t,Xr)}_${e}`)}onClose(){window.clearTimeout(this.pingInterval),window.clearTimeout(this.reconnectTimeout),this.reconnectTimeoutMs&&(this.reconnectTimeout=window.setTimeout(()=>this.open(),this.reconnectTimeoutMs))}onOpen(){this.bbox&&this.wsApi.send(`BBOX ${this.bbox.join(" ")}`),this.buffer&&this.wsApi.send(`BUFFER ${this.buffer.join(" ")}`),this.pingIntervalMs&&(window.clearInterval(this.pingInterval),this.pingInterval=window.setInterval(()=>{this.wsApi.send("PING")},this.pingIntervalMs))}open(){this.wsApi.connect(this.url,this.onOpen.bind(this)),this.wsApi.websocket&&(this.wsApi.websocket.onclose=()=>{this.onClose()})}reset(){this.wsApi.send("RESET")}subscribe(e,t,i=()=>{},r=!1){!e||!t||this.wsApi.subscribe({channel:e},t,i,r)}subscribeDeletedVehicles(e,t,i=()=>{},r=!1){this.unsubscribeDeletedVehicles(t);let n="";"1"===this.version&&(n=Ro(e,Xr)),this.subscribe(`deleted_vehicles${n}`,t,i,r)}subscribeDepartures(e,t,i=()=>{},r=!1){this.subscribeTimetable(e,t,i,r)}subscribeDisruptions(e,t,i=()=>{},r=!1){this.subscribeNewsticker(e,t,i,r)}subscribeExtraGeoms(e,t=()=>{},i=!1){this.subscribe("extra_geoms",e,t,i)}subscribeFullTrajectory(e,t,i,r=()=>{},n=!1){let a="";"1"===this.version&&(a=Ro(t,Xr)),this.subscribe(`full_trajectory${a}_${e}`,i,r,n)}subscribeHealthCheck(e,t=()=>{},i=!1){this.subscribe("healthcheck",e,t,i)}subscribeNewsticker(e,t,i=()=>{},r=!1){this.subscribe(`${e}_newsticker`,t,i,r)}subscribeStations(e,t,i=()=>{},r=!1){this.subscribe(`station${Ro(e,Xr)}`,t,i,r)}subscribeStopSequence(e,t,i=()=>{},r=!1){this.subscribe(`stopsequence_${e}`,t,i,r)}subscribeTimetable(e,t,i=()=>{},r=!1){this.subscribe(`timetable_${e}`,t,i,r)}subscribeTrajectory(e,t,i=()=>{},r=!1){this.unsubscribeTrajectory(t);let n="";"1"===this.version&&(n=Ro(e,Xr)),this.subscribe(`trajectory${n}`,t,i,r)}unsubscribe(e,t="",i){let r=Ro(Xr.SCHEMATIC,Xr),n=Ro(Xr.TOPOGRAPHIC,Xr);this.wsApi.unsubscribe(`${e}${r}${t||""}`,i),this.wsApi.unsubscribe(`${e}${n}${t||""}`,i)}unsubscribeDeletedVehicles(e){this.unsubscribe("deleted_vehicles","",e)}unsubscribeDepartures(e,t){this.unsubscribeTimetable(e,t)}unsubscribeDisruptions(e,t){this.unsubscribeNewsticker(e,t)}unsubscribeExtraGeoms(e){this.unsubscribe("extra_geoms","",e)}unsubscribeFullTrajectory(e,t){this.unsubscribe("full_trajectory",`_${e}`,t)}unsubscribeHealthCheck(e){this.unsubscribe("healthcheck","",e)}unsubscribeNewsticker(e,t){this.unsubscribe(`${e}_newsticker`,"",t)}unsubscribeStations(e){this.unsubscribe("station","",e)}unsubscribeStopSequence(e,t){this.unsubscribe("stopsequence",`_${e}`,t)}unsubscribeTimetable(e,t){this.unsubscribe(`timetable_${e}`,"",t)}unsubscribeTrajectory(e){this.unsubscribe("trajectory","",e)}},Z_=U_,$_=class extends Ga{constructor(e={}){super(Object.assign(Object.assign({},e),{url:e.url||"https://api.geops.io/tracker-http/v1/"})),e.tenant&&(this.tenant=e.tenant)}feeds(e={},t){return this.fetch("feeds/",e,t)}trainsByRouteIdentifier(e={exact_match:!0},t){return this.fetch(`trains_by_route_identifier/${this.tenant}/`,e,t)}trajectories(e={},t){return this.fetch(`trajectories/${this.tenant}/`,e,t)}},Id=$_,W_=class extends Ga{constructor(e={}){super(Object.assign(Object.assign({},e),{url:e.url||"https://api.geops.io/stops/v1/"}))}search(e,t){return this.fetch("",e,t)}},Md=W_,nA=(e,t)=>{let i=null;return typeof window>"u"?null:(typeof document<"u"&&document?.createElement?(i=document.createElement("canvas"),i.width=e,i.height=t):OffscreenCanvas?i=new OffscreenCanvas(e,t):console.error("We didn't find a way to create a canvas element, document.createElement('canvas') and new OffscrenCanvas() are not supported"),i)},os=nA,oA=(e,t)=>{let i=e.getContext("2d");i?.translate(e.width/2,e.height/2),i?.rotate(t),i?.translate(-e.width/2,-e.height/2)},H_={},sA=(e,t,i=1)=>{let r=`${e.toString()},${t},${i}`;if(!H_[r]){let n=0*i,a=os(e[0]*i,e[1]*i),s=a?.getContext("2d");a&&s&&(s.fillStyle=t,s.beginPath(),s.moveTo(n,n),s.lineTo(a.width-n,a.height/2),s.lineTo(n,a.height-n),s.fill(),s.beginPath(),s.moveTo(n,n),s.lineTo(a.width-n,a.height/2),s.lineTo(n,a.height-n),s.lineTo(n,n),s.stroke()),H_[r]=a}return H_[r]},q_={},NS=(e,t,i,r,n=0,a=1,s=0)=>{if(!r)return null;let o=`${i},${e},${t},${n},${a},${s}.${r.toString()}`;if(!q_[o]){let l=sA(r,i,a);if(l){let i=os(e+2*l.width+2*s,t+2*l.height+2*s);if(i){let e=i.getContext("2d");oA(i,-n),e?.drawImage(l,i.width-l.width,i.height/2-l.height/2-s/2,l.width,l.height)}q_[o]=i}}return q_[o]},X_={},VS=(e,t,i=1,r=1)=>{let n=`${e}, ${t}, ${r}, ${i}`,a=1*i,s=r*i;if(!X_[n]){let i=2*e+2*a+2*s+2*a,r=os(i,i),o=r?.getContext("2d");r&&o&&(o.beginPath(),o.arc(i/2,i/2,e+a+s,0,2*Math.PI,!1),o.fillStyle=t,o.filter=`blur(${s}px)`,o.fill(),X_[n]=r)}return X_[n]},Y_={},aA=(e,t,i,r,n,a)=>{let s=`${e}, ${t}, ${i}, ${r}, ${n}, ${a}`;if(!Y_[s]){let o=os(300*a,300*a),l=o?.getContext("2d");if(o&&l){l.font=t,l.textBaseline="hanging",l.textAlign="left",l.fillStyle=i,l.strokeStyle=r,l.lineWidth=n,l.strokeText(e,0,0),l.fillText(e,0,0);let a=l.measureText(e),o={height:a.fontBoundingBoxAscent+a.fontBoundingBoxDescent,width:a.width};Y_[s]=o}}return Y_[s]},K_={},jS=(e,t,i,r,n="#000",a=1)=>{let s=`${e}, ${i}, ${r}, ${n}, ${a}`,o=2*a,l=1.5*a;if(!K_[s]){let t=aA(e,i,r,n,l,a);if(t?.width&&t?.height){let a=os(t.width+2*o,t.height+2*o),h=a?.getContext("2d");a&&h&&(h.font=i,h.fillStyle=r,h.lineWidth=l,h.strokeStyle=n,h.textAlign="left",h.textBaseline="ideographic",h.strokeText(e,o,a.height-o),h.fillText(e,o,a.height-o),K_[s]=a)}}return K_[s]},J_={},GS=(e,t,i,r,n)=>{let a=`${e}, ${t}, ${i},  ${r}, ${n}`,s=1*n,o=i?1*n:0,l=r?[5*n,3*n]:null;if(!J_[a]){let i=os(2*e+2*s,2*e+2*s);if(i){let r=i.getContext("2d");if(!r)return null;r.fillStyle=t,r.lineWidth=o,r.strokeStyle="#000000",r.beginPath(),r.arc(i.width/2,i.height/2,e,0,2*Math.PI,!1),r.fill(),l&&r.setLineDash(l),o>0&&r.stroke(),J_[a]=i}}return J_[a]},Q_={},US=(e,t,i,r,n,a,s,o)=>{let l=`${e}, ${t}, ${i}, ${r},${n}, ${a}, ${s}`;if(!Q_[l]){let i=os(2*t,2*t);if(i){let s=i.getContext("2d");if(!s)return null;a&&(s.save(),s.textBaseline="middle",s.textAlign="center",s.font=o,s.strokeStyle=n,s.strokeText(e,t,t),s.restore()),s.textBaseline="middle",s.textAlign="center",s.fillStyle=r,s.font=o,s.strokeStyle=n,s.strokeText(e,t,t),s.fillText(e,t,t),Q_[l]=i}}return Q_[l]},ey={},lA=(e,t,i)=>{var r,n,a,s,o,l,h,u,c;let{delayDisplay:d,delayOutlineColor:p,getArrowSize:f,getColor:m,getDelayColor:g,getDelayFont:_,getDelayText:y,getDelayTextColor:v,getImage:x,getMaxRadiusForStrokeAndDelay:b,getMaxRadiusForText:w,getRadius:T,getText:S,getTextColor:I,getTextFont:P,getTextSize:C,hoverVehicleId:E,selectedVehicleId:M,showDelayBg:A,showDelayText:k,showHeading:L,useDelayStyle:F}=i,{pixelRatio:D=1}=t,{delay:R,operator_provides_realtime_journey:z,rotation:N,state:O,train_id:B}=e.properties,j=S?.(e,t)||"",V=m(e,t),G=I(e,t),U="JOURNEY_CANCELLED"===O,Z=!(!E||E!==B),$=!(!M||M!==B);F&&(V=g(e,t,R,U),G=v(e,t,R,U));let q=T(e,t)*D,W=q>=b()*D;(Z||$)&&(q=W?q+5*D:14*D);let H=q>w()*D,X=`${q}${Z||$}${L?N:""}`;if(F?X+=`${z}${R}${U}`:(X+=`${V}`,W&&(X+=`${U}${R}`)),H&&(X+=`${j}${G}`),!ey[X]){if(0===q)return null;let i=V,m=W||Z||$,v=!!W&&!!F&&null===R&&"yes"===z,b=A&&W&&null!==R,w=L&&H&&N,T=0,S=null;k&&W&&(Z||(R||0)>=d||U)&&(T=Math.max(U?19:14,Math.min(U?19:17,1.2*q))*D,S=y(e,t,R??0,U));let I=GS(q,i,m,v,D),E=null;if(H&&I){let r=x(e,t,j,q);if(r)E=r;else{let r=6*D,n=Math.max(q,10),a=Number(n.toFixed(1)),s=C(e,t,I.getContext("2d"),2*q-r,j,a,P(e,t,a,j)),o=P(e,t,s,j);E=US(j,q,s,G,i,!!F&&null===R&&"yes"===z,D,o)}}let M=null;b&&(M=VS(q,g(e,t,R,U),D));let O=null;S&&(O=jS(S,T,_(e,t,T,S),g(e,t,R,U,!0),p,D));let B=!0,Y=null,K=M??I;if(w&&K&&I){let r=N%(2*Math.PI);(-.5>r||r>.5)&&(B=!1),Y=NS(K.width,K.height,i,f(e,t,q/D),N,D)}let J=Math.max(null!==(r=M?.width)&&void 0!==r?r:0,null!==(n=I?.width)&&void 0!==n?n:0),Q=Math.max(null!==(a=Y?.width)&&void 0!==a?a:0,null!==(s=M?.width)&&void 0!==s?s:0,null!==(o=I?.width)&&void 0!==o?o:0),ee=Q+2*(null!==(l=O?.width)&&void 0!==l?l:0),te=null!==(c=null!==(u=null!==(h=Y?.height)&&void 0!==h?h:M?.height)&&void 0!==u?u:I?.height)&&void 0!==c?c:0,ie=os(ee,te);if(ie){let e=ie.getContext("2d");if(!e)return null;Y&&e?.drawImage(Y,ie.width/2-Y.width/2,ie.height/2-Y.height/2),M&&e.drawImage(M,ie.width/2-M.width/2,ie.height/2-M.height/2),I&&e.drawImage(I,ie.width/2-I.width/2,ie.height/2-I.height/2),E&&e.drawImage(E,ie.width/2-E.width/2,ie.height/2-E.height/2),O&&e.drawImage(O,ie.width/2+(B?Q:J)/2,ie.height/2-O.height/2),ey[X]=ie}}return ey[X]},Kf=lA,ZS=Kf,cA=(e,t,i=!1)=>{let r=["HIDDEN","LEAVING","BOARDING"],n=e.has_fzo&&r.includes(e.state),a=t.has_fzo&&r.includes(t.state);if(n||a){if(n!==a)return n?-1:1;if(e.state!==t.state)return r.indexOf(e.state)-r.indexOf(t.state)}let s=null,o=null,l=Date.now();if(i){let i=e.min_arrival_time||e.time,r=t.min_arrival_time||t.time;if(!i&&!r)return 0;if(!i)return 1;if(!r)return-1;i&&r&&(s=new Date(i).getTime()-l,o=new Date(r).getTime()-l)}else{if(!e.time&&!t.time)return 0;if(!e.time)return 1;if(!t.time)return-1;e.time&&t.time&&(s=new Date(e.time).getTime()-l,o=new Date(t.time).getTime()-l)}return s||o?s?o?s-o:-1:1:0},$S=cA,Jf="vectorTileFeature",uA=(e,t=!1,i=30)=>{let r=Object.keys(e).map(t=>e[t]);r.sort((e,i)=>$S(e,i,t));let n=new Date;n.setMinutes(n.getMinutes()+i);let a=n.getTime(),s=new Date;s.setMinutes(s.getMinutes()-i);let o=s.getTime(),l=[],h=[],u=null;for(let e=r.length-1;e>=0;e-=1){let t=Object.assign({},r[e]);if(!t.time){console.warn("Departure without time found, skipping it.",t);continue}let i=new Date(t.time).getTime();i>o&&i<a&&("BOARDING"===t.state&&(t.platform&&!h.includes(t.platform)?h.push(t.platform):t.state="HIDDEN"),u&&t.to[0]===u.to[0]&&Math.abs(i-(u.time||0))<1e3&&t.line.name===u.line.name&&(t.state="HIDDEN"),/(STOP_CANCELLED|JOURNEY_CANCELLED)/.test(t.state)&&(t.cancelled=!0),u=t,u.time=i,l.unshift(t))}return l},WS=uA,hA=(e,t=!1,i=30,r=100)=>{let n={},a={};return s=>{let{content:o,source:l}=s;n[l]&&window.clearTimeout(n[l]),o&&(a[o.call_id]=o,n[l]=window.setTimeout(()=>{let r=WS(a,t||!1,i);e(r)},r))}},ty=hA,HS=e=>{let t=e;Array.isArray(t)||(t=[e]);let i=[];return t.forEach(e=>{var t,r,n;i.push(e);let a=e.children||e.get("children")||(null===(n=null===(r=(t=e).getLayers)||void 0===r?void 0:r.call(t))||void 0===n?void 0:n.getArray());i=i.concat(HS(a||[]))}),i},Do=HS,Qf=class e extends Wn{constructor(e,t,i){super(),void 0!==i&&void 0===t?this.setFlatCoordinates(i,e):(t=t||0,this.setCenterAndRadius(e,t,i))}clone(){let t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(e,t,i,r){let n=this.flatCoordinates,a=e-n[0],s=t-n[1],o=a*a+s*s;if(o<r){if(0===o)for(let e=0;e<this.stride;++e)i[e]=n[e];else{let e=this.getRadius()/Math.sqrt(o);i[0]=n[0]+e*a,i[1]=n[1]+e*s;for(let e=2;e<this.stride;++e)i[e]=n[e]}return i.length=this.stride,o}return r}containsXY(e,t){let i=this.flatCoordinates,r=e-i[0],n=t-i[1];return r*r+n*n<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){let t=this.flatCoordinates,i=t[this.stride]-t[0];return Zl(t[0]-i,t[1]-i,t[0]+i,t[1]+i,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){let e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){let t=this.getExtent();if(Dr(e,t)){let t=this.getCenter();return e[0]<=t[0]&&e[2]>=t[0]||e[1]<=t[1]&&e[3]>=t[1]||kw(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){let t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],r=e.slice();r[t]=r[0]+i;for(let i=1;i<t;++i)r[t+i]=e[i];this.setFlatCoordinates(this.layout,r),this.changed()}setCenterAndRadius(e,t,i){this.setLayout(i,e,0),this.flatCoordinates||(this.flatCoordinates=[]);let r=this.flatCoordinates,n=h2(r,0,e,this.stride);r[n++]=r[0]+t;for(let e=1,t=this.stride;e<t;++e)r[n++]=r[e];r.length=n,this.changed()}getCoordinates(){return null}setCoordinates(e,t){}setRadius(e){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+e,this.changed()}rotate(e,t){let i=this.getCenter(),r=this.getStride();this.setCenter(Nf(i,0,i.length,r,e,t,i)),this.changed()}};Qf.prototype.transform;var qS=Qf,ry=class e extends c2{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(fd),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let e=this.geometries_;for(let t=0,i=e.length;t<i;++t)this.changeEventsKeys_.push(pd(e[t],Eu.CHANGE,this.changed,this))}clone(){let t=new e(iy(this.geometries_));return t.applyProperties(this),t}closestPointXY(e,t,i,r){if(r<is(this.getExtent(),e,t))return r;let n=this.geometries_;for(let a=0,s=n.length;a<s;++a)r=n[a].closestPointXY(e,t,i,r);return r}containsXY(e,t){let i=this.geometries_;for(let r=0,n=i.length;r<n;++r)if(i[r].containsXY(e,t))return!0;return!1}computeExtent(e){Aw(e);let t=this.geometries_;for(let i=0,r=t.length;i<r;++i)Rw(e,t[i].getExtent());return e}getGeometries(){return iy(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[],t=this.geometries_;for(let i=0,r=t.length;i<r;++i)t[i].getType()===this.getType()?e=e.concat(t[i].getGeometriesArrayRecursive()):e.push(t[i]);return e}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let i=[],r=this.geometries_,n=!1;for(let e=0,a=r.length;e<a;++e){let a=r[e],s=a.getSimplifiedGeometry(t);i.push(s),s!==a&&(n=!0)}return n?new e(i):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(e){let t=this.geometries_;for(let i=0,r=t.length;i<r;++i)if(t[i].intersectsExtent(e))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(e,t){let i=this.geometries_;for(let r=0,n=i.length;r<n;++r)i[r].rotate(e,t);this.changed()}scale(e,t,i){i||(i=Cu(this.getExtent()));let r=this.geometries_;for(let n=0,a=r.length;n<a;++n)r[n].scale(e,t,i);this.changed()}setGeometries(e){this.setGeometriesArray(iy(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){let t=this.geometries_;for(let i=0,r=t.length;i<r;++i)t[i].applyTransform(e);this.changed()}translate(e,t){let i=this.geometries_;for(let r=0,n=i.length;r<n;++r)i[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function iy(e){return e.map(e=>e.clone())}var ao=ry;function tc(e,t,i,r,n,a,s){let o,l,h=(i-t)/r;if(1===h)o=t;else if(2===h)o=t,l=n;else if(0!==h){let a=e[t],s=e[t+1],h=0,u=[0];for(let n=t+r;n<i;n+=r){let t=e[n],i=e[n+1];h+=Math.sqrt((t-a)*(t-a)+(i-s)*(i-s)),u.push(h),a=t,s=i}let c=n*h,d=jw(u,c);d<0?(l=(c-u[-d-2])/(u[-d-1]-u[-d-2]),o=t+(-d-2)*r):o=t+d*r}s=s>1?s:2,a=a||new Array(s);for(let t=0;t<s;++t)a[t]=void 0===o?NaN:void 0===l?e[o+t]:xn(e[o+t],e[o+r+t],l);return a}function em(e,t,i,r,n,a){if(i==t)return null;let s;if(n<e[t+r-1])return a?(s=e.slice(t,t+r),s[r-1]=n,s):null;if(e[i-1]<n)return a?(s=e.slice(i-r,i),s[r-1]=n,s):null;if(n==e[t+r-1])return e.slice(t,t+r);let o=t/r,l=i/r;for(;o<l;){let t=o+l>>1;n<e[(t+1)*r-1]?l=t:o=t+1}let h=e[o*r-1];if(n==h)return e.slice((o-1)*r,(o-1)*r+r);let u=(n-h)/(e[(o+1)*r-1]-h);s=[];for(let t=0;t<r-1;++t)s.push(xn(e[(o-1)*r+t],e[o*r+t],u));return s.push(n),s}function XS(e,t,i,r,n,a,s){if(s)return em(e,t,i[i.length-1],r,n,a);let o;if(n<e[r-1])return a?(o=e.slice(0,r),o[r-1]=n,o):null;if(e[e.length-1]<n)return a?(o=e.slice(e.length-r),o[r-1]=n,o):null;for(let a=0,s=i.length;a<s;++a){let s=i[a];if(t!=s){if(n<e[t+r-1])return null;if(n<=e[s-1])return em(e,t,s,r,n,!1);t=s}}return null}function ku(e,t,i,r){let n=e[t],a=e[t+1],s=0;for(let o=t+r;o<i;o+=r){let t=e[o],i=e[o+1];s+=Math.sqrt((t-n)*(t-n)+(i-a)*(i-a)),n=t,a=i}return s}var ny=class e extends Wn{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===t||Array.isArray(e[0])?this.setCoordinates(e,t):this.setFlatCoordinates(t,e)}appendCoordinate(e){Wt(this.flatCoordinates,e),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,i,r){return r<is(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(p2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),g2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,i,r))}forEachSegment(e){return S2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(t=void 0!==t&&t,em(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Ns(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return tc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return ku(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let i=[];return i.length=Gf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,i,0),new e(i,"XY")}getType(){return"LineString"}intersectsExtent(e){return T2(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vf(this.flatCoordinates,0,e,this.stride),this.changed()}},ko=ny,oy=class e extends Wn{constructor(e,t,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(void 0!==t&&i)this.setFlatCoordinates(t,e),this.ends_=i;else{let t=e,i=[],r=[];for(let e=0,n=t.length;e<n;++e){let n=t[e];Wt(i,n.getFlatCoordinates()),r.push(i.length)}let n=0===t.length?this.getLayout():t[0].getLayout();this.setFlatCoordinates(n,i),this.ends_=r}}appendLineString(e){Wt(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,i,r){return r<is(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(f2(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),_2(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,i,r))}getCoordinateAtM(e,t,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(t=void 0!==t&&t,i=void 0!==i&&i,XS(this.flatCoordinates,0,this.ends_,this.stride,e,t,i))}getCoordinates(){return yd(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new ko(this.flatCoordinates.slice(0===e?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,i=this.layout,r=[],n=0;for(let a=0,s=t.length;a<s;++a){let s=t[a],o=new ko(e.slice(n,s),i);r.push(o),n=s}return r}getLength(){let e=this.ends_,t=0,i=0;for(let r=0,n=e.length;r<n;++r)i+=ku(this.flatCoordinates,t,e[r],this.stride),t=e[r];return i}getFlatMidpoints(){let e=[],t=this.flatCoordinates,i=0,r=this.ends_,n=this.stride;for(let a=0,s=r.length;a<s;++a){let s=r[a],o=tc(t,i,s,n,.5);Wt(e,o),i=s}return e}getSimplifiedGeometryInternal(t){let i=[],r=[];return i.length=Uf(this.flatCoordinates,0,this.ends_,this.stride,t,i,0,r),new e(i,"XY",r)}getType(){return"MultiLineString"}intersectsExtent(e){return P2(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let i=_d(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}},Cd=oy,sy=class e extends Wn{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Wt(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,i,r){if(r<is(this.getExtent(),e,t))return r;let n=this.flatCoordinates,a=this.stride;for(let s=0,o=n.length;s<o;s+=a){let o=Xw(e,t,n[s],n[s+1]);if(o<r){r=o;for(let e=0;e<a;++e)i[e]=n[s+e];i.length=a}}return r}getCoordinates(){return Ns(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new bn(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,i=this.stride,r=[];for(let n=0,a=e.length;n<a;n+=i){let a=new bn(e.slice(n,n+i),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,i=this.stride;for(let r=0,n=t.length;r<n;r+=i){let i=t[r],n=t[r+1];if(Cw(e,i,n))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Vf(this.flatCoordinates,0,e,this.stride),this.changed()}},js=sy;function tm(e,t,i,r){let n=[],a=Os();for(let s=0,o=i.length;s<o;++s){let o=i[s];a=Af(e,t,o[0],r),n.push((a[0]+a[2])/2,(a[1]+a[3])/2),t=o[o.length-1]}return n}var ay=class e extends Wn{constructor(e,t,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(e[0])){let r=e,n=[],a=[];for(let e=0,t=r.length;e<t;++e){let t=r[e],i=n.length,s=t.getEnds();for(let e=0,t=s.length;e<t;++e)s[e]+=i;Wt(n,t.getFlatCoordinates()),a.push(s)}t=0===r.length?this.getLayout():r[0].getLayout(),e=n,i=a}void 0!==t&&i?(this.setFlatCoordinates(t,e),this.endss_=i):this.setCoordinates(e,t)}appendPolygon(e){let t;if(this.flatCoordinates){let i=this.flatCoordinates.length;Wt(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,r=t.length;e<r;++e)t[e]+=i}else this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();this.endss_.push(t),this.changed()}clone(){let t=this.endss_.length,i=new Array(t);for(let e=0;e<t;++e)i[e]=this.endss_[e].slice();let r=new e(this.flatCoordinates.slice(),this.layout,i);return r.applyProperties(this),r}closestPointXY(e,t,i,r){return r<is(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(m2(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),y2(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,i,r))}containsXY(e,t){return w2(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return d2(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return void 0!==e?(t=this.getOrientedFlatCoordinates().slice(),vd(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,xd(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=tm(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Zf(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new js(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;$f(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=vd(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let i=[],r=[];return i.length=b2(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),i,0,r),new e(i,"XY",r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(0===e)t=0;else{let i=this.endss_[e-1];t=i[i.length-1]}let i=this.endss_[e].slice(),r=i[i.length-1];if(0!==t)for(let e=0,r=i.length;e<r;++e)i[e]-=t;return new Oa(this.flatCoordinates.slice(t,r),this.layout,i)}getPolygons(){let e=this.layout,t=this.flatCoordinates,i=this.endss_,r=[],n=0;for(let a=0,s=i.length;a<s;++a){let s=i[a].slice(),o=s[s.length-1];if(0!==n)for(let e=0,t=s.length;e<t;++e)s[e]-=n;let l=new Oa(t.slice(n,o),e,s);r.push(l),n=o}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return I2(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let i=jf(this.flatCoordinates,0,e,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{let e=i[i.length-1];this.flatCoordinates.length=0===e.length?0:e[e.length-1]}this.changed()}},im=ay,dA=(e,t,i)=>{var r;let n,{coordinate:a,olGeometry:s,rotation:o,time_intervals:l}=t.properties,{coordinates:h,type:u}=t.geometry,c=s,d=o;if(c&&(u=c.getType(),h=null!==(r=c.getCoordinates())&&void 0!==r?r:[]),i&&a)n=a;else if("Point"===u)n=h;else if("LineString"===u){c??(c=new ko(h));let t=l||[[]],i=t[0],r=t[t.length-1];if(e<i[0])[,,d]=i,n=c.getFirstCoordinate();else if(e>r[0])[,,d]=r,n=c.getLastCoordinate();else for(let i=0;i<t.length-1;i+=1){let[r,a]=t[i],[s,o]=t[i+1];if(r<=e&&e<=s){let l=Math.min((e-r)/(s-r),1)*(o-a)+a;n=c?.getCoordinateAt(l),[,,d]=t[i];break}}}else console.error("This geometry type is not supported. Only Point or LineString are. Current geometry: ",c);return{coord:n,rotation:d}},Ed=dA,YS=vn(),Ad=class e{constructor(e,t,i,r,n,a){this.styleFunction,this.extent_,this.id_=a,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=n,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?Lw(this.flatCoordinates_):Af(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Cu(this.getExtent());this.flatInteriorPoints_=M2(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=A2(this.flatCoordinates_,this.ends_),t=tm(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Zf(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=tc(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,i=this.ends_;for(let r=0,n=i.length;r<n;++r){let n=i[r],a=tc(e,t,n,this.stride_,.5);Wt(this.flatMidpoints_,a),t=n}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){let t=(e=kr(e)).getExtent(),i=e.getWorldExtent();if(t&&i){let e=$l(i)/$l(t);$n(YS,i[0],i[3],e,-e,0,0,0),ns(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,YS,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Ww((t,i)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),i&&this.simplifiedGeometry_.applyTransform(i);let r,n=this.simplifiedGeometry_.getFlatCoordinates();switch(this.type_){case"LineString":n.length=Gf(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Uf(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,n,0,r);break;case"Polygon":r=[],n.length=v2(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),n,0,r)}return r&&(this.simplifiedGeometry_=new e(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};Ad.prototype.getFlatCoordinates=Ad.prototype.getOrientedFlatCoordinates;var Fo=Ad,ly=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Eo,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?kr(t.dataProjection):this.readProjection(e);t.extent&&i&&"tile-pixels"===i.getUnits()&&(i=kr(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return qi()}readFeature(e,t){return qi()}readFeatures(e,t){return qi()}readGeometry(e,t){return qi()}readProjection(e){return qi()}writeFeature(e,t){return qi()}writeFeatures(e,t){return qi()}writeGeometry(e,t){return qi()}},rm=ly;function ic(e,t,i){let r=i?kr(i.featureProjection):null,n=i?kr(i.dataProjection):null,a=e;if(r&&n&&!t2(r,n)){t&&(a=e.clone());let i=t?r:n,s=t?n:r;"tile-pixels"===i.getUnits()?a.transform(i,s):a.applyTransform(i2(i,s))}if(t&&i&&void 0!==i.decimals){let t=Math.pow(10,i.decimals),r=function(e){for(let i=0,r=e.length;i<r;++i)e[i]=Math.round(e[i]*t)/t;return e};a===e&&(a=e.clone()),a.applyTransform(r)}return a}var pA={Point:bn,LineString:ko,Polygon:Oa,MultiPoint:js,MultiLineString:Cd,MultiPolygon:im};function fA(e,t,i){return Array.isArray(t[0])?($f(e,0,t,i)||(e=e.slice(),vd(e,0,t,i)),e):(C2(e,0,t,i)||(e=e.slice(),E2(e,0,t,i)),e)}function cy(e,t){let i=e.geometry;if(!i)return[];if(Array.isArray(i))return i.map(t=>cy({...e,geometry:t})).flat();let r="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===r||"Circle"===r)throw new Error("Unsupported geometry type: "+r);let n=i.layout.length;return ic(new Fo(r,"Polygon"===r?fA(i.flatCoordinates,i.ends,n):i.flatCoordinates,i.ends?.flat(),n,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function nm(e,t){if(!e)return null;if(Array.isArray(e)){let i=e.map(e=>nm(e,t));return new ao(i)}return ic(new(0,pA[e.type])(e.flatCoordinates,e.layout||"XY",e.ends),!1,t)}var uy=class extends rm{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(om(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(om(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return qi()}readFeaturesFromObject(e,t){return qi()}readGeometry(e,t){return this.readGeometryFromObject(om(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return qi()}readProjection(e){return this.readProjectionFromObject(om(e))}readProjectionFromObject(e){return qi()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return qi()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return qi()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return qi()}};function om(e){if("string"==typeof e){return JSON.parse(e)||null}return null!==e?e:null}var KS=uy,hy=class extends KS{constructor(e){e=e||{},super(),this.dataProjection=kr(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=kr(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let i=null;i="Feature"===e.type?e:{type:"Feature",geometry:e,properties:null};let r=py(i.geometry,t);if(this.featureClass===Fo)return cy({geometry:r,id:i.id,properties:i.properties},t);let n=new Eo;return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&n.setGeometryName(i.geometry_name),n.setGeometry(nm(r,t)),"id"in i&&n.setId(i.id),i.properties&&n.setProperties(i.properties,!0),n}readFeaturesFromObject(e,t){let i=null;if("FeatureCollection"===e.type){i=[];let r=e.features;for(let e=0,n=r.length;e<n;++e){let n=this.readFeatureFromObject(r[e],t);n&&i.push(n)}}else i=[this.readFeatureFromObject(e,t)];return i.flat()}readGeometryFromObject(e,t){return mA(e,t)}readProjectionFromObject(e){let t,i=e.crs;if(i)if("name"==i.type)t=kr(i.properties.name);else{if("EPSG"!==i.type)throw new Error("Unknown SRS type");t=kr("EPSG:"+i.properties.code)}else t=this.dataProjection;return t}writeFeatureObject(e,t){t=this.adaptOptions(t);let i={type:"Feature",geometry:null,properties:null},r=e.getId();if(void 0!==r&&(i.id=r),!e.hasProperties())return i;let n=e.getProperties(),a=e.getGeometry();return a&&(i.geometry=dy(a,t),delete n[e.getGeometryName()]),Bs(n)||(i.properties=n),i}writeFeaturesObject(e,t){t=this.adaptOptions(t);let i=[];for(let r=0,n=e.length;r<n;++r)i.push(this.writeFeatureObject(e[r],t));return{type:"FeatureCollection",features:i}}writeGeometryObject(e,t){return dy(e,this.adaptOptions(t))}};function py(e,t){if(!e)return null;let i;switch(e.type){case"Point":i=_A(e);break;case"LineString":i=yA(e);break;case"Polygon":i=wA(e);break;case"MultiPoint":i=vA(e);break;case"MultiLineString":i=xA(e);break;case"MultiPolygon":i=bA(e);break;case"GeometryCollection":i=gA(e);break;default:throw new Error("Unsupported GeoJSON type: "+e.type)}return i}function mA(e,t){return nm(py(e,t),t)}function gA(e,t){return e.geometries.map(function(e){return py(e,t)})}function _A(e){let t=e.coordinates;return{type:"Point",flatCoordinates:t,layout:Hl(t.length)}}function yA(e){let t=e.coordinates,i=t.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:Hl(t[0]?.length||2)}}function xA(e){let t=e.coordinates,i=t[0]?.[0]?.length||2,r=[];return{type:"MultiLineString",flatCoordinates:r,ends:_d(r,0,t,i),layout:Hl(i)}}function vA(e){let t=e.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:Hl(t[0]?.length||2)}}function bA(e){let t=e.coordinates,i=[],r=t[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:jf(i,0,t,r),layout:Hl(r)}}function wA(e){let t=e.coordinates,i=[],r=t[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:_d(i,0,t,r),layout:Hl(r)}}function dy(e,t){let i,r=(e=ic(e,!0,t)).getType();switch(r){case"Point":i=CA(e,t);break;case"LineString":i=TA(e,t);break;case"Polygon":i=EA(e,t);break;case"MultiPoint":i=IA(e,t);break;case"MultiLineString":i=PA(e,t);break;case"MultiPolygon":i=MA(e,t);break;case"GeometryCollection":i=SA(e,t);break;case"Circle":i={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+r)}return i}function SA(e,t){return delete(t=Object.assign({},t)).featureProjection,{type:"GeometryCollection",geometries:e.getGeometriesArray().map(function(e){return dy(e,t)})}}function TA(e,t){return{type:"LineString",coordinates:e.getCoordinates()}}function PA(e,t){return{type:"MultiLineString",coordinates:e.getCoordinates()}}function IA(e,t){return{type:"MultiPoint",coordinates:e.getCoordinates()}}function MA(e,t){let i;return t&&(i=t.rightHanded),{type:"MultiPolygon",coordinates:e.getCoordinates(i)}}function CA(e,t){return{type:"Point",coordinates:e.getCoordinates()}}function EA(e,t){let i;return t&&(i=t.rightHanded),{type:"Polygon",coordinates:e.getCoordinates(i)}}var Xi=hy,Yr=[];for(let e=0;e<256;++e)Yr.push((e+256).toString(16).slice(1));function JS(e,t=0){return(Yr[e[t+0]]+Yr[e[t+1]]+Yr[e[t+2]]+Yr[e[t+3]]+"-"+Yr[e[t+4]]+Yr[e[t+5]]+"-"+Yr[e[t+6]]+Yr[e[t+7]]+"-"+Yr[e[t+8]]+Yr[e[t+9]]+"-"+Yr[e[t+10]]+Yr[e[t+11]]+Yr[e[t+12]]+Yr[e[t+13]]+Yr[e[t+14]]+Yr[e[t+15]]).toLowerCase()}var fy,AA=new Uint8Array(16);function my(){if(!fy){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fy=crypto.getRandomValues.bind(crypto)}return fy(AA)}var LA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),gy={randomUUID:LA};function RA(e,t,i){let r=(e=e||{}).random??e.rng?.()??my();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=r[e];return t}return JS(r)}function DA(e,t,i){return!gy.randomUUID||t||e?RA(e,t,i):gy.randomUUID()}var Ld=DA,_y=e=>parseInt(e?.substr(0,8).replace(/:/g,""),10),yy=new Xi,eT=(e,t=new Date)=>{var i;return!(null===(i=e.affectedTimeIntervals)||void 0===i||!i.some(e=>{let{dailyEndTime:i="",dailyStartTime:r="",endTime:n,startTime:a}=e,s=_y(t.toTimeString()),o=_y(r),l=_y(i),h=new Date(a)<=t&&t<=new Date(n);return o&&l?h&&o<=s&&s<=l:h}))},kA=(e,t=new Date)=>{var i,r,n;let a=null!==(n=null!==(i=e.publicationWindows)&&void 0!==i?i:null===(r=e.publications)||void 0===r?void 0:r.flatMap(e=>{var t;return null!==(t=e.publicationWindows)&&void 0!==t?t:[]}))&&void 0!==n?n:[];return a.length?!!a.some(({endTime:e,startTime:i})=>new Date(i)<=t&&t<=new Date(e)):!!eT(e,t)},FA=e=>{let t=yy.readGeometry(e.geometry),i=Cu(t.getExtent());return{geometry:{coordinates:t.getClosestPoint(i),type:"Point"},id:Ld(),properties:Object.assign(Object.assign({},e.properties),{geometry:void 0}),type:"Feature"}},QS=e=>yy.writeGeometryObject(yy.readGeometry(e,{dataProjection:"EPSG:3857",featureProjection:"EPSG:4326"})),zA=(e="undefiniert")=>e.toLowerCase().replace(/\s/g,"_").replace(/ü/g,"ue").replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ß/g,"ss"),tT=(e,t=new Date)=>{var i,r,n;let a=[],s=zA(null===(r=null===(i=e.reasons)||void 0===i?void 0:i[0])||void 0===r?void 0:r.categoryName),o={reasonCategoryImageName:s,reasons:e.reasons,reasons_category:s};return null===(n=e?.publications)||void 0===n||n.forEach(i=>{var r,n,s;let l=eT(e,t),h=kA(e,t),u={condition_group:i.serviceConditionGroup.toLowerCase(),isActive:l,isAffected:l,isPublished:h,serviceCondition:i.serviceCondition,serviceConditionGroup:i.serviceConditionGroup,severity:i.severity,severity_group:null===(r=i.severityGroup)||void 0===r?void 0:r.toLocaleLowerCase(),severityGroup:i.severityGroup};null===(n=i.publicationLines)||void 0===n||n.forEach(t=>{t.lines.forEach(r=>{r.geometry.forEach(({geom:n,graph:s})=>{let l={geometry:QS(n),id:Ld(),properties:Object.assign(Object.assign(Object.assign({graph:s,hasIcon:t.hasIcon,line:r,mot:t.mot,publicationId:i.id,situationId:e.id},o),u),{geometry:void 0}),type:"Feature"};if(a.push(l),t.hasIcon){let t=FA(l);t.properties.situationId=e.id,a.push(t)}})})}),null===(s=i.publicationStops)||void 0===s||s.forEach(t=>{t.geometry.forEach(({geom:r,graph:n})=>{let s={geometry:QS(r),id:Ld(),properties:Object.assign(Object.assign(Object.assign({graph:n,name:t.name,publicationId:i.id,publicationStopId:t.id,situationId:e.id},o),u),{geometry:void 0}),type:"Feature"};a.push(s)})})}),{features:a,type:"FeatureCollection"}},Ua={};WE(Ua,{DEFAULT_TYPE:()=>nT,MOTS_ALL:()=>NA,MOTS_ONLY_RAIL:()=>zo,MOTS_WITHOUT_CABLE:()=>sm,MOTS_WITH_CABLE:()=>BA,bgColors:()=>iT,findDefaultIndexType:()=>xy,getBgColor:()=>jA,getColorForLine:()=>cT,getColorForType:()=>Rd,getDelayColor:()=>aT,getDelayText:()=>lT,getRadius:()=>VA,getRadiusForTypeAndZoom:()=>by,getTextColor:()=>GA,getTextColorForLine:()=>oT,getTextColorForType:()=>wy,getTextSize:()=>sT,getTypeIndex:()=>am,styleOptionsForMot:()=>Sy,textColors:()=>rT,types:()=>vy});var OA=[[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7],[0,0,0,0,0,2,2,3,7,7,7,12,15,15,15,15,15]],zo=["rail"],BA=["cablecar","gondola","funicular","coach"],sm=["tram","subway","rail","bus"],NA=["tram","subway","rail","bus","ferry","cablecar","gondola","funicular","coach"],vy=[/^Tram/i,/^Subway( \/ Metro \/ S-Bahn)?/i,/^Train/i,/^Bus/i,/^Ferry/i,/^Cable ?Car/i,/^Gondola/i,/^Funicular/i,/^(Long distance bus|coach)/i,/^Rail/i,/^unknown/i],iT=["#ffb400","#ff5400","#ff8080","#ea0000","#3000ff","#ffb400","#41a27b","#00d237","#b5b5b5","#ff8080","#ffb400"],rT=["#000000","#ffffff","#000000","#ffffff","#ffffff","#000000","#ffffff","#000000","#000000","#000000"],nT="unknown",xy=()=>vy.findIndex(e=>e.test(nT)),am=e=>{let t=e;if(null==t)return xy();if("string"==typeof t){let e=vy.findIndex(e=>e.test(t));return-1===e?xy():e}return t},by=(e,t)=>{let i=Math.min(Math.floor(t??1),16);try{let t=am(e);return OA[t][i]}catch{return 1}},VA=by,Rd=e=>{try{let t=am(e);return iT[t]}catch{return"#000"}},jA=Rd,wy=e=>{try{let t=am(e);return rT[t]}catch{return"#ffffff"}},oT=e=>{let t=e?.text_color;return t&&!t.startsWith("#")&&(t=`#${t}`),t},GA=wy,sT=(e,t,i,r,n)=>{if(!(e&&n&&t&&i&&r))return 0;e.font=n;let a=e.measureText(i),s=0;for(;a.width>t&&s<25;){let t=r;r-=.5,e.font=e.font.replace(`${t}px`,`${r}px`),a=e.measureText(i),s+=1}return r},aT=(e,t,i)=>t?i?"#ff0000":"#a0a0a0":null==e?"":e>=36e5?"#ed004c":e>=5e5?"#e80000":e>=3e5?"#ff4a00":e>=18e4?"#f7bf00":"#00a00c",lT=(e,t)=>t?String.fromCodePoint(215):e?e>=36e5?`+${Math.round(e/36e5)}h`:e>=6e4?`+${Math.round(e/6e4)}m`:e>=1e3?`+${Math.round(e/1e3)}s`:e>0?`+${e}ms`:"":"",cT=e=>{let t=e?.color;return t&&!t.startsWith("#")&&(t=`#${t}`),t},Sy={getColor:e=>{var t,i;return cT(null===(t=e?.properties)||void 0===t?void 0:t.line)||Rd(null===(i=e?.properties)||void 0===i?void 0:i.type)||"#000"},getDelayColor:(e,t,i,r,n)=>aT(i,r,n)||"transparent",getDelayText:(e,t,i,r)=>lT(i,r)||"",getRadius:(e,t)=>{var i;return by(null===(i=e?.properties)||void 0===i?void 0:i.type,t?.zoom)||1},getTextColor:e=>oT(e.properties.line)||wy(e.properties.type),getTextSize:(e,t,i,r,n,a,s)=>sT(i,r,n,a,s)||12},UA=(e,t,i,r,n)=>{if(!e)return{renderedTrajectories:[]};let{center:a,pixelRatio:s=1,resolution:o,rotation:l=0,size:h=[],time:u=Date.now()}=r;if(!o||!a)return{renderedTrajectories:[]};let{filter:c,getScreenPixel:d=(e,t)=>(t.zoom||0)<12?e.map(e=>Math.floor(e)):e,hoverVehicleId:p,noInterpolate:f=!1,selectedVehicleId:m}=n,g=e.getContext("2d");g?.clearRect(0,0,e.width,e.height);let[_,y]=h;_&&y&&(e.width!==_*s||e.height!==y*s)&&([e.width,e.height]=[_*s,y*s]);let v=$n(vn(),h[0]/2,h[1]/2,1/o,-1/o,-l,-a[0],-a[1]);e.style&&(e.style.width=e.width/s+"px",e.style.height=e.height/s+"px");let x,b,w,T,S=[];for(let a=t.length-1;a>=0;a-=1){let o=t[a];if(c&&!c(o))continue;let{timeOffset:l,train_id:h}=o.properties,{coord:_,rotation:y}=Ed(u-(l||0),o,f);if(t[a].properties.coordinate=_,t[a].properties.rotation=y,!_)continue;let I=qr(v,[..._]);if(!I||(I=I.map(e=>e*s),I[0]<0||I[0]>e.width||I[1]<0||I[1]>e.height))continue;let P=i(o,r,n);if(P){if(p!==h&&m!==h){let[e,t]=d([I[0]-P.width/2,I[1]-P.height/2],r);g?.drawImage(P,e,t)}p&&p===h&&(x=P,b=I),m&&m===h&&(w=P,T=I),S.push(o)}}return w&&T&&g?.drawImage(w,Math.floor(T[0]-w.width/2),Math.floor(T[1]-w.height/2)),x&&b&&g?.drawImage(x,Math.floor(b[0]-x.width/2),Math.floor(b[1]-x.height/2)),{renderedTrajectories:S}},uT=UA;function lm(e,t,i,r,n,a,s,o){s=s??[],o=o??r;let l,h,u,c,d,p,f,m,g=e[t+r],_=e[t+r+1],y=e[i-2*r],v=e[i-2*r+1],x=0;for(let b=t;b<i;b+=r){u=l,c=h,d=void 0,p=void 0,b+r<i&&(d=e[b+r],p=e[b+r+1]),a&&b===t&&(u=y,c=v),a&&b===i-r&&(d=g,p=_),l=e[b],h=e[b+1],[f,m]=ZA(l,h,u,c,d,p,n),s[x++]=f,s[x++]=m;for(let t=2;t<o;t++)s[x++]=e[b+t]}return s.length!=x&&(s.length=x),s}function ZA(e,t,i,r,n,a,s){let o,l;void 0!==i&&void 0!==r?(o=e-i,l=t-r):void 0!==n&&void 0!==a?(o=n-e,l=a-t):(o=1,l=0);let h=Math.hypot(o,l),u=o/h,c=l/h;if(o=-c,l=u,void 0===i||void 0===r)return[e+o*s,t+l*s];if(void 0===n||void 0===a)return[e+o*s,t+l*s];let d=Qw([e,t],[i,r],[n,a]);if(Math.cos(d)>.998)return[e+u*s,t+c*s];let p=Math.cos(d/2),f=Math.sin(d/2);return[e+(f*o+p*l)*(1/f)*s,t+(-p*o+f*l)*(1/f)*s]}function cm(e,t){for(let i=0,r=e.length-2;i<r;i+=t)for(let r=e.length-2*t;r>i+t;r-=t){let n=e[i],a=e[i+1],s=e[i+t],o=e[i+t+1],l=e[r],h=e[r+1],u=e[r+t],c=e[r+t+1],d=(c-h)*(s-n)-(u-l)*(o-a);if(0===d)continue;let p=((u-l)*(a-h)-(c-h)*(n-l))/d,f=((s-n)*(a-h)-(o-a)*(n-l))/d;if(p>0&&p<1&&f>0&&f<1){let l=n+p*(s-n),h=a+p*(o-a);e[i+t]=l,e[i+t+1]=h,e.splice(i+2*t,r-i-t);break}}return e}var Ty=class{drawCustom(e,t,i,r,n){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,i){}drawFeature(e,t,i){}drawGeometryCollection(e,t,i){}drawLineString(e,t,i){}drawMultiLineString(e,t,i){}drawMultiPoint(e,t,i){}drawMultiPolygon(e,t,i){}drawPoint(e,t,i){}drawPolygon(e,t,i){}drawText(e,t,i){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},um=Ty,Py=class extends um{constructor(e,t,i,r,n,a,s){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=r,this.transformRotation_=r?Kw(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=a,this.userTransform_=s,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=vn()}drawImages_(e,t,i,r){if(!this.image_)return;let n=ns(e,t,i,r,this.transform_,this.pixelCoordinates_),a=this.context_,s=this.tmpLocalTransform_,o=a.globalAlpha;1!=this.imageOpacity_&&(a.globalAlpha=o*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let e=0,t=n.length;e<t;e+=2){let t=n[e]-this.imageAnchorX_,i=n[e+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){let e=t+this.imageAnchorX_,r=i+this.imageAnchorY_;$n(s,e,r,1,1,l,-e,-r),a.save(),a.transform.apply(a,s),a.translate(e,r),a.scale(this.imageScale_[0],this.imageScale_[1]),a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),a.restore()}else a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(a.globalAlpha=o)}drawText_(e,t,i,r){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let n=ns(e,t,i,r,this.transform_,this.pixelCoordinates_),a=this.context_,s=this.textRotation_;for(0===this.transformRotation_&&(s-=this.viewRotation_),this.textRotateWithView_&&(s+=this.viewRotation_);t<i;t+=r){let e=n[t]+this.textOffsetX_,i=n[t+1]+this.textOffsetY_;0!==s||1!=this.textScale_[0]||1!=this.textScale_[1]?(a.save(),a.translate(e-this.textOffsetX_,i-this.textOffsetY_),a.rotate(s),a.translate(this.textOffsetX_,this.textOffsetY_),a.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&a.strokeText(this.text_,0,0),this.textFillState_&&a.fillText(this.text_,0,0),a.restore()):(this.textStrokeState_&&a.strokeText(this.text_,e,i),this.textFillState_&&a.fillText(this.text_,e,i))}}moveToLineTo_(e,t,i,r,n,a){let s=this.context_,o=ns(e,t,i,r,this.transform_,this.pixelCoordinates_);Math.abs(a)>0&&(o=lm(o,0,o.length,2,a,n,o),cm(o,2)),s.moveTo(o[0],o[1]);let l=o.length;n&&(l-=2);for(let e=2;e<l;e+=2)s.lineTo(o[e],o[e+1]);return n&&s.closePath(),i}drawRings_(e,t,i,r,n){for(let a=0,s=i.length;a<s;++a)t=this.moveToLineTo_(e,t,i[a],r,!0,n);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Dr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=u2(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],r=t[3]-t[1],n=Math.sqrt(i*i+r*r),a=this.context_;a.beginPath(),a.arc(t[0],t[1],n,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}""!==this.text_&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e)}}drawFeature(e,t){let i=t.getGeometryFunction()(e);i&&(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let e=0,i=t.length;e<i;++e)this.drawGeometry(t[e])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),""!==this.text_&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),""!==this.text_&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Dr(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(""!==this.text_){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Dr(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,i=e.getFlatCoordinates(),r=0,n=e.getEnds(),a=e.getStride();t.beginPath();for(let e=0,t=n.length;e<t;++e)r=this.moveToLineTo_(i,r,n[e],a,!1,this.strokeState_.strokeOffset);t.stroke()}if(""!==this.text_){let t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Dr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Dr(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,i=e.getOrientedFlatCoordinates(),r=0,n=e.getEndss(),a=e.getStride();t.beginPath();for(let e=0,t=n.length;e<t;++e){let t=n[e];r=this.drawRings_(i,r,t,a,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),rs(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,i=this.contextTextState_,r=e.textAlign?e.textAlign:Na;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=r&&(i.textAlign=r,t.textAlign=r),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(e){let t=e.getColor();this.fillState_={fillStyle:Lo(t||an)}}else this.fillState_=null;if(t){let e=t.getColor(),i=t.getLineCap(),r=t.getLineDash(),n=t.getLineDashOffset(),a=t.getLineJoin(),s=t.getWidth(),o=t.getMiterLimit(),l=r||kn,h=t.getOffset();this.strokeState_={lineCap:void 0!==i?i:Xl,lineDash:1===this.pixelRatio_?l:l.map(e=>e*this.pixelRatio_),lineDashOffset:(n||Fn)*this.pixelRatio_,lineJoin:void 0!==a?a:Yl,lineWidth:(void 0!==s?s:Ql)*this.pixelRatio_,miterLimit:void 0!==o?o:Kl,strokeStyle:Lo(e||zn),strokeOffset:(h??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(e){let t;if(!e||!(t=e.getSize()))return void(this.image_=null);let i=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),n=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*i,this.imageAnchorY_=r[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/i,a[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(e){let t=e.getFill();if(t){let e=t.getColor();this.textFillState_={fillStyle:Lo(e||an)}}else this.textFillState_=null;let i=e.getStroke();if(i){let e=i.getColor(),t=i.getLineCap(),r=i.getLineDash(),n=i.getLineDashOffset(),a=i.getLineJoin(),s=i.getWidth(),o=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==t?t:Xl,lineDash:r||kn,lineDashOffset:n||Fn,lineJoin:void 0!==a?a:Yl,lineWidth:void 0!==s?s:Ql,miterLimit:void 0!==o?o:Kl,strokeStyle:Lo(e||zn)}}else this.textStrokeState_=null;let r=e.getFont(),n=e.getOffsetX(),a=e.getOffsetY(),s=e.getRotateWithView(),o=e.getRotation(),l=e.getScaleArray(),h=e.getText(),u=e.getTextAlign(),c=e.getTextBaseline();this.textState_={font:void 0!==r?r:Wf,textAlign:void 0!==u?u:Na,textBaseline:void 0!==c?c:Jl},this.text_=void 0!==h?Array.isArray(h)?h.reduce((e,t,i)=>e+(i%2?" ":t),""):h:"",this.textOffsetX_=void 0!==n?this.pixelRatio_*n:0,this.textOffsetY_=void 0!==a?this.pixelRatio_*a:0,this.textRotateWithView_=void 0!==s&&s,this.textRotation_=void 0!==o?o:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},hT=Py,$A=.5,dT={Point:JA,LineString:XA,Polygon:eL,MultiPoint:QA,MultiLineString:YA,MultiPolygon:KA,GeometryCollection:qA,Circle:WA};function pT(e,t){return parseInt(wi(e),10)-parseInt(wi(t),10)}function Iy(e,t){let i=My(e,t);return i*i}function My(e,t){return $A*e/t}function WA(e,t,i,r,n){let a=i.getFill(),s=i.getStroke();if(a||s){let o=e.getBuilder(i.getZIndex(),"Circle");o.setFillStrokeStyle(a,s),o.drawCircle(t,r,n)}let o=i.getText();if(o&&o.getText()){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,r,n)}}function Cy(e,t,i,r,n,a,s,o){let l=[],h=i.getImage();if(h){let e=!0,t=h.getImageState();t==Sr.LOADED||t==Sr.ERROR?e=!1:t==Sr.IDLE&&h.load(),e&&l.push(h.ready())}let u=i.getFill();u&&u.loading()&&l.push(u.ready());let c=l.length>0;return c&&Promise.all(l).then(()=>n(null)),HA(e,t,i,r,a,s,o),c}function HA(e,t,i,r,n,a,s){let o=i.getGeometryFunction()(t);if(!o)return;let l=o.simplifyTransformed(r,n);if(i.getRenderer())fT(e,l,i,t,s);else{(0,dT[l.getType()])(e,l,i,t,s,a)}}function fT(e,t,i,r,n){if("GeometryCollection"==t.getType()){let a=t.getGeometries();for(let t=0,s=a.length;t<s;++t)fT(e,a[t],i,r,n);return}e.getBuilder(i.getZIndex(),"Default").drawCustom(t,r,i.getRenderer(),i.getHitDetectionRenderer(),n)}function qA(e,t,i,r,n,a){let s,o,l=t.getGeometriesArray();for(s=0,o=l.length;s<o;++s){(0,dT[l[s].getType()])(e,l[s],i,r,n,a)}}function XA(e,t,i,r,n){let a=i.getStroke();if(a){let s=e.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,a),s.drawLineString(t,r,n)}let s=i.getText();if(s&&s.getText()){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(s),a.drawText(t,r,n)}}function YA(e,t,i,r,n){let a=i.getStroke();if(a){let s=e.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,a),s.drawMultiLineString(t,r,n)}let s=i.getText();if(s&&s.getText()){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(s),a.drawText(t,r,n)}}function KA(e,t,i,r,n){let a=i.getFill(),s=i.getStroke();if(s||a){let o=e.getBuilder(i.getZIndex(),"Polygon");o.setFillStrokeStyle(a,s),o.drawMultiPolygon(t,r,n)}let o=i.getText();if(o&&o.getText()){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,r,n)}}function JA(e,t,i,r,n,a){let s=i.getImage(),o=i.getText(),l=o&&o.getText(),h=a&&s&&l?{}:void 0;if(s){if(s.getImageState()!=Sr.LOADED)return;let a=e.getBuilder(i.getZIndex(),"Image");a.setImageStyle(s,h),a.drawPoint(t,r,n)}if(l){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o,h),a.drawText(t,r,n)}}function QA(e,t,i,r,n,a){let s=i.getImage(),o=s&&0!==s.getOpacity(),l=i.getText(),h=l&&l.getText(),u=a&&o&&h?{}:void 0;if(o){if(s.getImageState()!=Sr.LOADED)return;let a=e.getBuilder(i.getZIndex(),"Image");a.setImageStyle(s,u),a.drawMultiPoint(t,r,n)}if(h){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(l,u),a.drawText(t,r,n)}}function eL(e,t,i,r,n){let a=i.getFill(),s=i.getStroke();if(a||s){let o=e.getBuilder(i.getZIndex(),"Polygon");o.setFillStrokeStyle(a,s),o.drawPolygon(t,r,n)}let o=i.getText();if(o&&o.getText()){let a=e.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,r,n)}}var tL=!1;function iL(e,t,i,r,n,a,s){let o=new XMLHttpRequest;o.open("GET","function"==typeof e?e(i,r,n):e,!0),"arraybuffer"==t.getType()&&(o.responseType="arraybuffer"),o.withCredentials=tL,o.onload=function(e){if(!o.status||o.status>=200&&o.status<300){let e=t.getType();try{let r;"text"==e||"json"==e?r=o.responseText:"xml"==e?r=o.responseXML||o.responseText:"arraybuffer"==e&&(r=o.response),r?a(t.readFeatures(r,{extent:i,featureProjection:n}),t.readProjection(r)):s()}catch{s()}}else s()},o.onerror=s,o.send()}function Ey(e,t){return function(i,r,n,a,s){iL(e,t,i,r,n,(e,t)=>{this.addFeatures(e),void 0!==a&&a(e)},()=>{this.changed(),void 0!==s&&s()})}}function mT(e,t){return[[-1/0,-1/0,1/0,1/0]]}var Ay=class{constructor(e){this.rbush_=new q2(e),this.items_={}}insert(e,t){let i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[wi(t)]=i}load(e,t){let i=new Array(t.length);for(let r=0,n=t.length;r<n;r++){let n=e[r],a=t[r],s={minX:n[0],minY:n[1],maxX:n[2],maxY:n[3],value:a};i[r]=s,this.items_[wi(a)]=s}this.rbush_.load(i)}remove(e){let t=wi(e),i=this.items_[t];return delete this.items_[t],null!==this.rbush_.remove(i)}update(e,t){let i=this.items_[wi(t)],r=[i.minX,i.minY,i.maxX,i.maxY];Lf(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let r=0,n=e.length;r<n;r++)if(i=t(e[r]),i)return i;return i}isEmpty(){return Bs(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return Zl(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},Ly=Ay,Ry=class extends qw{constructor(e){super(),this.projection=kr(e.projection),this.attributions_=gT(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==e.state?e.state:"ready",this.wrapX_=void 0!==e.wrapX&&e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(e,i){t.viewResolver=e,t.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=gT(e),this.changed()}setState(e){this.state_=e,this.changed()}};function gT(e){return e?"function"==typeof e?e:(Array.isArray(e)||(e=[e]),t=>e):null}var Oo=Ry,Xn={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"},ss=class extends Ff{constructor(e,t,i){super(e),this.feature=t,this.features=i}},Dy=class extends Oo{constructor(e){super({attributions:(e=e||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===e.wrapX||e.wrapX}),this.on,this.once,this.un,this.loader_=$w,this.format_=e.format||null,this.overlaps_=void 0===e.overlaps||e.overlaps,this.url_=e.url,void 0!==e.loader?this.loader_=e.loader:void 0!==this.url_&&(Bf(this.format_,"`format` must be set when `url` is set"),this.loader_=Ey(this.url_,this.format_)),this.strategy_=void 0!==e.strategy?e.strategy:mT;let t,i,r=void 0===e.useSpatialIndex||e.useSpatialIndex;this.featuresRtree_=r?new Ly:null,this.loadedExtentsRtree_=new Ly,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(e.features)?i=e.features:e.features&&(t=e.features,i=t.getArray()),!r&&void 0===t&&(t=new z2(i)),void 0!==i&&this.addFeaturesInternal(i),void 0!==t&&this.bindFeaturesCollection_(t)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=wi(e);if(!this.addToIndex_(t,e))return void(this.featuresCollection_&&this.featuresCollection_.remove(e));this.setupChangeEvents_(t,e);let i=e.getGeometry();if(i){let t=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new ss(Xn.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Fo||(this.featureChangeKeys_[e]=[pd(t,Eu.CHANGE,this.handleFeatureChange_,this),pd(t,Vw.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let i=!0;if(void 0!==t.getId()){let e=String(t.getId());if(e in this.idIndex_)if(t instanceof Fo){let r=this.idIndex_[e];r instanceof Fo?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:i=!1}else i=!1;else this.idIndex_[e]=t}return i&&(Bf(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],i=[],r=[];for(let t=0,r=e.length;t<r;t++){let r=e[t],n=wi(r);this.addToIndex_(n,r)&&i.push(r)}for(let e=0,n=i.length;e<n;e++){let n=i[e],a=wi(n);this.setupChangeEvents_(a,n);let s=n.getGeometry();if(s){let e=s.getExtent();t.push(e),r.push(n)}else this.nullGeometryFeatures_[a]=n}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(Xn.ADDFEATURE))for(let e=0,t=i.length;e<t;e++)this.dispatchEvent(new ss(Xn.ADDFEATURE,i[e]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Xn.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(Xn.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(A_.ADD,e=>{t||(t=!0,this.addFeature(e.element),t=!1)}),e.addEventListener(A_.REMOVE,e=>{t||(t=!0,this.removeFeature(e.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(fd);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new ss(Xn.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(i){let r=i.getGeometry();if(r instanceof Fo||r.intersectsCoordinate(e))return t(i)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){let r=i.getGeometry();if(r instanceof Fo||r.intersectsExtent(e)){let e=t(i);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Bs(this.nullGeometryFeatures_)||Wt(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let i=Nw(e,t);return[].concat(...i.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let i=e[0],r=e[1],n=null,a=[NaN,NaN],s=1/0,o=[-1/0,-1/0,1/0,1/0];return t=t||Zw,this.featuresRtree_.forEachInExtent(o,function(e){if(t(e)){let t=e.getGeometry(),l=s;if(s=t instanceof Fo?0:t.closestPointXY(i,r,a,s),s<l){n=e;let t=Math.sqrt(s);o[0]=i-t,o[1]=r-t,o[2]=i+t,o[3]=r+t}}}),n}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return void 0!==t?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return void 0!==t?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,i=wi(t),r=t.getGeometry();if(r){let e=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);let n=t.getId();if(void 0!==n){let e=n.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new ss(Xn.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();return void 0!==t?t in this.idIndex_:wi(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Bs(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(e,t,i){let r=this.loadedExtentsRtree_,n=this.strategy_(e,t,i);for(let e=0,a=n.length;e<a;++e){let a=n[e];if(!r.forEachInExtent(a,function(e){return Ul(e.extent,a)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new ss(Xn.FEATURESLOADSTART));let e=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new ss(Xn.FEATURESLOADEND,void 0,e))},n=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new ss(Xn.FEATURESLOADERROR))},s=!1,o=this.loader_.call(this,a,t,i,t=>s||e(t),()=>s||n());o instanceof Promise?(s=!0,o.then(t=>{this.addFeatures(t),e(t)}).catch(n)):this.loader_.length<4&&(this.loading=!1),r.insert(a,{extent:a.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,i=t.forEachInExtent(e,function(t){if(Lf(t.extent,e))return t});i&&t.remove(i)}removeFeatures(e){let t=!1;for(let i=0,r=e.length;i<r;++i)t=this.removeFeatureInternal(e[i])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=wi(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(fd),delete this.featureChangeKeys_[t];let i=e.getId();if(void 0!==i){let t=i.toString(),r=this.idIndex_[t];r===e?delete this.idIndex_[t]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),1===r.length&&(this.idIndex_[t]=r[0]))}return delete this.uidIndex_[t],this.hasListener(Xn.REMOVEFEATURE)&&this.dispatchEvent(new ss(Xn.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Bf(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Ey(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Gs=Dy,Dd={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},kd=[Dd.FILL],as=[Dd.STROKE],Us=[Dd.BEGIN_PATH],ky=[Dd.CLOSE_PATH],yt=Dd,Fy=class extends um{constructor(e,t,i,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return 1==t?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){let i=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,n=this.coordinates,a=n.length;for(let s=0,o=e.length;s<o;s+=t)r[0]=e[s],r[1]=e[s+1],Gl(i,r)&&(n[a++]=r[0],n[a++]=r[1]);return a}appendFlatLineCoordinates(e,t,i,r,n,a){let s=this.coordinates,o=s.length,l=this.getBufferedMaxExtent();a&&(t+=r);let h,u,c,d=e[t],p=e[t+1],f=this.tmpCoordinate_,m=!0;for(h=t+r;h<i;h+=r)f[0]=e[h],f[1]=e[h+1],c=Ew(l,f),c!==u?(m&&(s[o++]=d,s[o++]=p,m=!1),s[o++]=f[0],s[o++]=f[1]):c===Iw.INTERSECTING?(s[o++]=f[0],s[o++]=f[1],m=!1):m=!0,d=f[0],p=f[1],u=c;return(n&&m||h===t+r)&&(s[o++]=d,s[o++]=p),o}drawCustomCoordinates_(e,t,i,r,n){for(let a=0,s=i.length;a<s;++a){let s=i[a],o=this.appendFlatLineCoordinates(e,t,s,r,!1,!1);n.push(o),t=s}return t}drawCustom(e,t,i,r,n){this.beginGeometry(e,t,n);let a,s,o,l,h,u=e.getType(),c=e.getStride(),d=this.coordinates.length;switch(u){case"MultiPolygon":a=e.getOrientedFlatCoordinates(),l=[];let t=e.getEndss();h=0;for(let e=0,i=t.length;e<i;++e){let i=[];h=this.drawCustomCoordinates_(a,h,t[e],c,i),l.push(i)}this.instructions.push([yt.CUSTOM,d,l,e,i,xd,n]),this.hitDetectionInstructions.push([yt.CUSTOM,d,l,e,r||i,xd,n]);break;case"Polygon":case"MultiLineString":o=[],a="Polygon"==u?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),h=this.drawCustomCoordinates_(a,0,e.getEnds(),c,o),this.instructions.push([yt.CUSTOM,d,o,e,i,yd,n]),this.hitDetectionInstructions.push([yt.CUSTOM,d,o,e,r||i,yd,n]);break;case"LineString":case"Circle":a=e.getFlatCoordinates(),s=this.appendFlatLineCoordinates(a,0,a.length,c,!1,!1),this.instructions.push([yt.CUSTOM,d,s,e,i,Ns,n]),this.hitDetectionInstructions.push([yt.CUSTOM,d,s,e,r||i,Ns,n]);break;case"MultiPoint":a=e.getFlatCoordinates(),s=this.appendFlatPointCoordinates(a,c),s>d&&(this.instructions.push([yt.CUSTOM,d,s,e,i,Ns,n]),this.hitDetectionInstructions.push([yt.CUSTOM,d,s,e,r||i,Ns,n]));break;case"Point":a=e.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),s=this.coordinates.length,this.instructions.push([yt.CUSTOM,d,s,e,i,void 0,n]),this.hitDetectionInstructions.push([yt.CUSTOM,d,s,e,r||i,void 0,n])}this.endGeometry(t)}beginGeometry(e,t,i){this.beginGeometryInstruction1_=[yt.BEGIN_GEOMETRY,t,0,e,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[yt.BEGIN_GEOMETRY,t,0,e,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,i,r,n=e.length,a=-1;for(t=0;t<n;++t)i=e[t],r=i[0],r==yt.END_GEOMETRY?a=t:r==yt.BEGIN_GEOMETRY&&(i[2]=t,Uw(this.hitDetectionInstructions,a,t),a=-1)}fillStyleToState(e,t={}){if(e){let i=e.getColor();t.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,t.fillStyle=Lo(i||an)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let i=e.getColor();t.strokeStyle=Lo(i||zn);let r=e.getLineCap();t.lineCap=void 0!==r?r:Xl;let n=e.getLineDash();t.lineDash=n?n.slice():kn;let a=e.getLineDashOffset();t.lineDashOffset=a||Fn;let s=e.getLineJoin();t.lineJoin=void 0!==s?s:Yl;let o=e.getWidth();t.lineWidth=void 0!==o?o:Ql;let l=e.getMiterLimit();t.miterLimit=void 0!==l?l:Kl;let h=e.getOffset();t.strokeOffset=h??Z2,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let i=this.state;this.fillStyleToState(e,i),this.strokeStyleToState(t,i)}createFill(e){let t=e.fillStyle,i=[yt.SET_FILL_STYLE,t];return"string"!=typeof t&&i.push(e.fillPatternScale),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[yt.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let i=e.fillStyle;(void 0!==i&&"string"!=typeof i||e.currentFillStyle!=i)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){let i=e.strokeStyle,r=e.lineCap,n=e.lineDash,a=e.lineDashOffset,s=e.lineJoin,o=e.lineWidth,l=e.miterLimit,h=e.strokeOffset;(e.currentStrokeStyle!=i||e.currentLineCap!=r||n!=e.currentLineDash&&!rs(e.currentLineDash,n)||e.currentLineDashOffset!=a||e.currentLineJoin!=s||e.currentLineWidth!=o||e.currentMiterLimit!=l||e.currentStrokeOffset!=h)&&(t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=r,e.currentLineDash=n,e.currentLineDashOffset=a,e.currentLineJoin=s,e.currentLineWidth=o,e.currentMiterLimit=l,e.currentStrokeOffset=h)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[yt.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Mw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Fa(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ls=Fy,zy=class extends ls{constructor(e,t,i,r){super(e,t,i,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,i){if(!this.image_||this.maxExtent&&!Gl(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,i);let r=e.getFlatCoordinates(),n=e.getStride(),a=this.coordinates.length,s=this.appendFlatPointCoordinates(r,n);this.instructions.push([yt.DRAW_IMAGE,a,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([yt.DRAW_IMAGE,a,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,i){if(!this.image_)return;this.beginGeometry(e,t,i);let r=e.getFlatCoordinates(),n=[];for(let t=0,i=r.length;t<i;t+=e.getStride())(!this.maxExtent||Gl(this.maxExtent,r.slice(t,t+2)))&&n.push(r[t],r[t+1]);let a=this.coordinates.length,s=this.appendFlatPointCoordinates(n,2);this.instructions.push([yt.DRAW_IMAGE,a,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([yt.DRAW_IMAGE,a,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let i=e.getAnchor(),r=e.getSize(),n=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},_T=zy,Oy=class extends ls{constructor(e,t,i,r){super(e,t,i,r)}drawFlatCoordinates_(e,t,i,r,n){let a=this.coordinates.length,s=this.appendFlatLineCoordinates(e,t,i,r,!1,!1);return this.instructions.push([yt.MOVE_TO_LINE_TO,a,s,n*this.pixelRatio]),this.hitDetectionInstructions.push([yt.MOVE_TO_LINE_TO,a,s,n]),i}drawLineString(e,t,i){let r=this.state,n=r.strokeStyle,a=r.lineWidth,s=r.strokeOffset;if(void 0===n||void 0===a)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([yt.SET_STROKE_STYLE,zn,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,kn,Fn],Us);let o=e.getFlatCoordinates(),l=e.getStride();this.drawFlatCoordinates_(o,0,o.length,l,s),this.hitDetectionInstructions.push(as),this.endGeometry(t)}drawMultiLineString(e,t,i){let r=this.state,n=r.strokeStyle,a=r.lineWidth,s=r.strokeOffset;if(void 0===n||void 0===a)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,i),this.hitDetectionInstructions.push([yt.SET_STROKE_STYLE,zn,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,kn,Fn],Us);let o=e.getEnds(),l=e.getFlatCoordinates(),h=e.getStride(),u=0;for(let e=0,t=o.length;e<t;++e)u=this.drawFlatCoordinates_(l,u,o[e],h,s);this.hitDetectionInstructions.push(as),this.endGeometry(t)}finish(){let e=this.state;return null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&this.instructions.push(as),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(as),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Us)}},yT=Oy,By=class extends ls{constructor(e,t,i,r){super(e,t,i,r)}drawFlatCoordinatess_(e,t,i,r,n){let a=this.state,s=void 0!==a.fillStyle,o=void 0!==a.strokeStyle,l=i.length;this.instructions.push(Us),this.hitDetectionInstructions.push(Us);for(let a=0;a<l;++a){let s=i[a],l=this.coordinates.length,h=this.appendFlatLineCoordinates(e,t,s,r,!0,!o);this.instructions.push([yt.MOVE_TO_LINE_TO,l,h,n*this.pixelRatio,!0]),this.hitDetectionInstructions.push([yt.MOVE_TO_LINE_TO,l,h,n,!0]),o&&(this.instructions.push(ky),this.hitDetectionInstructions.push(ky)),t=s}return s&&(this.instructions.push(kd),this.hitDetectionInstructions.push(kd)),o&&(this.instructions.push(as),this.hitDetectionInstructions.push(as)),t}drawCircle(e,t,i){let r=this.state,n=r.fillStyle,a=r.strokeStyle,s=r.strokeOffset;if(void 0===n&&void 0===a||this.handleStrokeOffset_(()=>this.drawCircle(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([yt.SET_FILL_STYLE,an]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([yt.SET_STROKE_STYLE,zn,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,kn,Fn]);let o=e.getFlatCoordinates(),l=e.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,l,!1,!1);let u=[yt.CIRCLE,h,s];this.instructions.push(Us,u),this.hitDetectionInstructions.push(Us,u),void 0!==r.fillStyle&&(this.instructions.push(kd),this.hitDetectionInstructions.push(kd)),void 0!==r.strokeStyle&&(this.instructions.push(as),this.hitDetectionInstructions.push(as)),this.endGeometry(t)}drawPolygon(e,t,i){let r=this.state,n=r.fillStyle,a=r.strokeStyle,s=r.strokeOffset;if(void 0===n&&void 0===a||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([yt.SET_FILL_STYLE,an]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([yt.SET_STROKE_STYLE,zn,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,kn,Fn]);let o=e.getEnds(),l=e.getOrientedFlatCoordinates(),h=e.getStride();this.drawFlatCoordinatess_(l,0,o,h,s),this.endGeometry(t)}drawMultiPolygon(e,t,i){let r=this.state,n=r.fillStyle,a=r.strokeStyle,s=r.strokeOffset;if(void 0===n&&void 0===a||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,i),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([yt.SET_FILL_STYLE,an]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([yt.SET_STROKE_STYLE,zn,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,kn,Fn]);let o=e.getEndss(),l=e.getOrientedFlatCoordinates(),h=e.getStride(),u=0;for(let e=0,t=o.length;e<t;++e)u=this.drawFlatCoordinatess_(l,u,o[e],h,s);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(0!==e){let t=this.coordinates;for(let i=0,r=t.length;i<r;++i)t[i]=x2(t[i],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,i=t.fillStyle,r=t.strokeStyle,n=t.strokeOffset;return Math.abs(n)>0&&void 0!==i&&void 0!==r&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=n,e(),t.fillStyle=i,!0)}},Ny=By;function xT(e,t,i,r,n){let a=[],s=i,o=0,l=t.slice(i,2);for(;o<e&&s+n<r;){let[i,r]=l.slice(-2),h=t[s+n],u=t[s+n+1],c=Math.sqrt((h-i)*(h-i)+(u-r)*(u-r));if(o+=c,o>=e){let t=(e-o+c)/c,d=xn(i,h,t),p=xn(r,u,t);l.push(d,p),a.push(l),l=[d,p],o==e&&(s+=n),o=0}else if(o<e)l.push(t[s+n],t[s+n+1]),s+=n;else{let e=c-o,t=xn(i,h,e/c),d=xn(r,u,e/c);l.push(t,d),a.push(l),l=[t,d],o=0,s+=n}}return o>0&&a.push(l),a}function vT(e,t,i,r,n){let a,s,o,l,h,u,c,d,p,f,m=i,g=i,_=0,y=0,v=i;for(s=i;s<r;s+=n){let i=t[s],r=t[s+1];void 0!==h&&(p=i-h,f=r-u,l=Math.sqrt(p*p+f*f),void 0!==c&&(y+=o,a=Math.acos((c*p+d*f)/(o*l)),a>e&&(y>_&&(_=y,m=v,g=s),y=0,v=s-n)),o=l,c=p,d=f),h=i,u=r}return y+=l,y>_?[v,s]:[m,g]}var Fd={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Vy=class extends ls{constructor(e,t,i,r){super(e,t,i,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[an]={fillStyle:an},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,i){let r=this.textFillState_,n=this.textStrokeState_,a=this.textState_;if(""===this.text_||!a||!r&&!n)return;let s=this.coordinates,o=s.length,l=e.getType(),h=null,u=e.getStride();if("line"!==a.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let r=a.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=e.getFlatCoordinates();break;case"LineString":h=e.getFlatMidpoint();break;case"Circle":h=e.getCenter();break;case"MultiLineString":h=e.getFlatMidpoints(),u=2;break;case"Polygon":h=e.getFlatInteriorPoint(),a.overflow||r.push(h[2]/this.resolution),u=3;break;case"MultiPolygon":let t=e.getFlatInteriorPoints();h=[];for(let e=0,i=t.length;e<i;e+=3)a.overflow||r.push(t[e+2]/this.resolution),h.push(t[e],t[e+1]);if(0===h.length)return;u=2}let n=this.appendFlatPointCoordinates(h,u);if(n===o)return;if(r&&(n-o)/2!==h.length/u){let e=o/2;r=r.filter((t,i)=>{let r=s[2*(e+i)]===h[i*u]&&s[2*(e+i)+1]===h[i*u+1];return r||--e,r})}this.saveTextStates_();let c=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,d=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,i);let p=a.padding;if(p!=Vs&&(a.scale[0]<0||a.scale[1]<0)){let e=a.padding[0],t=a.padding[1],i=a.padding[2],r=a.padding[3];a.scale[0]<0&&(t=-t,r=-r),a.scale[1]<0&&(e=-e,i=-i),p=[e,t,i,r]}let f=this.pixelRatio;this.instructions.push([yt.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==Vs?Vs:p.map(function(e){return e*f}),c,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let m=1/f,g=c?c.slice(0):null;g&&(g[1]=an),this.hitDetectionInstructions.push([yt.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,this.declutterMode_,this.declutterImageWithText_,p,g,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?an:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}else{if(!Dr(this.maxExtent,e.getExtent()))return;let r;if(h=e.getFlatCoordinates(),"LineString"==l)r=[h.length];else if("MultiLineString"==l)r=e.getEnds();else if("Polygon"==l)r=e.getEnds().slice(0,1);else if("MultiPolygon"==l){let t=e.getEndss();r=[];for(let e=0,i=t.length;e<i;++e)r.push(t[e][0])}this.beginGeometry(e,t,i);let n=a.repeat,c=n?void 0:a.textAlign,d=0;for(let e=0,t=r.length;e<t;++e){let t;t=n?xT(n*this.resolution,h,d,r[e],u):[h.slice(d,r[e])];for(let i=0,n=t.length;i<n;++i){let n=t[i],l=0,h=n.length;if(null==c){let e=vT(a.maxAngle,n,0,n.length,2);l=e[0],h=e[1]}for(let e=l;e<h;e+=u)s.push(n[e],n[e+1]);let p=s.length;d=r[e],this.drawChars_(o,p),o=p}}this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let n=this.textKey_;n in this.textStates||(this.textStates[n]={font:t.font,textAlign:t.textAlign||Na,justify:t.justify,textBaseline:t.textBaseline||Jl,scale:t.scale});let a=this.fillKey_;i&&(a in this.fillStates||(this.fillStates[a]={fillStyle:i.fillStyle}))}drawChars_(e,t){let i=this.textStrokeState_,r=this.textState_,n=this.strokeKey_,a=this.textKey_,s=this.fillKey_;this.saveTextStates_();let o=this.pixelRatio,l=Fd[r.textBaseline],h=this.textOffsetY_*o,u=this.text_,c=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([yt.DRAW_CHARS,e,t,l,r.overflow,s,r.maxAngle,o,h,n,c*o,u,a,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([yt.DRAW_CHARS,e,t,l,r.overflow,s&&an,r.maxAngle,o,h,n,c*o,u,a,1/o,this.declutterMode_,this.textKeepUpright_])}setTextStyle(e,t){let i,r,n;if(e){let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Lo(t.getColor()||an)):(r=null,this.textFillState_=r);let a=e.getStroke();if(a){n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);let e=a.getLineDash(),t=a.getLineDashOffset(),i=a.getWidth(),r=a.getMiterLimit();n.lineCap=a.getLineCap()||Xl,n.lineDash=e?e.slice():kn,n.lineDashOffset=void 0===t?Fn:t,n.lineJoin=a.getLineJoin()||Yl,n.lineWidth=void 0===i?Ql:i,n.miterLimit=void 0===r?Kl:r,n.strokeStyle=Lo(a.getColor()||zn)}else n=null,this.textStrokeState_=n;i=this.textState_;let s=e.getFont()||Wf;$2(s);let o=e.getScaleArray();i.overflow=e.getOverflow(),i.font=s,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.repeat=e.getRepeat(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||Jl,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||Vs,i.scale=void 0===o?[1,1]:o;let l=e.getOffsetX(),h=e.getOffsetY(),u=e.getRotateWithView(),c=e.getKeepUpright(),d=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===h?0:h,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===c||c,this.textRotation_=void 0===d?0:d,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:wi(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?"string"==typeof r.fillStyle?r.fillStyle:"|"+wi(r.fillStyle):""}else this.text_="";this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},bT=Vy,rL={Circle:Ny,Default:ls,Image:_T,LineString:yT,Polygon:Ny,Text:bT},jy=class{constructor(e,t,i,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=i,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let i=this.buildersByZIndex_[t];for(let r in i){let n=i[r].finish();e[t][r]=n}}return e}getBuilder(e,t){let i=void 0!==e?e.toString():"0",r=this.buildersByZIndex_[i];void 0===r&&(r={},this.buildersByZIndex_[i]=r);let n=r[t];if(void 0===n){n=new(0,rL[t])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=n}return n}},wT=jy;function ST(e,t,i,r,n,a,s,o,l,h,u,c,d=!0){let p=e[t],f=e[t+1],m=0,g=0,_=0,y=0;function v(){m=p,g=f,p=e[t+=r],f=e[t+1],y+=_,_=Math.sqrt((p-m)*(p-m)+(f-g)*(f-g))}do{v()}while(t<i-r&&y+_<a);let x=0===_?0:(a-y)/_,b=xn(m,p,x),w=xn(g,f,x),T=t-r,S=y,I=a+o*l(h,n,u);for(;t<i-r&&y+_<I;)v();x=0===_?0:(I-y)/_;let P=xn(m,p,x),C=xn(g,f,x),E=!1;if(d)if(c){let e=[b,w,P,C];Nf(e,0,4,2,c,e,e),E=e[0]>e[2]}else E=b>P;let M,A=Math.PI,k=[],L=T+r===t;if(_=0,y=S,p=e[t=T],f=e[t+1],L){v(),M=Math.atan2(f-g,p-m),E&&(M+=M>0?-A:A);let e=(P+b)/2,t=(C+w)/2;return k[0]=[e,t,(I-a)/2,M,n],k}for(let e=0,c=(n=n.replace(/\n/g," ")).length;e<c;){v();let d=Math.atan2(f-g,p-m);if(E&&(d+=d>0?-A:A),void 0!==M){let e=d-M;if(e+=e>A?-2*A:e<-A?2*A:0,Math.abs(e)>s)return null}M=d;let b=e,w=0;for(;e<c;++e){let s=o*l(h,n[E?c-e-1:e],u);if(t+r<i&&y+_<a+w+s/2)break;w+=s}if(e===b)continue;let T=E?n.substring(c-b,c-e):n.substring(b,e);x=0===_?0:(a+w/2-y)/_;let S=xn(m,p,x),I=xn(g,f,x);k.push([S,I,w/2,d,T]),a+=w}return k}var Gy=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(L_(),{get:(e,t)=>{if("function"==typeof L_()[t])return this.push_(t),this.pushMethodArgs_},set:(e,t,i)=>(this.push_(t,i),!0)})}push_(...e){let t=this.instructions_,i=this.zIndex+this.offset_;t[i]||(t[i]=[]),t[i].push(...e)}pushMethodArgs_=(...e)=>(this.push_(e),this);pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let i=0,r=t.length;i<r;++i){let r=t[i];if("function"==typeof r){r(e);continue}let n=t[++i];if("function"==typeof e[r])e[r](...n);else{if("function"==typeof n){e[r]=n(e);continue}e[r]=n}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},hm=Gy,Fu=Os(),Za=[],Zs=[],$s=[],$a=[];function TT(e){return e[3].declutterBox}var PT=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function Uy(e,t){return"start"===t?t=PT.test(e)?"right":"left":"end"===t&&(t=PT.test(e)?"left":"right"),Fd[t]}function nL(e,t,i){return i>0&&e.push("\n",""),e.push(t,""),e}function oL(e,t,i){return i%2==0&&(e+=t),e}var Zy=class{constructor(e,t,i,r,n){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=vn(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new hm:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,i,r){let n=e+t+i+r;if(this.labels_[n])return this.labels_[n];let a=r?this.strokeStates[r]:null,s=i?this.fillStates[i]:null,o=this.textStates[t],l=this.pixelRatio,h=[o.scale[0]*l,o.scale[1]*l],u=o.justify?Fd[o.justify]:Uy(Array.isArray(e)?e[0]:e,o.textAlign||Na),c=r&&a.lineWidth?a.lineWidth:0,d=Array.isArray(e)?e:String(e).split("\n").reduce(nL,[]),{width:p,height:f,widths:m,heights:g,lineWidths:_}=W2(o,d),y=p+c,v=[],x=(y+2)*h[0],b=(f+c)*h[1],w={width:x<0?Math.floor(x):Math.ceil(x),height:b<0?Math.floor(b):Math.ceil(b),contextInstructions:v};(1!=h[0]||1!=h[1])&&v.push("scale",h),r&&(v.push("strokeStyle",a.strokeStyle),v.push("lineWidth",c),v.push("lineCap",a.lineCap),v.push("lineJoin",a.lineJoin),v.push("miterLimit",a.miterLimit),v.push("setLineDash",[a.lineDash]),v.push("lineDashOffset",a.lineDashOffset)),i&&v.push("fillStyle",s.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");let T,S=.5-u,I=u*y+S*c,P=[],C=[],E=0,M=0,A=0,k=0;for(let e=0,t=d.length;e<t;e+=2){let t=d[e];if("\n"===t){M+=E,E=0,I=u*y+S*c,++k;continue}let n=d[e+1]||o.font;n!==T&&(r&&P.push("font",n),i&&C.push("font",n),T=n),E=Math.max(E,g[A]);let a=[t,I+S*m[A]+u*(m[A]-_[k]),.5*(c+E)+M];I+=m[A],r&&P.push("strokeText",a),i&&C.push("fillText",a),++A}return Array.prototype.push.apply(v,P),Array.prototype.push.apply(v,C),this.labels_[n]=w,w}replayTextBackground_(e,t,i,r,n,a,s){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,r),e.lineTo.apply(e,n),e.lineTo.apply(e,t),a&&(this.alignAndScaleFill_=a[2],e.fillStyle=a[1],this.fill_(e)),s&&(this.setStrokeStyle_(e,s),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,r,n,a,s,o,l,h,u,c,d,p,f,m){let g,_=i-(s*=c[0]),y=r-(o*=c[1]),v=n+l>e?e-l:n,x=a+h>t?t-h:a,b=p[3]+v*c[0]+p[1],w=p[0]+x*c[1]+p[2],T=_-p[3],S=y-p[0];return(f||0!==u)&&(Za[0]=T,$a[0]=T,Za[1]=S,Zs[1]=S,Zs[0]=T+b,$s[0]=Zs[0],$s[1]=S+w,$a[1]=$s[1]),0!==u?(g=$n(vn(),i,r,1,1,u,-i,-r),qr(g,Za),qr(g,Zs),qr(g,$s),qr(g,$a),Zl(Math.min(Za[0],Zs[0],$s[0],$a[0]),Math.min(Za[1],Zs[1],$s[1],$a[1]),Math.max(Za[0],Zs[0],$s[0],$a[0]),Math.max(Za[1],Zs[1],$s[1],$a[1]),Fu)):Zl(Math.min(T,T+b),Math.min(S,S+w),Math.max(T,T+b),Math.max(S,S+w),Fu),d&&(_=Math.round(_),y=Math.round(y)),{drawImageX:_,drawImageY:y,drawImageW:v,drawImageH:x,originX:l,originY:h,declutterBox:{minX:Fu[0],minY:Fu[1],maxX:Fu[2],maxY:Fu[3],value:m},canvasTransform:g,scale:c}}replayImageOrLabel_(e,t,i,r,n,a,s){let o=!(!a&&!s),l=r.declutterBox,h=s?s[2]*r.scale[0]/2:0;return l.minX-h<=t[0]&&l.maxX+h>=0&&l.minY-h<=t[1]&&l.maxY+h>=0&&(o&&this.replayTextBackground_(e,Za,Zs,$s,$a,a,s),H2(e,r.canvasTransform,n,i,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let i=qr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(i[0]%r,i[1]%r),1!==t&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,i,r){let n=this.textStates[t],a=this.createLabel(e,t,r,i),s=this.strokeStates[i],o=this.pixelRatio,l=Uy(Array.isArray(e)?e[0]:e,n.textAlign||Na),h=Fd[n.textBaseline||Jl],u=s&&s.lineWidth?s.lineWidth:0;return{label:a,anchorX:l*(a.width/o-2*n.scale[0])+2*(.5-l)*u,anchorY:h*a.height/o+2*(.5-h)*u}}execute_(e,t,i,r,n,a,s,o){let l,h=this.zIndexContext_;this.pixelCoordinates_&&rs(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=ns(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),n2(this.renderedTransform_,i));let u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I,P,C,E=0,M=r.length,A=0,k=[],L=0,F=0,D=this.coordinateCache_,R=this.viewRotation_,z=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,N={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:R},O=this.instructions!=r||this.overlaps?0:200;for(;E<M;){let i=r[E];switch(i[0]){case yt.BEGIN_GEOMETRY:S=i[1],C=i[3],S.getGeometry()?void 0===s||Dr(s,C.getExtent())?++E:E=i[2]+1:E=i[2],h&&(h.zIndex=i[4]);break;case yt.BEGIN_PATH:L>O&&(this.fill_(e),L=0),F>O&&(e.stroke(),F=0),!L&&!F&&(e.beginPath(),m=NaN,g=NaN),++E;break;case yt.CIRCLE:A=i[1],p=i[2]??0;let r=l[A],M=l[A+1],B=l[A+2]-p-r,j=l[A+3]-p-M,V=Math.sqrt(B*B+j*j);e.moveTo(r+V,M),e.arc(r,M,V,0,2*Math.PI,!0),++E;break;case yt.CLOSE_PATH:e.closePath(),++E;break;case yt.CUSTOM:A=i[1],u=i[2];let G=i[3],U=i[4],Z=i[5];N.geometry=G,N.feature=S,E in D||(D[E]=[]);let $=D[E];Z?Z(l,A,u,2,$):($[0]=l[A],$[1]=l[A+1],$.length=2),h&&(h.zIndex=i[6]),U($,N),++E;break;case yt.DRAW_IMAGE:A=i[1],u=i[2],v=i[3],c=i[4],d=i[5];let q=i[6],W=i[7],H=i[8],X=i[9],Y=i[10],K=i[11],J=i[12],Q=i[13];f=i[14]||"declutter";let ee,te,ie,re,ne=i[15];if(!v&&i.length>=20){x=i[19],b=i[20],w=i[21],T=i[22];let e=this.drawLabelWithPointPlacement_(x,b,w,T);v=e.label,i[3]=v;let t=i[23];c=(e.anchorX-t)*this.pixelRatio,i[4]=c;let r=i[24];d=(e.anchorY-r)*this.pixelRatio,i[5]=d,q=v.height,i[6]=q,Q=v.width,i[13]=Q}i.length>25&&(ee=i[25]),i.length>17?(te=i[16],ie=i[17],re=i[18]):(te=Vs,ie=null,re=null),Y&&z?K+=R:!Y&&!z&&(K-=R);let ae=0;for(;A<u;A+=2){if(ee&&ee[ae++]<Q/this.pixelRatio)continue;let i=this.calculateImageOrLabelDimensions_(v.width,v.height,l[A],l[A+1],Q,q,c,d,H,X,K,J,n,te,!!ie||!!re,S),r=[e,t,v,i,W,ie,re];if(o){let e,t,n,a,s;if(ne){let i=u-A;if(!ne[i]){ne[i]={args:r,declutterMode:f};continue}let a=ne[i];e=a.args,t=a.declutterMode,delete ne[i],n=TT(e)}if(e&&("declutter"!==t||!o.collides(n))&&(a=!0),("declutter"!==f||!o.collides(i.declutterBox))&&(s=!0),"declutter"===t&&"declutter"===f){let e=a&&s;a=e,s=e}a&&("none"!==t&&o.insert(n),this.replayImageOrLabel_.apply(this,e)),s&&("none"!==f&&o.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,r))}else this.replayImageOrLabel_.apply(this,r)}++E;break;case yt.DRAW_CHARS:let se=i[1],oe=i[2],le=i[3],he=i[4];T=i[5];let ue=i[6],ce=i[7],de=i[8];w=i[9];let pe=i[10];x=i[11],Array.isArray(x)&&(x=x.reduce(oL,"")),b=i[12];let fe=[i[13],i[13]];f=i[14]||"declutter";let me,ge=i[15],_e=this.textStates[b],ye=_e.font,ve=[_e.scale[0]*ce,_e.scale[1]*ce];ye in this.widths_?me=this.widths_[ye]:(me={},this.widths_[ye]=me);let xe=ku(l,se,oe,2),be=Math.abs(ve[0])*D_(ye,x,me);if(he||be<=xe){let i=ST(l,se,oe,2,x,(xe-be)*Uy(x,this.textStates[b].textAlign),ue,Math.abs(ve[0]),D_,ye,me,z?0:this.viewRotation_,ge);e:if(i){let r,n,a,s,l,h=[];if(w)for(r=0,n=i.length;r<n;++r){l=i[r],a=l[4],s=this.createLabel(a,b,"",w),c=l[2]+(ve[0]<0?-pe:pe),d=le*s.height+2*(.5-le)*pe*ve[1]/ve[0]-de;let n=this.calculateImageOrLabelDimensions_(s.width,s.height,l[0],l[1],s.width,s.height,c,d,0,0,l[3],fe,!1,Vs,!1,S);if(o&&"declutter"===f&&o.collides(n.declutterBox))break e;h.push([e,t,s,n,1,null,null])}if(T)for(r=0,n=i.length;r<n;++r){l=i[r],a=l[4],s=this.createLabel(a,b,T,""),c=l[2],d=le*s.height-de;let n=this.calculateImageOrLabelDimensions_(s.width,s.height,l[0],l[1],s.width,s.height,c,d,0,0,l[3],fe,!1,Vs,!1,S);if(o&&"declutter"===f&&o.collides(n.declutterBox))break e;h.push([e,t,s,n,1,null,null])}o&&"none"!==f&&o.load(h.map(TT));for(let e=0,t=h.length;e<t;++e)this.replayImageOrLabel_.apply(this,h[e])}}++E;break;case yt.END_GEOMETRY:if(void 0!==a){S=i[1];let e=a(S,C,f);if(e)return e}++E;break;case yt.FILL:O?L++:this.fill_(e),++E;break;case yt.MOVE_TO_LINE_TO:let we,Te,Se;if(A=i[1],u=i[2],p=i[3],p){lm(l,A,u,2,p,i[4]??!1,k),cm(k,2),we=k,Te=0,Se=we.length}else we=l,Te=A,Se=u;I=we[Te],P=we[Te+1],e.moveTo(I,P),m=I+.5|0,g=P+.5|0;for(let t=Te+2;t<Se;t+=2)I=we[t],P=we[t+1],_=I+.5|0,y=P+.5|0,(t==Se-2||_!==m||y!==g)&&(e.lineTo(I,P),m=_,g=y);++E;break;case yt.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],L?(this.fill_(e),L=0,F&&(e.stroke(),F=0)):F&&i[1]&&(e.stroke(),F=0),e.fillStyle=i[1],++E;break;case yt.SET_STROKE_STYLE:L&&i[1]&&(this.fill_(e),L=0),F&&(e.stroke(),F=0),this.setStrokeStyle_(e,i),++E;break;case yt.STROKE:O?F++:e.stroke(),++E;break;default:++E}}L&&this.fill_(e),F&&e.stroke()}execute(e,t,i,r,n,a){this.viewRotation_=r,this.execute_(e,t,i,this.instructions,n,void 0,void 0,a)}executeHitDetection(e,t,i,r,n){return this.viewRotation_=i,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,n)}},IT=Zy,Wa=["Polygon","Circle","LineString","Image","Text","Default"],Hy=["Image","Text"],MT=Wa.filter(e=>!Hy.includes(e)),CT=!1,ET=!1;function sL(){let e=0,t=t=>{let i=Ao(1,1,null,{willReadFrequently:t}),r=0,n=performance.now();for(;performance.now()-n<50;++r)i.fillStyle=`rgba(255,0,${r%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return e=r>e?r:e,r};CT={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],ET=!0}var Wy=class{constructor(e,t,i,r,n,a,s){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=vn(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,s)}clip(e,t){let i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e,t){for(let i in e){let r=this.executorsByZIndex_[i];void 0===r&&(r={},this.executorsByZIndex_[i]=r);let n=e[i];for(let e in n){let i=n[e];r[e]=new IT(this.resolution_,this.pixelRatio_,this.overlaps_,i,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let i=this.executorsByZIndex_[t];for(let t=0,r=e.length;t<r;++t)if(e[t]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,r,n,a){!1===ET&&sL();let s=2*(r=Math.round(r))+1,o=$n(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-i,-e[0],-e[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=Ao(s,s,null,{willReadFrequently:CT}));let h,u=this.hitDetectionContext_;u.canvas.width!==s||u.canvas.height!==s?(u.canvas.width=s,u.canvas.height=s):l||u.clearRect(0,0,s,s),void 0!==this.renderBuffer_&&(h=Os(),Dw(h,e),Fa(h,t*(this.renderBuffer_+r),h));let c,d=aL(r);function p(e,t,i){let o=u.getImageData(0,0,s,s).data;for(let l=0,h=d.length;l<h;l++)if(o[d[l]]>0){if(!a||"none"===i||"Image"!==c&&"Text"!==c||a.includes(e)){let i=(d[l]-3)/4,a=r-i%s,o=r-(i/s|0),h=n(e,t,a*a+o*o);if(h)return h}u.clearRect(0,0,s,s);break}}let f,m,g,_,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(Au),f=v.length-1;f>=0;--f){let e=v[f].toString();for(g=this.executorsByZIndex_[e],m=Wa.length-1;m>=0;--m)if(c=Wa[m],_=g[c],void 0!==_&&(y=_.executeHitDetection(u,o,i,p,h),y))return y}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let i=t[0],r=t[1],n=t[2],a=t[3],s=[i,r,i,a,n,a,n,r];return ns(s,0,8,2,e,s),s}isEmpty(){return Bs(this.executorsByZIndex_)}execute(e,t,i,r,n,a,s){let o=Object.keys(this.executorsByZIndex_).map(Number);o.sort(s?Gw:Au),a=a||Wa;let l=Wa.length;for(let h=0,u=o.length;h<u;++h){let u=o[h].toString(),c=this.executorsByZIndex_[u];for(let u=0,d=a.length;u<d;++u){let d=a[u],p=c[d];if(void 0!==p){let a=null===s?void 0:p.getZIndexContext(),u=a?a.getContext():e,c=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(c&&(u.save(),this.clip(u,i)),a&&"Text"!==d&&"Image"!==d?a.pushFunction(e=>p.execute(e,t,i,r,n,s)):p.execute(u,t,i,r,n,s),c&&u.restore(),a){a.offset();let e=o[h]*l+Wa.indexOf(d);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(a)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Au);for(let i=0,r=t.length;i<r;++i)e[t[i]].forEach(e=>{e.draw(this.renderedContext_),e.clear()}),e[t[i]].length=0}},$y={};function aL(e){if(void 0!==$y[e])return $y[e];let t=2*e+1,i=e*e,r=new Array(i+1);for(let n=0;n<=e;++n)for(let a=0;a<=e;++a){let s=n*n+a*a;if(s>i)break;let o=r[s];o||(o=[],r[s]=o),o.push(4*((e+n)*t+(e+a))+3),n>0&&o.push(4*((e-n)*t+(e+a))+3),a>0&&(o.push(4*((e+n)*t+(e-a))+3),n>0&&o.push(4*((e-n)*t+(e-a))+3))}let n=[];for(let e=0,t=r.length;e<t;++e)r[e]&&n.push(...r[e]);return $y[e]=n,n}var AT=Wy,Bo=.5;function LT(e,t,i,r,n,a,s,o,l){let h=l?Lu(n,l):n,u=e[0]*Bo,c=e[1]*Bo,d=Ao(u,c);d.imageSmoothingEnabled=!1;let p=d.canvas,f=new hT(d,Bo,n,null,s,o,l?Of(gd(),l):null),m=i.length,g=Math.floor(16777215/m),_={};for(let e=1;e<=m;++e){let t=i[e-1],n=t.getStyleFunction()||r;if(!n)continue;let s=n(t,a);if(!s)continue;Array.isArray(s)||(s=[s]);let o=(e*g).toString(16).padStart(7,"#00000");for(let e=0,i=s.length;e<i;++e){let i=s[e],r=i.getGeometryFunction()(t);if(!r||!Dr(h,r.getExtent()))continue;let n=i.clone(),a=n.getFill();a&&a.setColor(o);let l=n.getStroke();l&&(l.setColor(o),l.setLineDash(null)),n.setText(void 0);let u=i.getImage();if(u){let e=u.getImageSize();if(!e)continue;let t=Ao(e[0],e[1],void 0,{alpha:!1}),i=t.canvas;t.fillStyle=o,t.fillRect(0,0,i.width,i.height),n.setImage(new so({img:i,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}let c=n.getZIndex()||0,d=_[c];d||(d={},_[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);let p=r.getType();if("GeometryCollection"===p){let e=r.getGeometriesArrayRecursive();for(let t=0,i=e.length;t<i;++t){let i=e[t];d[i.getType().replace("Multi","")].push(i,n)}}else d[p.replace("Multi","")].push(r,n)}}let y=Object.keys(_).map(Number).sort(Au);for(let e=0,i=y.length;e<i;++e){let i=_[y[e]];for(let e in i){let r=i[e];for(let e=0,i=r.length;e<i;e+=2){f.setStyle(r[e+1]);for(let i=0,n=t.length;i<n;++i)f.setTransform(t[i]),f.drawGeometry(r[e])}}}return d.getImageData(0,0,p.width,p.height)}function RT(e,t,i){let r=[];if(i){let n=Math.floor(Math.round(e[0])*Bo),a=Math.floor(Math.round(e[1])*Bo),s=4*(P_(n,0,i.width-1)+P_(a,0,i.height-1)*i.width),o=i.data[s],l=i.data[s+1],h=i.data[s+2]+256*(l+256*o),u=Math.floor(16777215/t.length);h&&h%u===0&&r.push(t[h/u-1])}return r}var lL=5,qy=class extends Hw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=lL}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return qi()}getData(e){return null}prepareFrame(e){return qi()}renderFrame(e,t){return qi()}forEachFeatureAtCoordinate(e,t,i,r,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Sr.LOADED||t.getState()===Sr.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Sr.LOADED&&t!=Sr.ERROR&&e.addEventListener(Eu.CHANGE,this.boundHandleImageChange_),t==Sr.IDLE&&(e.load(),t=e.getState()),t==Sr.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&"ready"===e.getSourceState()&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},zu=qy,Yy=[],Ou=null;function cL(){Ou=Ao(1,1,void 0,{willReadFrequently:!0})}var Xy=class extends zu{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=vn(),this.pixelTransform=vn(),this.inversePixelTransform=vn(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,i){let r;Ou||cL(),Ou.clearRect(0,0,1,1);try{Ou.drawImage(e,t,i,1,1,0,0,1,1),r=Ou.getImageData(0,0,1,1).data}catch{return Ou=null,null}return r}getBackground(e){let t=this.getLayer().getBackground();return"function"==typeof t&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,i){let r,n,a=this.getLayer().getClassName();if(e&&e.className===a&&(!i||e&&e.style.backgroundColor&&rs(Sd(e.style.backgroundColor),Sd(i)))){let t=e.firstElementChild;G2(t)&&(n=t.getContext("2d"))}if(n&&l2(n.canvas.style.transform,t)?(this.container=e,this.context=n,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=N2?j2():document.createElement("div"),r.className=a;let e=r.style;e.position="absolute",e.width="100%",e.height="100%",n=Ao();let t=n.canvas;r.appendChild(t),e=t.style,e.position="absolute",e.left="0",e.transformOrigin="top left",this.container=r,this.context=n}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){let r=Df(i),n=Ow(i),a=Rf(i),s=Fw(i);qr(t.coordinateToPixelTransform,r),qr(t.coordinateToPixelTransform,n),qr(t.coordinateToPixelTransform,a),qr(t.coordinateToPixelTransform,s);let o=this.inversePixelTransform;qr(o,r),qr(o,n),qr(o,a),qr(o,s),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(n[0]),Math.round(n[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.clip()}prepareContainer(e,t){let i=e.extent,r=e.viewState.resolution,n=e.viewState.rotation,a=e.pixelRatio,s=Math.round(za(i)/r*a),o=Math.round($l(i)/r*a);$n(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,n,-s/2,-o/2),s2(this.inversePixelTransform,this.pixelTransform);let l=a2(this.pixelTransform);if(this.useContainer(t,l,this.getBackground(e)),!this.containerReused){let e=this.context.canvas;e.width!=s||e.height!=o?(e.width=s,e.height=o):this.context.clearRect(0,0,s,o),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,i){let r=this.getLayer();if(r.hasListener(e)){let n=new X2(e,this.inversePixelTransform,i,t);r.dispatchEvent(n)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Ba.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Ba.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new hm),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Ba.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Ba.POSTRENDER,this.context,e))}getRenderTransform(e,t,i,r,n,a,s){let o=n/2,l=a/2,h=r/t,u=-h,c=-e[0]+s,d=-e[1];return $n(this.tempTransform,o,l,h,u,-i,c,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},dm=Xy,Ky=class extends dm{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Os(),this.wrappedRenderedExtent_=Os(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,i){let r=t.extent,n=t.viewState,a=n.center,s=n.resolution,o=n.projection,l=n.rotation,h=o.getExtent(),u=this.getLayer().getSource(),c=this.getLayer().getDeclutter(),d=t.pixelRatio,p=t.viewHints,f=!(p[wd.ANIMATING]||p[wd.INTERACTING]),m=this.context,g=Math.round(za(r)/s*d),_=Math.round($l(r)/s*d),y=u.getWrapX()&&o.canWrapX(),v=y?za(h):null,x=y?Math.ceil((r[2]-h[2])/v)+(this.extendX_?2:1):1,b=y?Math.floor((r[0]-h[0])/v)-(this.extendX_?1:0):0;do{let r=this.getRenderTransform(a,s,0,d,g,_,b*v);t.declutter&&(r=r.slice(0)),e.execute(m,[m.canvas.width,m.canvas.height],r,l,f,void 0===i?Wa:i?Hy:MT,i?c&&t.declutter[c]:void 0)}while(++b<x)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=Ao(this.context.canvas.width,this.context.canvas.height,Yy))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,V2(this.context),Yy.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let i=e.layerStatesArray[e.layerIndex];this.opacity_=i.opacity;let r=e.viewState;this.prepareContainer(e,t);let n=this.context,a=this.replayGroup_,s=a&&!a.isEmpty();if(!s&&!this.getLayer().hasListener(Ba.PRERENDER)&&!this.getLayer().hasListener(Ba.POSTRENDER))return this.container;this.setDrawContext_(),this.preRender(n,e);let o=r.projection;this.clipExtent_=null;let l=!1;if(s&&i.extent&&this.clipping){let t=E_(i.extent,o);s=Dr(t,e.extent),s&&!Ul(t,e.extent)&&(e.declutter?this.clipExtent_=t:(this.clipUnrotated(n,e,t),l=!0))}return s&&this.renderWorlds(a,e,!this.getLayer().getDeclutter()&&void 0),l&&n.restore(),this.postRender(n,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,i=this.renderedResolution_,r=this.renderedRotation_,n=this.renderedProjection_,a=this.wrappedRenderedExtent_,s=this.getLayer(),o=[],l=e[0]*Bo,h=e[1]*Bo;o.push(this.getRenderTransform(t,i,r,Bo,l,h,0).slice());let u=s.getSource(),c=n.getExtent();if(u.getWrapX()&&n.canWrapX()&&!Ul(c,a)){let e,n=a[0],s=za(c),u=0;for(;n<c[0];)--u,e=s*u,o.push(this.getRenderTransform(t,i,r,Bo,l,h,e).slice()),n+=s;for(u=0,n=a[2];n>c[2];)++u,e=s*u,o.push(this.getRenderTransform(t,i,r,Bo,l,h,e).slice()),n-=s}let d=gd();this.hitDetectionImageData_=LT(e,o,this.renderedFeatures_,s.getStyleFunction(),a,i,r,Iy(i,this.renderedPixelRatio_),d?n:null)}t(RT(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,i,r,n){if(!this.replayGroup_)return;let a=t.viewState.resolution,s=t.viewState.rotation,o=this.getLayer(),l={},h=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,a,s,i,function(e,t,i){let a=wi(e),s=l[a];if(s){if(!0!==s&&i<s.distanceSq){if(0===i)return l[a]=!0,n.splice(n.lastIndexOf(s),1),r(e,o,t);s.geometry=t,s.distanceSq=i}}else{if(0===i)return l[a]=!0,r(e,o,t);n.push(l[a]={feature:e,layer:o,geometry:t,distanceSq:i,callback:r})}},h?t.declutter?.[h]?.all().map(e=>e.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),i=t.getSource();if(!i)return!1;let r=e.viewHints[wd.ANIMATING],n=e.viewHints[wd.INTERACTING],a=t.getUpdateWhileAnimating(),s=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!s&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let o=e.extent,l=e.viewState,h=l.projection,u=l.resolution,c=e.pixelRatio,d=t.getRevision(),p=t.getRenderBuffer(),f=t.getRenderOrder();void 0===f&&(f=pT);let m=l.center.slice(),g=Fa(o,p*u),_=g.slice(),y=[g.slice()],v=h.getExtent(),x=i.getWrapX()&&h.canWrapX();if(this.extendX_=!1,x){let e=i.getExtent();e&&!kf(e)&&(this.extendX_=e[0]<v[0]||e[2]>v[2])}if(x&&(!Ul(v,e.extent)||this.extendX_)){let e=za(v),t=Math.max(za(g)/2,e),i=v[0],r=v[2];this.extendX_&&(i-=e,r+=e),g[0]=i-t,g[2]=r+t,Jw(m,h);let n=Bw(y[0],h);n[0]<v[0]&&n[2]<v[2]?y.push([n[0]+e,n[1],n[2]+e,n[3]]):n[0]>v[0]&&n[2]>v[2]&&y.push([n[0]-e,n[1],n[2]-e,n[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===c&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!e.declutter&&Ul(this.wrappedRenderedExtent_,g))return rs(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=m,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let b,w=new wT(My(u,c),g,u,c),T=gd();if(T){for(let e=0,t=y.length;e<t;++e){let t=y[e],r=Lu(t,h);i.loadFeatures(r,r2(u,h),T)}b=Of(T,h)}else for(let e=0,t=y.length;e<t;++e)i.loadFeatures(y[e],u,h);let S=Iy(u,c),I=!0,P=(e,i)=>{let r,n=e.getStyleFunction()||t.getStyleFunction();if(n&&(r=n(e,u)),r){let t=this.renderFeature(e,S,r,w,b,this.getLayer().getDeclutter(),i);I=I&&!t}},C=Lu(g,h),E=i.getFeaturesInExtent(C);f&&E.sort(f);for(let e=0,t=E.length;e<t;++e)P(E[e],e);this.renderedFeatures_=E,this.ready=I;let M=w.finish(),A=new AT(g,u,c,i.getOverlaps(),M,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=g,this.renderedCenter_=m,this.renderedProjection_=h,this.renderedPixelRatio_=c,this.replayGroup_=A,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,r,n,a,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)o=Cy(r,e,i[l],t,this.boundHandleStyleImageChange_,n,a,s)||o;else o=Cy(r,e,i,t,this.boundHandleStyleImageChange_,n,a,s);return o}},DT=Ky,Jy=class extends Y2{constructor(e){super(e)}createRenderer(){return new DT(this)}},pm=Jy,t0="http://www.w3.org/2001/XMLSchema-instance";function Bu(e,t){return zd().createElementNS(e,t)}function No(e,t){return kT(e,t,[]).join("")}function kT(e,t,i){if(e.nodeType==Node.CDATA_SECTION_NODE||e.nodeType==Node.TEXT_NODE)t?i.push(String(e.nodeValue).replace(/(\r\n|\r|\n)/g,"")):i.push(e.nodeValue);else{let r;for(r=e.firstChild;r;r=r.nextSibling)kT(r,t,i)}return i}function cs(e){return"documentElement"in e}function Yn(e){return(new DOMParser).parseFromString(e,"application/xml")}function i0(e,t){return function(i,r){let n=e.call(t??this,i,r);if(void 0!==n){let e=r[r.length-1];Wt(e,n)}}}function Ws(e,t){return function(i,r){let n=e.call(t??this,i,r);void 0!==n&&r[r.length-1].push(n)}}function fm(e,t){return function(i,r){let n=e.call(t??this,i,r);void 0!==n&&(r[r.length-1]=n)}}function ft(e,t,i){return function(r,n){let a=e.call(i??this,r,n);if(void 0!==a){n[n.length-1][void 0!==t?t:r.localName]=a}}}function wt(e,t){return function(i,r,n){e.call(t??this,i,r,n),n[n.length-1].node.appendChild(i)}}function us(e,t){return function(i,r,n){let a=r[r.length-1].node,s=e;return void 0===s&&(s=n),Bu(void 0!==t?t:a.namespaceURI,s)}}var Qy,e0,Kn=us();function lo(e,t){let i=t.length,r=new Array(i);for(let n=0;n<i;++n)r[n]=e[t[n]];return r}function xt(e,t,i){let r,n;for(i=void 0!==i?i:{},r=0,n=e.length;r<n;++r)i[e[r]]=t;return i}function rc(e,t,i,r){let n;for(n=t.firstElementChild;n;n=n.nextElementSibling){let t=e[n.namespaceURI];if(void 0!==t){let e=t[n.localName];void 0!==e&&e.call(r,n,i)}}}function _i(e,t,i,r,n){return r.push(e),rc(t,i,r,n),r.pop()}function uL(e,t,i,r,n,a){let s,o,l=(void 0!==n?n:i).length;for(let h=0;h<l;++h)s=i[h],void 0!==s&&(o=t.call(a,s,r,void 0!==n?n[h]:void 0),void 0!==o&&e[o.namespaceURI][o.localName].call(a,o,s,r))}function er(e,t,i,r,n,a,s){return n.push(e),uL(t,i,r,n,a,s),n.pop()}function FT(){return void 0===Qy&&typeof XMLSerializer<"u"&&(Qy=new XMLSerializer),Qy}function zd(){return void 0===e0&&typeof document<"u"&&(e0=document.implementation.createDocument("","",null)),e0}var r0=class extends rm{constructor(){super(),this.xmlSerializer_=FT()}getType(){return"xml"}readFeature(e,t){if(!e)return null;if("string"==typeof e){let i=Yn(e);return this.readFeatureFromDocument(i,t)}return cs(e)?this.readFeatureFromDocument(e,t):this.readFeatureFromNode(e,t)}readFeatureFromDocument(e,t){let i=this.readFeaturesFromDocument(e,t);return i.length>0?i[0]:null}readFeatureFromNode(e,t){return null}readFeatures(e,t){if(!e)return[];if("string"==typeof e){let i=Yn(e);return this.readFeaturesFromDocument(i,t)}return cs(e)?this.readFeaturesFromDocument(e,t):this.readFeaturesFromNode(e,t)}readFeaturesFromDocument(e,t){let i=[];for(let r=e.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&Wt(i,this.readFeaturesFromNode(r,t));return i}readFeaturesFromNode(e,t){return qi()}readGeometry(e,t){if(!e)return null;if("string"==typeof e){let i=Yn(e);return this.readGeometryFromDocument(i,t)}return cs(e)?this.readGeometryFromDocument(e,t):this.readGeometryFromNode(e,t)}readGeometryFromDocument(e,t){return null}readGeometryFromNode(e,t){return null}readProjection(e){if(!e)return null;if("string"==typeof e){let t=Yn(e);return this.readProjectionFromDocument(t)}return cs(e)?this.readProjectionFromDocument(e):this.readProjectionFromNode(e)}readProjectionFromDocument(e){return this.dataProjection}readProjectionFromNode(e){return this.dataProjection}writeFeature(e,t){let i=this.writeFeatureNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(e,t){return null}writeFeatures(e,t){let i=this.writeFeaturesNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(e,t){return null}writeGeometry(e,t){let i=this.writeGeometryNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(e,t){return null}},zT=r0;function Hs(e){return hL(No(e,!1))}function hL(e){let t=/^\s*(true|1)|(false|0)\s*$/.exec(e);if(t)return void 0!==t[1]||!1}function Ui(e){return dL(No(e,!1))}function dL(e){let t=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(e);if(t)return parseFloat(t[1])}function Kr(e){return No(e,!1).trim()}function nc(e,t){Jn(e,t?"1":"0")}function pL(e,t){e.appendChild(zd().createCDATASection(t))}function Ha(e,t){let i=t.toPrecision();e.appendChild(zd().createTextNode(i))}var fL=/^\s/,mL=/\s$/,gL=/(\n|\t|\r|<|&| {2})/;function Jn(e,t){"string"==typeof t&&(fL.test(t)||mL.test(t)||gL.test(t))?t.split("]]>").forEach((t,i,r)=>{i<r.length-1&&(t+="]]"),i>0&&(t=">"+t),pL(e,t)}):e.appendChild(zd().createTextNode(t))}var Nu,s0,Od,Bd,Nd,ym,d0,c0,mm,qs=["http://www.google.com/kml/ext/2.2"],gt=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],_L="http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd",OT={fraction:"fraction",pixels:"pixels",insetPixels:"pixels"},yL=xt(gt,{ExtendedData:rP,Region:nP,MultiGeometry:ft(eP,"geometry"),LineString:ft(JT,"geometry"),LinearRing:ft(QT,"geometry"),Point:ft(tP,"geometry"),Polygon:ft(iP,"geometry"),Style:ft(f0),StyleMap:eR,address:ft(Kr),description:ft(Kr),name:ft(Kr),open:ft(Hs),phoneNumber:ft(Kr),styleUrl:ft(HT),visibility:ft(Hs)},xt(qs,{MultiTrack:ft(jL,"geometry"),Track:ft(KT,"geometry")})),xL=xt(gt,{ExtendedData:rP,Region:nP,Link:dR,address:ft(Kr),description:ft(Kr),name:ft(Kr),open:ft(Hs),phoneNumber:ft(Kr),visibility:ft(Hs)}),vL=xt(gt,{href:ft(WT)}),bL=xt(gt,{Altitude:ft(Ui),Longitude:ft(Ui),Latitude:ft(Ui),Tilt:ft(Ui),AltitudeMode:ft(Kr),Heading:ft(Ui),Roll:ft(Ui)}),UT=xt(gt,{LatLonAltBox:oR,Lod:aR}),wL=xt(gt,["Document","Placemark"]),SL=xt(gt,{Document:wt(vR),Placemark:wt(aP)}),gm=null,a0=null,l0=null,oc=null,BT=null,u0=null;function xm(e){return 32/Math.min(e[0],e[1])}function TL(){gm=new Hn({color:Nu=[255,255,255,1]}),ym="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",a0=new so({anchor:s0=[20,2],anchorOrigin:"bottom-left",anchorXUnits:Od="pixels",anchorYUnits:Bd="pixels",crossOrigin:"anonymous",rotation:0,scale:xm(Nd=[64,64]),size:Nd,src:ym}),d0="NO_IMAGE",l0=new qn({color:Nu,width:1}),c0=new qn({color:[51,51,51,1],width:2}),oc=new ec({font:"bold 16px Helvetica",fill:gm,stroke:c0,scale:.8}),BT=new Fr({fill:gm,image:a0,text:oc,stroke:l0,zIndex:0}),u0=[BT]}function PL(e){return e}var h0=class extends zT{constructor(e){super(),e=e||{},u0||TL(),this.dataProjection=kr("EPSG:4326"),this.defaultStyle_=e.defaultStyle?e.defaultStyle:u0,this.extractStyles_=void 0===e.extractStyles||e.extractStyles,this.writeStyles_=void 0===e.writeStyles||e.writeStyles,this.sharedStyles_={},this.showPointNames_=void 0===e.showPointNames||e.showPointNames,this.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:"anonymous",this.referrerPolicy_=e.referrerPolicy,this.iconUrlFunction_=e.iconUrlFunction?e.iconUrlFunction:PL,this.supportedMediaTypes=["application/vnd.google-earth.kml+xml"]}readDocumentOrFolder_(e,t){let i=_i([],xt(gt,{Document:i0(this.readDocumentOrFolder_,this),Folder:i0(this.readDocumentOrFolder_,this),Placemark:Ws(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),e,t,this);if(i)return i}readPlacemark_(e,t){let i=_i({geometry:null},yL,e,t,this);if(!i)return;let r=new Eo,n=e.getAttribute("id");null!==n&&r.setId(n);let a=t[0],s=i.geometry;if(s&&ic(s,!1,a),r.setGeometry(s),delete i.geometry,this.extractStyles_){let e=ML(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);r.setStyle(e)}return delete i.Style,r.setProperties(i,!0),r}readSharedStyle_(e,t){let i=e.getAttribute("id");if(null!==i){let r=f0.call(this,e,t);if(r){let t,n=e.baseURI;(!n||"about:blank"==n)&&(n=window.location.href),t=n?new URL("#"+i,n).href:"#"+i,this.sharedStyles_[t]=r}}}readSharedStyleMap_(e,t){let i=e.getAttribute("id");if(null===i)return;let r=XT.call(this,e,t);if(!r)return;let n,a=e.baseURI;(!a||"about:blank"==a)&&(a=window.location.href),n=a?new URL("#"+i,a).href:"#"+i,this.sharedStyles_[n]=r}readFeatureFromNode(e,t){if(!gt.includes(e.namespaceURI))return null;return this.readPlacemark_(e,[this.getReadOptions(e,t)])||null}readFeaturesFromNode(e,t){if(!gt.includes(e.namespaceURI))return[];let i,r=e.localName;if("Document"==r||"Folder"==r)return i=this.readDocumentOrFolder_(e,[this.getReadOptions(e,t)]),i||[];if("Placemark"==r){let i=this.readPlacemark_(e,[this.getReadOptions(e,t)]);return i?[i]:[]}if("kml"==r){i=[];for(let r=e.firstElementChild;r;r=r.nextElementSibling){let e=this.readFeaturesFromNode(r,t);e&&Wt(i,e)}return i}return[]}readName(e){if(e){if("string"==typeof e){let t=Yn(e);return this.readNameFromDocument(t)}return cs(e)?this.readNameFromDocument(e):this.readNameFromNode(e)}}readNameFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE){let e=this.readNameFromNode(t);if(e)return e}}readNameFromNode(e){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(gt.includes(t.namespaceURI)&&"name"==t.localName)return Kr(t);for(let t=e.firstElementChild;t;t=t.nextElementSibling){let e=t.localName;if(gt.includes(t.namespaceURI)&&("Document"==e||"Folder"==e||"Placemark"==e||"kml"==e)){let e=this.readNameFromNode(t);if(e)return e}}}readNetworkLinks(e){let t=[];if("string"==typeof e){let i=Yn(e);Wt(t,this.readNetworkLinksFromDocument(i))}else cs(e)?Wt(t,this.readNetworkLinksFromDocument(e)):Wt(t,this.readNetworkLinksFromNode(e));return t}readNetworkLinksFromDocument(e){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&Wt(t,this.readNetworkLinksFromNode(i));return t}readNetworkLinksFromNode(e){let t=[];for(let i=e.firstElementChild;i;i=i.nextElementSibling)if(gt.includes(i.namespaceURI)&&"NetworkLink"==i.localName){let e=_i({},xL,i,[]);t.push(e)}for(let i=e.firstElementChild;i;i=i.nextElementSibling){let e=i.localName;gt.includes(i.namespaceURI)&&("Document"==e||"Folder"==e||"kml"==e)&&Wt(t,this.readNetworkLinksFromNode(i))}return t}readRegion(e){let t=[];if("string"==typeof e){let i=Yn(e);Wt(t,this.readRegionFromDocument(i))}else cs(e)?Wt(t,this.readRegionFromDocument(e)):Wt(t,this.readRegionFromNode(e));return t}readRegionFromDocument(e){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&Wt(t,this.readRegionFromNode(i));return t}readRegionFromNode(e){let t=[];for(let i=e.firstElementChild;i;i=i.nextElementSibling)if(gt.includes(i.namespaceURI)&&"Region"==i.localName){let e=_i({},UT,i,[]);t.push(e)}for(let i=e.firstElementChild;i;i=i.nextElementSibling){let e=i.localName;gt.includes(i.namespaceURI)&&("Document"==e||"Folder"==e||"kml"==e)&&Wt(t,this.readRegionFromNode(i))}return t}readCamera(e){let t=[];if("string"==typeof e){let i=Yn(e);Wt(t,this.readCameraFromDocument(i))}else cs(e)?Wt(t,this.readCameraFromDocument(e)):Wt(t,this.readCameraFromNode(e));return t}readCameraFromDocument(e){let t=[];for(let i=e.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&Wt(t,this.readCameraFromNode(i));return t}readCameraFromNode(e){let t=[];for(let i=e.firstElementChild;i;i=i.nextElementSibling)if(gt.includes(i.namespaceURI)&&"Camera"===i.localName){let e=_i({},bL,i,[]);t.push(e)}for(let i=e.firstElementChild;i;i=i.nextElementSibling){let e=i.localName;gt.includes(i.namespaceURI)&&("Document"===e||"Folder"===e||"Placemark"===e||"kml"===e)&&Wt(t,this.readCameraFromNode(i))}return t}writeFeaturesNode(e,t){t=this.adaptOptions(t);let i=Bu(gt[4],"kml"),r="http://www.w3.org/2000/xmlns/";i.setAttributeNS(r,"xmlns:gx",qs[0]),i.setAttributeNS(r,"xmlns:xsi",t0),i.setAttributeNS(t0,"xsi:schemaLocation",_L);let n={node:i},a={};e.length>1?a.Document=e:1==e.length&&(a.Placemark=e[0]);let s=wL[i.namespaceURI],o=lo(a,s);return er(n,SL,Kn,o,[t],s,this),i}};function IL(e,t){let i=[0,0],r="start",n=e.getImage();if(n){let e=n.getSize();if(e&&2==e.length){let t=n.getScaleArray(),a=n.getAnchor();i[0]=t[0]*(e[0]-a[0]),i[1]=t[1]*(e[1]/2-a[1]),r="left"}}let a=e.getText();return a?(a=a.clone(),a.setFont(a.getFont()||oc.getFont()),a.setScale(a.getScale()||oc.getScale()),a.setFill(a.getFill()||oc.getFill()),a.setStroke(a.getStroke()||c0)):a=oc.clone(),a.setText(t),a.setOffsetX(i[0]),a.setOffsetY(i[1]),a.setTextAlign(r),new Fr({image:n,text:a})}function ML(e,t,i,r,n){return function(a,s){let o=n,l="",h=[];if(o){let e=a.getGeometry();if(e)if(e instanceof ao)h=e.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"Point"===t||"MultiPoint"===t}),o=h.length>0;else{let t=e.getType();o="Point"===t||"MultiPoint"===t}}o&&(l=a.get("name"),o=o&&!!l,o&&/&[^&]+;/.test(l)&&(mm||(mm=document.createElement("textarea")),mm.innerHTML=l,l=mm.value));let u=i;if(e?u=e:t&&(u=ZT(t,i,r)),o){let e=IL(u[0],l);if(h.length>0){return e.setGeometry(new ao(h)),[e,new Fr({geometry:u[0].getGeometry(),image:null,fill:u[0].getFill(),stroke:u[0].getStroke(),text:null})].concat(u.slice(1))}return e}return u}}function ZT(e,t,i){return Array.isArray(e)?e:"string"==typeof e?ZT(i[e],t,i):t}function vm(e){let t=No(e,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(t);if(i){let e=i[1];return[parseInt(e.substr(6,2),16),parseInt(e.substr(4,2),16),parseInt(e.substr(2,2),16),parseInt(e.substr(0,2),16)/255]}}function $T(e){let t=No(e,!1),i=[];t=t.replace(/\s*,\s*/g,",");let r,n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;for(;r=n.exec(t);){let e=parseFloat(r[1]),n=parseFloat(r[2]),a=r[3]?parseFloat(r[3]):0;i.push(e,n,a),t=t.substr(r[0].length)}if(""===t)return i}function WT(e){let t=No(e,!1).trim(),i=e.baseURI;return(!i||"about:blank"==i)&&(i=window.location.href),i?new URL(t,i).href:t}function HT(e){let t=No(e,!1).trim().replace(/^(?!.*#)/,"#"),i=e.baseURI;return(!i||"about:blank"==i)&&(i=window.location.href),i?new URL(t,i).href:t}function CL(e){let t,i=e.getAttribute("xunits"),r=e.getAttribute("yunits");return t="insetPixels"!==i?"insetPixels"!==r?"bottom-left":"top-left":"insetPixels"!==r?"bottom-right":"top-right",{x:parseFloat(e.getAttribute("x")),xunits:OT[i],y:parseFloat(e.getAttribute("y")),yunits:OT[r],origin:t}}function qT(e){return Ui(e)}var EL=xt(gt,{Pair:QL});function XT(e,t){return _i(void 0,EL,e,t,this)}var AL=xt(gt,{Icon:ft(ZL),color:ft(vm),heading:ft(Ui),hotSpot:ft(CL),scale:ft(qT)});function LL(e,t){let i=_i({},AL,e,t);if(!i)return;let r,n=t[t.length-1],a="Icon"in i?i.Icon:{},s=!("Icon"in i)||Object.keys(a).length>0,o=a.href;o?r=o:s&&(r=ym);let l,h,u,c="bottom-left",d=i.hotSpot;d?(l=[d.x,d.y],h=d.xunits,u=d.yunits,c=d.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(r)&&(r.includes("pushpin")?(l=s0,h=Od,u=Bd):r.includes("arrow-reverse")?(l=[54,42],h=Od,u=Bd):r.includes("paddle")&&(l=[32,1],h=Od,u=Bd));let p,f=a.x,m=a.y;void 0!==f&&void 0!==m&&(p=[f,m]);let g,_=a.w,y=a.h;void 0!==_&&void 0!==y&&(g=[_,y]);let v,x=i.heading;void 0!==x&&(v=Yw(x));let b=i.scale,w=i.color;if(s){r==ym&&(g=Nd);let e=new so({anchor:l,anchorOrigin:c,anchorXUnits:h,anchorYUnits:u,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:p,offsetOrigin:"bottom-left",rotation:v,scale:b,size:g,src:this.iconUrlFunction_(r),color:w}),t=e.getScaleArray()[0],i=e.getSize();if(null===i){let i=e.getImageState();if(i===Sr.IDLE||i===Sr.LOADING){let r=function(){let i=e.getImageState();if(i!==Sr.IDLE&&i!==Sr.LOADING){let i=e.getSize();if(i&&2==i.length){let r=xm(i);e.setScale(t*r)}e.unlistenImageChange(r)}};e.listenImageChange(r),i===Sr.IDLE&&e.load()}}else if(2==i.length){let r=xm(i);e.setScale(t*r)}n.imageStyle=e}else n.imageStyle=d0}var RL=xt(gt,{color:ft(vm),scale:ft(qT)});function DL(e,t){let i=_i({},RL,e,t);if(!i)return;let r=t[t.length-1],n=new ec({fill:new Hn({color:"color"in i?i.color:Nu}),scale:i.scale});r.textStyle=n}var kL=xt(gt,{color:ft(vm),width:ft(Ui)});function FL(e,t){let i=_i({},kL,e,t);if(!i)return;let r=t[t.length-1],n=new qn({color:"color"in i?i.color:Nu,width:"width"in i?i.width:1});r.strokeStyle=n}var zL=xt(gt,{color:ft(vm),fill:ft(Hs),outline:ft(Hs)});function OL(e,t){let i=_i({},zL,e,t);if(!i)return;let r=t[t.length-1],n=new Hn({color:"color"in i?i.color:Nu});r.fillStyle=n;let a=i.fill;void 0!==a&&(r.fill=a);let s=i.outline;void 0!==s&&(r.outline=s)}var BL=xt(gt,{coordinates:fm($T)});function YT(e,t){return _i(null,BL,e,t)}function NL(e,t){let i=t[t.length-1].coordinates,r=No(e,!1),n=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(r);if(n){let e=parseFloat(n[1]),t=parseFloat(n[2]),r=parseFloat(n[3]);i.push([e,t,r])}else i.push([])}var VL=xt(qs,{Track:Ws(KT)});function jL(e,t){let i=_i([],VL,e,t);if(i)return new Cd(i)}var GL=xt(gt,{when:pR},xt(qs,{coord:NL}));function KT(e,t){let i=_i({coordinates:[],whens:[]},GL,e,t);if(!i)return;let r=[],n=i.coordinates,a=i.whens;for(let e=0,t=Math.min(n.length,a.length);e<t;++e)3==n[e].length&&r.push(n[e][0],n[e][1],n[e][2],a[e]);return new ko(r,"XYZM")}var UL=xt(gt,{href:ft(WT)},xt(qs,{x:ft(Ui),y:ft(Ui),w:ft(Ui),h:ft(Ui)}));function ZL(e,t){return _i({},UL,e,t)||null}var $L=xt(gt,{coordinates:fm($T)});function p0(e,t){return _i(null,$L,e,t)}var bm=xt(gt,{extrude:ft(Hs),tessellate:ft(Hs),altitudeMode:ft(Kr)});function JT(e,t){let i=_i({},bm,e,t),r=p0(e,t);if(r){let e=new ko(r,"XYZ");return e.setProperties(i,!0),e}}function QT(e,t){let i=_i({},bm,e,t),r=p0(e,t);if(r){let e=new Oa(r,"XYZ",[r.length]);return e.setProperties(i,!0),e}}var WL=xt(gt,{LineString:Ws(JT),LinearRing:Ws(QT),MultiGeometry:Ws(eP),Point:Ws(tP),Polygon:Ws(iP)});function eP(e,t){let i=_i([],WL,e,t);if(!i)return null;if(0===i.length)return new ao(i);let r,n,a=!0,s=i[0].getType();for(let e=1,t=i.length;e<t;++e)if(n=i[e],n.getType()!=s){a=!1;break}if(a){let e,t;if("Point"==s){let a=i[0];e=a.getLayout(),t=a.getFlatCoordinates();for(let e=1,r=i.length;e<r;++e)n=i[e],Wt(t,n.getFlatCoordinates());r=new js(t,e),n0(r,i)}else if("LineString"==s)r=new Cd(i),n0(r,i);else if("Polygon"==s)r=new im(i),n0(r,i);else{if("GeometryCollection"!=s&&!s.startsWith("Multi"))throw new Error("Unknown geometry type found");r=new ao(i)}}else r=new ao(i);return r}function tP(e,t){let i=_i({},bm,e,t),r=p0(e,t);if(r){let e=new bn(r,"XYZ");return e.setProperties(i,!0),e}}var HL=xt(gt,{innerBoundaryIs:cR,outerBoundaryIs:hR});function iP(e,t){let i=_i({},bm,e,t),r=_i([null],HL,e,t);if(r&&r[0]){let e=r[0],t=[e.length];for(let i=1,n=r.length;i<n;++i)Wt(e,r[i]),t.push(e.length);let n=new Oa(e,"XYZ",t);return n.setProperties(i,!0),n}}var qL=xt(gt,{IconStyle:LL,LabelStyle:DL,LineStyle:FL,PolyStyle:OL});function f0(e,t){let i=_i({},qL,e,t,this);if(!i)return null;let r,n="fillStyle"in i?i.fillStyle:gm,a=i.fill;void 0!==a&&!a&&(n=null),"imageStyle"in i?i.imageStyle!=d0&&(r=i.imageStyle):r=a0;let s="textStyle"in i?i.textStyle:oc,o="strokeStyle"in i?i.strokeStyle:l0,l=i.outline;return void 0===l||l?[new Fr({fill:n,image:r,stroke:o,text:s,zIndex:void 0})]:[new Fr({geometry:function(e){let t=e.getGeometry(),i=t.getType();if("GeometryCollection"===i){return new ao(t.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"Polygon"!==t&&"MultiPolygon"!==t}))}if("Polygon"!==i&&"MultiPolygon"!==i)return t},fill:n,image:r,stroke:o,text:s,zIndex:void 0}),new Fr({geometry:function(e){let t=e.getGeometry(),i=t.getType();if("GeometryCollection"===i){return new ao(t.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"Polygon"===t||"MultiPolygon"===t}))}if("Polygon"===i||"MultiPolygon"===i)return t},fill:n,stroke:null,zIndex:void 0})]}function n0(e,t){let i,r,n,a=t.length,s=new Array(t.length),o=new Array(t.length),l=new Array(t.length);i=!1,r=!1,n=!1;for(let e=0;e<a;++e){let a=t[e];s[e]=a.get("extrude"),o[e]=a.get("tessellate"),l[e]=a.get("altitudeMode"),i=i||void 0!==s[e],r=r||void 0!==o[e],n=n||l[e]}i&&e.set("extrude",s),r&&e.set("tessellate",o),n&&e.set("altitudeMode",l)}var XL=xt(gt,{displayName:ft(Kr),value:ft(Kr)});function YL(e,t){let i=e.getAttribute("name");rc(XL,e,t);let r=t[t.length-1];i&&r.displayName?r[i]={value:r.value,displayName:r.displayName,toString:function(){return r.value}}:null!==i?r[i]=r.value:null!==r.displayName&&(r[r.displayName]=r.value),delete r.value}var KL=xt(gt,{Data:YL,SchemaData:iR});function rP(e,t){rc(KL,e,t)}function nP(e,t){rc(UT,e,t)}var JL=xt(gt,{Style:ft(f0),key:ft(Kr),styleUrl:ft(HT)});function QL(e,t){let i=_i({},JL,e,t,this);if(!i)return;let r=i.key;if(r&&"normal"==r){let e=i.styleUrl;e&&(t[t.length-1]=e);let r=i.Style;r&&(t[t.length-1]=r)}}function eR(e,t){let i=XT.call(this,e,t);if(!i)return;let r=t[t.length-1];if(Array.isArray(i))r.Style=i;else{if("string"!=typeof i)throw new Error("`styleMapValue` has an unknown type");r.styleUrl=i}}var tR=xt(gt,{SimpleData:rR});function iR(e,t){rc(tR,e,t)}function rR(e,t){let i=e.getAttribute("name");if(null!==i){let r=Kr(e);t[t.length-1][i]=r}}var nR=xt(gt,{altitudeMode:ft(Kr),minAltitude:ft(Ui),maxAltitude:ft(Ui),north:ft(Ui),south:ft(Ui),east:ft(Ui),west:ft(Ui)});function oR(e,t){let i=_i({},nR,e,t);if(!i)return;let r=t[t.length-1],n=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];r.extent=n,r.altitudeMode=i.altitudeMode,r.minAltitude=parseFloat(i.minAltitude),r.maxAltitude=parseFloat(i.maxAltitude)}var sR=xt(gt,{minLodPixels:ft(Ui),maxLodPixels:ft(Ui),minFadeExtent:ft(Ui),maxFadeExtent:ft(Ui)});function aR(e,t){let i=_i({},sR,e,t);if(!i)return;let r=t[t.length-1];r.minLodPixels=parseFloat(i.minLodPixels),r.maxLodPixels=parseFloat(i.maxLodPixels),r.minFadeExtent=parseFloat(i.minFadeExtent),r.maxFadeExtent=parseFloat(i.maxFadeExtent)}var lR=xt(gt,{LinearRing:Ws(YT)});function cR(e,t){let i=_i([],lR,e,t);i.length>0&&t[t.length-1].push(...i)}var uR=xt(gt,{LinearRing:fm(YT)});function hR(e,t){let i=_i(void 0,uR,e,t);if(i){t[t.length-1][0]=i}}function dR(e,t){rc(vL,e,t)}function pR(e,t){let i=t[t.length-1].whens,r=No(e,!1),n=Date.parse(r);i.push(isNaN(n)?0:n)}function wm(e,t){let i=Sd(t),r=[255*(4==i.length?i[3]:1),i[2],i[1],i[0]];for(let e=0;e<4;++e){let t=Math.floor(r[e]).toString(16);r[e]=1==t.length?"0"+t:t}Jn(e,r.join(""))}function fR(e,t,i){let r,n=i[i.length-1],a=n.layout,s=n.stride;if("XY"==a||"XYM"==a)r=2;else{if("XYZ"!=a&&"XYZM"!=a)throw new Error("Invalid geometry layout");r=3}let o=t.length,l="";if(o>0){l+=t[0];for(let e=1;e<r;++e)l+=","+t[e];for(let e=s;e<o;e+=s){l+=" "+t[e];for(let i=1;i<r;++i)l+=","+t[e+i]}}Jn(e,l)}var _m=xt(gt,{Data:wt(mR),value:wt(_R),displayName:wt(gR)});function mR(e,t,i){e.setAttribute("name",t.name);let r={node:e},n=t.value;"object"==typeof n?(null!==n&&n.displayName&&er(r,_m,Kn,[n.displayName],i,["displayName"]),null!==n&&n.value&&er(r,_m,Kn,[n.value],i,["value"])):er(r,_m,Kn,[n],i,["value"])}function gR(e,t){Jn(e,t)}function _R(e,t){Jn(e,t)}var yR=xt(gt,{Placemark:wt(aP)}),xR=function(e,t,i){return Bu(t[t.length-1].node.namespaceURI,"Placemark")};function vR(e,t,i){er({node:e},yR,xR,t,i,void 0,this)}var bR=us("Data");function wR(e,t,i){let r={node:e},n=t.names,a=t.values,s=n.length;for(let e=0;e<s;e++)er(r,_m,bR,[{name:n[e],value:a[e]}],i)}var NT=xt(gt,["href"],xt(qs,["x","y","w","h"])),VT=xt(gt,{href:wt(Jn)},xt(qs,{x:wt(Ha),y:wt(Ha),w:wt(Ha),h:wt(Ha)})),SR=function(e,t,i){return Bu(qs[0],"gx:"+i)};function TR(e,t,i){let r={node:e},n=i[i.length-1].node,a=NT[n.namespaceURI],s=lo(t,a);er(r,VT,Kn,s,i,a),a=NT[qs[0]],s=lo(t,a),er(r,VT,SR,s,i,a)}var PR=xt(gt,["scale","heading","Icon","color","hotSpot"]),IR=xt(gt,{Icon:wt(TR),color:wt(wm),heading:wt(Ha),hotSpot:wt(QR),scale:wt(cP)});function MR(e,t,i){let r={node:e},n={},a=t.getSrc(),s=t.getSize(),o=t.getImageSize(),l={href:a};if(s){l.w=s[0],l.h=s[1];let e=t.getAnchor(),i=t.getOrigin();if(i&&o&&0!==i[0]&&i[1]!==s[1]&&(l.x=i[0],l.y=o[1]-(i[1]+s[1])),e&&(e[0]!==s[0]/2||e[1]!==s[1]/2)){let t={x:e[0],xunits:"pixels",y:s[1]-e[1],yunits:"pixels"};n.hotSpot=t}}n.Icon=l;let h=t.getScaleArray()[0],u=s;if(null===u&&(u=Nd),2==u.length){h/=xm(u)}1!==h&&(n.scale=h);let c=t.getRotation();0!==c&&(n.heading=c);let d=t.getColor();d&&(n.color=d);let p=i[i.length-1].node,f=PR[p.namespaceURI],m=lo(n,f);er(r,IR,Kn,m,i,f)}var CR=xt(gt,["color","scale"]),ER=xt(gt,{color:wt(wm),scale:wt(cP)});function AR(e,t,i){let r={node:e},n={},a=t.getFill();a&&(n.color=a.getColor());let s=t.getScale();s&&1!==s&&(n.scale=s);let o=i[i.length-1].node,l=CR[o.namespaceURI],h=lo(n,l);er(r,ER,Kn,h,i,l)}var LR=xt(gt,["color","width"]),RR=xt(gt,{color:wt(wm),width:wt(Ha)});function DR(e,t,i){let r={node:e},n={color:t.getColor(),width:Number(t.getWidth())||1},a=i[i.length-1].node,s=LR[a.namespaceURI],o=lo(n,s);er(r,RR,Kn,o,i,s)}var kR={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},oP=function(e,t,i){if(e){return Bu(t[t.length-1].node.namespaceURI,kR[e.getType()])}},FR=us("Point"),zR=us("LineString"),OR=us("LinearRing"),BR=us("Polygon"),NR=xt(gt,{LineString:wt(Vu),Point:wt(Vu),Polygon:wt(lP),GeometryCollection:wt(sP)});function sP(e,t,i){let r,n={node:e},a=t.getType(),s=[];if("GeometryCollection"===a)t.getGeometriesArrayRecursive().forEach(function(e){let t=e.getType();if("MultiPoint"===t)s=s.concat(e.getPoints());else if("MultiLineString"===t)s=s.concat(e.getLineStrings());else if("MultiPolygon"===t)s=s.concat(e.getPolygons());else{if("Point"!==t&&"LineString"!==t&&"Polygon"!==t)throw new Error("Unknown geometry type");s.push(e)}}),r=oP;else if("MultiPoint"===a)s=t.getPoints(),r=FR;else if("MultiLineString"===a)s=t.getLineStrings(),r=zR;else{if("MultiPolygon"!==a)throw new Error("Unknown geometry type");s=t.getPolygons(),r=BR}er(n,NR,r,s,i)}var VR=xt(gt,{LinearRing:wt(Vu)});function jT(e,t,i){er({node:e},VR,OR,[t],i)}var o0=xt(gt,{ExtendedData:wt(wR),MultiGeometry:wt(sP),LineString:wt(Vu),LinearRing:wt(Vu),Point:wt(Vu),Polygon:wt(lP),Style:wt(JR),address:wt(Jn),description:wt(Jn),name:wt(Jn),open:wt(nc),phoneNumber:wt(Jn),styleUrl:wt(Jn),visibility:wt(nc)}),jR=xt(gt,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),GR=us("ExtendedData");function aP(e,t,i){let r={node:e};t.getId()&&e.setAttribute("id",t.getId());let n=t.getProperties(),a={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};a[t.getGeometryName()]=1;let s=Object.keys(n||{}).sort().filter(function(e){return!a[e]}),o=t.getStyleFunction();if(o){let e=o(t,0);if(e){let i=Array.isArray(e)?e:[e],r=i;if(t.getGeometry()&&(r=i.filter(function(e){let i=e.getGeometryFunction()(t);if(i){let e=i.getType();return"GeometryCollection"===e?i.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"Point"===t||"MultiPoint"===t}).length:"Point"===e||"MultiPoint"===e}})),this.writeStyles_){let e=i,a=i;t.getGeometry()&&(e=i.filter(function(e){let i=e.getGeometryFunction()(t);if(i){let e=i.getType();return"GeometryCollection"===e?i.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"LineString"===t||"MultiLineString"===t}).length:"LineString"===e||"MultiLineString"===e}}),a=i.filter(function(e){let i=e.getGeometryFunction()(t);if(i){let e=i.getType();return"GeometryCollection"===e?i.getGeometriesArrayRecursive().filter(function(e){let t=e.getType();return"Polygon"===t||"MultiPolygon"===t}).length:"Polygon"===e||"MultiPolygon"===e}})),n.Style={pointStyles:r,lineStyles:e,polyStyles:a}}if(r.length&&void 0===n.name){let e=r[0].getText();e&&(n.name=e.getText())}}}let l=i[i.length-1].node,h=jR[l.namespaceURI],u=lo(n,h);if(er(r,o0,Kn,u,i,h),s.length>0){let e=lo(n,s);er(r,o0,GR,[{names:s,values:e}],i)}let c=i[0],d=t.getGeometry();d&&(d=ic(d,!0,c)),er(r,o0,oP,[d],i)}var UR=xt(gt,["extrude","tessellate","altitudeMode","coordinates"]),ZR=xt(gt,{extrude:wt(nc),tessellate:wt(nc),altitudeMode:wt(Jn),coordinates:wt(fR)});function Vu(e,t,i){let r=t.getFlatCoordinates(),n={node:e};n.layout=t.getLayout(),n.stride=t.getStride();let a=t.getProperties();a.coordinates=r;let s=i[i.length-1].node,o=UR[s.namespaceURI],l=lo(a,o);er(n,ZR,Kn,l,i,o)}var $R=xt(gt,["color","fill","outline"]),GT=xt(gt,{outerBoundaryIs:wt(jT),innerBoundaryIs:wt(jT)}),WR=us("innerBoundaryIs"),HR=us("outerBoundaryIs");function lP(e,t,i){let r=t.getLinearRings(),n=r.shift(),a={node:e};er(a,GT,WR,r,i),er(a,GT,HR,[n],i)}var qR=xt(gt,{color:wt(wm),fill:wt(nc),outline:wt(nc)});function XR(e,t,i){let r={node:e},n=t.getFill(),a=t.getStroke(),s={color:n?n.getColor():void 0,fill:!!n&&void 0,outline:!!a&&void 0},o=i[i.length-1].node,l=$R[o.namespaceURI],h=lo(s,l);er(r,qR,Kn,h,i,l)}function cP(e,t){Ha(e,Math.round(1e6*t)/1e6)}var YR=xt(gt,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),KR=xt(gt,{IconStyle:wt(MR),LabelStyle:wt(AR),LineStyle:wt(DR),PolyStyle:wt(XR)});function JR(e,t,i){let r={node:e},n={};if(t.pointStyles.length){let e=t.pointStyles[0].getText();e&&(n.LabelStyle=e);let i=t.pointStyles[0].getImage();i&&"function"==typeof i.getSrc&&(n.IconStyle=i)}if(t.lineStyles.length){let e=t.lineStyles[0].getStroke();e&&(n.LineStyle=e)}if(t.polyStyles.length){let e=t.polyStyles[0].getStroke();e&&!n.LineStyle&&(n.LineStyle=e),n.PolyStyle=t.polyStyles[0]}let a=i[i.length-1].node,s=YR[a.namespaceURI],o=lo(n,s);er(r,KR,Kn,o,i,s)}function QR(e,t){e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("xunits",t.xunits),e.setAttribute("yunits",t.yunits)}var m0=h0,pP=Rn(Vo()),Ri=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Ri=(0,pP.default)(e=>{console.warn(e)},1e3));var _D=(e,t)=>{(t||[]).forEach(e=>{e.set("parent",void 0)}),(e.get("children")||[]).forEach(t=>{t.set("parent",e)})},yD=(e,t)=>{t.properties&&(Ri("Deprecated. Don't use properties options. Pass the values directly in options object."),e.setProperties(t.properties)),e.on("propertychange",e=>{if("children"===e.key&&_D(e.target,e.oldValue),"map"===e.key){let t=e.target.get(e.key);t?(e.target.get("children")||[]).forEach(e=>{t.addLayer(e)}):e.oldValue&&(e.target.get("children")||[]).forEach(t=>{var i;null===(i=e.oldValue)||void 0===i||i.removeLayer(t)})}}),e.set("options",t),e.set("children",[...t.children||[]]),Object.defineProperties(e,{children:{get:()=>(Ri("Layer.children is deprecated. Use the Layer.get('children') method instead."),e.get("children")||[]),set:t=>{Ri("Layer.children is deprecated. Use the Layer.set('children', children) method instead."),e.set("children",t||[])}},copyrights:{get:()=>(Ri("Layer.copyrights is deprecated. Get the attributions from the source object"),e.get("copyrights")),set:t=>{Ri("Layer.copyrights is deprecated. Set the attributions to the source object.");let i=t&&!Array.isArray(t)?[t]:t;e.set("copyrights",i||[])}},disabled:{get:()=>(Ri("Layer.disabled is deprecated. Use the Layer.get('disabled') method instead."),e.get("disabled")),set(t){Ri("Layer.disabled is deprecated. Use the Layer.set('disabled', newValue) method instead."),e.set("disabled",t)}},group:{get:()=>(Ri("Layer.group is deprecated. Use the Layer.get('group') method instead."),e.get("group"))},hitTolerance:{get:()=>(Ri("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),e.get("hitTolerance")||5),set(t){Ri("Layer.hitTolerance is deprecated. Pass the hitTolerance when you request the features."),e.set("hitTolerance",t)}},key:{get:()=>(Ri('Layer.key is deprecated. Use the Layer.get("key") method instead.'),e.get("key")||e.get("name"))},map:{get:()=>(Ri('Layer.map is deprecated. Use the Layer.get("map") method instead.'),e.getMapInternal())},name:{get:()=>(Ri("Layer.name is deprecated. Use the Layer.get('name') method instead."),e.get("name"))},olLayer:{get:()=>(Ri("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj getter is only a redirect to the current 'this' object."),e),set(){Ri("Layer.olLayer is deprecated. mobility-toolbox-js/ol layers inherits now from ol/layer/Layer class. obj setter has no effect.")}},olListenersKeys:{get:()=>(Ri("Layer.olListenersKeys is deprecated. Use the Layer.olEventsKeys instead."),e.olEventsKeys||[]),set(t){Ri("Layer.olListenersKeys is deprecated. Use the Layer.olEventsKeys instead."),e.olEventsKeys=t}},options:{get:()=>(Ri('Layer.options is deprecated. Use the Layer.get("options") method instead.'),e.get("options")),set:t=>(Ri('Layer.options is deprecated.  Use the Layer.set("options", newValue) method instead.'),e.set("options",t))},parent:{get:()=>(Ri("Layer.parent is deprecated. Use the Layer.get('parent') method instead."),e.get("parent")),set(t){Ri("Layer.parent is deprecated. Use the Layer.set('parent', parent) method instead."),e.set("parent",t)}},properties:{get:()=>(Ri("Layer.properties is deprecated. Use the Layer.getProperties() method instead."),e.getProperties()),set(t){Ri("Layer.properties is deprecated. Use the Layer.setProperties(newValue) method instead."),e.setProperties(t)}},visible:{get:()=>(Ri("Layer.visible is deprecated. Use the Layer.getVisible() method instead."),e.getVisible()),set(t){Ri("Layer.visible is deprecated. Use the Layer.setVisible(newValue) method instead."),e.setVisible(t)}}})},qa=yD,gP=Rn(mP(),1),xD="vectorTileFeature",v0={"EPSG:3857":new Xi({featureProjection:"EPSG:3857"})},Xa=class extends zu{translateZoom;constructor(e,t){super(e),this.translateZoom=t}getFeaturesAtCoordinate(e,t=5){let i=this.getMapLibrePixels(e,t);if(!i)return[];let r=this.getLayer().get("queryRenderedFeaturesOptions")||{};return this.getLayer().mapLibreMap?.queryRenderedFeatures(i,r).map(e=>this.toOlFeature(e))||[]}prepareFrame(){return!0}renderFrame(e){let t=this.getLayer(),{mapLibreMap:i}=t,r=t.getMapInternal();if(!t||!r||!i)return null;let n=i.getCanvas(),{viewState:a}=e;i.jumpTo({center:Wl(a.center,a.projection),zoom:(this.translateZoom?this.translateZoom(a.zoom):a.zoom)-1,bearing:zf(-a.rotation)});let s=t.getOpacity().toString();return n&&s!==n.style.opacity&&(n.style.opacity=s),n.isConnected?vD(n,e)||i.resize():r.render(),i.redraw(),i.getContainer()}getFeatures(e){let t=this.getLayer().getMapInternal()?.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(t))}forEachFeatureAtCoordinate(e,t,i,r){let n=this.getFeaturesAtCoordinate(e,i);return n.forEach(e=>{let t=e.getGeometry();t instanceof Wn&&r(e,this.getLayer(),t)}),n?.[0]}getMapLibrePixels(e,t){if(!e)return;let i=this.getLayer().mapLibreMap?.project(Wl(e));if(void 0===i?.x||void 0===i?.y)return;let r=[i.x,i.y];if(t){let[e,i]=r;r=[[e-t,i-t],[e+t,i+t]]}return r}toOlFeature(e){let t=this.getLayer().getMapInternal()?.getView()?.getProjection()?.getCode()||"EPSG:3857";v0[t]||(v0[t]=new Xi({featureProjection:t}));let i=v0[t].readFeature(e);return i&&i.set(xD,e,!0),i}};function vD(e,t){return e.width===Math.floor(t.size[0]*t.pixelRatio)&&e.height===Math.floor(t.size[1]*t.pixelRatio)}var bD=e=>{if(!e)return[];let{style:t}=e;if(!t)return[];let{sourceCaches:i}=t,r=[];return Object.values(i).forEach(e=>{if(e.used){let{attribution:t}=e.getSource();t&&(r=r.concat(t.replace(/&copy;/g,"©").split(/(<a.*?<\/a>)/)))}}),wD(r)},wD=e=>{let t=e.filter(e=>null!=e&&e.trim&&e.trim()),i=t.map(e=>e.toLowerCase());return[...new Set(i)].map(e=>t.find(t=>t.toLowerCase()===e))},Vd=bD,ju=class extends ql{mapLibreMap;loaded=!1;olListenersKeys=[];constructor(e){super({source:new Oo({attributions:()=>Vd(this.mapLibreMap)}),...e})}disposeInternal(){Bt(this.olListenersKeys),this.loaded=!1,this.mapLibreMap&&(this.mapLibreMap.triggerRepaint=()=>{},this.mapLibreMap.remove()),super.disposeInternal()}setMapInternal(e){super.setMapInternal(e),e?this.loadMapLibreMap():this.dispose()}loadMapLibreMap(){this.loaded=!1;let e=this.getMapInternal();if(e&&this.olListenersKeys.push(e.on("change:target",this.loadMapLibreMap.bind(this))),!e?.getTargetElement())return;if(!this.getVisible())return void this.olListenersKeys.push(this.once("change:visible",this.loadMapLibreMap.bind(this)));let t=document.createElement("div");t.style.position="absolute",t.style.width="100%",t.style.height="100%";let i=this.get("mapLibreOptions");this.mapLibreMap=new gP.Map(Object.assign({},i,{container:t,attributionControl:!1,interactive:!1,trackResize:!1})),this.mapLibreMap.on("sourcedata",()=>{this.getSource()?.refresh()}),this.mapLibreMap.once("load",()=>{this.loaded=!0,this.dispatchEvent(new Ff("load"))})}createRenderer(){let e=this.get("translateZoom");return new Xa(this,e)}},w0=Rn(Vo());function _P(e,t){return e.transform.width===Math.floor(t.size[0])&&e.transform.height===Math.floor(t.size[1])}var jd=class extends Xa{constructor(e,t){super(e,t),this.ignoreNextRender=!1,this.translateZoom2=t,this.setIsReady=this.setIsReady.bind(this),this.ignoreNextRender=!1}prepareFrame(){return!0}renderFrame(e){let t=this.getLayer(),{mapLibreMap:i}=t,r=t.getMapInternal();if(!t||!r||!i)return null;if(i.off("idle",this.setIsReady),this.ready&&this.ignoreNextRender&&_P(i,e))return this.ignoreNextRender=!1,i.getContainer();this.ready=!1,this.ignoreNextRender=!1;let n=i.getCanvas(),{viewState:a}=e;i.jumpTo({bearing:zf(-a.rotation),center:Wl(a.center,a.projection),zoom:(this.translateZoom2?this.translateZoom2(a.zoom):a.zoom)-1});let s=t.getOpacity().toString();return s!==n?.style.opacity&&(n.style.opacity=s),n.isConnected?_P(i,e)||i.resize():r.render(),i.once("idle",this.setIsReady),i.redraw(),i.getContainer()}setIsReady(){var e;this.ready||(this.ready=!0,this.ignoreNextRender=!0,null===(e=this.getLayer())||void 0===e||e.changed())}},yP=(e,t,i,r)=>Pd(Yf(e,`/styles/${t}/style.json`),{[r]:i}).toString(),Gu=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(Gu=(0,w0.default)(e=>{console.warn(e)},1e3));var b0=class e extends ju{set apiKey(e){this.set("apiKey",e)}get apiKey(){return this.get("apiKey")}set apiKeyName(e){this.set("apiKeyName",e)}get apiKeyName(){return this.get("apiKeyName")}get maplibreMap(){return Gu("MaplibreLayer.maplibreMap is deprecated. Use layer.mapLibreMap."),this.mapLibreMap}get mbMap(){return Gu("MaplibreLayer.mbMap is deprecated. Use layer.maplibreMap."),this.maplibreMap}get style(){return this.get("style")}set style(e){this.set("style",e)}get url(){return this.get("url")}set url(e){this.set("url",e)}constructor(e){var t,i;e.mapOptions&&!e.mapLibreOptions&&(Gu("MaplibreLayer.mapOptions is deprecated. Use mapLibreOptions instead."),e.mapLibreOptions=e.mapOptions);let r=Object.assign(Object.assign({apiKeyName:"key",style:"travic_v2",url:"https://maps.geops.io"},e||{}),{mapLibreOptions:Object.assign({fadeDuration:10},e.mapLibreOptions||{}),source:null!==(t=e.source)&&void 0!==t?t:new Oo({attributions:()=>{var e,t;let i=null===(e=this.mapLibreMap)||void 0===e?void 0:e.style;return this.mapLibreMap&&i&&!i.sourceCaches&&(this.mapLibreMap.style.sourceCaches=null!==(t=this.mapLibreMap.style.tileManagers)&&void 0!==t?t:{}),Vd(this.mapLibreMap)}})});!r.mapLibreOptions.style&&null!==(i=r.url)&&void 0!==i&&i.includes("style.json")?r.mapLibreOptions.style=r.url:!r.mapLibreOptions.style&&r.apiKey&&r.style&&"string"==typeof r.style&&(r.mapLibreOptions.style=yP(r.url,r.style,r.apiKey,r.apiKeyName)),super(r),this.olEventsKeys=[],qa(this,e),this.set("options",e)}attachToMap(){let e=(0,w0.default)(this.updateMaplibreMap.bind(this),150);this.olEventsKeys.push(this.on("propertychange",t=>{/(url|style|apiKey|apiKeyName)/.test(t.key)&&e()}))}clone(t){return new e(Object.assign(Object.assign({},this.get("options")||{}),t||{}))}createRenderer(){return new jd(this)}detachFromMap(){Bt(this.olEventsKeys)}disposeInternal(){let e=this.getSource();super.disposeInternal(),this.mapLibreMap=void 0,this.setSource(e)}getStyle(){var e;if(this.style&&"object"==typeof this.style&&this.style.name&&this.style.version)return this.style;if(this.url.includes("style.json"))return this.url;let t=this.get("options");return null!==(e=t?.mapLibreOptions)&&void 0!==e&&e.style?t.mapLibreOptions.style:yP(this.url,this.style,this.apiKey,this.apiKeyName)}setMapInternal(e){e?(super.setMapInternal(e),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(e))}updateMaplibreMap(){var e;try{null===(e=this.mapLibreMap)||void 0===e||e.setStyle(this.getStyle(),{diff:!1})}catch(e){console.error("Error while updating MaplibreMap",e)}}},S0=b0,xP=Rn(Vo()),T0={"EPSG:3857":new Xi({featureProjection:"EPSG:3857"})},Gd=class extends zu{forEachFeatureAtCoordinate(e,t,i,r){let n=this.getFeaturesAtCoordinate(e,i);return n.forEach(e=>{r(e,this.layer_,e.getGeometry())}),n?.[0]}getFeatures(e){var t,i;let r=null===(i=null===(t=this.getLayer())||void 0===t?void 0:t.getMapInternal())||void 0===i?void 0:i.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(e,t=5){var i,r,n;if(!e)return[];let a=this.getLayer(),s=a.getMapInternal(),o=null===(i=a.maplibreLayer)||void 0===i?void 0:i.mapLibreMap,l=(null===(n=null===(r=s?.getView())||void 0===r?void 0:r.getProjection())||void 0===n?void 0:n.getCode())||"EPSG:3857",h=[];if(T0[l]||(T0[l]=new Xi({featureProjection:l})),o?.isStyleLoaded()){let i=e&&o.project(Wl(e));if(i?.x&&i?.y){let e=[i.x,i.y];if(t){let[i,r]=e;e=[[i-t,r-t],[i+t,r+t]]}let r=a.layers||[];a.layersFilter&&(r=o.getStyle().layers.filter(a.layersFilter)),a.queryRenderedLayersFilter&&(r=o.getStyle().layers.filter(a.queryRenderedLayersFilter)),h=o.queryRenderedFeatures(e,{layers:r.map(e=>e.id),validate:!1}).map(e=>{let t=T0[l].readFeature(e);return t&&t.set(Jf,e),t})}}return h}prepareFrame(){return!0}renderFrame(e,t){return t??document.createElement("div")}},wn=()=>{};typeof window<"u"&&new URLSearchParams(window.location.search).get("deprecated")&&(wn=(0,xP.default)((...e)=>{console.warn(...e)},1e3));var Ys,P0=class e extends ql{get beforeId(){return this.get("beforeId")}set beforeId(e){this.set("beforeId",e)}get layers(){return this.get("layers")||[]}set layers(e){this.set("layers",e)}get layersFilter(){return this.get("layersFilter")}set layersFilter(e){this.set("layersFilter",e)}get mapboxLayer(){return wn("Deprecated. Use maplibreLayer instead."),this.get("maplibreLayer")}get maplibreLayer(){return this.get("maplibreLayer")}set maplibreLayer(e){this.set("maplibreLayer",e)}get queryRenderedLayersFilter(){return this.get("queryRenderedLayersFilter")}set queryRenderedLayersFilter(e){this.set("queryRenderedLayersFilter",e)}get sources(){return this.get("sources")}set sources(e){this.set("sources",e)}get styleLayer(){return wn("Deprecated. Use MaplibreStyleLayer.layer instead."),this.layers[0]}set styleLayer(e){wn("MaplibreStyleLayer.styleLayer is deprecated. Use MaplibreStyleLayer.layer instead."),this.layers=[e]}get styleLayers(){return wn("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers}set styleLayers(e){wn("MaplibreStyleLayer.styleLayers is deprecated. Use MaplibreStyleLayer.layers instead."),this.layers=e}constructor(e={mapLibreOptions:{style:{layers:[],sources:{},version:8}}}){e.mapboxLayer&&(wn("options.mapboxLayer is deprecated. Use options.maplibreLayer instead."),e.maplibreLayer=e.mapboxLayer,delete e.mapboxLayer),e.styleLayer&&(wn("options.styleLayer is deprecated. Use options.layers instead."),e.layers=[e.styleLayer],delete e.styleLayer),e.styleLayers&&(wn("options.styleLayers is deprecated. Use options.layers instead."),e.layers=e.styleLayers,delete e.styleLayers),e.styleLayersFilter&&(wn("options.styleLayersFilter is deprecated. Use options.layersFilter instead."),e.layersFilter=e.styleLayersFilter,delete e.styleLayersFilter),super(Object.assign({source:new Oo({})},e)),this.highlightedFeatures=[],this.olEventsKeys=[],this.selectedFeatures=[],qa(this,e),this.set("options",e),this.beforeId=e.beforeId,this.onLoad=this.onLoad.bind(this),!this.layersFilter&&this.layers&&(this.layersFilter=e=>!!this.layers.find(t=>e.id===t.id))}addLayers(){var e;if(null===(e=this.maplibreLayer)||void 0===e||!e.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&(this.layers.forEach(e=>{let{id:i,source:r}=e;(!r||r&&t.getSource(r))&&i&&!t.getLayer(i)&&t.addLayer(e,this.beforeId)}),this.applyLayoutVisibility())}addSources(){var e;if(null===(e=this.maplibreLayer)||void 0===e||!e.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.entries(this.sources).forEach(([e,i])=>{t.getSource(e)||t.addSource(e,i)})}applyLayoutVisibility(e){var t,i,r,n,a,s;if(null===(i=null===(t=this.maplibreLayer)||void 0===t?void 0:t.mapLibreMap)||void 0===i||!i.getStyle()||!this.layersFilter)return;let{mapLibreMap:o}=this.maplibreLayer,l=o.getStyle(),h=this.getVisible()?"visible":"none",u=l.layers||[],c=Number.isFinite(this.getMinZoom()),d=Number.isFinite(this.getMaxZoom()),p=c?this.getMinZoom()-1:0,f=d?this.getMaxZoom()-1:24;for(let e=0;e<u.length;e+=1){let t=u[e];if(this.layersFilter(t)){let{id:e}=t;if(o.getLayer(e)&&(o.setLayoutProperty(e,"visibility",h),c||d)){let t=null!==(n=null===(r=o.getLayer(e))||void 0===r?void 0:r.minzoom)&&void 0!==n?n:0,i=null!==(s=null===(a=o.getLayer(e))||void 0===a?void 0:a.maxzoom)&&void 0!==s?s:24;o.setLayerZoomRange(e,t<p?p:t,i>f?f:i)}}}}attachToMap(e){if(!this.getMapInternal()||!this.maplibreLayer)return;let{mapLibreMap:t}=this.maplibreLayer;t&&(t.loaded()||t.isStyleLoaded()?this.onLoad():t.once("load",this.onLoad)),this.olEventsKeys.push(this.maplibreLayer.on("load",this.onLoad.bind(this)),this.on("change:visible",e=>{this.applyLayoutVisibility(e)}),this.on("propertychange",t=>{/(sources|layers|layersFilter|maplibreLayer|beforeId)/.test(t.key)&&(this.detachFromMap(),this.attachToMap(e))}),this.maplibreLayer.on("propertychange",e=>{if("style"===e.key){let t=e.target.mapLibreMap;t?.once("styledata",()=>{t?.once("idle",()=>{this.onLoad()})})}}))}clone(t){return new e(Object.assign(Object.assign({},this.get("options")||{}),t||{}))}createRenderer(){return new Gd(this)}detachFromMap(){var e;Bt(this.olEventsKeys),null!==(e=this.maplibreLayer)&&void 0!==e&&e.mapLibreMap&&(this.maplibreLayer.mapLibreMap.off("load",this.onLoad),this.removeLayers(),this.removeSources())}highlight(e=[]){var t;wn("Deprecated. Use layer.setFeatureState(features, {hover: true}) instead.");let i=(null===(t=this.highlightedFeatures)||void 0===t?void 0:t.filter(e=>!(this.selectedFeatures||[]).map(e=>e.getId()).includes(e.getId())))||[];this.setHoverState(i,!1),this.highlightedFeatures=e,this.setHoverState(this.highlightedFeatures,!0)}onLoad(){var e;if(null===(e=this.maplibreLayer)||void 0===e||!e.mapLibreMap)return;this.addSources(),this.addLayers();let{mapLibreMap:t}=this.maplibreLayer,i=t.getStyle();if(i?.layers&&this.layersFilter){let e=i.layers.filter(this.layersFilter);this.set("disabled",!e.length)}this.applyLayoutVisibility()}removeLayers(){var e;if(null===(e=this.maplibreLayer)||void 0===e||!e.mapLibreMap||!Array.isArray(this.layers))return;let{mapLibreMap:t}=this.maplibreLayer;t&&this.layers.forEach(e=>{let{id:i}=e;i&&t?.getLayer(i)&&t.removeLayer(i)})}removeSources(){var e;if(null===(e=this.maplibreLayer)||void 0===e||!e.mapLibreMap||!this.sources)return;let{mapLibreMap:t}=this.maplibreLayer;t&&Object.keys(this.sources).forEach(e=>{t.getSource(e)&&t.removeSource(e)})}select(e=[]){wn("Deprecated. Use layer.setFeatureState(features, {selected: true}) instead."),this.setHoverState(this.selectedFeatures||[],!1),this.selectedFeatures=e,this.setHoverState(this.selectedFeatures||[],!0)}setFeatureState(e,t){var i;if(null===(i=this.maplibreLayer)||void 0===i||!i.mapLibreMap||!e.length)return;let r=this.maplibreLayer.mapLibreMap;e.forEach(e=>{let{source:i,sourceLayer:n}=e.get(Jf)||{};(i||n)&&e.getId()?i?r.setFeatureState({id:e.getId(),source:i,sourceLayer:n},t):wn("No source found for the feature. To use the feature state functionnality, a source must be defined.",e.getProperties()):e.getId()||wn("No feature's id found. To use the feature state functionnality, tiles must be generated with --generate-ids. See https://github.com/Maplibre/tippecanoe#adding-calculated-attributes.",e.getProperties())})}setHoverState(e,t){wn(`Deprecated. Use layer.setFeatureState(features, {hover: ${t}}) instead.`),this.setFeatureState(e,{hover:t})}setMapInternal(e){e?(super.setMapInternal(e),this.attachToMap(e)):(this.detachFromMap(),super.setMapInternal(e))}},Xs=P0,SD=(e=1,t=[235,0,0,1])=>{if(1===e)return t;let i=document.createElement("canvas"),r=B2;i.width=20*r,i.height=20*r;let n={},a=i.getContext("2d");if(a){switch(a.strokeStyle=`rgba(${t.toString()})`,a.fillStyle=`rgba(${t.toString()})`,a.lineWidth=3,e){case 2:a.beginPath(),a.moveTo(0,i.height),a.lineTo(0,i.height-a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,0),a.lineTo(i.width,0),a.lineTo(i.width,a.lineWidth/2),a.lineTo(a.lineWidth/2,i.height),a.lineTo(a.lineWidth/2,i.height),a.fill(),a.closePath(),a.beginPath(),a.moveTo(0,0),a.lineTo(0,a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,i.height),a.lineTo(i.width,i.height),a.lineTo(i.width,i.height-a.lineWidth/2),a.lineTo(a.lineWidth/2,0),a.lineTo(0,0),a.fill(),a.closePath(),n=a.createPattern(i,"repeat"),n.canvas=i;break;case 3:a.beginPath(),a.moveTo(0,0),a.lineTo(0,a.lineWidth/2),a.lineTo(a.lineWidth/2,0),a.fill(),a.closePath(),a.beginPath(),a.moveTo(0,i.height),a.lineTo(0,i.height-a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,0),a.lineTo(i.width,0),a.lineTo(i.width,a.lineWidth/2),a.lineTo(a.lineWidth/2,i.height),a.lineTo(a.lineWidth/2,i.height),a.fill(),a.closePath(),a.beginPath(),a.moveTo(i.width,i.height),a.lineTo(i.width,i.height-a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,i.height),a.fill(),a.closePath(),n=a.createPattern(i,"repeat"),n.canvas=i;break;case 4:a.beginPath(),a.moveTo(i.width,0),a.lineTo(i.width,a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,0),a.fill(),a.closePath(),a.beginPath(),a.moveTo(0,0),a.lineTo(0,a.lineWidth/2),a.lineTo(i.width-a.lineWidth/2,i.height),a.lineTo(i.width,i.height),a.lineTo(i.width,i.height-a.lineWidth/2),a.lineTo(a.lineWidth/2,0),a.lineTo(0,0),a.fill(),a.closePath(),a.beginPath(),a.moveTo(0,i.height),a.lineTo(0,i.height-a.lineWidth/2),a.lineTo(a.lineWidth/2,i.height),a.fill(),a.closePath(),n=a.createPattern(i,"repeat"),n.canvas=i}return 0===e&&(n.empty=!0),n.id=e,n.color=t,n}},vP=SD,I0="circleGeometryCenter",M0="circleGeometryRadius",Sm=kr("EPSG:4326"),E0=new Hn({color:[255,0,0,.7]}),wP=new qn({color:[255,0,0,1],width:1.5}),TD=new Va({fill:E0,radius:7,stroke:wP}),PD=new Fr({fill:E0,image:TD,stroke:wP,text:new ec({fill:E0,font:"normal 16px Helvetica",stroke:new qn({color:[255,255,255,1],width:3})})}),ID=e=>32/Math.min(e[0],e[1]),MD=(e,t)=>{let i=e.getSize()||[48,48],r=e.getScale()||1,n=e.getAnchor()||[i[0]*r/2,i[1]*r/2],a=[r*(i[0]-n[0])+5,r*(i[1]/2-n[1])];t.setOffsetX(a[0]),t.setOffsetY(a[1]),t.setTextAlign("left")},C0=(e,t=!0,i=0)=>{let r=e?.getCoordinates();if(!r)return;let n=r.length-1;return t?r[i]:r[n-i]},bP=(e,t,i,r=!0)=>{let n=e.getGeometry(),a=C0(n,r,1),s=C0(n,r);if(!a||!s)return new Fr;let o=r?a[0]-s[0]:s[0]-a[0],l=r?a[1]-s[1]:s[1]-a[1],h=Math.atan2(l,o);return new Fr({geometry:e=>{let t=e.getGeometry();return new bn(C0(t,r))},image:new so({color:i,rotateWithView:!0,rotation:-h,scale:t.scale,size:t.size,src:t.url}),zIndex:t.zIndex})},A0=class{constructor(){this.writeDocumentCamera=(e,t)=>{let i=Yn(this.removeDocumentCamera(e));if(t){let e=i.createElement("Camera");Object.keys(t).forEach(r=>{let n=i.createElement(`${r.charAt(0).toUpperCase()+r.slice(1)}`);n.innerHTML=t[r],e.appendChild(n)}),i.getElementsByTagName("Document")[0].appendChild(e)}return(new XMLSerializer).serializeToString(i)}}readFeatures(e,t={}){let{featureProjection:i=Sm}=t,r=(new m0).readFeatures(e,t);return r.forEach(e=>{var r,n;let{[I0]:a,[M0]:s}=e?.getProperties()||{};if(e&&a&&s){let t=new qS(M_(JSON.parse(a),Sm,i),parseFloat(s));t.setProperties(null!==(n=null===(r=e?.getGeometry())||void 0===r?void 0:r.getProperties())&&void 0!==n?n:{}),e.setGeometry(t)}this.sanitizeFeature(e,t)}),r}removeDocumentCamera(e){let t=Yn(e),i=t.getElementsByTagName("Camera")[0];return i&&i.remove(),(new XMLSerializer).serializeToString(t)}sanitizeFeature(e,t){var i,r,n,a,s,o,l;let{applyMinMaxZoom:h=!0,doNotRevert32pxScaling:u=!1,getResolutionForZoom:c}=t,d=e.getGeometry(),p=e.getStyleFunction(),f=parseFloat(e.get("maxZoom"));Number.isNaN(f)||e.set("maxZoom",f);let m=parseFloat(e.get("minZoom"));Number.isNaN(m)||e.set("minZoom",m);let g,_=p?.(e,1),y=null===(i=Array.isArray(_)?_[0]:_)||void 0===i?void 0:i.clone(),v=y?.getStroke();if(e.get("lineCap")&&v?.setLineCap(e.get("lineCap")),e.get("lineJoin")&&v?.setLineJoin(e.get("lineJoin")),e.get("lineDash")&&v?.setLineDash((e?.get("lineDash")).split(",").map(e=>parseInt(e,10))),e.get("lineDashOffset")&&v?.setLineDashOffset(parseInt(e.get("lineDashOffset"),10)),e.get("miterLimit")&&v?.setMiterLimit(parseInt(e.get("miterLimit"),10)),v&&0===v.getWidth()&&(v=void 0),e.get("zIndex")&&y?.setZIndex(parseInt(e.get("zIndex"),10)),y&&(d instanceof bn||d instanceof js)){let t=y.getImage(),i=null,s=y.getFill();if(e.get("name")&&y.getText()&&0!==(null===(r=y.getText())||void 0===r?void 0:r.getScale())){t&&0===t.getScale()&&(t=new Va({fill:new Hn({color:[0,0,0,0]}),radius:1,stroke:new qn({color:[0,0,0,0]})}));let r=e.get("name");/\u200B/g.test(r)&&(r=r.replace(/\u200B/g,""),e.set("name",r));let s=e.get("textFont")||"normal 16px Arial";if(r.includes("\n")){let e=[],t=r.split("\n");t.forEach((i,r)=>{e.push(i||"​",i?s:""),r<t.length-1&&e.push("\n","")}),r=e}else r=[r,s];if(i=new ec({fill:y.getText().getFill(),font:`${s.replace(/bold/g,"normal")}, Arial, sans-serif`,rotation:e.get("textRotation")||0,scale:null===(n=y.getText())||void 0===n?void 0:n.getScale(),text:r}),e.get("textArray"))try{let t=JSON.parse((e.get("textArray")||"").replace(/\r?\n/g,"\\n"));i.setText(t)}catch(t){console.error("Error parsing textArray",e.get("textArray"),t)}e.get("textStrokeColor")&&e.get("textStrokeWidth")&&i.setStroke(new qn({color:e.get("textStrokeColor"),width:parseFloat(e.get("textStrokeWidth"))})),e.get("textAlign")&&i.setTextAlign(e.get("textAlign")),e.get("textOffsetX")&&i.setOffsetX(parseFloat(e.get("textOffsetX"))),e.get("textOffsetY")&&i.setOffsetY(parseFloat(e.get("textOffsetY"))),e.get("textBackgroundFillColor")&&i.setBackgroundFill(new Hn({color:e.get("textBackgroundFillColor")})),e.get("textPadding")&&i.setPadding(null===(a=e.get("textPadding"))||void 0===a?void 0:a.split(",").map(e=>parseFloat(e))),t instanceof so&&MD(t,i)}if(t instanceof so)if(t.setRotation(parseFloat(e.get("iconRotation"))||0),e.get("iconScale"))t.setScale(parseFloat(e.get("iconScale"))||0);else if(!u&&t.getSize()){let e=ID(t.getSize());t.setScale(t.getScaleArray()[0]/e)}s=null,v=null,p=(e,r)=>{var n;if(e.get("pictureOptions")){let i=e.get("pictureOptions");"string"==typeof i&&(i=JSON.parse(i)),e.set("pictureOptions",i),i.resolution&&t?.setScale(i.resolution/r*(null!==(n=i?.defaultScale)&&void 0!==n?n:1))}return new Fr({fill:s??void 0,image:t??void 0,stroke:v??void 0,text:i??void 0,zIndex:y.getZIndex()})}}if(!(d instanceof bn||d instanceof js||d instanceof ao)){p=[new Fr({fill:null!==(s=y?.getFill())&&void 0!==s?s:void 0,image:void 0,stroke:v??void 0,text:void 0,zIndex:y?.getZIndex()})];let t=e.get("fillPattern");if(t){let i=JSON.parse(t);e.set("fillPattern",i),y?.getFill()||p[0].setFill(new Hn);let r=i?.empty?[0,0,0,0]:vP(i.id,i.color);null===(l=null===(o=p[0])||void 0===o?void 0:o.getFill())||void 0===l||l.setColor(r)}e.get("lineStartIcon")&&p.push(bP(e,JSON.parse(e.get("lineStartIcon")),v?.getColor())),e.get("lineEndIcon")&&p.push(bP(e,JSON.parse(e.get("lineEndIcon")),v?.getColor(),!1))}h&&c&&(!Number.isNaN(e.get("minZoom"))||!Number.isNaN(e.get("maxZoom")))&&(g=(t,i)=>{let r=c(e.get("minZoom")||-1/0),n=c(e.get("maxZoom")||1/0);if(Number.isNaN(i)||!(i>r||n>i))return"function"==typeof p?p(t,i):p}),e.setStyle(g??p)}writeFeatures(e,t,i){var r,n;let a,s=[];return[...null!==(n=null===(r=e?.getSource())||void 0===r?void 0:r.getFeatures())&&void 0!==n?n:[]].sort((e,t)=>wi(e)<=wi(t)?-1:1).forEach(r=>{var n,a,o,l,h,u,c,d,p,f,m,g,_,y,v,x,b,w,T,S,I,P,C,E,M,A,k,L,F,D,R;let z,N=r.clone();if("Circle"===(null===(n=N.getGeometry())||void 0===n?void 0:n.getType())){let e=r.getGeometry();N.setGeometry(R2(e,100)),N.set(I0,JSON.stringify(M_(e.getCenter(),t,Sm))),N.set(M0,e.getRadius())}N.setId(r.getId()),null===(a=N.getGeometry())||void 0===a||a.transform(t,Sm),Object.keys(r.getProperties()).forEach(e=>{[I0,M0,"description","geometry","name"].includes(e)||N.unset(e,!0)}),r.getStyleFunction()?z=null===(o=r.getStyleFunction())||void 0===o?void 0:o(r,i):e?.getStyleFunction()&&(z=null===(l=e.getStyleFunction())||void 0===l?void 0:l(r,i));let O=Array.isArray(z)?z[0]:z,B={fill:null!==(h=O?.getFill())&&void 0!==h?h:void 0,image:null!==(u=O?.getImage())&&void 0!==u?u:void 0,stroke:null!==(c=O?.getStroke())&&void 0!==c?c:void 0,text:null!==(d=O?.getText())&&void 0!==d?d:void 0,zIndex:null!==(p=O?.getZIndex())&&void 0!==p?p:void 0};B.zIndex&&N.set("zIndex",B.zIndex);let j=null===(f=B.text)||void 0===f?void 0:f.getText();if(j){let e="";Array.isArray(j)&&(N.set("textArray",JSON.stringify(j)),e=j.map((e,t)=>t%2==0?e:"").join("").replace(/\u200B/g,"")),e&&(/^(\s|\n)|(\n|\s)$/g.test(e)?N.set("name",`​${e}​`):N.set("name",e))}if(!(null===(m=B.text)||void 0===m)&&m.getRotation()&&N.set("textRotation",B.text.getRotation()),!(null===(g=B.text)||void 0===g)&&g.getFont()&&N.set("textFont",B.text.getFont()),!(null===(_=B.text)||void 0===_)&&_.getTextAlign()&&N.set("textAlign",B.text.getTextAlign()),!(null===(y=B.text)||void 0===y)&&y.getOffsetX()&&N.set("textOffsetX",B.text.getOffsetX()),!(null===(v=B.text)||void 0===v)&&v.getOffsetY()&&N.set("textOffsetY",B.text.getOffsetY()),!(null===(x=B.text)||void 0===x)&&x.getStroke()&&(!(null===(b=B.text.getStroke())||void 0===b)&&b.getColor()&&N.set("textStrokeColor",R_(null===(w=B.text.getStroke())||void 0===w?void 0:w.getColor())),!(null===(T=B.text.getStroke())||void 0===T)&&T.getWidth()&&N.set("textStrokeWidth",null===(S=B.text.getStroke())||void 0===S?void 0:S.getWidth())),!(null===(I=B.text)||void 0===I)&&I.getBackgroundFill()&&N.set("textBackgroundFillColor",R_(null===(P=B.text.getBackgroundFill())||void 0===P?void 0:P.getColor())),!(null===(C=B.text)||void 0===C)&&C.getPadding()&&N.set("textPadding",null===(E=B.text.getPadding())||void 0===E?void 0:E.join()),!(null===(M=B.stroke)||void 0===M)&&M.getLineCap()&&N.set("lineCap",B.stroke.getLineCap()),!(null===(A=B.stroke)||void 0===A)&&A.getLineJoin()&&N.set("lineJoin",B.stroke.getLineJoin()),!(null===(k=B.stroke)||void 0===k)&&k.getLineDash()&&N.set("lineDash",null===(L=B.stroke.getLineDash())||void 0===L?void 0:L.join(",")),!(null===(F=B.stroke)||void 0===F)&&F.getLineDashOffset()&&N.set("lineDashOffset",B.stroke.getLineDashOffset()),!(null===(D=B.stroke)||void 0===D)&&D.getMiterLimit()&&N.set("miterLimit",B.stroke.getMiterLimit()),B.image instanceof Va&&(B.image=void 0),B.image){let e=B.image.getSrc();/(http(s?)):\/\//gi.test(e)||console.log("Local image source not supported for KML export.Should use remote web server"),B.image.getRotation()&&N.set("iconRotation",B.image.getRotation()),B.image.getScale()&&N.set("iconScale",B.image.getScale()),r.get("pictureOptions")&&N.set("pictureOptions",JSON.stringify(r.get("pictureOptions")))}r.get("fillPattern")&&(N.set("fillPattern",JSON.stringify(r.get("fillPattern"))),B.fill=void 0);let V=parseFloat(r.get("maxZoom"));Number.isNaN(V)||N.set("maxZoom",V);let G=parseFloat(r.get("minZoom"));Number.isNaN(G)||N.set("minZoom",G),B.text&&!B.image&&(B.image=new so({scale:0,src:"noimage"})),(Array.isArray(z)&&z.slice(1)||[]).forEach(e=>{var t,i,n,a,s,o,l,h,u;if(e&&e.getImage()instanceof so&&e.getGeometry()){let c=null===(i=null===(t=e?.getGeometry())||void 0===t?void 0:t(r))||void 0===i?void 0:i.getCoordinates(),d=null===(n=r.getGeometry())||void 0===n?void 0:n.getFirstCoordinate();c?.[0]===d?.[0]&&c?.[1]===d?.[1]?N.set("lineStartIcon",JSON.stringify({scale:null===(a=e?.getImage())||void 0===a?void 0:a.getScale(),size:null===(s=e?.getImage())||void 0===s?void 0:s.getSize(),url:null===(o=e?.getImage())||void 0===o?void 0:o.getSrc(),zIndex:e?.getZIndex()})):N.set("lineEndIcon",JSON.stringify({scale:null===(l=e.getImage())||void 0===l?void 0:l.getScale(),size:null===(h=e.getImage())||void 0===h?void 0:h.getSize(),url:null===(u=e.getImage())||void 0===u?void 0:u.getSrc(),zIndex:e.getZIndex()}))}});let U=new Fr(B);N.setStyle(U),N.getGeometry()instanceof bn&&U.getText()&&(null===(R=U.getText())||void 0===R||!R.getText())||s.push(N)}),s.length>0&&(1===s.length&&s.push(new Eo),a=new m0({defaultStyle:[PD],extractStyles:!0}).writeFeatures(s),a=a.replace(/<Icon>\s*<href>noimage<\/href>\s*<\/Icon>/g,""),a=a.replace(/<Placemark\/>/g,""),e.get("name")&&(a=a.replace(/<Document>/,`<Document><name>${e.get("name")}</name>`))),a}},SP=A0,TP=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},L0=function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i},Tm=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},CD=new SP,R0=class extends pm{get api(){return this.get("api")}set api(e){this.set("api",e),this.fetchPlans()}get apiKey(){return this.api.apiKey}set apiKey(e){this.api.apiKey!==e&&(this.api.apiKey=e,this.fetchPlans())}get planId(){return this.get("planId")}set planId(e){this.planId!==e&&(this.set("planId",e),this.fetchPlanById(e))}get plans(){return this.get("plans")}set plans(e){this.set("plans",e),this.updateFeatures()}get tags(){return this.api.tags}set tags(e){var t;(null===(t=this.api.tags)||void 0===t?void 0:t.toString())!==e?.toString()&&(this.api.tags=e,this.fetchPlans())}get tenants(){return this.api.tenants}set tenants(e){var t;(null===(t=this.api.tenants)||void 0===t?void 0:t.toString())!==e?.toString()&&(this.api.tenants=e,this.fetchPlans())}get timestamp(){return this.get("timestamp")}set timestamp(e){this.timestamp!==e&&(this.set("timestamp",e),this.fetchPlans())}get url(){var e;return null===(e=this.api)||void 0===e?void 0:e.url}set url(e){var t;this.api&&(null===(t=this.api)||void 0===t?void 0:t.url)!==e&&(this.api.url=e,this.fetchPlans())}constructor(e){var t,i;super(Object.assign({source:null!==(t=e.source)&&void 0!==t?t:new Gs},e||{})),this.loadAll=!0,this.olEventsKeys=[],Ys.set(this,void 0),this.api=null!==(i=e.api)&&void 0!==i?i:new FS({apiKey:e.apiKey,tags:e.tags,tenants:e.tenants,url:e.url}),L0(this,Ys,new AbortController,"f"),!1===e.loadAll&&(this.loadAll=e.loadAll),qa(this,e)}fetchPlanById(e){return TP(this,void 0,void 0,function*(){var t;if(null===(t=Tm(this,Ys,"f"))||void 0===t||t.abort(),L0(this,Ys,new AbortController,"f"),!e)return void(this.plans=[]);let i;try{this.dispatchEvent("featuresloadstart"),i=yield this.api.getPlanById(e,{signal:Tm(this,Ys,"f").signal}),this.plans=[i],this.dispatchEvent("featuresloadend")}catch(e){if((e?.name).includes("AbortError"))return;throw console.error("MapsetLayer: Error fetching plan by ID...",e),this.plans=[],this.dispatchEvent("featuresloaderror"),e}})}fetchPlans(){return TP(this,void 0,void 0,function*(){var e,t,i;if(!this.getVisible())return;let r=null===(e=this.getMapInternal())||void 0===e?void 0:e.getView();if(!r)return;let n=C_(r.calculateExtent(),r.getProjection(),"EPSG:4326"),a=r.getZoom();if(!a||!n)return void(this.plans=[]);null===(t=Tm(this,Ys,"f"))||void 0===t||t.abort(),L0(this,Ys,new AbortController,"f");let s=[];try{this.dispatchEvent("featuresloadstart"),s=yield this.api.getPlans({bbox:n?.toString(),timestamp:null!==(i=this.timestamp)&&void 0!==i?i:(new Date).toISOString(),zoom:a},{signal:Tm(this,Ys,"f").signal}),this.plans=s,this.dispatchEvent("featuresloadend")}catch(e){if((e?.name).includes("AbortError"))return[];throw this.dispatchEvent("featuresloaderror"),e}})}setMapInternal(e){super.setMapInternal(e),e&&this.loadAll?(this.fetchPlans(),this.olEventsKeys.push(e.on("moveend",()=>{this.fetchPlans()}),this.on("change:visible",()=>{this.fetchPlans()}))):Bt(this.olEventsKeys),e&&this.planId&&this.fetchPlanById(this.planId)}updateFeatures(){var e,t,i,r,n;null===(e=this.getSource())||void 0===e||e.clear();let a=this.getMapInternal();if(a&&0!==(null===(t=this.plans)||void 0===t?void 0:t.length)){let e=null!==(r=null===(i=this.plans)||void 0===i?void 0:i.flatMap(e=>{var t;return CD.readFeatures(e.data,Object.assign({featureProjection:a.getView().getProjection(),getResolutionForZoom:e=>a.getView().getResolutionForZoom(e)},null!==(t=this.get("readOptions"))&&void 0!==t?t:{}))}))&&void 0!==r?r:[];null===(n=this.getSource())||void 0===n||n.addFeatures(e)}this.dispatchEvent("updatefeatures")}};Ys=new WeakMap;var D0=R0,k0={1:"osm"};function Uu(e=0,t=k0){var i;let r=Object.keys(t).map(e=>parseFloat(e)),n=r.reverse().find(t=>t<=Math.floor(e)-1);return n??(n=Math.min(...r)),null!==(i=t[n])&&void 0!==i?i:"osm"}var Ks,$u,PP=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},Ya=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)},F0=function(e,t,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(e,i):n?n.value=i:t.set(e,i),i},Zu="moco",ED="moco",z0=class extends Xs{get api(){return this.get("api")}set api(e){this.set("api",e),this.updateData()}get apiKey(){return this.api.apiKey}set apiKey(e){this.api.apiKey=e,this.updateData()}get apiParameters(){return this.get("apiParameters")}set apiParameters(e){this.set("apiParameters",e),this.updateData()}get loadAll(){var e;return null===(e=this.get("loadAll"))||void 0===e||e}set loadAll(e){this.set("loadAll",e),this.updateData()}set publicAt(e){this.set("publicAt",e),this.updateData()}get publicAt(){return this.get("publicAt")}set situations(e){this.loadAll=!1,this.set("situations",e),this.updateData()}get situations(){return this.get("situations")}get tenant(){return this.get("tenant")}set tenant(e){this.set("tenant",e),this.updateData()}get url(){return this.api.url}set url(e){this.api.url=e,this.updateData()}get useGraphs(){return this.get("useGraphs")}constructor(e){super(Object.assign({api:new j_({apiKey:e.apiKey,tenant:e.tenant,url:e.url}),layersFilter:({metadata:e,source:t})=>e?.["general.filter"]===ED||t===Zu},e)),Ks.set(this,null),$u.set(this,{features:[],type:"FeatureCollection"})}attachToMap(e){var t,i;if(super.attachToMap(e),!(null===(i=null===(t=this.maplibreLayer)||void 0===t?void 0:t.mapLibreMap)||void 0===i)&&i.getSource(Zu)&&this.updateData(),this.useGraphs){let e=this.getMapInternal();e&&this.olEventsKeys.push(e.on("moveend",()=>{this.onZoomEnd()}))}}detachFromMap(){var e,t;super.detachFromMap();let i=null===(t=null===(e=this.maplibreLayer)||void 0===e?void 0:e.mapLibreMap)||void 0===t?void 0:t.getSource(Zu);i&&i.setData({features:[],type:"FeatureCollection"}),Ya(this,Ks,"f")&&(Ya(this,Ks,"f").abort(),F0(this,Ks,null,"f"))}getDataByGraph(e){var t,i,r,n,a;let s=Uu(null===(i=null===(t=this.getMapInternal())||void 0===t?void 0:t.getView())||void 0===i?void 0:i.getZoom(),null===(a=(null===(n=null===(r=this.maplibreLayer)||void 0===r?void 0:r.mapLibreMap)||void 0===n?void 0:n.getStyle()).metadata)||void 0===a?void 0:a.graphs);return{features:(e?.features||[]).filter(e=>{var t;return(null===(t=e.properties)||void 0===t?void 0:t.graph)===s}),type:"FeatureCollection"}}loadData(){return PP(this,void 0,void 0,function*(){var e,t,i,r,n;Ya(this,Ks,"f")&&Ya(this,Ks,"f").abort(),F0(this,Ks,new AbortController,"f");let a=(null===(i=(null===(t=null===(e=this.maplibreLayer)||void 0===e?void 0:e.mapLibreMap)||void 0===t?void 0:t.getStyle()).metadata)||void 0===i?void 0:i.graphs)??k0,s=[...new Set(Object.values(a))].join(",");try{return(yield this.api.export(Object.assign({graph:s,hasGeoms:!0,publicAt:null===(r=this.publicAt)||void 0===r?void 0:r.toISOString(),publicNow:!this.publicAt},null!==(n=this.apiParameters)&&void 0!==n?n:{}),{signal:Ya(this,Ks,"f").signal})).paginatedSituations.results}catch(e){if(e&&e.name.includes("AbortError"))return[];throw e}})}onLoad(){super.onLoad(),this.updateData()}onZoomEnd(){var e,t;let i=null===(t=null===(e=this.maplibreLayer)||void 0===e?void 0:e.mapLibreMap)||void 0===t?void 0:t.getSource(Zu);if(!i||!Ya(this,$u,"f").features.length)return;let r=this.getDataByGraph(Ya(this,$u,"f"));r!==Ya(this,$u,"f")&&i.setData(r)}updateData(){return PP(this,void 0,void 0,function*(){var e,t,i;if(this.loadAll){let e=yield this.loadData();this.set("situations",e??[])}let r=null===(t=null===(e=this.maplibreLayer)||void 0===e?void 0:e.mapLibreMap)||void 0===t?void 0:t.getSource(Zu);if(!r)return console.warn("MocoLayer: No source found for id : ",Zu),Promise.reject(new Error("No source found"));let n={features:(null!==(i=this.situations)&&void 0!==i?i:[]).flatMap(e=>tT(e,this.publicAt).features),type:"FeatureCollection"};return F0(this,$u,n,"f"),this.useGraphs?r.setData(this.getDataByGraph(n)):r.setData(n),Promise.resolve(!0)})}};Ks=new WeakMap,$u=new WeakMap;var O0=z0,U0=Rn(Vo()),N0=Rn(Vo()),V0=Rn(AP()),HD=Object.assign({delayDisplay:3e5,delayOutlineColor:"#000",getArrowSize:(e,t,i=0)=>[3*i/4,i],getColor:()=>"#000",getDelayColor:()=>"#000",getDelayFont:(e,t,i)=>`bold ${i}px arial, sans-serif`,getDelayText:()=>"",getDelayTextColor:()=>"#000",getImage:()=>null,getMaxRadiusForStrokeAndDelay:()=>7,getMaxRadiusForText:()=>10,getRadius:()=>5,getText:e=>{var t,i;return(null===(i=null===(t=e?.properties)||void 0===t?void 0:t.line)||void 0===i?void 0:i.name)||"U"},getTextColor:()=>"#fff",getTextFont:(e,t,i)=>`bold ${i}px arial, sans-serif`,getTextSize:()=>14,showDelayBg:!0,showDelayText:!0,showHeading:!1,useDelayStyle:!1},Sy),j0=class{get mode(){return this._mode}set mode(e){var t,i;e!==this._mode&&(this._mode=e,null!==(i=null===(t=this.api)||void 0===t?void 0:t.wsApi)&&void 0!==i&&i.open&&(this.stop(),this.start()))}get speed(){return this._speed}set speed(e){this._speed=e,this.start()}get style(){return this._style}set style(e){this._style=e,this.renderTrajectories()}get time(){return this._time}set time(e){this._time=e?.getTime?e:new Date(e),this.renderTrajectories()}constructor(e){var t,i,r,n,a,s,o,l,h,u,c,d,p,f,m,g,_;this.isIdle=!1,this.getViewState=()=>({}),this.shouldRender=()=>!0,this._mode=e.mode||Xr.TOPOGRAPHIC,this._speed=null!==(t=e.speed)&&void 0!==t?t:1,this._style=null!==(i=e.style)&&void 0!==i?i:Kf,this._time=null!==(r=e.time)&&void 0!==r?r:new Date,this.api=null!==(n=e.api)&&void 0!==n?n:new Z_(e),this.bboxParameters=e.bboxParameters,this.canvas=null!==(a=e.canvas)&&void 0!==a?a:typeof document<"u"?document.createElement("canvas"):void 0,this.debug=null!==(s=e.debug)&&void 0!==s&&s,this.filter=e.filter,this.hoverVehicleId=e.hoverVehicleId,this.live=!1!==e.live,this.minZoomInterpolation=null!==(o=e.minZoomInterpolation)&&void 0!==o?o:8,this.pixelRatio=null!==(l=e.pixelRatio)&&void 0!==l?l:typeof window<"u"?window.devicePixelRatio:1,this.selectedVehicleId=e.selectedVehicleId,this.sort=e.sort,this.styleOptions=Object.assign(Object.assign({},HD),null!==(h=e.styleOptions)&&void 0!==h?h:{}),this.tenant=null!==(u=e.tenant)&&void 0!==u?u:"",this.trajectories={},this.useDebounce=null!==(c=e.useDebounce)&&void 0!==c&&c,this.useRequestAnimationFrame=null!==(d=e.useRequestAnimationFrame)&&void 0!==d&&d,this.useThrottle=!1!==e.useThrottle,this.getViewState=null!==(p=e.getViewState)&&void 0!==p?p:()=>({}),this.shouldRender=null!==(f=e.shouldRender)&&void 0!==f?f:()=>!0,this.getRefreshTimeInMs=null!==(m=e.getRefreshTimeInMs)&&void 0!==m?m:this.getRefreshTimeInMs.bind(this),this.onRender=e.onRender,this.onIdle=e.onIdle,this.onStart=e.onStart,this.onStop=e.onStop,this.format=new Xi,this.motsByZoom=null!==(g=e.motsByZoom)&&void 0!==g?g:[zo,zo,zo,zo,zo,zo,zo,zo,zo,sm,sm],this.getMotsByZoom=t=>e.getMotsByZoom?e.getMotsByZoom(t,this.motsByZoom):t>this.motsByZoom.length-1?this.motsByZoom[this.motsByZoom.length-1]:this.motsByZoom[t],this.generalizationLevelByZoom=e.generalizationLevelByZoom||[],this.getGeneralizationLevelByZoom=t=>e.getGeneralizationLevelByZoom?e.getGeneralizationLevelByZoom(t,this.generalizationLevelByZoom):t>this.generalizationLevelByZoom.length-1?this.generalizationLevelByZoom[this.generalizationLevelByZoom.length-1]:this.generalizationLevelByZoom[t],this.graphByZoom=null!==(_=e.graphByZoom)&&void 0!==_?_:[],this.getGraphByZoom=t=>{var i,r;return e.getGraphByZoom?e.getGraphByZoom(t,this.graphByZoom):t>this.graphByZoom.length-1?null===(i=this.graphByZoom)||void 0===i?void 0:i[this.graphByZoom.length-1]:null===(r=this.graphByZoom)||void 0===r?void 0:r[t]},this.renderTimeIntervalByZoom=e.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=t=>e.getRenderTimeIntervalByZoom?e.getRenderTimeIntervalByZoom(t,this.renderTimeIntervalByZoom):this.renderTimeIntervalByZoom[t],this.isUpdateBboxOnMoveEnd=!1!==e.isUpdateBboxOnMoveEnd,this.throttleRenderTrajectories=(0,V0.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,N0.default)(this.renderTrajectoriesInternal,50,{leading:!0,maxWait:5e3,trailing:!0}),this.renderState={center:[0,0],rotation:0,zoom:void 0},this.onTrajectoryMessage=this.onTrajectoryMessage.bind(this),this.onDeleteTrajectoryMessage=this.onDeleteTrajectoryMessage.bind(this),this.onDocumentVisibilityChange=this.onDocumentVisibilityChange.bind(this)}addTrajectory(e){this.trajectories||(this.trajectories={});let t=e.properties.train_id;void 0!==t&&(this.trajectories[t]=e),this.renderTrajectories()}attachToMap(){document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){if(document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),this.canvas){let e=this.canvas.getContext("2d");e&&e.clearRect(0,0,this.canvas.width,this.canvas.height)}}getRefreshTimeInMs(){var e,t;let i=null!==(e=this.getViewState().zoom)&&void 0!==e?e:0,r=void 0!==i?Math.round(i):-1,n=this.getRenderTimeIntervalByZoom(r)||25,a=Math.max(25,n/(this.speed||1)),s=Math.min(a,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,V0.default)(this.renderTrajectoriesInternal,s,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,N0.default)(this.renderTrajectoriesInternal,s,{leading:!0,maxWait:5e3,trailing:!0})),null!==(t=this.api)&&void 0!==t&&t.buffer){let[,e]=this.api.buffer;this.api.buffer=[s,e]}return a}getVehicles(e){return this.trajectories&&Object.values(this.trajectories).filter(e)||[]}getVehiclesAtCoordinate(e,t){let{resolution:i}=this.getViewState(),{hitTolerance:r,nb:n}=t||{},a=Fa([...e,...e],(r??5)*(i??1)),s=Object.values(this.trajectories||{});this.sort&&(s=s.sort(this.sort));let o=[];for(let e=0;e<s.length;e+=1){let t=s[e],{coordinate:i}=t.properties;if(i&&Gl(a,i)&&o.push(t),o.length===n)break}return{features:o,type:"FeatureCollection"}}onDeleteTrajectoryMessage(e){e.content&&this.removeTrajectory(e.content)}onDocumentVisibilityChange(){if(document.hidden)this.stop(),this.trajectories={};else{if(!this.getViewState().visible)return;this.start()}}onTrajectoryMessage(e){if(this.updateIdleState(),!e.content)return;let t=e.content,{geometry:i,properties:{raw_coordinates:r,time_since_update:n}}=t;n<0||this.purgeTrajectory(t)||(this.debug&&this.mode===Xr.TOPOGRAPHIC&&r?t.properties.olGeometry=this.format.readGeometry({coordinates:md(r),type:"Point"}):t.properties.olGeometry=this.format.readGeometry(i),t.properties.timeOffset=Date.now()-e.timestamp,this.addTrajectory(t))}onZoomEnd(){this.startUpdateTime()}purgeOutOfDateTrajectories(){Object.entries(this.trajectories||{}).forEach(([e,t])=>{var i;let r=null===(i=t?.properties)||void 0===i?void 0:i.time_intervals;this.time&&r?.length&&r[r.length-1][0]<this.time.getTime()&&this.removeTrajectory(e)})}purgeTrajectory(e){let t=this.getViewState().extent,{bounds:i,type:r}=e.properties;return!!(this.isUpdateBboxOnMoveEnd&&t&&!Dr(t,i)||this.mots&&!this.mots.includes(r))&&(this.removeTrajectory(e),!0)}removeTrajectory(e){var t;let i;i="string"!=typeof e?null===(t=e?.properties)||void 0===t?void 0:t.train_id:e,void 0!==i&&this.trajectories&&delete this.trajectories[i]}renderTrajectories(e){let t=this.getViewState();this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=void 0),t?.center&&t?.extent&&t?.size&&(!e&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(t,e)}):!e&&this.useDebounce?this.debounceRenderTrajectories(t,e):!e&&this.useThrottle?this.throttleRenderTrajectories(t,e):this.renderTrajectoriesInternal(t,e))}renderTrajectoriesInternal(e,t=!1){var i;if(!this.trajectories||!this.shouldRender())return!1;let r=new Date;this.live?this._time=r:this.time&&(r=this.time);let n=Object.values(this.trajectories);return this.sort&&n.sort(this.sort),!this.canvas||!this.style||(this.renderState=uT(this.canvas,n,this.style,Object.assign(Object.assign({},e),{pixelRatio:this.pixelRatio||1,time:r.getTime()}),Object.assign(Object.assign({},this.styleOptions),{filter:this.filter,hoverVehicleId:this.hoverVehicleId,noInterpolate:(e.zoom||0)<this.minZoomInterpolation||t,selectedVehicleId:this.selectedVehicleId})),null===(i=this.onRender)||void 0===i||i.call(this,this.renderState,e)),!0}setBbox(){var e;this.updateIdleState();let t=this.getViewState(),i=t.extent,r=null!==(e=t.zoom)&&void 0!==e?e:0;if(!i||Number.isNaN(r))return;if(this.trajectories&&i&&r){let e=Object.keys(this.trajectories);for(let t=e.length-1;t>=0;t-=1)this.purgeTrajectory(this.trajectories[e[t]])}let n=Math.floor(r);if(!i||Number.isNaN(n))return;let[a,s,o,l]=i,h=[Math.floor(a),Math.floor(s),Math.ceil(o),Math.ceil(l),n];this.generalizationLevel=this.getGeneralizationLevelByZoom(n),this.generalizationLevel&&h.push(`gen=${this.generalizationLevel}`),this.mots=this.getMotsByZoom(n),this.mots&&h.push(`mots=${this.mots.toString()}`),this.tenant&&h.push(`tenant=${this.tenant}`),"topographic"!==this.mode&&h.push(`channel_prefix=${this.mode}`);let u=this.getGraphByZoom(n);u&&h.push(`graph=${u}`),this.bboxParameters&&Object.entries(this.bboxParameters).forEach(([e,t])=>{h.push(`${e}=${t}`)}),this.api.bbox=h}start(){this.stop(),this.purgeOutOfDateTrajectories(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,void 0,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.onStart&&this.onStart(this)}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs()||0,this.updateTimeInterval=window.setInterval(()=>{this.live?this.time=new Date:this.time&&this.updateTimeDelay&&this.speed&&(this.time=new Date(this.time.getTime()+this.updateTimeDelay*this.speed))},this.updateTimeDelay)}stop(){this.api.unsubscribeTrajectory(this.onTrajectoryMessage),this.api.unsubscribeDeletedVehicles(this.onDeleteTrajectoryMessage),this.api.close(),this.onStop&&this.onStop(this)}stopUpdateTime(){this.updateTimeInterval&&(clearInterval(this.updateTimeInterval),this.updateTimeInterval=void 0)}updateIdleState(){this.isIdle=!1,clearTimeout(this._idleTimeout),this._idleTimeout=window.setTimeout(()=>{var e;this.isIdle=!0,null===(e=this.onIdle)||void 0===e||e.call(this,this)},1e3)}},LP=j0,qD=new Xi,Ud=class extends dm{forEachFeatureAtCoordinate(e,t,i,r){let n=this.getFeaturesAtCoordinate(e,i);return n.forEach(e=>{r(e,this.layer_,e.getGeometry())}),n?.[0]}getData(e){var t;let i;try{let{pixelRatio:r}=this.getLayer(),n=null===(t=this.canvas)||void 0===t?void 0:t.getContext("2d",{willReadFrequently:!0});return i=n?.getImageData(e[0]*(r||1),e[1]*(r||1),1,1).data||null,i}catch(e){console.error("error getting data",e)}return null}getFeatures(e){var t,i;let r=null===(i=null===(t=this.getLayer())||void 0===t?void 0:t.getMapInternal())||void 0===i?void 0:i.getCoordinateFromPixel(e);return Promise.resolve(this.getFeaturesAtCoordinate(r))}getFeaturesAtCoordinate(e,t=5){if(!e)return[];let i=this.getLayer(),r=i.engine.getVehiclesAtCoordinate(e,{hitTolerance:t,nb:i.maxNbFeaturesRequested});return qD.readFeatures(r)}prepareFrame(){return!0}renderFrame(e){var t;let{canvas:i,engine:r,renderedViewState:n}=this.getLayer();if(this.getLayer().engine.pixelRatio=e.pixelRatio,this.ready=!(null===(t=r.renderState)||void 0===t||!t.renderedTrajectories)&&r.isIdle,this.container||(this.container=document.createElement("div"),this.container.className=this.getLayer().getClassName(),this.container.style.position="absolute",this.container.style.width="100%",this.container.style.height="100%",i instanceof HTMLCanvasElement&&(i.style.position="absolute",i.style.top="0",i.style.left="0",i.style.transformOrigin="top left",this.container.appendChild(i))),n){let{center:t,resolution:r,rotation:a}=e.viewState,{center:s,resolution:o,rotation:l}=n;if(o/r>=3){let e=i?.getContext("2d");i?.width&&i?.height&&e?.clearRect(0,0,i.width,i.height)}else{let e=this.getLayer().getMapInternal(),i=e?.getPixelFromCoordinate(s),n=e?.getPixelFromCoordinate(t);i&&n&&(this.container.style.transform=o2(i[0]-n[0],i[1]-n[1],o/r,o/r,a-l,0,0))}}return this.container}},XD=new Fr({image:new Va({fill:new Hn({color:"#000000"}),radius:5}),stroke:new qn({color:"#000000",width:6}),zIndex:2}),YD=e=>{let{stroke:t,type:i}=e.getProperties(),r=t||Rd(i)||"#000";return r&&!r.startsWith("#")&&(r=`#${r}`),[XD,new Fr({image:new Va({fill:new Hn({color:r}),radius:4}),stroke:new qn({color:r,width:4}),zIndex:3})]},G0=YD,Im=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},RP=new Xi,Z0=class e extends ql{get api(){return this.engine.api}set api(e){this.engine.api=e}get canvas(){return this.engine.canvas}get filter(){return this.engine.filter}set filter(e){this.engine.filter=e}get hoverVehicleId(){return this.engine.hoverVehicleId}set hoverVehicleId(e){this.engine.hoverVehicleId=e}get mode(){return this.engine.mode}set mode(e){this.engine.mode=e}get pixelRatio(){return this.engine.pixelRatio}get selectedVehicleId(){return this.engine.selectedVehicleId}set selectedVehicleId(e){this.engine.selectedVehicleId=e}get sort(){return this.engine.sort}set sort(e){this.engine.sort=e}get style(){var e;return null===(e=this.engine)||void 0===e?void 0:e.style}set style(e){this.engine&&(this.engine.style=e)}get styleOptions(){return this.engine.styleOptions}set styleOptions(e){this.engine.styleOptions=e}get time(){return this.engine.time||new Date}set time(e){this.engine.time=e}get trajectories(){return this.engine.trajectories}constructor(e){super(Object.assign({minZoom:4,source:new Oo({})},e)),this.allowRenderWhenAnimating=!1,this.maxNbFeaturesRequested=100,this.olEventsKeys=[],qa(this,e),this.engine=new LP(Object.assign({getViewState:this.getViewState.bind(this),onIdle:this.onRealtimeEngineIdle.bind(this),onRender:this.onRealtimeEngineRender.bind(this),style:ZS},e)),this.allowRenderWhenAnimating=!!e.allowRenderWhenAnimating,this.vectorLayer=new pm({minZoom:this.getMinZoom(),source:new Gs({features:[]}),style:(t,i)=>(e.fullTrajectoryStyle||G0)(t,i,this),updateWhileAnimating:this.allowRenderWhenAnimating,updateWhileInteracting:!0}),this.onZoomEndDebounced=(0,U0.default)(this.onZoomEnd,100),this.onMoveEndDebounced=(0,U0.default)(this.onMoveEnd,100)}addTrajectory(e){var t;null===(t=this.engine)||void 0===t||t.addTrajectory(e)}attachToMap(){this.engine.attachToMap();let e=this.getMapInternal();e&&(this.getVisible()&&this.engine.start(),this.olEventsKeys.push(e.on("movestart",()=>{this.engine.isUpdateBboxOnMoveEnd&&this.engine.updateIdleState()}),...e.on(["moveend","change:target"],e=>{let t=(e.map||e.target).getView();if(!t||t?.getAnimating()||t?.getInteracting())return;let i=t.getZoom();this.currentZoom!==i&&this.onZoomEndDebounced(e),this.currentZoom=i,this.onMoveEndDebounced(e)}),this.on("change:visible",e=>{e.target.getVisible()?this.engine.start():this.engine.stop()}),this.on("propertychange",e=>{/(opacity|visible|zIndex|minResolution|maxResolution|minZoom|maxZoom)/.test(e.key)&&this.vectorLayer.set(e.key,e.target.get(e.key))})))}cleanVectorLayer(){var e,t,i;null===(t=null===(e=this.vectorLayer)||void 0===e?void 0:e.getSource())||void 0===t||t.clear(!0),null===(i=this.vectorLayer.getMapInternal())||void 0===i||i.removeLayer(this.vectorLayer)}clone(t){return new e(Object.assign(Object.assign({},this.get("options")),t))}createRenderer(){return new Ud(this)}detachFromMap(){var e;Bt(this.olEventsKeys),null===(e=this.getMapInternal())||void 0===e||e.removeLayer(this.vectorLayer),this.engine.detachFromMap()}getFullTrajectory(e){return Im(this,void 0,void 0,function*(){var t,i,r,n;let a=yield this.engine.api.getFullTrajectory(e,this.engine.mode,this.engine.getGeneralizationLevelByZoom(Math.floor((null===(i=null===(t=this.getMapInternal())||void 0===t?void 0:t.getView())||void 0===i?void 0:i.getZoom())||0)));return null!==(n=null===(r=a?.content)||void 0===r?void 0:r.features)&&void 0!==n&&n.length?RP.readFeatures(a?.content):[]})}getStopSequences(e){return Im(this,void 0,void 0,function*(){let t=yield this.engine.api.getStopSequence(e);return t?.content})}getTrajectoryInfos(e){return Im(this,void 0,void 0,function*(){let t=[this.getStopSequences(e),this.getFullTrajectory(e)],[i,r]=yield Promise.all(t);return{fullTrajectory:r,stopSequences:i}})}getVehicles(e){return this.engine.getVehicles(e)}getViewState(){let e=this.getMapInternal();if(!e?.getView())return{};let t=e.getView(),i=t.calculateExtent(),r=this.getExtent();return r&&(i=zw(i,r),kf(i)&&(i=r)),{center:t.getCenter(),extent:i,pixelRatio:this.engine.pixelRatio,resolution:t.getResolution(),rotation:t.getRotation(),size:e.getSize(),visible:this.getVisible(),zoom:t.getZoom()}}highlight(e){let t=Array.isArray(e)?e[0]:e,i=t?.get("train_id");this.hoverVehicleId!==i&&(this.hoverVehicleId=i,this.engine.renderTrajectories(!0))}highlightTrajectory(e){return Im(this,void 0,void 0,function*(){return new Promise(t=>{this.api.subscribeFullTrajectory(e,this.engine.mode,i=>{var r,n;if(this.selectedVehicleId===e&&i?.content){let e=[];!(null===(n=null===(r=i?.content)||void 0===r?void 0:r.features)||void 0===n)&&n.length&&(e=RP.readFeatures(i?.content)),this.updateHighlightFeatures(e),t(e)}})})})}onMoveEnd(){!this.engine.isUpdateBboxOnMoveEnd||!this.getVisible()||this.engine.setBbox()}onRealtimeEngineIdle(){this.changed()}onRealtimeEngineRender(e,t){this.renderedViewState=Object.assign({},t);let{container:i}=this.getRenderer();i&&(i.style.transform="")}onZoomEnd(){this.engine.onZoomEnd(),!this.engine.isUpdateBboxOnMoveEnd||this.getVisible()}removeTrajectory(e){var t;null===(t=this.engine)||void 0===t||t.removeTrajectory(e)}renderTrajectories(e){Gu("RealtimeLayer.renderTrajectories is deprecated. Use RealtimeLayer.engine.renderTrajectories instead."),this.engine.renderTrajectories(e)}select(e){let t=Array.isArray(e)?e[0]:e,i=t?.get("train_id");this.selectedVehicleId!==i&&(this.selectedVehicleId&&this.api.unsubscribeFullTrajectory(this.selectedVehicleId),this.cleanVectorLayer(),this.selectedVehicleId=i,this.engine.renderTrajectories(!0)),i&&this.highlightTrajectory(i)}setMapInternal(e){e?(super.setMapInternal(e),this.attachToMap()):(this.detachFromMap(),super.setMapInternal(e))}shouldRender(){var e,t;return!this.allowRenderWhenAnimating&&((null===(e=this.getMapInternal())||void 0===e?void 0:e.getView().getAnimating())||(null===(t=this.getMapInternal())||void 0===t?void 0:t.getView().getInteracting()))}start(){this.engine.start()}stop(){this.engine.stop()}updateHighlightFeatures(e){var t,i,r,n,a,s;this.cleanVectorLayer(),e?.length&&(null===(i=null===(t=this.vectorLayer)||void 0===t?void 0:t.getSource())||void 0===i||i.addFeatures(e)),this.vectorLayer.getMapInternal()&&this.vectorLayer.getMapInternal()!==this.getMapInternal()&&(null===(r=this.vectorLayer.getMapInternal())||void 0===r||r.removeLayer(this.vectorLayer));let o=this.getZIndex();if(void 0!==o)this.vectorLayer.setZIndex(o-1),this.vectorLayer.getMapInternal()||null===(n=this.getMapInternal())||void 0===n||n.addLayer(this.vectorLayer);else if(!this.vectorLayer.getMapInternal()){let e=(null===(a=this.getMapInternal())||void 0===a?void 0:a.getLayers().getArray().indexOf(this))||0;e&&(null===(s=this.getMapInternal())||void 0===s||s.getLayers().insertAt(e,this.vectorLayer))}return e}},$0=Z0,DP=function(e,t,i,r){return new(i||(i=Promise))(function(n,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){e.done?n(e.value):function(e){return e instanceof i?e:new i(function(t){t(e)})}(e.value).then(s,o)}l((r=r.apply(e,t||[])).next())})},KD=new Xi,JD=(e,t,i)=>{let r,{coordinate:n,params:a,projection:s,resolution:o}=t;return e&&o&&s&&(r=e.getFeatureInfoUrl(n,o,s,Object.assign({info_format:"application/json",query_layers:e.getParams().layers},a))),fetch(r,{signal:i.signal}).then(e=>e.json()).then(e=>KD.readFeatures(e)).catch(()=>[])},Zd={},QD=(e,t,...i)=>DP(void 0,[e,t,...i],void 0,function*(e,t,i=5,r=!1){Object.values(Zd).forEach(e=>{e?.abort()}),Zd={};let n=Do(t).map(t=>DP(void 0,void 0,void 0,function*(){var n,a,s,o;let l=t.getMapInternal(),h=null===(a=null===(n=l?.getView())||void 0===n?void 0:n.getProjection())||void 0===a?void 0:a.getCode(),u={coordinate:e,features:[],layer:t};if(!h)return Promise.resolve(u);let c=t;if(!r&&c.getFeatureInfoAtCoordinate)return c.getFeatureInfoAtCoordinate(e);let d=c?.getSource();if(d?.getFeatureInfoUrl){let t=wi(c);null===(s=Zd[t])||void 0===s||s.abort(),Zd[t]=new AbortController;let i=null===(o=l?.getView())||void 0===o?void 0:o.getResolution(),r=yield JD(d,{coordinate:e,params:{info_format:"application/json",query_layers:d.getParams().layers},projection:h,resolution:i},Zd[t]).catch(()=>[]),n={coordinate:e,features:r,layer:c};return Promise.resolve(n)}let p=l?.getPixelFromCoordinate(e);if(!p)return Promise.resolve(u);let f=l?.getFeaturesAtPixel(p,{hitTolerance:c.get("hitTolerance")||i||5,layerFilter:e=>e===c});return Promise.resolve({coordinate:e,features:f,layer:c})}));return Promise.all(n)}),W0=QD;function ek(e){let{apikey:t,baselayer:i,hasPrint:r,hasShare:n,map:a,mapsurl:s,setBaseLayer:o}=Ze(),l=nt(()=>n||r,[n,r]),h=nt(()=>{if(i&&t)return new S0({apiKey:t,style:i,url:s,zIndex:0,...e||{},mapLibreOptions:{maxCanvasSize:[2e4,2e4],...e?.mapLibreOptions||{},canvasContextAttributes:{preserveDrawingBuffer:l,...e?.mapLibreOptions?.canvasContextAttributes||{}}}})},[i,t,s,e,l]);return Ae(()=>{o(h)},[h,o]),Ae(()=>{if(a&&h)return a.addLayer(h),()=>{a.removeLayer(h)}},[a,h]),null}var H0=Fe(ek);function tk(){let{baseLayer:e,featuresInfos:t,featuresInfosHovered:i,linesNetworkPlanLayer:r,notificationsLayer:n,realtimeLayer:a,setLinesIds:s,setSelectedFeature:o,setSelectedFeatures:l,setStationId:h,setTrainId:u,stationsLayer:c,tenant:d}=Ze();return Ae(()=>{if(!i?.length)return;let[e]=i?.find(e=>e.layer===a)?.features||[],[t]=i?.find(e=>e.layer===n)?.features||[];("Point"===t?.getGeometry()?.getType()?t||e:e||t)===e?a?.highlight(e):a?.highlight(null)},[i,n,a]),Ae(()=>{if(!t?.length)return o(null),void l([]);let[e]=t?.find(e=>e.layer===a)?.features||[],[i]=t?.find(e=>e.layer===n)?.features||[],[h]=t?.find(e=>e.layer===c)?.features||[],u=t?.find(e=>e.layer===r)?.features||[],d=[...new Set((u||[]).map(e=>e.get(ja)))],p=t?.flatMap(e=>e.features)||[],f="Point"===i?.getGeometry()?.getType()?i||e:e||i;f=f||h,f?(o(f),l([f]),s(null)):p.length?(l(p),o(p[0]),s(d?.length?d:null)):(o(null),l([]),s(null))},[e?.mapLibreMap,t,r,a,n,s,o,l,h,u,c,d]),null}var q0=tk,zP=Rn(kP(),1),ik=/{{(.*?)}}/g;function FP(e,t){return e.replace(ik,(e,i,r)=>{for(e=0,r=t,i=i.trim().split(".");r&&e<i.length;)r=r[i[e++]];return r??""})}function OP(e){var t="",i=e||{};return{set(e,t){i[e]=Object.assign(i[e]||{},t)},locale:e=>t=e||t,table:e=>i[e],t(e,r,n){var a=(0,zP.default)(i[n||t],e,"");return"function"==typeof a?a(r):"string"==typeof a?FP(a,r):a}}}var rk={de:{"Abwesendes Personal":"Abwesendes Personal",accident:"Unfall","Allgemeine Fahrzeugstörung":"Allgemeine Fahrzeugstörung","Anderes Rollmaterial":"Anderes Rollmaterial","Angefahrene Person":"Angefahrene Person","Angefahrenes Tier":"Angefahrenes Tier","Anweisung der Feuerwehr":"Anweisung der Feuerwehr","Anweisung der Polizei":"Anweisung der Polizei","Aufprall eines Objekts":"Aufprall eines Objekts","Ausfall der Beleuchtung":"Ausfall der Beleuchtung","Ausfall der Drehbrücke":"Ausfall der Drehbrücke","Ausfall der Rolltreppe":"Ausfall der Rolltreppe","Ausfall des Antriebsystems":"Ausfall des Antriebsystems","Ausfall des Aufzuges":"Ausfall des Aufzuges","Ausfall des Verkehrsmanagementsystems":"Ausfall des Verkehrsmanagementsystems","Auswirkung aus vorhergehender Störung(en)":"Effect from previous disruption(s)","Auswirkung einer Störung im Ausland":"Auswirkung einer Störung im Ausland","Bahnübergang gesperrt":"Bahnübergang gesperrt",Bauarbeiten:"Bauarbeiten","Beinahe-Unfall":"Beinahe-Unfall",Betriebseinstellung:"Betriebseinstellung",Blitzeinschlag:"Blitzeinschlag","Bombenentschärfung":"Bombenentschärfung","Brückenschaden":"Brückenschaden",congestion:"Überlastung",CONSTRUCTION:"Bauarbeiten",constructionWork:"Bauarbeiten","Das Quellsystem unterstützt keine Störungsgründe":"Das Quellsystem unterstützt keine Störungsgründe","Defekt an der Oberleitung":"Defekt an der Oberleitung","Defekt an der Signalanlage":"Defekt an der Signalanlage","Defekter Bahnübergang":"Defekter Bahnübergang","Defektes Fahrzeug":"Defektes Fahrzeug","Defektes Sicherheitssystem":"Defektes Sicherheitssystem",Demonstration:"Demonstration","Der Grund ist nicht bekannt":"Der Grund ist nicht bekannt.",DISRUPTION:"Störung",Ebbe:"Ebbe","Einsatz der Polizei":"Einsatz der Polizei","Eis auf den Wagen":"Eis auf den Wagen",emergencyServicesCall:"Rettungsdiensteinsatz",Enteisungsarbeiten:"Enteisungsarbeiten",Entgleisung:"Entgleisung","Erbebenschäden":"Erbebenschäden",Erdabsenkung:"Erdabsenkung",Erdrutsch:"Erdrutsch",Erdrutschgefahr:"Erdrutschgefahr","Erkranktes Personal":"Erkranktes Personal",Evakuierung:"Evakuierung",Explosion:"Explosion",Explosionsgefahr:"Explosionsgefahr","Fahrbahnschäden":"Fahrbahnschäden","Fahrgast blockiert die Tür":"Fahrgast blockiert die Tür","Fahrzeug blockiert Gleis/Straße":"Fahrzeug blockiert Gleis/Straße",Felssturz:"Felssturz",Feuer:"Feuer","Feuer an der Haltestelle":"Feuer an der Haltestelle",Feuerwehreinsatz:"Feuerwehreinsatz",Flut:"Flut","Gebrochene Schiene":"Gebrochene Schiene",Geschwindigkeitsbegrenzung:"Geschwindigkeitsbegrenzung",Glatteis:"Glatteis",Gleisschaden:"Gleisschaden","Gleisstromkreisschäden":"Gleisstromkreisschäden",Grasfeuer:"Grasfeuer",Grenzkontrolle:"Grenzkontrolle","Großveranstaltung":"Großveranstaltung",Hagel:"Hagel",Hochwasser:"Hochwasser","Hohe Temperatur":"Hohe Temperatur",INDUSTRIAL_ACTION:"Streik","Instandhaltungsarbeiten an der Kanalisation":"Instandhaltungsarbeiten an der Kanalisation",Kabelbrand:"Kabelbrand",Kabeldiebstahl:"Kabeldiebstahl",Kollision:"Kollision",Laubfall:"Laubfall",Lawinen:"Lawinen",Lawinengefahr:"Lawinengefahr","Liegengebliebenes Fahrzeug auf dem Gleisabschnitt":"Liegengebliebenes Fahrzeug auf dem Gleisabschnitt",LIFT_FAILURE:"Aufzugausfall",liftFailure:"Aufzugausfall",maintenanceWork:"Unterhaltsarbeiten",MEDICAL_EMERGENCY:"Medizinischer Notfall","Medizinischer Notfalleinsatz":"Medizinischer Notfalleinsatz",Nebel:"Nebel","Nicht weiter bekannter Unfall":"Nicht weiter bekannter Unfall","Niedriger Wasserstand":"Niedriger Wasserstand",Notbremsung:"Notbremsung","Notruf ausgelöst":"Notruf ausgelöst","Objekt im Gleis":"Objekt im Gleis","Öffentliche Unruhe":"Öffentliche Unruhe",OTHER:"Sonstiges",OTHER_CAUSE:"Anderer Grund",Panne:"Panne","Personen im Gleis":"Personen im Gleis",Pflanzenbewuchs:"Pflanzenbewuchs",POLICE_ACTIVITY:"Polizeieinsatz",poorWeather:"Schlechte Witterung","Problem mit der Landungsbrücke":"Problem mit der Landungsbrücke","Problem mit der Signalanlage":"Problem mit der Signalanlage","Problem mit der Stromversorgung":"Problem mit der Stromversorgung",Prozession:"Prozession",Radschaden:"Radschaden",RAIL_REPLACEMENT:"Ersatzverkehr","Rauch im Fahrzeug":"Rauch im Fahrzeug","Raue See":"Raue See",Reparaturarbeiten:"Reparaturarbeiten",routeBlockage:"Streckenblockierung","Schlammlawine, Murgang":"Schlammlawine, Murgang","Schlechtes Wetter":"Schlechtes Wetter",Schneesturm:"Schneesturm",Schneeverwehungen:"Schneeverwehungen",serviceDisruption:"Störung",Sicherheitsalarm:"Sicherheitsalarm","Signal bei Gefahr passiert":"Signal bei Gefahr passiert",SPECIAL_EVENT:"Sonderereignis",specialEvent:"Unvorhersehbares Ereignis","Starker Regen":"Starker Regen","Starker Schneefall":"Starker Schneefall","Starker Verkehr":"Starker Verkehr",Stausituation:"Stausituation","Straße gesperrt":"Straße gesperrt","Straßenarbeiten":"Straßenarbeiten",Streckenblockierung:"Streckenblockierung","Streik, Arbeitskampfmaßnahmen":"Streik, Arbeitskampfmaßnahmen",Sturm:"Sturm","Sturmschäden":"Sturmschäden",Sturzflut:"Sturzflut",TECHNICAL_PROBLEM_OTHER:"Technisches Problem",TECHNICAL_PROBLEM_RAILWAY_SECTION:"Technisches Problem an der Bahnanlage",TECHNICAL_PROBLEM_VEHICLE:"Technisches Problem am Zug",technicalProblem:"Technisches Problem","Technische Störung":"Technische Störung","Telefonische Terrordrohung":"Telefonische Terrordrohung","Terroristischer Anschlag":"Terroristischer Anschlag","Tiere im Gleis":"Tiere im Gleis",Treibeis:"Treibeis","Türstörung":"Türstörung","Überfahrene Haltestelle":"Überfahrene Haltestelle","Überfüllt":"Überfüllt","Überholung":"Überholung","Überschwemmung":"Überschwemmung","Überschwemmungsgefahr":"Überschwemmungsgefahr","Umgestürzte Bäume auf dem Gleis":"Umgestürzte Bäume auf dem Gleis","Umgestürzter Baum":"Umgestürzter Baum","Umleitung, der geplante Fahrweg kann nicht genutzt werden.":"Umleitung, der geplante Fahrweg kann nicht genutzt werden.","Unbeaufsichtigtes Gepäck":"Unbeaufsichtigtes Gepäck",undefined:"",undefinedAlertCause:"Unbestimmte Ursache","Unfall auf dem Bahnübergang":"Unfall auf dem Bahnübergang","Ungeplante Bauarbeiten":"Ungeplante Bauarbeiten",unknown:"Unbekannt","Unterbruch der Bedienung durch den ÖV":"Unterbruch der Bedienung durch den ÖV",Vandalismus:"Vandalismus",VEHICLE_FAILURE:"Fahrzeugausfall",VEHICLE_FAULURE:"Fahrzeugausfall",vehicleFailure:"Fahrzeugausfall",vehicleFaulure:"Fahrzeugausfall","Verdächtiges Fahrzeug":"Verdächtiges Fahrzeug","Vereiste Schienen":"Vereiste Schienen","Verspäteter Einstieg":"Verspäteter Einstieg","Verzögerte Bereitstellung":"Verzögerte Bereitstellung","Vorausfahrendes Fahrzeug":"Vorausfahrendes Fahrzeug",Waldbrand:"Waldbrand",WARNING:"Warnung","Warten auf entgegenkommendes Fahrzeug":"Warten auf entgegenkommendes Fahrzeug","Warten auf umsteigende Fahrgäste":"Warten auf umsteigende Fahrgäste",Wartungsarbeiten:"Wartungsarbeiten","Weichenstörung":"Weichenstörung","Weitere Gründe":"Weitere Gründe",Zugkopplung:"Zugkopplung"},en:{"Abwesendes Personal":"Absent Staff",accident:"Accident","Allgemeine Fahrzeugstörung":"General Vehicle Malfunction","Anderes Rollmaterial":"Other Rolling Stock","Angefahrene Person":"Person Hit","Angefahrenes Tier":"Animal Hit","Anweisung der Feuerwehr":"Fire Department Instruction","Anweisung der Polizei":"Police Instruction","Aufprall eines Objekts":"Impact of an Object","Ausfall der Beleuchtung":"Lighting Failure","Ausfall der Drehbrücke":"Swing Bridge Failure","Ausfall der Rolltreppe":"Escalator Failure","Ausfall des Antriebsystems":"Drive System Failure","Ausfall des Aufzuges":"Elevator Failure","Ausfall des Verkehrsmanagementsystems":"Traffic Management System Failure","Auswirkung aus vorhergehender Störung(en)":"Effect from previous disruption(s)","Auswirkung einer Störung im Ausland":"Effect from disruption abroad","Bahnübergang gesperrt":"Level crossing closed",Bauarbeiten:"Construction work","Beinahe-Unfall":"Near accident",Betriebseinstellung:"Service suspension",Blitzeinschlag:"Lightning strike","Bombenentschärfung":"Bomb disposal","Brückenschaden":"Bridge damage",constructionWork:"Construction work","Das Quellsystem unterstützt keine Störungsgründe":"Source system does not support disruption reasons","Defekt an der Oberleitung":"Overhead line defect","Defekt an der Signalanlage":"Signal system defect","Defekter Bahnübergang":"Defective level crossing","Defektes Fahrzeug":"Defective vehicle","Defektes Sicherheitssystem":"Defective safety system",Demonstration:"Demonstration","Der Grund ist nicht bekannt":"Reason is not known.",Ebbe:"Low tide","Einsatz der Polizei":"Police operation","Eis auf den Wagen":"Ice on the cars",Enteisungsarbeiten:"De-icing work",Entgleisung:"Derailment","Erbebenschäden":"Earthquake damage",Erdabsenkung:"Ground subsidence",Erdrutsch:"Landslide",Erdrutschgefahr:"Landslide risk","Erkranktes Personal":"Sick staff",Evakuierung:"Evacuation",Explosion:"Explosion",Explosionsgefahr:"Explosion risk","Fahrbahnschäden":"Road damage","Fahrgast blockiert die Tür":"Passenger blocks the door","Fahrzeug blockiert Gleis/Straße":"Vehicle blocks track/road",Felssturz:"Rockfall",Feuer:"Fire","Feuer an der Haltestelle":"Fire at the stop",Feuerwehreinsatz:"Fire brigade operation",Flut:"Flood","Gebrochene Schiene":"Broken rail",Geschwindigkeitsbegrenzung:"Speed limit",Glatteis:"Black ice",Gleisschaden:"Track damage","Gleisstromkreisschäden":"Track circuit damage",Grasfeuer:"Grass fire",Grenzkontrolle:"Border control","Großveranstaltung":"Major event",Hagel:"Hail",Hochwasser:"High water","Hohe Temperatur":"High temperature","Instandhaltungsarbeiten an der Kanalisation":"Sewer maintenance work",Kabelbrand:"Cable fire",Kabeldiebstahl:"Cable theft",Kollision:"Collision",Laubfall:"Leaf fall",Lawinen:"Avalanches",Lawinengefahr:"Avalanche risk","Liegengebliebenes Fahrzeug auf dem Gleisabschnitt":"Vehicle stranded on track section",LIFT_FAILURE:"Lift Failure",liftFailure:"Lift Failure",maintenanceWork:"Maintenance Work",MEDICAL_EMERGENCY:"Medical Emergency","Medizinischer Notfalleinsatz":"Medical emergency operation",Nebel:"Fog","Nicht weiter bekannter Unfall":"Unknown accident","Niedriger Wasserstand":"Low water level",Notbremsung:"Emergency braking","Notruf ausgelöst":"Emergency call triggered","Objekt im Gleis":"Object on the track","Öffentliche Unruhe":"Public unrest",OTHER:"Other",OTHER_CAUSE:"Other Cause",Panne:"Breakdown","Personen im Gleis":"People on the track",Pflanzenbewuchs:"Vegetation growth",POLICE_ACTIVITY:"Police Activity",poorWeather:"Poor Weather","Problem mit der Landungsbrücke":"Problem with the landing bridge","Problem mit der Signalanlage":"Problem with the signal system","Problem mit der Stromversorgung":"Problem with the power supply",Prozession:"Procession",Radschaden:"Wheel damage",RAIL_REPLACEMENT:"Rail Replacement","Rauch im Fahrzeug":"Smoke in the vehicle","Raue See":"Rough sea",Reparaturarbeiten:"Repair work",routeBlockage:"Route Blockage","Schlammlawine, Murgang":"Mudslide, debris flow","Schlechtes Wetter":"Bad weather",Schneesturm:"Snowstorm",Schneeverwehungen:"Snowdrifts",serviceDisruption:"Service Disruption",Sicherheitsalarm:"Security alarm","Signal bei Gefahr passiert":"Signal passed at danger",SPECIAL_EVENT:"Special Event",specialEvent:"Unforeseeable Event","Starker Regen":"Heavy rain","Starker Schneefall":"Heavy snowfall","Starker Verkehr":"Heavy traffic",Stausituation:"Traffic jam situation","Straße gesperrt":"Road closed","Straßenarbeiten":"Road works",Streckenblockierung:"Route blockage","Streik, Arbeitskampfmaßnahmen":"Strike, industrial action",Sturm:"Storm","Sturmschäden":"Storm damage",Sturzflut:"Flash flood",TECHNICAL_PROBLEM_OTHER:"Technical Problem",TECHNICAL_PROBLEM_RAILWAY_SECTION:"Technical Problem at Railway Section",TECHNICAL_PROBLEM_VEHICLE:"Technical Problem with Vehicle",technicalProblem:"Technical Problem","Technische Störung":"Technical fault","Telefonische Terrordrohung":"Telephone terror threat","Terroristischer Anschlag":"Terrorist attack","Tiere im Gleis":"Animals on the track",Treibeis:"Drift ice","Türstörung":"Door fault","Überfahrene Haltestelle":"Missed stop","Überfüllt":"Overcrowded","Überholung":"Overtaking","Überschwemmung":"Flooding","Überschwemmungsgefahr":"Flood risk","Umgestürzte Bäume auf dem Gleis":"Fallen trees on the track","Umgestürzter Baum":"Fallen tree","Umleitung, der geplante Fahrweg kann nicht genutzt werden.":"Diversion, planned route cannot be used.","Unbeaufsichtigtes Gepäck":"Unattended luggage",undefined:"",undefinedAlertCause:"Undefined Cause","Unfall auf dem Bahnübergang":"Accident at level crossing","Ungeplante Bauarbeiten":"Unplanned construction work",unknown:"Unknown","Unterbruch der Bedienung durch den ÖV":"Interruption of public transport service",Vandalismus:"Vandalism",VEHICLE_FAILURE:"Vehicle Failure",VEHICLE_FAULURE:"Vehicle Failure",vehicleFailure:"Vehicle Failure",vehicleFaulure:"Vehicle Failure","Verdächtiges Fahrzeug":"Suspicious vehicle","Vereiste Schienen":"Icy rails","Verspäteter Einstieg":"Delayed boarding","Verzögerte Bereitstellung":"Delayed provision","Vorausfahrendes Fahrzeug":"Preceding vehicle",Waldbrand:"Forest fire",WARNING:"Warning","Warten auf entgegenkommendes Fahrzeug":"Waiting for oncoming vehicle","Warten auf umsteigende Fahrgäste":"Waiting for transferring passengers",Wartungsarbeiten:"Maintenance work","Weichenstörung":"Switch fault","Weitere Gründe":"Other reasons",Zugkopplung:"Train coupling"},fr:{"Abwesendes Personal":"Personnel absent",accident:"Accident","Allgemeine Fahrzeugstörung":"Panne générale du véhicule","Anderes Rollmaterial":"Autre matériel roulant","Angefahrene Person":"Personne heurtée","Angefahrenes Tier":"Animal heurté","Anweisung der Feuerwehr":"Instruction des pompiers","Anweisung der Polizei":"Instruction de la police","Aufprall eines Objekts":"Impact d'un objet","Ausfall der Beleuchtung":"Panne d'éclairage","Ausfall der Drehbrücke":"Panne du pont tournant","Ausfall der Rolltreppe":"Panne de l'escalator","Ausfall des Antriebsystems":"Panne du système d'entraînement","Ausfall des Aufzuges":"Panne d'ascenseur","Ausfall des Verkehrsmanagementsystems":"Panne du système de gestion du trafic","Auswirkung aus vorhergehender Störung(en)":"Effet d'une perturbation précédente","Auswirkung einer Störung im Ausland":"Effet d'une perturbation à l'étranger","Bahnübergang gesperrt":"Passage à niveau fermé",Bauarbeiten:"Travaux de construction","Beinahe-Unfall":"Accident évité de justesse",Betriebseinstellung:"Suspension du service",Blitzeinschlag:"Foudre","Bombenentschärfung":"Désamorçage de bombe","Brückenschaden":"Dommage au pont",constructionWork:"Travaux de construction","Das Quellsystem unterstützt keine Störungsgründe":"Le système source ne prend pas en charge les raisons de perturbation","Defekt an der Oberleitung":"Défaut de la ligne aérienne","Defekt an der Signalanlage":"Défaut du système de signalisation","Defekter Bahnübergang":"Passage à niveau défectueux","Defektes Fahrzeug":"Véhicule défectueux","Defektes Sicherheitssystem":"Système de sécurité défectueux",Demonstration:"Manifestation","Der Grund ist nicht bekannt":"Raison inconnue.",Ebbe:"Marée basse","Einsatz der Polizei":"Intervention de la police","Eis auf den Wagen":"Glace sur les véhicules",Enteisungsarbeiten:"Travaux de dégivrage",Entgleisung:"Déraillement","Erbebenschäden":"Dommages causés par un tremblement de terre",Erdabsenkung:"Affaissement du sol",Erdrutsch:"Glissement de terrain",Erdrutschgefahr:"Risque de glissement de terrain","Erkranktes Personal":"Personnel malade",Evakuierung:"Évacuation",Explosion:"Explosion",Explosionsgefahr:"Risque d'explosion","Fahrbahnschäden":"Dommages à la chaussée","Fahrgast blockiert die Tür":"Passager bloque la porte","Fahrzeug blockiert Gleis/Straße":"Véhicule bloque la voie/la route",Felssturz:"Chute de pierres",Feuer:"Feu","Feuer an der Haltestelle":"Feu à l'arrêt",Feuerwehreinsatz:"Intervention des pompiers",Flut:"Inondation","Gebrochene Schiene":"Rail cassé",Geschwindigkeitsbegrenzung:"Limite de vitesse",Glatteis:"Verglas",Gleisschaden:"Dommage à la voie","Gleisstromkreisschäden":"Dommages au circuit de voie",Grasfeuer:"Feu d'herbe",Grenzkontrolle:"Contrôle frontalier","Großveranstaltung":"Grand événement",Hagel:"Grêle",Hochwasser:"Crue","Hohe Temperatur":"Température élevée","Instandhaltungsarbeiten an der Kanalisation":"Travaux d'entretien des égouts",Kabelbrand:"Incendie de câble",Kabeldiebstahl:"Vol de câble",Kollision:"Collision",Laubfall:"Chute de feuilles",Lawinen:"Avalanches",Lawinengefahr:"Risque d'avalanche","Liegengebliebenes Fahrzeug auf dem Gleisabschnitt":"Véhicule immobilisé sur la section de voie",LIFT_FAILURE:"Panne d'ascenseur",liftFailure:"Panne d'ascenseur",maintenanceWork:"Travaux de maintenance",MEDICAL_EMERGENCY:"Urgence médicale","Medizinischer Notfalleinsatz":"Intervention médicale d'urgence",Nebel:"Brouillard","Nicht weiter bekannter Unfall":"Accident inconnu","Niedriger Wasserstand":"Niveau d'eau bas",Notbremsung:"Freinage d'urgence","Notruf ausgelöst":"Appel d'urgence déclenché","Objekt im Gleis":"Objet sur la voie","Öffentliche Unruhe":"Troubles publics",OTHER:"Autre",OTHER_CAUSE:"Autre raison",Panne:"Panne","Personen im Gleis":"Personnes sur la voie",Pflanzenbewuchs:"Végétation",POLICE_ACTIVITY:"Activité policière",poorWeather:"Mauvais temps","Problem mit der Landungsbrücke":"Problème avec la passerelle","Problem mit der Signalanlage":"Problème avec le système de signalisation","Problem mit der Stromversorgung":"Problème avec l'alimentation électrique",Prozession:"Procession",Radschaden:"Dommage à la roue",RAIL_REPLACEMENT:"Remplacement ferroviaire","Rauch im Fahrzeug":"Fumée dans le véhicule","Raue See":"Mer agitée",Reparaturarbeiten:"Travaux de réparation",routeBlockage:"Blocage de la route","Schlammlawine, Murgang":"Coulée de boue, flux de débris","Schlechtes Wetter":"Mauvais temps",Schneesturm:"Tempête de neige",Schneeverwehungen:"Congères",serviceDisruption:"Perturbation du service",Sicherheitsalarm:"Alarme de sécurité","Signal bei Gefahr passiert":"Signal passé en cas de danger",SPECIAL_EVENT:"Événement spécial",specialEvent:"Événement imprévisible","Starker Regen":"Pluie forte","Starker Schneefall":"Chute de neige abondante","Starker Verkehr":"Trafic intense",Stausituation:"Situation d'embouteillage","Straße gesperrt":"Route fermée","Straßenarbeiten":"Travaux routiers",Streckenblockierung:"Blocage de la voie","Streik, Arbeitskampfmaßnahmen":"Grève, actions syndicales",Sturm:"Tempête","Sturmschäden":"Dommages causés par la tempête",Sturzflut:"Crue soudaine",TECHNICAL_PROBLEM_OTHER:"Problème technique",TECHNICAL_PROBLEM_RAILWAY_SECTION:"Problème technique sur la section ferroviaire",TECHNICAL_PROBLEM_VEHICLE:"Problème technique avec le véhicule",technicalProblem:"Problème technique","Technische Störung":"Défaillance technique","Telefonische Terrordrohung":"Menace terroriste téléphonique","Terroristischer Anschlag":"Attentat terroriste","Tiere im Gleis":"Animaux sur la voie",Treibeis:"Glace flottante","Türstörung":"Défaillance de porte","Überfahrene Haltestelle":"Arrêt manqué","Überfüllt":"Surchargé","Überholung":"Dépassement","Überschwemmung":"Inondation","Überschwemmungsgefahr":"Risque d'inondation","Umgestürzte Bäume auf dem Gleis":"Arbres tombés sur la voie","Umgestürzter Baum":"Arbre tombé","Umleitung, der geplante Fahrweg kann nicht genutzt werden.":"Déviation, l'itinéraire prévu ne peut pas être utilisé.","Unbeaufsichtigtes Gepäck":"Bagage sans surveillance",undefined:"",undefinedAlertCause:"Cause indéfinie","Unfall auf dem Bahnübergang":"Accident au passage à niveau","Ungeplante Bauarbeiten":"Travaux de construction non planifiés",unknown:"Inconnu","Unterbruch der Bedienung durch den ÖV":"Interruption du service de transport public",Vandalismus:"Vandalisme",VEHICLE_FAILURE:"Panne de véhicule",VEHICLE_FAULURE:"Panne de véhicule",vehicleFailure:"Panne de véhicule",vehicleFaulure:"Panne de véhicule","Verdächtiges Fahrzeug":"Véhicule suspect","Vereiste Schienen":"Rails verglacés","Verspäteter Einstieg":"Embarquement retardé","Verzögerte Bereitstellung":"Mise à disposition retardée","Vorausfahrendes Fahrzeug":"Véhicule précédent",Waldbrand:"Feu de forêt",WARNING:"Avertissement","Warten auf entgegenkommendes Fahrzeug":"Attente d'un véhicule arrivant en sens inverse","Warten auf umsteigende Fahrgäste":"Attente de passagers en correspondance",Wartungsarbeiten:"Travaux de maintenance","Weichenstörung":"Défaillance d'aiguillage","Weitere Gründe":"Autres raisons",Zugkopplung:"Accouplement de trains"},it:{"Abwesendes Personal":"Personale assente",accident:"Incidente","Allgemeine Fahrzeugstörung":"Guasto generale del veicolo","Anderes Rollmaterial":"Altro materiale rotabile","Angefahrene Person":"Persona investita","Angefahrenes Tier":"Animale investito","Anweisung der Feuerwehr":"Istruzione dei vigili del fuoco","Anweisung der Polizei":"Istruzione della polizia","Aufprall eines Objekts":"Impatto di un oggetto","Ausfall der Beleuchtung":"Guasto illuminazione","Ausfall der Drehbrücke":"Guasto ponte girevole","Ausfall der Rolltreppe":"Guasto scala mobile","Ausfall des Antriebsystems":"Guasto sistema di trazione","Ausfall des Aufzuges":"Guasto ascensore","Ausfall des Verkehrsmanagementsystems":"Guasto sistema di gestione del traffico","Auswirkung aus vorhergehender Störung(en)":"Effetto da precedente interruzione","Auswirkung einer Störung im Ausland":"Effetto da interruzione all'estero","Bahnübergang gesperrt":"Passaggio a livello chiuso",Bauarbeiten:"Lavori di costruzione","Beinahe-Unfall":"Incidente sfiorato",Betriebseinstellung:"Sospensione del servizio",Blitzeinschlag:"Fulmine","Bombenentschärfung":"Disinnesco bomba","Brückenschaden":"Danno al ponte",constructionWork:"Lavori di costruzione","Das Quellsystem unterstützt keine Störungsgründe":"Il sistema sorgente non supporta motivi di interruzione","Defekt an der Oberleitung":"Guasto alla linea aerea","Defekt an der Signalanlage":"Guasto al sistema di segnalazione","Defekter Bahnübergang":"Passaggio a livello difettoso","Defektes Fahrzeug":"Veicolo difettoso","Defektes Sicherheitssystem":"Sistema di sicurezza difettoso",Demonstration:"Dimostrazione","Der Grund ist nicht bekannt":"Motivo sconosciuto.",Ebbe:"Bassa marea","Einsatz der Polizei":"Intervento della polizia","Eis auf den Wagen":"Ghiaccio sui veicoli",Enteisungsarbeiten:"Lavori di sbrinamento",Entgleisung:"Deragliamento","Erbebenschäden":"Danni da terremoto",Erdabsenkung:"Abbassamento del terreno",Erdrutsch:"Frana",Erdrutschgefahr:"Rischio frana","Erkranktes Personal":"Personale malato",Evakuierung:"Evacuazione",Explosion:"Esplosione",Explosionsgefahr:"Rischio esplosione","Fahrbahnschäden":"Danni alla carreggiata","Fahrgast blockiert die Tür":"Passeggero blocca la porta","Fahrzeug blockiert Gleis/Straße":"Veicolo blocca binario/strada",Felssturz:"Caduta massi",Feuer:"Incendio","Feuer an der Haltestelle":"Incendio alla fermata",Feuerwehreinsatz:"Intervento dei vigili del fuoco",Flut:"Alluvione","Gebrochene Schiene":"Binario rotto",Geschwindigkeitsbegrenzung:"Limite di velocità",Glatteis:"Ghiaccio",Gleisschaden:"Danno al binario","Gleisstromkreisschäden":"Danni al circuito binario",Grasfeuer:"Incendio d'erba",Grenzkontrolle:"Controllo di frontiera","Großveranstaltung":"Grande evento",Hagel:"Grandine",Hochwasser:"Acqua alta","Hohe Temperatur":"Alta temperatura","Instandhaltungsarbeiten an der Kanalisation":"Lavori di manutenzione fognaria",Kabelbrand:"Incendio cavi",Kabeldiebstahl:"Furto di cavi",Kollision:"Collisione",Laubfall:"Caduta foglie",Lawinen:"Valanghe",Lawinengefahr:"Rischio valanghe","Liegengebliebenes Fahrzeug auf dem Gleisabschnitt":"Veicolo fermo sul tratto di binario",LIFT_FAILURE:"Guasto ascensore",liftFailure:"Guasto ascensore",maintenanceWork:"Lavori di manutenzione",MEDICAL_EMERGENCY:"Emergenza medica","Medizinischer Notfalleinsatz":"Intervento medico d'emergenza",Nebel:"Nebbia","Nicht weiter bekannter Unfall":"Incidente sconosciuto","Niedriger Wasserstand":"Livello dell'acqua basso",Notbremsung:"Frenata d'emergenza","Notruf ausgelöst":"Chiamata d'emergenza attivata","Objekt im Gleis":"Oggetto sul binario","Öffentliche Unruhe":"Disordini pubblici",OTHER:"Altro",OTHER_CAUSE:"Altro motivo",Panne:"Guasto","Personen im Gleis":"Persone sul binario",Pflanzenbewuchs:"Vegetazione",POLICE_ACTIVITY:"Attività della polizia",poorWeather:"Maltempo","Problem mit der Landungsbrücke":"Problema con la passerella","Problem mit der Signalanlage":"Problema con il sistema di segnalazione","Problem mit der Stromversorgung":"Problema con l'alimentazione elettrica",Prozession:"Processione",Radschaden:"Danno alla ruota",RAIL_REPLACEMENT:"Sostituzione ferroviaria","Rauch im Fahrzeug":"Fumo nel veicolo","Raue See":"Mare mosso",Reparaturarbeiten:"Lavori di riparazione",routeBlockage:"Blocco del percorso","Schlammlawine, Murgang":"Colata di fango, flusso di detriti","Schlechtes Wetter":"Brutto tempo",Schneesturm:"Tempesta di neve",Schneeverwehungen:"Cumuli di neve",serviceDisruption:"Interruzione del servizio",Sicherheitsalarm:"Allarme di sicurezza","Signal bei Gefahr passiert":"Segnale passato in caso di pericolo",SPECIAL_EVENT:"Evento speciale",specialEvent:"Evento imprevedibile","Starker Regen":"Pioggia intensa","Starker Schneefall":"Forte nevicata","Starker Verkehr":"Traffico intenso",Stausituation:"Situazione di ingorgo","Straße gesperrt":"Strada chiusa","Straßenarbeiten":"Lavori stradali",Streckenblockierung:"Blocco del percorso","Streik, Arbeitskampfmaßnahmen":"Sciopero, azioni sindacali",Sturm:"Tempesta","Sturmschäden":"Danni da tempesta",Sturzflut:"Alluvione improvvisa",TECHNICAL_PROBLEM_OTHER:"Problema tecnico",TECHNICAL_PROBLEM_RAILWAY_SECTION:"Problema tecnico alla sezione ferroviaria",TECHNICAL_PROBLEM_VEHICLE:"Problema tecnico al veicolo",technicalProblem:"Problema tecnico","Technische Störung":"Guasto tecnico","Telefonische Terrordrohung":"Minaccia terroristica telefonica","Terroristischer Anschlag":"Attacco terroristico","Tiere im Gleis":"Animali sul binario",Treibeis:"Ghiaccio galleggiante","Türstörung":"Guasto porta","Überfahrene Haltestelle":"Fermata mancata","Überfüllt":"Sovraffollato","Überholung":"Sorpasso","Überschwemmung":"Alluvione","Überschwemmungsgefahr":"Rischio alluvione","Umgestürzte Bäume auf dem Gleis":"Alberi caduti sul binario","Umgestürzter Baum":"Albero caduto","Umleitung, der geplante Fahrweg kann nicht genutzt werden.":"Deviazione, percorso pianificato non utilizzabile","Unbeaufsichtigtes Gepäck":"Bagaglio incustodito",undefined:"",undefinedAlertCause:"Causa indefinita","Unfall auf dem Bahnübergang":"Incidente al passaggio a livello","Ungeplante Bauarbeiten":"Lavori di costruzione non pianificati",unknown:"Sconosciuto","Unterbruch der Bedienung durch den ÖV":"Interruzione del servizio di trasporto pubblico",Vandalismus:"Vandalismo",VEHICLE_FAILURE:"Guasto veicolo",VEHICLE_FAULURE:"Guasto veicolo",vehicleFailure:"Guasto veicolo",vehicleFaulure:"Guasto veicolo","Verdächtiges Fahrzeug":"Veicolo sospetto","Vereiste Schienen":"Binari ghiacciati","Verspäteter Einstieg":"Imbarco ritardato","Verzögerte Bereitstellung":"Fornitura ritardata","Vorausfahrendes Fahrzeug":"Veicolo precedente",Waldbrand:"Incendio boschivo",WARNING:"Avviso","Warten auf entgegenkommendes Fahrzeug":"Attesa veicolo in arrivo","Warten auf umsteigende Fahrgäste":"Attesa passeggeri in coincidenza",Wartungsarbeiten:"Lavori di manutenzione","Weichenstörung":"Guasto scambio","Weitere Gründe":"Altri motivi",Zugkopplung:"Accoppiamento treni"}},$d=rk,nk={de:{...$d.de,affected_lines:"Betroffene Linien",affected_stops:"Betroffene Haltestellen",all_line_stops:"Alle Haltestellen auf dieser Strecke",daily_from_to:"Täglich von {{from}} bis {{to}}",download:"Herunterladen",error:"Fehler",export_all_region:"Ganze Region exportieren",export_format_title:"Format",exporting:"Exportieren ...",from_to:"von {{from}} bis {{to}}",geolocation_button_title_off:"Geolokalisierung deaktivieren",geolocation_button_title_on:"Geolokalisierung aktivieren",input_copy_success:"Kopiert!",[Si.linesnetworkplan]:"Liniennetzpläne",[Si.mapset]:"Mapset-Pläne",[Si.notifications]:"Meldungen",[Si.realtime]:"Echtzeit",[Si.stations]:"Stationen",layertree_menu_title:"Ebenen",linesnetworkplan:"plan retea linii",no_details_available:"Keine Details verfügbar",no_stops_found:"Keine Haltestellen gefunden",notifications:"Meldungen",permalink_input_hint:"Sie können auch den Link aus der Adresszeile des Browsers kopieren.",platform_ferry:"St.",platform_other:"Kan.",platform_rail:"Gl.",print_menu_title:"Drucken",search_input_cancel:"Eingabe löschen",search_lines_results:"Linien",search_menu_title:"Suchen",search_placeholder:"Haltestelle, Linie, Fährte suchen",search_stops_results:"Haltestellen",search_trains_results:"Fährte",share_email_send:"E-Mail senden",share_image_save:"Bild speichern",share_menu_title:"Teilen",stops_search_placeholder:"Haltestelle suchen",use_2_fingers:"Benutzen Sie 2 Finger um die Karte zu bedienen.",zoomin:"Hineinzoomen",zoomout:"Herauszoomen"},en:{...$d.en,affected_lines:"Affected lines",affected_stops:"Affected stops",all_line_stops:"All stops on this line",daily_from_to:"Daily from {{from}} to {{to}}",download:"Download",error:"Error",export_all_region:"Export entire region",export_format_title:"Format",exporting:"Exporting ...",from_to:"from {{from}} to {{to}}",geolocation_button_title_off:"Disable geolocation",geolocation_button_title_on:"Enable geolocation",input_copy_success:"Copied!",[Si.linesnetworkplan]:"Lines Network Plan",[Si.mapset]:"Mapset plans",[Si.notifications]:"Notifications",[Si.realtime]:"Realtime",[Si.stations]:"Stations",layertree_menu_title:"Layers",no_details_available:"No details available",no_stops_found:"No stops found",permalink_input_hint:"You can also copy the link from the browser address bar.",platform_ferry:"Pier",platform_other:"Std.",platform_rail:"Pl.",print_menu_title:"Print",search_lines_results:"Lines",search_menu_title:"Search",search_placeholder:"Search stop, line, route",search_stops_results:"Stops",search_trains_results:"Routes",share_email_send:"Send email",share_image_save:"Save image",share_menu_title:"Share",stops_search_placeholder:"Search for stop",use_2_fingers:"Use 2 fingers to operate the map.",zoomin:"Zoom in",zoomout:"Zoom out"},fr:{...$d.fr,affected_lines:"Lignes affectées",affected_stops:"Arrêts affectés",all_line_stops:"Tous les arrêts sur cette ligne",daily_from_to:"Tous les jours de {{from}} à {{to}}",download:"Télécharger",error:"Erreur",export_all_region:"Exporter toute la région",export_format_title:"Format",exporting:"Exportation ...",from_to:"de {{from}} à {{to}}",geolocation_button_title_off:"Désactiver la géolocalisation",geolocation_button_title_on:"Activer la géolocalisation",input_copy_success:"Copié!",[Si.linesnetworkplan]:"Plans du réseau",[Si.mapset]:"Plans de Mapset",[Si.notifications]:"Notifications",[Si.realtime]:"Temps réel",[Si.stations]:"Stations",layertree_menu_title:"Couches",no_details_available:"Aucun détail disponible",no_stops_found:"Aucun arrêt trouvé",permalink_input_hint:"Vous pouvez aussi copier le lien depuis la barre d'adresse du navigateur.",platform_ferry:"Quai",platform_other:"Quai",platform_rail:"Voie",print_menu_title:"Imprimer",search_lines_results:"Lignes",search_menu_title:"Rechercher",search_placeholder:"Rechercher un arrêt, une ligne, une route",search_stops_results:"Arrêts",search_trains_results:"Trajets",share_email_send:"Envoyer un email",share_image_save:"Enregistrer l'image",share_menu_title:"Partager",stops_search_placeholder:"Chercher un arrêt",use_2_fingers:"Utilisez 2 doigts pour manipuler la carte.",zoomin:"Zoomer",zoomout:"Dézoomer"},it:{...$d.it,affected_lines:"Linee interessate",affected_stops:"Fermate interessate",all_line_stops:"Tutte le fermate su questa linea",daily_from_to:"Tutti i giorni da {{from}} a {{to}}",download:"Scarica",error:"Errore",export_all_region:"Esporta l'intera regione",export_format_title:"Formato",exporting:"Esportazione ...",from_to:"da {{from}} a {{to}}",geolocation_button_title_off:"Disattiva geolocalizzazione",geolocation_button_title_on:"Attiva geolocalizzazione",input_copy_success:"Copiato!",[Si.linesnetworkplan]:"Piani della rete",[Si.mapset]:"Piani di Mapset",[Si.notifications]:"Notifiche",[Si.realtime]:"In tempo reale",[Si.stations]:"Stazioni",layertree_menu_title:"Livelli",no_details_available:"Nessun dettaglio disponibile",no_stops_found:"Nessuna fermata trovata",permalink_input_hint:"Puoi anche copiare il link dalla barra degli indirizzi del browser.",platform_ferry:"Imb.",platform_other:"Cor.",platform_rail:"Bin.",print_menu_title:"Stampa",search_lines_results:"Linee",search_menu_title:"Cerca",search_placeholder:"Cerca fermata, linea, percorso",search_stops_results:"Fermate",search_trains_results:"Percorsi",share_email_send:"Invia email",share_image_save:"Salva immagine",share_menu_title:"Condividi",stops_search_placeholder:"Ricerca delle fermate",use_2_fingers:"Usa 2 dita per operare la mappa.",zoomin:"Zoom avanti",zoomout:"Zoom indietro"}},BP=nk,K0=OP(BP),ok="en";function sk({children:e,locale:t=ok}){let i=nt(()=>(K0.locale(t),{locale:e=>K0.locale(e),t:(...e)=>K0.t(...e)}),[t]);return N(dS.Provider,{value:i,children:e})}var Wd=Fe(sk),ak=new Xi,lk=()=>{let{isOverlayOpen:e,map:t}=Ze(),i=Qi(e),r=Qi();return Ae(()=>{i.current=e},[e]),Ae(()=>{r.current=(e,r=!1,n)=>{if(!n&&!t||!e?.length)return;let a=e,s=e?.[0];s?.geometry&&"Feature"===s?.type&&(a=ak.readFeatures({features:e,type:"FeatureCollection"},{featureProjection:"EPSG:3857"}));let o=n||t,l=new Gs({features:a}).getExtent();return o.getView().fit(l,{duration:500,maxZoom:l[0]===l[2]||l[1]===l[3]?hS:void 0,padding:[50,50,50,r||i.current?350:50]}),()=>{o?.getView().cancelAnimations()}}},[t]),r},NP=lk;function ck(){let e=NP(),t=Qi();return Ae(()=>{t.current=(t,i=!1)=>{if("Feature"===t?.type&&t.geometry)return void e.current([t],i);let r=t?.extent||t?.bounds;if(r){let t=new Eo(L2(r));return void e.current([t],i)}let n=t?.coordinates;if(n){let t=new Eo(new bn(n));return void e.current([t],i)}}},[e]),t}var Mm=ck,J0=null;function VP(){let{baseLayer:e}=Ze(),[t,i]=qe(null);return Ae(()=>{let t=e?.mapLibreMap?.getSource(F_)?.url,r=t=>{t.sourceId===F_&&t.isSourceLoaded&&(i(t.source?.url),e?.mapLibreMap?.off("sourcedata",r))};return t?i(t):e?.mapLibreMap?.on("sourcedata",r),()=>{e?.mapLibreMap?.off("sourcedata",r)}},[e?.mapLibreMap]),Ae(()=>{let e=new AbortController;return t&&(async t=>{J0||(J0=await(await fetch(t,{signal:e.signal})).json())})(t),()=>{e?.abort()}},[t]),J0}function Hd(){return VP()?.[sS]}function Q0(){return VP()?.[aS]}function uk(e){let t=Hd();return t&&e?t[e]?t[e]:Object.values(t).find(t=>["id","external_id","short_name","long_name"].find(i=>!!t[i]&&t[i].toLowerCase()===e.toLowerCase())):null}function jP(e){let t=Q0();return t&&e?t[e]?t[e]:Object.values(t).find(t=>["id","external_id","short_name","long_name"].find(i=>!!t[i]&&t[i].toLowerCase()===e.toLowerCase())||t?.codes?.find(t=>t.toLowerCase()===e.toLowerCase()||t.split(":")[1]?.toLowerCase()===e.toLowerCase())):null}var GP=uk;function hk(e){let{apikey:t,hasRealtime:i,realtimeresturl:r,realtimetenant:n,tenant:a}=Ze(),[s,o]=qe(),l=nt(()=>n||a,[n,a]),h=nt(()=>t&&l&&i?new Id({apiKey:t,tenant:l,url:r}):null,[t,l,i,r]);return Ae(()=>{if(!h||!e)return;let t=new AbortController;return h.trainsByRouteIdentifier({exact_match:!0,query:e},{signal:t.signal}).then(e=>{e.matches.length>0?o(e.matches[0]):o(void 0)}).catch(t=>{20===t.code||console.error("Failed to fetch train by route identifier",e,t)}),()=>{t?.abort()}},[h,e]),s}var UP=hk;function dk(){let{details:e,embed:t,geolocation:i,hasDetails:r,hasLayerTree:n,hasLnp:a,hasNotification:s,hasPrint:o,hasRealtime:l,hasShare:h,isExportMenuOpen:u,isLayerTreeOpen:c,isSearchOpen:d,isShareMenuOpen:p,layertree:f,lineid:m,linesIds:g,lnp:_,mapset:y,notification:v,notificationid:x,notificationId:b,notificationlang:w,permalink:T,previewNotifications:S,print:I,realtime:P,search:C,selectedFeature:E,setFeaturesInfos:M,setHasDetails:A,setHasGeolocation:k,setHasLayerTree:L,setHasLnp:F,setHasMapset:D,setHasNotification:R,setHasPermalink:z,setHasPrint:N,setHasRealtime:O,setHasSearch:B,setHasShare:j,setHasStations:V,setHasToolbar:G,setIsEmbed:U,setIsExportMenuOpen:Z,setIsLayerTreeOpen:$,setIsOverlayOpen:q,setIsSearchOpen:W,setIsShareMenuOpen:H,setLinesIds:X,setNotificationId:Y,setNotificationSupportedLanguages:K,setStationId:J,setTrainId:Q,share:ee,stationId:te,stationid:ie,tenant:re,toolbar:ne,trainid:ae,trainId:se}=Ze(),oe=GP(m),le=jP(ie),he=UP(ae),ue=Mm(),{locale:ce}=Ct();Ae(()=>{let e=w?.split(",").map(e=>e.trim()).filter(e=>e!==ce())||[];K(e)},[w,K,ce]),Ae(()=>{V(!!re)},[V,re]),Ae(()=>{O("true"===P)},[P,O]),Ae(()=>{R("true"===v||!!S)},[v,S,R]),Ae(()=>{D("true"===y)},[y,D]),Ae(()=>{k("true"===i)},[i,k]),Ae(()=>{z("true"===T)},[T,z]),Ae(()=>{B("true"===C)},[C,B]),Ae(()=>{U("true"===t)},[t,U]),Ae(()=>{F("true"===_)},[_,F]),Ae(()=>{j("true"===ee)},[ee,j]),Ae(()=>{N("true"===I)},[I,N]),Ae(()=>{A("true"===e)},[e,A]),Ae(()=>{G("true"===ne)},[ne,G]),Ae(()=>{L("true"===f)},[f,L]),Ae(()=>{X(oe?.external_id?[oe.external_id]:null)},[oe,X]),Ae(()=>{ue.current(oe,!0)},[oe,ue]),Ae(()=>{J(le?.external_id)},[le,J]),Ae(()=>{ue.current(le,!0)},[le,ue]),Ae(()=>{Y(x)},[x,Y]),Ae(()=>{Q(he?.train_id)},[Q,he]),Ae(()=>{ue.current(he,!0)},[he,ue]);let de=$t(()=>{$(!1),Z(!1),W(!1),H(!1)},[Z,$,W,H]),pe=$t(()=>{J(null),Q(null),Y(null),X(null),M(null)},[J,Q,Y,X,M]);return Ae(()=>{d&&($(!1),Z(!1),H(!1),J(null),pe())},[pe,d,Z,$,H,J]),Ae(()=>{p&&($(!1),Z(!1),W(!1),pe())},[p,pe,Z,$,W]),Ae(()=>{c&&(Z(!1),$(c),W(!1),H(!1),pe())},[c,pe,Z,$,W,H]),Ae(()=>{u&&($(!1),Z(u),W(!1),H(!1),pe())},[pe,u,Z,$,W,H]),Ae(()=>{E&&(de(),Q(E?.get("train_id")||null),J(E?.get("uid")||null),Y(E?.get("situationId")||null))},[E,de,J,Q,Y]),Ae(()=>{te&&(de(),Q(null),X(null),Y(null))},[de,X,Y,Q,te]),Ae(()=>{se&&(de(),J(null),X(null),Y(null))},[de,X,Y,J,se]),Ae(()=>{b&&(de(),J(null),X(null),Q(null))},[de,b,X,J,Q]),Ae(()=>{g?.length&&(de(),J(null),Y(null),Q(null))},[de,g?.length,Y,J,Q]),Ae(()=>{q(o&&u||n&&c||h&&p||r&&!!E||r&&l&&!!se||r&&re&&!!te||r&&a&&!!g||r&&s&&!!b)},[r,E,o,u,n,c,h,p,l,se,re,te,q,a,g,s,b]),null}var ex=dk;function pk(e){let{baseLayer:t,map:i,setLinesNetworkPlanLayer:r}=Ze(),n=nt(()=>t?new Xs({layersFilter:({metadata:e})=>e?.["geops.filter"]?.startsWith("netzplan"),maplibreLayer:t,name:Si.linesnetworkplan,queryRenderedLayersFilter:({metadata:e})=>"netzplan_trips_info"===e?.["geops.filter"],...e||{}}):null,[t,e]);return Ae(()=>{r?.(n)},[n,r]),Ae(()=>{if(i&&n)return i.addLayer(n),()=>{i.removeLayer(n)}},[i,n]),null}var tx=Fe(pk);function fk(e=[0],t){try{let i=t?.mapLibreMap?.getLayer(cS);i&&t?.mapLibreMap?.setFilter(i.id,["match",["get",ja],e,!0,!1])}catch(e){console.error("Error setting filter for highlight layer",e)}}var ix=fk;function mk(e){let{baseLayer:t,linesIds:i,map:r}=Ze(),n=nt(()=>t?new Xs({layersFilter:({metadata:e})=>e?.["geops.filter"]?.startsWith(lS),maplibreLayer:t,visible:!1,...e||{}}):null,[t,e]);return Ae(()=>{if(r&&n)return r.addLayer(n),()=>{r.removeLayer(n)}},[r,n]),Ae(()=>{if(n&&t?.loaded)return i?.length&&(ix(i,t),n.setVisible(!0)),()=>{n?.setVisible(!1),ix(void 0,t)}},[t,t?.loaded,n,i]),null}var rx=Fe(mk),nx=class extends Event{data;constructor(e,t,i={}){super(e,{...i,composed:!0}),this.data=t}logImportantData(){console.log(this.data)}},qd=nx,Cm=(e,t,i)=>{e?.dispatchEvent(new qd(t,i,{bubbles:!0}))},ZP=new Xi;function gk({node:e,wcAttributes:t}){let{map:i,permalinkUrlSearchParams:r,selectedFeature:n}=Ze();return Ae(()=>{Cm(e,"mwc:attribute",t)},[e,t]),Ae(()=>{i?.on("singleclick",t=>{Cm(e,"mwc:singleclick",{coordinate:t.coordinate,pixel:t.pixel})})},[e,i]),Ae(()=>{let t=n?ZP.writeFeatureObject(n):null;t?.properties?.features?.length>0&&(t.properties.features=t.properties.features.map(e=>ZP.writeFeatureObject(e))),Cm(e,"mwc:selectedfeature",t)},[e,n]),Ae(()=>{Cm(e,"mwc:permalink",r?.toString())},[e,r]),null}var ox=Fe(gk);function _k({options:e,...t}){let{map:i}=Ze(),[r,n]=qe(),a=nt(()=>{if(!r)return null;let t=document.createElement("div");return t.className="flex flex-wrap-reverse justify-end",new F2({element:t,target:r,...e})},[e,r]);return Ae(()=>{if(i&&a)return i.addControl(a),()=>{i?.removeControl(a)}},[i,a]),N("div",{ref:e=>{n(e)},...t})}var sx=_k;function yk(e){return N("svg",{height:"24",viewBox:"0 0 48 48",width:"24",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M22.999,25 L22.997,13.002 C22.997,11.896 23.893,11 24.999,11 C26.105,11 27.001,11.896 27.001,13.002 L26.999,26.002 M31,25.003 C31,23.897 31.896,23.001 33.002,23.001 C34.11,23.001 35.006,23.897 35.006,25.003 C35.006,25.003 35,26.125 35,32.001 C35,37.875 33.2,41.001 33.2,41.001 L19,41.001 C19,41.001 12.21,29.483 11.586,28.419 C10.962,27.355 10.804,26.369 11.586,25.587 C12.37,24.805 13.636,24.805 14.418,25.587 L18.998,30.169 L19,30.169 L19,25.001 L18.996,15.003 C18.996,13.897 19.894,13.001 21,13.001 C22.106,13.001 23.002,13.897 23.002,15.003 L23,26.015 M26.9942,22.997 C26.9942,21.891 27.8902,20.995 28.9962,20.995 C30.1042,20.995 31.0002,21.891 31.0002,22.997 L31.0002,26.001 M30,16.3046 C30.632,15.3606 31,14.2246 31,13.0006 C31,9.6846 28.314,7.0006 25,7.0006 C23.208,7.0006 21.616,7.8026 20.518,9.0486 C17.432,9.2986 15,11.8506 15,15.0006 C15,16.2166 15.368,17.3426 15.988,18.2866",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}var ax=yk,lx="units",xk=[1,2,5],Xd=25.4/.28,cx=class extends bd{constructor(e){e=e||{};let t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;let i=void 0!==e.className?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+U2,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==e.minWidth?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(lx,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(lx)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(lx,e)}setDpi(e){this.dpi_=e}updateElement_(){let e=this.viewState_;if(!e)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));let t=e.center,i=e.projection,r=this.getUnits(),n="degrees"==r?"degrees":"m",a=I_(i,e.resolution,t,n),s=this.minWidth_*(this.dpi_||Xd)/Xd,o=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||Xd)/Xd:void 0,l=s*a,h="";if("degrees"==r){let e=e2.degrees;l*=e,l<e/60?(h="″",a*=3600):l<e?(h="′",a*=60):h="°"}else if("imperial"==r)l<.9144?(h="in",a/=.0254):l<1609.344?(h="ft",a/=.3048):(h="mi",a/=1609.344);else if("nautical"==r)a/=1852,h="NM";else if("metric"==r)l<1e-6?(h="nm",a*=1e9):l<.001?(h="μm",a*=1e6):l<1?(h="mm",a*=1e3):l<1e3?h="m":(h="km",a/=1e3);else{if("us"!=r)throw new Error("Invalid units");l<.9144?(h="in",a*=39.37):l<1609.344?(h="ft",a/=.30480061):(h="mi",a/=1609.3472)}let u,c,d,p,f,m=3*Math.floor(Math.log(s*a)/Math.log(10)),g=0;for(;;){d=Math.floor(m/3);let e=Math.pow(10,d);if(u=xk[(m%3+3)%3]*e,c=Math.round(u/a),isNaN(c))return this.element.style.display="none",void(this.renderedVisible_=!1);if(void 0!==o&&c>=o){u=g,c=p,d=f;break}if(c>=s)break;g=u,p=c,f=d,++m}let _=this.scaleBar_?this.createScaleBar(c,u,h):u.toFixed(d<0?-d:0)+" "+h;this.renderedHTML_!=_&&(this.innerElement_.innerHTML=_,this.renderedHTML_=_),this.renderedWidth_!=c&&(this.innerElement_.style.width=c+"px",this.renderedWidth_=c),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){let r=this.getScaleForResolution(),n=r<1?Math.round(1/r).toLocaleString()+" : 1":"1 : "+Math.round(r).toLocaleString(),a=this.scaleBarSteps_,s=e/a,o=[this.createMarker("absolute")];for(let r=0;r<a;++r){let n=r%2==0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";o.push(`<div><div class="ol-scale-singlebar ${n}" style="width: ${s}px;"></div>`+this.createMarker("relative")+(r%2==0||2===a?this.createStepText(r,e,!1,t,i):"")+"</div>")}return o.push(this.createStepText(a,e,!0,t,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+n+"</div>":"")+o.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${"absolute"===e?3:-10}px;"></div>`}createStepText(e,t,i,r,n){let a=(0===e?0:Math.round(r/this.scaleBarSteps_*e*100)/100)+(0===e?"":" "+n);return`<div class="ol-scale-step-text" style="margin-left: ${0===e?-3:t/this.scaleBarSteps_*-1}px;text-align: ${0===e?"left":"center"};min-width: ${0===e?0:t/this.scaleBarSteps_*2}px;left: ${i?t+"px":"unset"};">`+a+"</div>"}getScaleForResolution(){return I_(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||Xd)}render(e){let t=e.frameState;this.viewState_=t?t.viewState:null,this.updateElement_()}},$P=cx,ux=class extends bd{dragPan;icon;onPointerDragRef;text;constructor(e={}){let t=e.element;t||(t=document.createElement("div"),t.className=void 0!==e.className?e.className:"ol-drag-pan-warning"),t.style.display="none",t.style.pointerEvents="auto",super({element:t,render:e.render,target:e.target}),e.element||(this.icon=document.createElement("div"),this.icon.className=`${t.className}-icon`,this.icon.innerHTML='\n      <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">\n        <path fill="none" stroke="currentColor" stroke-width="2" d="M22.999,25 L22.997,13.002 C22.997,11.896 23.893,11 24.999,11 C26.105,11 27.001,11.896 27.001,13.002 L26.999,26.002 M31,25.003 C31,23.897 31.896,23.001 33.002,23.001 C34.11,23.001 35.006,23.897 35.006,25.003 C35.006,25.003 35,26.125 35,32.001 C35,37.875 33.2,41.001 33.2,41.001 L19,41.001 C19,41.001 12.21,29.483 11.586,28.419 C10.962,27.355 10.804,26.369 11.586,25.587 C12.37,24.805 13.636,24.805 14.418,25.587 L18.998,30.169 L19,30.169 L19,25.001 L18.996,15.003 C18.996,13.897 19.894,13.001 21,13.001 C22.106,13.001 23.002,13.897 23.002,15.003 L23,26.015 M26.9942,22.997 C26.9942,21.891 27.8902,20.995 28.9962,20.995 C30.1042,20.995 31.0002,21.891 31.0002,22.997 L31.0002,26.001 M30,16.3046 C30.632,15.3606 31,14.2246 31,13.0006 C31,9.6846 28.314,7.0006 25,7.0006 C23.208,7.0006 21.616,7.8026 20.518,9.0486 C17.432,9.2986 15,11.8506 15,15.0006 C15,16.2166 15.368,17.3426 15.988,18.2866"/>\n      </svg>\n    ',this.element.appendChild(this.icon),this.text=document.createElement("p"),this.text.className=`${t.className}-text`,this.text.innerHTML="Benutzen Sie 2 Finger um die Karte zu bedienen.",this.element.appendChild(this.text)),this.dragPan=void 0,this.onPointerDragRef=void 0,this.onPointerDrag=this.onPointerDrag.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this)}onPointerDrag(e){return 1!==e.activePointers?.length||(this.element.style.display="flex",document.addEventListener("touchend",this.onTouchEnd,{once:!0}),!1)}onTouchEnd(){Bt(this.onPointerDragRef),this.element.style.display="none"}setMap(e){if(super.setMap(e),document.removeEventListener("touchend",this.onTouchEnd),Bt(this.onPointerDragRef),e){if(e.getViewport().style.touchAction="pan-x pan-y",this.dragPan=e.getInteractions().getArray().find(e=>e instanceof k_),!this.dragPan)return void console.error("Impossible to find the DragPan interaction, DragPanWarning will not work as expected.");this.listenerKeys.push(e.on("pointerdown",t=>(document.removeEventListener("touchend",this.onTouchEnd),"touch"===t.originalEvent.pointerType&&this.dragPan?.condition_(t)?(this.onPointerDragRef=e.on("pointerdrag",this.onPointerDrag),!0):(this.element.style.display="none",!0)))),this.element.addEventListener("click",this.onTouchEnd)}}},WP=ux;function vk({children:e,elementClassName:t,iconProps:i}){let{t:r}=Ct(),{isEmbed:n,map:a}=Ze(),[s,o]=qe(null),[l,h]=qe(null);return Ae(()=>{let e=null;if(a&&s&&n&&l)return a.getInteractions().forEach(e=>{e instanceof Hf&&e.setActive(!1)}),e=new WP({element:l,target:s}),a.addControl(e),()=>{e&&a.removeControl(e),a.getInteractions().forEach(e=>{e instanceof Hf&&e.setActive(!0)})}},[a,s,n,l]),N("div",{ref:e=>o(e),children:N("div",{className:Qe("absolute inset-0 z-100000 flex flex-col items-center justify-center bg-black/60 p-6 font-bold text-white",t,"hidden"),ref:e=>h(e),children:e||N(Zt,{children:[N(ax,{height:"48",width:"48",...i}),N("p",{children:r("use_2_fingers")})]})})})}var hx=vk;function bk(e){return N(PS,{size:24,...e})}var dx=bk,wk="flex size-9 items-center justify-center rounded-full bg-white p-1.5 shadow-lg hover:not-disabled:cursor-pointer",HP={primary:{classes:"",selectedClasses:""},secondary:{classes:"",selectedClasses:""}};function Sk({children:e,className:t,href:i,selected:r=!1,theme:n="secondary",...a}){let s=nt(()=>Qe(wk,HP[n].classes,r?HP[n].selectedClasses:"",t),[t,r,n]);return i?N("a",{className:s,href:i,...a,children:e}):N("button",{className:s,...a,children:e})}var Zi=Fe(Sk);function Tk({...e}){let{isExportMenuOpen:t,setIsExportMenuOpen:i}=Ze(),{t:r}=Ct(),n=$t(()=>{i(!t)},[t,i]);return N(Zi,{title:r("print_menu_title"),...e,onClick:n,selected:t,children:N(dx,{})})}var px=Fe(Tk);function Pk(e){return N(SS,{size:24,...e})}var fx=Pk,Ik=16;function Mk({...e}){let t=Ze(),{isTracking:i,map:r,setIsTracking:n}=t,{t:a}=Ct(),s=nt(()=>new O2,[]);return Ae(()=>{let e=[];if(r&&s)return e=[s.once("change:position",e=>{let t=e.target.getPosition();e.target.getPosition()&&(r.getView().setZoom(Ik),r.getView().setCenter(md(t,"EPSG:3857")))}),s.on("change:position",e=>{let t=e.target.getPosition();e.target.getPosition()&&r.getView().setCenter(md(t,"EPSG:3857"))})],()=>{Bt(e)}},[r,s]),Ae(()=>{s.setTracking(i)},[s,i]),N(Zi,{onClick:()=>{n(!i)},title:a(i?"geolocation_button_title_off":"geolocation_button_title_on"),...e,children:N(fx,{className:i?"animate-pulse":""})})}var mx=Fe(Mk);function Ck(e){return N(TS,{size:24,...e})}var gx=Ck;function Ek({...e}){let{isLayerTreeOpen:t,setIsLayerTreeOpen:i}=Ze(),{t:r}=Ct(),n=$t(()=>{i(!t)},[t,i]);return N(Zi,{title:r("layertree_menu_title"),...e,onClick:n,selected:t,children:N(gx,{})})}var _x=Fe(Ek),Ak=e=>{let{permalinktemplate:t}=Ze();return nt(()=>{let i=e||t;if(!i)return null;try{let e,t,r,n;if(i?.startsWith("?")){let a=new URLSearchParams(i),s=[...a.keys()],o=s.find(e=>a.get(e).includes("{{x}}")),l=s.find(e=>a.get(e).includes("{{y}}")),h=s.find(e=>a.get(e).includes("{{z}}")),u=s.find(e=>a.get(e).includes("{{layers}}")),c=new URLSearchParams(window.location.search);t=c.get(o),r=c.get(l),n=c.get(h),e=c.get(u)}else if(i?.startsWith("#")){let a=i.substring(1).split("/"),s=window.location.hash.substring(1).split("/"),o=a.findIndex(e=>e.includes("{{x}}")),l=a.findIndex(e=>e.includes("{{y}}")),h=a.findIndex(e=>e.includes("{{z}}")),u=a.findIndex(e=>e.includes("{{layers}}"));t=o>-1?s[o]:null,r=l>-1?s[l]:null,n=h>-1?s[h]:null,e=u>-1?s[u]:null}let a={};return t&&r&&(a.center=`${t},${r}`),n&&(a.zoom=n),null!=e&&(a.layers=e),a}catch(e){console.warn("Impossible to read x,y,z and layers from the url with template",i,e)}return null},[t,e])},Em=Ak,qP=':root,\n:host {\n  --ol-background-color: white;\n  --ol-accent-background-color: #F5F5F5;\n  --ol-subtle-background-color: rgba(128, 128, 128, 0.25);\n  --ol-partial-background-color: rgba(255, 255, 255, 0.75);\n  --ol-foreground-color: #333333;\n  --ol-subtle-foreground-color: #666666;\n  --ol-brand-color: #00AAFF;\n}\n\n.ol-box {\n  box-sizing: border-box;\n  border-radius: 2px;\n  border: 1.5px solid var(--ol-background-color);\n  background-color: var(--ol-partial-background-color);\n}\n\n.ol-mouse-position {\n  top: 8px;\n  right: 8px;\n  position: absolute;\n}\n\n.ol-scale-line {\n  background: var(--ol-partial-background-color);\n  border-radius: 4px;\n  bottom: 8px;\n  left: 8px;\n  padding: 2px;\n  position: absolute;\n}\n\n.ol-scale-line-inner {\n  border: 1px solid var(--ol-subtle-foreground-color);\n  border-top: none;\n  color: var(--ol-foreground-color);\n  font-size: 10px;\n  text-align: center;\n  margin: 1px;\n  will-change: contents, width;\n  transition: all 0.25s;\n}\n\n.ol-scale-bar {\n  position: absolute;\n  bottom: 8px;\n  left: 8px;\n}\n\n.ol-scale-bar-inner {\n  display: flex;\n}\n\n.ol-scale-step-marker {\n  width: 1px;\n  height: 15px;\n  background-color: var(--ol-foreground-color);\n  float: right;\n  z-index: 10;\n}\n\n.ol-scale-step-text {\n  position: absolute;\n  bottom: -5px;\n  font-size: 10px;\n  z-index: 11;\n  color: var(--ol-foreground-color);\n  text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-text {\n  position: absolute;\n  font-size: 12px;\n  text-align: center;\n  bottom: 25px;\n  color: var(--ol-foreground-color);\n  text-shadow: -1.5px 0 var(--ol-partial-background-color), 0 1.5px var(--ol-partial-background-color), 1.5px 0 var(--ol-partial-background-color), 0 -1.5px var(--ol-partial-background-color);\n}\n\n.ol-scale-singlebar {\n  position: relative;\n  height: 10px;\n  z-index: 9;\n  box-sizing: border-box;\n  border: 1px solid var(--ol-foreground-color);\n}\n\n.ol-scale-singlebar-even {\n  background-color: var(--ol-subtle-foreground-color);\n}\n\n.ol-scale-singlebar-odd {\n  background-color: var(--ol-background-color);\n}\n\n.ol-unsupported {\n  display: none;\n}\n\n.ol-viewport,\n.ol-unselectable {\n  -webkit-touch-callout: none;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  user-select: none;\n  -webkit-tap-highlight-color: transparent;\n}\n\n.ol-viewport canvas {\n  all: unset;\n  overflow: hidden;\n}\n\n.ol-viewport {\n  touch-action: pan-x pan-y;\n}\n\n.ol-selectable {\n  -webkit-touch-callout: default;\n  -webkit-user-select: text;\n  -moz-user-select: text;\n  user-select: text;\n}\n\n.ol-grabbing {\n  cursor: -webkit-grabbing;\n  cursor: -moz-grabbing;\n  cursor: grabbing;\n}\n\n.ol-grab {\n  cursor: move;\n  cursor: -webkit-grab;\n  cursor: -moz-grab;\n  cursor: grab;\n}\n\n.ol-control {\n  position: absolute;\n  background-color: var(--ol-subtle-background-color);\n  border-radius: 4px;\n}\n\n.ol-zoom {\n  top: .5em;\n  left: .5em;\n}\n\n.ol-rotate {\n  top: .5em;\n  right: .5em;\n  transition: opacity .25s linear, visibility 0s linear;\n}\n\n.ol-rotate.ol-hidden {\n  opacity: 0;\n  visibility: hidden;\n  transition: opacity .25s linear, visibility 0s linear .25s;\n}\n\n.ol-zoom-extent {\n  top: 4.643em;\n  left: .5em;\n}\n\n.ol-full-screen {\n  right: .5em;\n  top: .5em;\n}\n\n.ol-control button {\n  display: block;\n  margin: 1px;\n  padding: 0;\n  color: var(--ol-subtle-foreground-color);\n  font-weight: bold;\n  text-decoration: none;\n  font-size: inherit;\n  text-align: center;\n  height: 1.375em;\n  width: 1.375em;\n  line-height: .4em;\n  background-color: var(--ol-background-color);\n  border: none;\n  border-radius: 2px;\n}\n\n.ol-control button::-moz-focus-inner {\n  border: none;\n  padding: 0;\n}\n\n.ol-zoom-extent button {\n  line-height: 1.4em;\n}\n\n.ol-compass {\n  display: block;\n  font-weight: normal;\n  will-change: transform;\n}\n\n.ol-touch .ol-control button {\n  font-size: 1.5em;\n}\n\n.ol-touch .ol-zoom-extent {\n  top: 5.5em;\n}\n\n.ol-control button:hover,\n.ol-control button:focus {\n  text-decoration: none;\n  outline: 1px solid var(--ol-subtle-foreground-color);\n  color: var(--ol-foreground-color);\n}\n\n.ol-zoom .ol-zoom-in {\n  border-radius: 2px 2px 0 0;\n}\n\n.ol-zoom .ol-zoom-out {\n  border-radius: 0 0 2px 2px;\n}\n\n.ol-attribution {\n  text-align: right;\n  bottom: .5em;\n  right: .5em;\n  max-width: calc(100% - 1.3em);\n  display: flex;\n  flex-flow: row-reverse;\n  align-items: center;\n}\n\n.ol-attribution a {\n  color: var(--ol-subtle-foreground-color);\n  text-decoration: none;\n}\n\n.ol-attribution ul {\n  margin: 0;\n  padding: 1px .5em;\n  color: var(--ol-foreground-color);\n  text-shadow: 0 0 2px var(--ol-background-color);\n  font-size: 12px;\n}\n\n.ol-attribution li {\n  display: inline;\n  list-style: none;\n}\n\n.ol-attribution li:not(:last-child):after {\n  content: " ";\n}\n\n.ol-attribution img {\n  max-height: 2em;\n  max-width: inherit;\n  vertical-align: middle;\n}\n\n.ol-attribution button {\n  flex-shrink: 0;\n}\n\n.ol-attribution.ol-collapsed ul {\n  display: none;\n}\n\n.ol-attribution:not(.ol-collapsed) {\n  background: var(--ol-partial-background-color);\n}\n\n.ol-attribution.ol-uncollapsible {\n  bottom: 0;\n  right: 0;\n  border-radius: 4px 0 0;\n}\n\n.ol-attribution.ol-uncollapsible img {\n  margin-top: -.2em;\n  max-height: 1.6em;\n}\n\n.ol-attribution.ol-uncollapsible button {\n  display: none;\n}\n\n.ol-zoomslider {\n  top: 4.5em;\n  left: .5em;\n  height: 200px;\n}\n\n.ol-zoomslider button {\n  position: relative;\n  height: 10px;\n}\n\n.ol-touch .ol-zoomslider {\n  top: 5.5em;\n}\n\n.ol-overviewmap {\n  left: 0.5em;\n  bottom: 0.5em;\n}\n\n.ol-overviewmap.ol-uncollapsible {\n  bottom: 0;\n  left: 0;\n  border-radius: 0 4px 0 0;\n}\n\n.ol-overviewmap .ol-overviewmap-map,\n.ol-overviewmap button {\n  display: block;\n}\n\n.ol-overviewmap .ol-overviewmap-map {\n  border: 1px solid var(--ol-subtle-foreground-color);\n  height: 150px;\n  width: 150px;\n}\n\n.ol-overviewmap:not(.ol-collapsed) button {\n  bottom: 0;\n  left: 0;\n  position: absolute;\n}\n\n.ol-overviewmap.ol-collapsed .ol-overviewmap-map,\n.ol-overviewmap.ol-uncollapsible button {\n  display: none;\n}\n\n.ol-overviewmap:not(.ol-collapsed) {\n  background: var(--ol-subtle-background-color);\n}\n\n.ol-overviewmap-box {\n  border: 1.5px dotted var(--ol-subtle-foreground-color);\n}\n\n.ol-overviewmap .ol-overviewmap-box:hover {\n  cursor: move;\n}\n\n.ol-overviewmap .ol-viewport:hover {\n  cursor: pointer;\n}\n';function Lk({children:e,...t}){let i=Qi(),{center:r,extent:n,map:a,maxextent:s,maxzoom:o,minzoom:l,setMap:h,zoom:u}=Ze(),c=Qi(Em()),d=nt(()=>{if(!s)return;let e=s.split(",").map(e=>parseFloat(e));return new k2({constrainOnlyCenter:!0,extent:e})},[s]);return Ae(()=>{if(!a||!d)return;let e=a.on("change:view",e=>{let t=e.oldValue;t&&(d.setMinZoom(t.getMinZoom()),d.setMaxZoom(t.getMaxZoom()),d.setCenter(t.getCenter()),d.setZoom(t.getZoom()))});return a.setView(d),()=>{Bt(e)}},[a,d]),Ae(()=>{let e;return i.current&&(e=new qf({controls:[],target:i.current}),h(e)),()=>{e?.setTarget(void 0),h()}},[h]),Ae(()=>{if(!a||!n)return;let e=n.split(",").map(e=>parseFloat(e));e&&a.getView().fit(e)},[a,n]),Ae(()=>{if(!a||!r)return;let[e,t]=r.split(",").map(e=>parseFloat(e));e&&t&&a.getView().setCenter([e,t])},[a,r]),Ae(()=>{if(!a)return;let e=parseFloat(u);e&&a.getView().setZoom(e)},[a,u]),Ae(()=>{if(!a)return;let e=parseFloat(o);e&&a.getView().setMaxZoom(e)},[a,o]),Ae(()=>{if(!a)return;let e=parseFloat(l);e&&a.getView().setMinZoom(e)},[a,l]),Ae(()=>{let e=c.current,t=a?.getView();t&&e.center&&t.setCenter(e.center.split(",").map(e=>parseFloat(e))),t&&e.zoom&&t.setZoom(parseFloat(e.zoom))},[a]),N(Zt,{children:[N("style",{children:qP}),N("div",{ref:i,...t,children:e})]})}var yx=Fe(Lk);function Rk(e){let[t,i]=qe(),[r,n]=qe(),{children:a}=e;return Ae(()=>()=>{r&&(r.style.height="",r.style.maxHeight="")},[r]),N("div",{ref:e=>{e&&(i(e),n(e.parentElement))},...e,onPointerDown:e=>{t.setPointerCapture(e.pointerId);let i=r.parentElement.getBoundingClientRect(),n=t.getBoundingClientRect(),a=i.top+(e.clientY-n.top);function s(e){r.style.height=`calc(100% - ${e.clientY-a}px)`,r.style.maxHeight="100%"}function o(t){t.target.releasePointerCapture(e.pointerId),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o)}document.addEventListener("pointerup",o),document.addEventListener("pointermove",s),document.addEventListener("pointercancel",e=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o),e.stopPropagation(),e.preventDefault()})},children:a})}var xx=Rk;function Dk({children:e,className:t,ScrollableHandlerProps:i={}}){let r=!!e;return Array.isArray(e)&&(r=e?.length&&(e||[]).find(e=>!!e)),r?N("div",{className:(Qe("pointer-events-auto relative z-50 flex flex-col overflow-hidden bg-white transition-[min-height,max-height] @lg:transition-[width]"),t),children:[N(xx,{className:"absolute inset-0 flex h-[65px] touch-none justify-center @lg/main:hidden",style:{width:"100%"},...i,children:N("div",{className:"m-2 mr-[-60px] bg-gray-300",style:{borderRadius:2,height:4,width:32}})}),e]}):null}var Am=Dk;function kk(){return N("svg",{"aria-hidden":"true",className:"h-8 w-8 animate-spin",fill:"none",viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg",children:[N("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"lightGray"}),N("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]})}var vx=Fe(kk),XP=zs(null),Lm=zs(null);function Fk(e){return N(fS,{size:24,...e})}var bx=Fk,YP='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><title>iconfont/minus</title><path d="M19 11a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2z"/></svg>';function KP({childContainerClassName:e,childItems:t,className:i,isCollapsedOnControlClick:r,isControlChecked:n,layer:a,selectionType:s,title:o}){let[l,h]=qe(!0),u=Dn(Lm),c=jl(),d=jl(),{t:p}=Ct();Ae(()=>{r&&h(n)},[n,r,a]);let f=t.filter(({title:e})=>!!e).map((e,t)=>N(KP,{...e},t));if(!o)return null;let m=()=>t.length>0&&(t.filter(e=>e.isControlChecked).length!==t.length&&t.some(e=>e.isControlChecked));return N(Zt,{children:[N("div",{className:Qe("flex items-center gap-2 py-2",i),children:["radio"===s?null:N(ES,{checked:n,checkedIconUrl:m()?YP:null,className:m()?"bg-[length:18px]":"",id:c,onChange:e=>{u({payload:{...this.props,isControlChecked:e.target.checked},type:"SELECT_ITEM"})}}),N("label",{className:"flex-1 cursor-pointer",htmlFor:f.length>0?d:c,children:"string"==typeof o?p(o):o}),f.length>0&&N("button",{className:"flex cursor-pointer items-center gap-2",id:d,onClick:()=>{h(!l),r&&!l&&u({payload:{...this.props,isControlChecked:!0},type:"SELECT_ITEM"})},children:N(l?bx:CS,{})})]}),l&&f.length>0&&N("div",{className:Qe("pl-6",e),children:f})]})}var wx=KP,QP={childItems:[],parent:null},eI=(e,t)=>{for(let i of e)i.parent=t,i.childItems.length&&eI(i.childItems,i)},Ok=e=>{let t={...QP};return t.childItems=e,eI(t.childItems,t),t},tI=(e,t)=>{if(e.id===t.id)return e;if(e.childItems.length)for(let i of e.childItems){let e=tI(i,t);if(e)return e}},Sx=(e,t,i)=>{if(t.isControlChecked)if("checkbox"===t.selectionType)e.isControlChecked=t.isControlChecked,e.layer.setVisible(e.isControlChecked);else for(let t of e.parent.childItems)t.isControlChecked=t.id===e.id,t.isControlChecked||iI(t);else"checkbox"===t.selectionType&&(e.isControlChecked=t.isControlChecked,e.layer.setVisible(e.isControlChecked));e.childItems.length&&!i&&Tx(e),Vk(e)},Bk=(e,t)=>{let i=tI(e,t);return i&&Sx(i,t,!1),{...e}},Tx=e=>{"radio"===e.childItems[0].selectionType?iI(e):Nk(e)},iI=e=>{if(e.isControlChecked)for(let t=0;t<e.childItems.length;t++)e.childItems[t].isControlChecked=0===t;else for(let t of e.childItems)t.isControlChecked=!1;e.childItems.length&&e.childItems[0].childItems.length&&Tx(e.childItems[0])},Nk=e=>{for(let t of e.childItems)t.isControlChecked=e.isControlChecked,t.layer.setVisible(t.isControlChecked),t.childItems.length&&Tx(t)},Vk=e=>{if(e.parent)if("checkbox"===e.parent.selectionType){let t={...e.parent,isControlChecked:e.parent.childItems.some(e=>e.isControlChecked)};Sx(e.parent,t,!0)}else if(e?.parent?.parent){let t={...e.parent,isControlChecked:e.parent.childItems.some(e=>e.isControlChecked)};Sx(e.parent,t,!0)}};function jk(e=QP,t){switch(t.type){case"INIT":return Ok(t.payload);case"SELECT_ITEM":return Bk(e,t.payload);default:return e}}var rI=jk;function Gk({className:e,layers:t,treeItemProps:i,...r}){let[n,a]=ww(rI,t);return Ae(()=>{a({payload:t,type:"INIT"})},[t]),N(XP.Provider,{value:n,children:N(Lm.Provider,{value:a,children:N("div",{className:Qe("relative flex flex-col",e),...r,children:t.map(e=>Da(wx,{...i||{},className:Qe("w-full",i?.className),key:e.id,...e}))})})})}var Px=Fe(Gk);function Uk(){let{layersconfig:e}=Ze(),[t,i]=qe({});return Ae(()=>{try{let t=JSON.parse(e||"{}");Object.values(Si).forEach(e=>{t[e]={title:e,...t[e]||{}}}),i(t)}catch(e){console.error("Error parsing layersconfig:",e)}},[e]),t}var Rm=Uk,nI=(e,t,i={})=>{let r=i[e.get("name")]?.title||"",n=e.get(uS),a=r;return"function"==typeof n&&(a=n(a)),{childItems:e?.getLayers?.().getArray().map(e=>nI(e,t,i))||[],id:wi(e),isControlChecked:e.getVisible(),layer:e,revision:t,selectionType:"checkbox",title:a}};function Zk({filter:e,order:t=iS,...i}){let{map:r}=Ze(),[n,a]=qe(0),s=Rm(),o=nt(()=>r?.getLayers().getArray().filter(e??(e=>!0!==(e.get(z_)||s[e.get("name")]?.[z_]))).sort((e,i)=>t&&t.indexOf(e.get("name"))>t.indexOf(i.get("name"))?1:-1).map(e=>nI(e,n,s))||[],[e,s,r,t,n]);return Ae(()=>{let e=[];return Do(r.getLayers().getArray()).forEach(t=>{let i=t.on("change:visible",()=>{a(e=>e+1)});e.push(i)}),e.push(r.on("change:layergroup",()=>{a(e=>e+1)}),r.getLayers().on("add",()=>{a(e=>e+1)}),r.getLayers().on("remove",()=>{a(e=>e+1)})),()=>{Bt(e)}},[r]),N(Px,{layers:o,...i})}var Ix=Fe(Zk);function $k(e){return N("svg",{height:"24",viewBox:"0 0 42 42",width:"24",xmlns:"http://www.w3.org/2000/svg",...e,children:[N("path",{d:"M40,20A20,20,0,1,1,20,0,20,20,0,0,1,40,20Z","data-name":"Pfad 1",fill:"#353535",id:"Pfad_1",transform:"translate(0 0)"}),N("path",{d:"M25.481,11.843a9.993,9.993,0,0,0-10,9.992c0,7.773,10,14.8,10,14.8s9.992-7.5,9.992-14.8a9.991,9.991,0,0,0-9.992-9.992m0,14.662a4.924,4.924,0,1,1,4.924-4.924A4.93,4.93,0,0,1,25.482,26.5","data-name":"Pfad 2",fill:"#fff",id:"Pfad_2",transform:"translate(-5.477 -4.19)"}),N("path",{d:"M12.015,8.124,38.081,34.031,35.4,36.536,9.06,10.527Z","data-name":"Pfad 3",fill:"#ec0016",id:"Pfad_3",transform:"translate(-3.206 -2.874)"}),N("path",{d:"M20,3.231A16.769,16.769,0,1,1,3.231,20,16.788,16.788,0,0,1,20,3.231M20,0A20,20,0,1,0,40,20,20,20,0,0,0,20,0","data-name":"Pfad 4",fill:"#353535",id:"Pfad_4",transform:"translate(0 0)"})]})}var Mx=$k,Wk=(e=null)=>{let t=e?.properties?.line?.color||e?.line?.color||e?.color;if(!t){let i=e?.properties?.type||e?.type;if(!i){let t=e?.vehicleType;Number.isFinite(t)||(t=e?.train_type),i=Number.isFinite(t)?t:"rail"}t=Ua.getColorForType(i)||Ua.getColorForType("rail")}return t&&!t.startsWith("#")&&(t=`#${t}`),t},Wu=Wk,Hk=e=>{let t=e.text_color||e.line?.text_color||e.properties?.line?.text_color;if(t)return t;let i=e.type||e.properties?.type;return Ua.getTextColorForType(i)},Dm=Hk,qk=(e,t,i,r)=>`bold ${i}px arial`,km=qk,Xk=(e="")=>e?.properties?.line?.name||e?.line?.name||e?.name||e?.short_name||e||"",Fm=Xk,Yk=[16,16,16,14,12];function Kk({children:e,className:t,departure:i,displayNoRealtimeIcon:r=!1,line:n,lineInfo:a,stopSequence:s,trajectory:o,...l}){let{realtimeLayer:h}=Ze(),u=n||a||i?.line||s?.line||o?.properties?.line,c=s?.id||i?.train_id,d=o||h?.trajectories[c],p=n||a||i||s||o,f=Wu(p),m=Dm(p),g=Fm(p),_=Yk[g.length]||12,y=km(p,null,_,g),v=s?.has_realtime_journey||i?.has_realtime_journey||d?.properties?.has_realtime_journey||s?.stations?.[0]?.state&&"TIME_BASED"!==s?.stations?.[0]?.state,x=!!s||!!i||!!d,b="JOURNEY_CANCELLED"===s?.stations[0]?.state,w=u?.stroke||"black";return w===f&&(w="black"),N("span",{className:Qe("relative flex h-[40px] min-w-[40px] items-center justify-center rounded-full border-2 px-1",t),style:{backgroundColor:f,borderColor:w,color:m,font:y},...l,children:[e||g,r&&x&&!b&&!v&&N(Mx,{className:"absolute -top-3 -right-3"})]})}var co=Kk;function Jk({children:e,className:t,...i},r){return N("div",{...i,className:Qe("relative overflow-y-auto",t),ref:r,children:[N("div",{className:"pointer-events-none sticky top-0 right-0 left-0 h-4 bg-gradient-to-t from-transparent to-white"}),e,N("div",{className:"pointer-events-none sticky right-0 bottom-[-1px] left-0 h-4 bg-gradient-to-b from-transparent to-white"})]})}var Js=Fe(Ef(Jk));function Qk(e){let t=Rm()[e]||{};return t.title||(t.title=e),t}var Hu=Qk,zm="runs";function eF({className:e,features:t,...i}){let{linesIds:r}=Ze(),n=Hd(),a=Q0(),s=Hu(Si.linesnetworkplan),[o,l]=qe(null),h=nt(()=>"true"===new URLSearchParams(window.location.search).get(zm),[]),u=$t(e=>{let t=s?.link?.href;return t?t.replace("{{id}}",e):null},[s]),c=nt(()=>{let e={};return[...new Set([...r||[],...t.map(e=>e.get(ja))])].filter(e=>!!e&&!!n?.[e]).forEach(i=>{let{operator_name:r}=n[i];e[r]||(e[r]=[],e[r].runs=0),n[i].id=i;let a=t?.filter(e=>e.get(ja)===i).reduce((e,t)=>e+t.get(zm),0);n[i].id=i,n[i].runs=a,e[r].runs+=a,e[r].push(n[i])}),e},[t,n,r]);nt(()=>{let e={};return t.forEach(t=>{let i=t.get(ja);if(i&&!e[i]&&t.get("stop_ids"))try{e[i]=JSON.parse(t.get("stop_ids"))}catch(e){console.warn("Impossible to parse stop_ids",e)}}),e},[t]);return t?.length||r?.length?N(Js,{...i,className:Qe("px-4 text-base",e),children:N("div",{className:"space-y-4",children:Object.entries(c).sort(([e],[t])=>c[e][zm]<c[t][zm]?1:-1).map(([e,t])=>N("div",{className:"flex flex-col gap-2",children:[N("div",{children:e}),N("div",{className:"flex flex-wrap gap-2",children:t.sort((e,t)=>e.runs<t.runs?1:-1).map(e=>{let{color:t,long_name:i,mot:r,runs:n,short_name:s,text_color:o}=e,l=i||s,c=null;if(c?.length||(c=null),!l&&c){let e=c.map(e=>a[e].short_name);l=[...new Set([e[0],e[e.length-1]])].join(" - ")}let d={color:null,id:null,name:s,stroke:null,text_color:null,type:r};return o&&(d.text_color=o.startsWith("#")?o:`#${o}`),t&&(d.color=t.startsWith("#")?t:`#${t}`),N("div",{className:l?"w-full":"",children:N("div",{className:"flex items-center justify-between gap-2",children:[N("div",{children:u(e.id)?N("a",{href:u(e.id),rel:"noreferrer",target:"_blank",children:N(co,{line:d})}):N(co,{line:d})}),!!l&&N("div",{className:"flex-1 text-left",children:l.split("-").map(e=>N("div",{children:e},e))}),h&&N("div",{className:"text-xs",children:n})]})},s)})})]},e))})}):null}var Cx=eF;function tF(e){return N(vS,{size:24,...e})}var Ex=tF;function iF(e){return N(bS,{size:24,...e})}var Ax=iF,rF="leading-[1.1] underline text-[14px] @sm/main:text-[16px] @md/main:text-[18px] font-semibold",nF={primary:{classes:"bg-red text-white disabled:bg-lightgrey  hover:bg-darkred hover:border-darkred  active:bg-lightred active:border-lightred ",selectedClasses:"bg-darkred border-darkred"},secondary:{classes:"bg-white text-black hover:text-red active:text-lightred",selectedClasses:"text-red"}};function oF({children:e,className:t,theme:i="secondary",...r}){let n=nt(()=>Qe(`${rF} ${nF[i].classes}  ${t||""}`),[t,i]);return N("a",{className:n,rel:"noreferrer",target:"_blank",...r,children:[N("span",{children:e}),N(Ax,{className:"inline shrink-0"})]})}var Lx=Fe(oF);function sF(e,t){let{lang:i,notificationsLayer:r,previewNotifications:n}=Ze(),[a,s]=qe(),o=nt(()=>r?.api,[r]);return Ae(()=>{let r=n?.find(t=>t.id===e);if(r)return void s(r);let a=new AbortController;return o?.exportById(e,{contentLarge:!0,contentMedium:!0,contentSmall:!0,includeGeoms:!1,includeLines:!0,includeStops:!0,[i]:!0,limit:1,...t||{}}).then(e=>{s(e)}).catch(e=>{if(20!==e.code)return s(void 0),void console.error("Failed to fetch situation",e)}),()=>{a.abort()}},[o,e,t,i,n]),a}var oI=sF,aF=(e=[])=>{let t=[];try{e.forEach(e=>{let i=JSON.stringify(e.publicationWindows),r=JSON.stringify(e.textualContents),n=t.find(t=>t.severity===e.severity&&t.serviceCondition===e.serviceCondition&&JSON.stringify(t.publicationWindows)===i&&JSON.stringify(t.textualContents)===r);if(n)return n.publicationLines=[...n.publicationLines||[],...e.publicationLines||[]],n.publicationStops=[...n.publicationStops||[],...e.publicationStops||[]],!1;t.push(e)})}catch(t){return console.error("Error merging publications",t),e}return t},sI=aF,aI=(e,t,i)=>{let r=e.toLocaleTimeString(["de"],{hour:"2-digit",minute:"2-digit"});return`${e.toLocaleDateString(["de"],{day:"2-digit",month:"short",weekday:"short",year:i?"numeric":void 0})}${t&&t!==r?` ${r}`:""}`.replace(",","").replace(/\./,"").replace(/\.$/,"")};function lF({className:e,...t}){let{locale:i,t:r}=Ct(),{notificationId:n,notificationSupportedLanguages:a}=Ze(),s=oI(n),o={},l={},h=[],u=[],c=[];return u=(s?.publications||[])?.filter(({publicationWindows:e})=>(!e?.length&&s?.publicationWindows?.length&&(e=s.publicationWindows),e.find(({endTime:e,startTime:t})=>{let i=new Date,r=new Date(t),n=new Date(e);return r<=i&&i<=n})))||[],u=sI(u),h=(s?.affectedTimeIntervals||[]).filter(({endTime:e,startTime:t})=>{let i=new Date,r=new Date(t),n=new Date(e);return r<=i&&i<=n||i<r})||[],c=(s?.reasons||[]).map(({name:e})=>e&&r(e.replace(".",""))),N(Js,{...t,className:Qe("px-4 text-base",e),children:N("div",{children:u?.map(({id:e,infoLinks:t,publicationLines:n,publicationStops:s,textualContentLarge:u,textualContentMedium:d,textualContentSmall:p})=>{let f=i();if(a?.length&&!a.includes(f)&&(f=a[0]),o=u||d||p,l=o?.[f],!l?.summary)for(let e of a){let t=o?.[e];if(t?.summary){f=e,l=t;break}}let m=n?.flatMap(e=>e.lines?.map(({name:e})=>e)||[])||[];m=[...new Set(m)];let g=s.map(e=>e?.name||"");return g=[...new Set(g)],N("div",{className:"text-base",children:[N("div",{className:"text-xs uppercase",children:c}),N("h3",{className:"space-x-2 text-lg leading-[1.3] font-bold text-balance",children:[N("span",{className:"inline-block align-middle",children:N(Ex,{})}),N("span",{className:"align-middle *:inline",dangerouslySetInnerHTML:{__html:l?.summary}})]}),N("hr",{className:"my-1"}),h?.map(({dailyEndTime:e,dailyStartTime:t,endTime:i,startTime:n})=>{let a=e&&t,s=(new Date).getFullYear()===new Date(n).getFullYear(),o=(new Date).getFullYear()===new Date(i).getFullYear(),l=i.includes("2500");return N("div",{className:"text-sm font-bold text-balance",children:[N("span",{children:r("from_to",{from:aI(new Date(n),!a,!s),to:l?void 0:aI(new Date(i),!a,!o)})}),a&&N("span",{children:` (${r("daily_from_to",{from:t,to:e})})`})]},n)}),N("div",{className:"my-4 flex flex-col gap-4",children:[l?.description&&N("div",{dangerouslySetInnerHTML:{__html:l?.description}}),!!t?.length&&N("div",{className:"space-y-1",children:t.map(({label:e,uri:t})=>{let i=e?.[f]||t||"";return N(Lx,{className:"block",href:t,title:i,children:i},t)})}),!!m?.length&&N("div",{children:[N("div",{className:"font-bold",children:[r("affected_lines"),":"]}),N("div",{className:"flex flex-wrap gap-1 text-sm",children:m?.map(e=>N("div",{className:"rounded-md bg-black px-2 py-1 font-bold text-white",children:e},e))})]}),!!g?.length&&N("div",{children:[N("div",{className:"font-bold",children:[r("affected_stops"),":"]}),N("div",{className:"flex flex-wrap gap-1 text-sm",children:g.map(e=>N("div",{className:"rounded-md bg-black px-2 py-1 font-bold text-white",children:e},e))})]})]})]},e)})})})}var Rx=lF,Dx=(e,t)=>t?N("a",{className:"whitespace-normal underline",href:t,rel:"noreferrer",target:"_blank",children:e}):e;function cF({stopSequence:e}){return e.operator||e.publisher?N(Zt,{children:N("div",{className:"m-4 mb-0 flex flex-wrap text-[10px] text-gray-500",children:[e.operator&&Dx(e.operator,e.operatorUrl),e.operator&&e.publisher&&N("span",{children:" - "}),e.publisher&&Dx(e.publisher,e.publisherUrl),e.license&&N("span",{children:" ("}),e.license&&Dx(e.license,e.licenseUrl),e.license&&")"]})}):null}var kx=Fe(cF);function uF({...e}){return N("svg",{fill:"none",height:"24",part:"svg",viewBox:"0 0 14 14",width:"24",xmlns:"http://www.w3.org/2000/svg",...e,children:[N("path",{clipRule:"evenodd",d:"M7 0.333344C7.375 0.333344 7.66667 0.62501 7.66667 0.97921V2.35414C9.7292 2.66668 11.3333 4.27081 11.625 6.33334H13C13.375 6.33334 13.6667 6.62501 13.6667 7.00001C13.6667 7.37501 13.375 7.66668 13 7.66668H11.625C11.3333 9.70834 9.70833 11.3333 7.66667 11.625V13C7.66667 13.375 7.375 13.6667 7 13.6667C6.64587 13.6667 6.33333 13.375 6.33333 13V11.625C4.29167 11.3333 2.68747 9.70834 2.39587 7.66668H1C0.625 7.66668 0.333333 7.37501 0.333333 7.00001C0.333333 6.62501 0.625 6.33334 1 6.33334H2.39587C2.68747 4.27081 4.29167 2.66668 6.33333 2.35414V0.97921C6.33333 0.62501 6.64587 0.333344 7 0.333344ZM7 3.66668C5.16667 3.66668 3.66667 5.16668 3.66667 7.00001C3.66667 8.79168 5.08333 10.3125 7 10.3125C8.89587 10.3125 10.3333 8.81254 10.3333 7.00001C10.3333 5.16668 8.83333 3.66668 7 3.66668Z",fill:"currentColor",fillRule:"evenodd"}),N("path",{clipRule:"evenodd",d:"M5.66667 7.00001C5.66667 6.27081 6.2708 5.66668 7 5.66668C7.7292 5.66668 8.33333 6.27081 8.33333 7.00001C8.33333 7.72921 7.7292 8.33334 7 8.33334C6.2708 8.33334 5.66667 7.72921 5.66667 7.00001Z",fill:"currentColor",fillRule:"evenodd",part:"circle"})]})}var Fx=uF;function hF({children:e,className:t,...i}){let{isFollowing:r,setIsFollowing:n}=Ze();return N(Zi,{className:Qe(""+(r?"animate-pulse":""),t),onClick:()=>{n(!r)},selected:r,...i,children:e||N(Fx,{})})}var zx=Fe(hF);function dF({stopSequence:e,...t}){let{destination:i}=e||{};return N("span",{...t,children:i})}var Ox=Fe(dF);function pF({stopSequence:e,...t}){let{longName:i,routeIdentifier:r}=e||{},n=i;if(r){let e=r;r.includes(".")?[e]=r.split("."):r.includes("_")?[e]=r.split("_"):r.includes(":")&&([e]=r.split(":")),/^\d*$/.test(e)&&(e=`${parseInt(e,10)}`),i.includes(e)||(n=`${i} (${e})`)}return N("span",{...t,children:n})}var Bx=Fe(pF);function fF({stopSequence:e,...t}){return N("div",{...t,children:[N(Ox,{className:"font-bold",stopSequence:e}),N(Bx,{className:"text-sm",stopSequence:e})]})}var Nx=Fe(fF);function mF({stopSequence:e}){return N("div",{className:"flex items-center gap-x-4 bg-slate-100 p-4",children:[N(co,{stopSequence:e}),N(Nx,{className:"flex grow flex-col",stopSequence:e}),N(zx,{})]})}var Vx=Fe(mF),gF=()=>nt(()=>{let e=new URLSearchParams(window.location.search).get("debug");return!(!e||"false"===e)&&e},[]),Om=gF,jx=zs({index:null,invertColor:null,station:null,status:null,stop:null,stopSequence:null}),_F=()=>{let e=Dn(jx);if(!e)throw new Error("useRouteStop must be used within a ContextProvider");return e},ln=_F;function yF(e){let{status:t,stop:i}=ln();return Om()?N("div",{className:"p-4 text-left text-xs",...e,children:[N("div",{children:["State: ",N("b",{children:i.state})," (isPassed: ",`${t.isPassed}`,") (cancelled: ",`${i.cancelled}`,")"]}),N("div",{children:["Arrival time: ",i.arrivalTime," (delay: ",N("b",{children:`${i.arrivalDelay}`}),") (aimed: ",i.aimedArrivalTime,")"]}),N("div",{children:["Departure time: ",i.arrivalTime," (delay:"," ",N("b",{children:`${i.departureDelay}`}),") (aimed: ",i.aimedArrivalTime,")"]}),N("div",{children:Object.entries(t).map(([e,t])=>!1===t?null:N("div",{children:[e,": ",`${t}`]},e))})]}):null}var lI=yF,xF=e=>{let t=Math.round(e/1e3/60);return t>=10?"#dc2626":t>=5?"#ea580c":t>=3?"#ca8a04":"#16a34a"},Yd=xF,vF=e=>{let t=e;t<0&&(t=0);let i=Math.floor(t/36e5),r=Math.round(t%36e5/6e4),n="";return i>0&&(n+=`${i}h`),r>0&&(n+=`${r}m`),n||"0"},Kd=vF;function bF(e){let{status:t,stop:i}=ln(),{arrivalDelay:r,departureDelay:n}=i,a=t.isNotRealtime||t.isCancelled||t.isNotStop||t.isPassed;return N("div",{...e,children:[a||null===r||t.isFirst?null:N("span",{style:{color:Yd(r)},children:`+${Kd(r)}`}),a||null===n||t.isLast?null:N("span",{style:{color:Yd(r)},children:`+${Kd(n)}`})]})}var Gx=Fe(bF);function wF({svgProps:e,...t}){let{invertColor:i,status:r,stopSequence:n}=ln(),{isBoarding:a,isFirst:s,isLast:o,isLeft:l,isPassed:h,progress:u}=r,c=s?"50%":"-100%",d=o?"50%":"100%",p=`${u}%`,f="rgb(156, 163, 175)",m=Wu(n),g=h?f:m,_=h?m:f,y=f;i&&(g=h?m:f,_=h?f:m,y=m);let v=h||!l&&!a?g:_;return N("div",{...t,children:N("svg",{fill:"none",height:"100%",stroke:g,width:"16",xmlns:"http://www.w3.org/2000/svg",...e,children:[N("circle",{cx:"50%",cy:"50%",r:"5",stroke:"black",strokeWidth:"6"}),N("line",{stroke:"black",strokeWidth:"6",x1:"50%",x2:"50%",y1:c,y2:d}),N("line",{stroke:y,strokeWidth:"4",x1:"50%",x2:"50%",y1:c,y2:p}),N("line",{strokeWidth:"4",x1:"50%",x2:"50%",y1:u-2+"%",y2:d}),N("circle",{cx:"50%",cy:"50%",r:"5",strokeWidth:"4"}),N("circle",{className:a?"animate-pulse":"",cx:"50%",cy:"50%",r:"5",stroke:v,strokeWidth:"4"}),N("circle",{cx:"50%",cy:"50%",fill:"white",r:"3",stroke:"black",strokeWidth:"1"})]})})}var Ux=Fe(wF);function SF({...e}){let{stop:t,stopSequence:i}=ln(),{type:r}=i,{t:n}=Ct(),{platform:a}=t||{};if(!a)return null;let s=n(`platform_${r||"rail"}`);return N("span",{...e,children:[s||n("platform_rail")," ",a]})}var Zx=Fe(SF);function TF({children:e,...t}){let{stop:i}=ln(),{stationName:r}=i||{};return N("div",{...t,children:[r,N("br",{}),N(Zx,{className:"rounded-sm bg-slate-100 px-0.5 py-px text-xs group-hover:bg-slate-50"}),e]})}var $x=Fe(TF);function PF({...e}){return N("svg",{fill:"currentColor",height:"24",version:"1.1",viewBox:"0 0 14 14",width:"24",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"m 14,8 0,1 -6,-1 0,3 2,2 0,1 L 7,13 4,14 4,13 6,11 6,8 0,9 0,8 6,5 6,2 C 6,1 6.22222,0 7,0 7.77777,0 8,1 8,2 l 0,3 z"})})}var Wx=PF;function IF({...e}){return N("svg",{fill:"currentColor",height:"24px",version:"1.1",viewBox:"0 -3.84 122.88 122.88",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M29.03,100.46l20.79-25.21l9.51,12.13L41,110.69C33.98,119.61,20.99,110.21,29.03,100.46L29.03,100.46z M53.31,43.05 c1.98-6.46,1.07-11.98-6.37-20.18L28.76,1c-2.58-3.03-8.66,1.42-6.12,5.09L37.18,24c2.75,3.34-2.36,7.76-5.2,4.32L16.94,9.8 c-2.8-3.21-8.59,1.03-5.66,4.7c4.24,5.1,10.8,13.43,15.04,18.53c2.94,2.99-1.53,7.42-4.43,3.69L6.96,18.32 c-2.19-2.38-5.77-0.9-6.72,1.88c-1.02,2.97,1.49,5.14,3.2,7.34L20.1,49.06c5.17,5.99,10.95,9.54,17.67,7.53 c1.03-0.31,2.29-0.94,3.64-1.77l44.76,57.78c2.41,3.11,7.06,3.44,10.08,0.93l0.69-0.57c3.4-2.83,3.95-8,1.04-11.34L50.58,47.16 C51.96,45.62,52.97,44.16,53.31,43.05L53.31,43.05z M65.98,55.65l7.37-8.94C63.87,23.21,99-8.11,116.03,6.29 C136.72,23.8,105.97,66,84.36,55.57l-8.73,11.09L65.98,55.65L65.98,55.65z"})})}var Hx=IF;function MF({...e}){return N("svg",{fill:"currentColor",height:"24px",version:"1.1",viewBox:"0 0 512 512",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:[N("g",{children:N("g",{children:N("path",{d:"M256,0c-9.217,0-16.696,7.473-16.696,16.696v478.609c0,9.223,7.479,16.696,16.696,16.696\n       c9.217,0,16.696-7.473,16.696-16.696V16.696C272.696,7.473,265.217,0,256,0z"})})}),N("g",{children:N("g",{children:N("path",{d:"M105.739,44.522c-36.826,0-66.783,29.956-66.783,66.783c0,36.826,29.956,66.783,66.783,66.783\n       s66.783-29.956,66.783-66.783C172.522,74.478,142.565,44.522,105.739,44.522z"})})}),N("g",{children:N("g",{children:N("path",{d:"M406.261,44.522c-36.826,0-66.783,29.956-66.783,66.783c0,36.826,29.956,66.783,66.783,66.783\n       s66.783-29.956,66.783-66.783C473.043,74.478,443.087,44.522,406.261,44.522z"})})}),N("g",{children:N("g",{children:N("path",{d:"M202.935,218.664c-3.109-4.501-8.239-7.186-13.717-7.186H22.261c-5.478,0-10.608,2.685-13.717,7.185\n       c-3.12,4.5-3.837,10.244-1.913,15.374l49.022,130.729v63.755c0,27.619,22.468,50.087,50.087,50.087s50.087-22.468,50.087-50.087\n       v-63.755l49.022-130.728C206.772,228.909,206.054,223.163,202.935,218.664z"})})}),N("g",{children:N("g",{children:N("path",{d:"M505.37,355.875l-50.087-133.565c-2.445-6.516-8.674-10.831-15.63-10.831H372.87c-6.957,0-13.185,4.315-15.63,10.831\n       l-50.087,133.565c-1.924,5.13-1.207,10.876,1.913,15.374c3.109,4.501,8.239,7.186,13.717,7.186h33.391v50.087\n       c0,27.619,22.468,50.087,50.087,50.087s50.087-22.468,50.087-50.087v-50.087h33.391c5.478,0,10.608-2.685,13.717-7.185\n       C506.576,366.75,507.293,361.006,505.37,355.875z"})})})]})}var qx=MF;function CF({...e}){return N("svg",{fill:"currentColor",height:"24px",version:"1.1",viewBox:"0 0 14 14",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"m 0,0 0,10 2.000077,0 0,-3.5 2.500097,0 c 1.976154,3e-7 3.500135,-1 3.500135,-3.25 C 8.000309,1 6.4871,2e-7 4.968942,0 z m 2.000077,2 2.500097,0 c 0.963608,0 1.500058,0.5254308 1.500058,1.25 0,0.7245692 -0.631804,1.25 -1.500058,1.25 l -2.500097,0 z M 9,7 9,7.5938559 9.500367,8 l 0,0.75 -3.000116,0 0,-0.25 0.50002,0 c 0.479412,0 0.455442,-0.5 0,-0.5 L 5.500213,8 c -0.50002,0 -0.50002,0.452061 0,0.5 l 0.500019,0 0,0.25 -0.562522,1.28125 C 5.296384,10.001436 5.147956,10 5.000193,10 c -1.02182,0 -2.000077,0.793929 -2.000077,2 0,1.206071 0.978257,2 2.000077,2 1.02182,0 1.937575,-0.856429 1.937575,-2.0625 0,-0.150759 -0.0039,-0.302075 -0.03125,-0.4375 l 0.843783,0 1.821945,-2 0.365639,0.78125 C 9.383285,10.615837 9.000348,11.229684 9.000348,12 c 0,1.206071 0.978257,2 2.000077,2 C 12.022246,14 12.938,13.143571 12.938,11.9375 12.938,10.731429 12.022246,10 11.000425,10 c -0.15008,0 -0.292278,0.02946 -0.437517,0.0625 L 10.000386,8.75 10,7.8 z m -2.593502,2.5 2.193834,0 -1.193796,1.25 -0.843782,0 C 6.422636,10.56342 6.258266,10.401358 6.062734,10.28125 z M 5.000193,11 c 0.635098,0 1.000039,0.549217 1.000039,1 0,0.450783 -0.364941,1 -1.000039,1 -0.635098,0 -1.000038,-0.549217 -1.000038,-1 0,-0.450783 0.36494,-1 1.000038,-1 z m 6.000232,0 c 0.635099,0 1.000039,0.549217 1.000039,1 0,0.450783 -0.36494,1 -1.000039,1 -0.635098,0 -1.000039,-0.549217 -1.000039,-1 0,-0.450783 0.364941,-1 1.000039,-1 z"})})}var Xx=CF;function EF({...e}){return N("svg",{fill:"currentColor",height:"24px",viewBox:"0 0 24 24",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M2 22h15V2H2zm14-1h-6V3h6zM3 3h6v18H3zm15.625 10h3.75L20.5 16zm3.75-2h-3.75L20.5 8z"})})}var Yx=EF;function AF({...e}){return N("svg",{fill:"currentColor",height:"24px",version:"1.1",viewBox:"0 0 15 15",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M5.5,1L6,2h5l0.5-1H5.5z M6,2.5v1.25c0,0,0,2.75,2.5,2.75S11,3.75,11,3.75V2.5H6z M1.9844,3.9863\n\tC1.4329,3.9949,0.9924,4.4485,1,5v4c-0.0001,0.6398,0.5922,1.1152,1.2168,0.9766L5,9.3574V14l5.8789-6.9297\n\tC10.7391,7.0294,10.5947,7,10.4414,7H6.5L3,7.7539V5C3.0077,4.4362,2.5481,3.9775,1.9844,3.9863z M11.748,7.7109L6.4121,14H12\n\tV8.5586C12,8.2451,11.9061,7.9548,11.748,7.7109z",id:"rect4718"})})}var Kx=AF;function LF({...e}){return N("svg",{fill:"currentColor",height:"24px",viewBox:"0 0 15 15",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M13.5,13h-3V9h3a.5.5,0,0,0,.4092-.7871L11.66,5h.84a.5.5,0,0,0,.3838-.82l-2.5-3a.5155.5155,0,0,0-.7676,0l-2.5,3A.5.5,0,0,0,7.5,5h.84L6.0908,8.2129A.5.5,0,0,0,6.5,9h3v4H4V11H5.5a.5.5,0,0,0,0-1h-4a.5.5,0,0,0,0,1H3v2H1.5a.5.5,0,0,0,0,1h12a.5.5,0,0,0,0-1Z"})})}var Jx=LF;function RF({...e}){return N("svg",{fill:"currentColor",height:"24px",viewBox:"0 0 24 24",width:"24px",xmlns:"http://www.w3.org/2000/svg",...e,children:N("path",{d:"M12,6.5a2,2,0,1,0-2-2A2,2,0,0,0,12,6.5Zm7.5,14h-1v-5a1,1,0,0,0-1-1h-5v-2h5a1,1,0,0,0,0-2h-5v-2a1,1,0,0,0-2,0v7a1,1,0,0,0,1,1h5v5a1,1,0,0,0,1,1h2a1,1,0,0,0,0-2Zm-6.8-1.6a4,4,0,0,1-7.2-2.4,4,4,0,0,1,2.4-3.66A1,1,0,1,0,7.1,11a6,6,0,1,0,7.2,9.1,1,1,0,0,0-1.6-1.2Z"})})}var Qx=RF;function DF({accessibility:e=!1,airport:t=!1,barAndRestaurants:i=!1,bathroom:r=!1,bikeStorage:n=!1,elevator:a=!1,iconProps:s={},police:o=!1,station:l,waitingAreas:h=!1,...u}){if(!l)return null;let{hasAccessibility:c,hasAirport:d,hasBarAndRestaurants:p,hasBathroom:f,hasBikeStorage:m,hasElevator:g,hasPolice:_,hasWaitingAreas:y}=l.properties;return N("div",{...u,children:[e&&c&&N(Qx,{...s}),t&&d&&N(Wx,{...s}),i&&p&&N(Hx,{...s}),r&&f&&N(qx,{...s}),n&&m&&N(Xx,{...s}),a&&g&&N(Yx,{...s}),o&&_&&N(Kx,{...s}),h&&y&&N(Jx,{...s})]})}var Jd=Fe(DF);function kF(e){let{station:t}=ln();return t?N(Jd,{accessibility:!0,station:t,...e,iconProps:{width:20}}):null}var ev=Fe(kF);function FF({children:e,className:t="flex items-center gap-2 w-full",classNameCancelled:i="text-red-600 line-through",...r}){let{status:n}=ln();return N("div",{...r,className:Qe(t,n.isCancelled?i:""),children:[N($x,{className:"grow"}),N(ev,{className:"flex shrink-0 flex-wrap gap-1"}),e]})}var tv=Fe(FF),cI=e=>e<10?`0${e}`:e,zF=e=>{if(!e||e<=0)return"";let t=new Date(e);return`${cI(t.getHours())}:${cI(t.getMinutes())}`},Qd=zF;function OF(e){let{status:t,stop:i}=ln(),{isCancelled:r,isFirst:n,isLast:a}=t,{aimedArrivalTime:s,aimedDepartureTime:o}=i;return N("div",{...e,children:[N("span",{className:`${r?"text-red-600 line-through":""} ${n?"hidden":""}`,children:Qd(s)}),N("span",{className:`${t.isCancelled?"text-red-600 line-through":""} ${a?"hidden":""}`,children:Qd(o)})]})}var iv=Fe(OF),uI=(e,t,i,r)=>{let n=e.arrivalTime,a=e.arrivalTime;i&&(n=e.arrivalTime-(e.arrivalTime-i.arrivalTime)/2),r&&(a=e.arrivalTime+(r.arrivalTime-e.arrivalTime)/2);let s=!e.arrivalTime&&!e.departureTime,o=null===e.arrivalDelay&&null===e.departureDelay,l="TIME_BASED"===e.state||o,h="JOURNEY_CANCELLED"===e.state||"STOP_CANCELLED"===e.state,u=t>a;return{bottomBoundary:a,isBoarding:"BOARDING"===e.state,isCancelled:h,isLeft:"LEAVING"===e.state||l&&u||h&&u,isNotRealtime:l,isNotStop:s,isPassedBottom:u,topBoundary:n}},hI=(e,t)=>{let{stations:i}=e,r=0,n=i[t-1],a=i[t],s=i[t+1];if(!a)return{};let o=Date.now(),l=n&&uI(n,o,i[t-2],a),h=uI(a,o,n,s),{isLeft:u}=h,{bottomBoundary:c,isBoarding:d,isCancelled:p,isNotRealtime:f,isNotStop:m,isPassedBottom:g,topBoundary:_}=h,y=!u&&(!n||l.isLeft),v=!(u||n&&l.isLeft),x=!1;if(y){let e=.2*(c-_);x=o>a.arrivalTime-e}let b=g&&!y&&!v;_<o&&o<c&&!v&&(r=Math.round(100*(o-_)/(c-_))),g&&(y||v)&&(r=0);let w=0===t;return w&&(r=50),(d||!w&&(u&&r<50||!u&&r>50))&&(r=50),r>50&&hI(e,t+1).progress>0&&(r=100,u=!0,b=!0),b&&(r=100),{isBoarding:d,isCancelled:p,isCloseToNextStop:x,isFirst:!n,isInBetween:!b&&r>0,isLast:!s,isLeft:u,isNextStop:y,isNotRealtime:f,isNotStop:m,isPassed:b,progress:r}},Bm=hI;function BF(e){let{realtimeLayer:t}=Ze(),[i,r]=qe(),n=nt(()=>t?.api,[t?.api]);return Ae(()=>{if(e&&n)return n.wsApi.open||n.wsApi.connect(n.url),n.subscribe(`station ${e}`,({content:e})=>{e&&r(e)}),()=>{r(void 0),e&&n?.unsubscribe(`station ${e}`)}},[e,n]),i}var Nm=BF;function NF({children:e,className:t,classNameGreyOut:i="text-gray-600",index:r,invertColor:n=!1,stop:a,stopSequence:s,...o}){let{map:l}=Ze(),{stopUID:h}=a,[u,c]=qe(Bm(s,r)),d=Nm(h);Ae(()=>{let e=null;return c(Bm(s,r)),u.isInBetween&&(e=setInterval(()=>{c(Bm(s,r))},1e3)),()=>{clearInterval(e)}},[r,u.isInBetween,s]);let p=nt(()=>({index:r,invertColor:n,station:d,status:u,stop:a,stopSequence:s}),[a,u,r,n,d,s]),f=u.isPassed||u.isLeft?i:"";return n&&(f=u.isPassed||u.isLeft||u.isBoarding?"":i),N(jx.Provider,{value:p,children:[N("button",{className:Qe(`flex max-h-[58px] w-full scroll-mt-[50px] items-stretch rounded text-left hover:bg-slate-100 ${f}`,t),"data-station-passed":u.isPassed,onClick:()=>{a.coordinate&&l.getView().animate({center:[a.coordinate[0],a.coordinate[1]],zoom:l.getView().getZoom()})},type:"button",...o,children:e||N(Zt,{children:[N(iv,{className:"ml-4 flex w-10 shrink-0 flex-col justify-center text-xs"}),N(Gx,{className:"flex w-8 shrink-0 flex-col justify-center text-[0.6rem]"}),N(Ux,{className:"relative flex w-8 shrink-0 items-center"}),N(tv,{className:"flex grow items-center justify-center pr-2 text-sm font-medium"})]})}),N(lI,{})]})}var rv=Fe(NF);function VF(e){let{realtimeLayer:t}=Ze(),[i,r]=qe(),n=nt(()=>t?.api,[t?.api]);return Ae(()=>{let t=null;if(!e||!n)return;n.wsApi.open||n.open(),t=e;return n.subscribeStopSequence(e,({content:e})=>{e&&r([...e])}),()=>{r([]),n.unsubscribeStopSequence(t)}},[e,n]),i}var dI=VF,jF={behavior:"smooth"};function GF(e,t,i=[],r=jF){Sw(()=>{let i=e.current;if(!i)return;let n=i.querySelector(t);if(n)try{i.scrollTo({...r,top:n.offsetTop||0})}catch(e){console.error("Error while scrolling to element",e)}},[...i])}var pI=GF;function UF({className:e}){let{trainId:t}=Ze(),i=dI(t),r=Qi();if(pI(r,"[data-station-passed=false]",[i]),!i?.[0])return null;let n=i[0];return N(Zt,{children:[N(Vx,{stopSequence:n}),N(Js,{ref:r,children:N("div",{className:Qe("text-base",e),children:[n.stations.map((e,t)=>{let{arrivalTime:i,departureTime:r,stationId:a,stationName:s}=e;return N(rv,{index:t,stop:e,stopSequence:n},(`${a}`||s)+i+r)}),N(kx,{stopSequence:n})]})})]})}var nv=Fe(UF),ov=zs({departure:null,index:null}),ZF=()=>{let e=Dn(ov);if(!e)throw new Error("useDeparture must be used within a ContextProvider");return e},fI=ZF,ep=e=>`0${e}`.slice(-2),Qs=(e,t=!1)=>{let i=new Date(e);return!e||Number.isNaN(i)?"unknown":[ep(i.getHours()),ep(i.getMinutes()),t?null:ep(i.getSeconds())].filter(e=>e).join(":")};function $F(e){let t=Om(),{departure:i}=fI();if(!t)return null;let{arrivalTime:r,at_station_ds100:n,departureTime:a,fzo_estimated_time:s,has_fzo:o,last_boarding_time:l,min_arrival_time:h,ris_aimed_time:u,ris_estimated_time:c,state:d,station:p,stations_in_between:f,time:m,train_number:g}=i,_=new Date(u),y=Number.isNaN(_)?"":[_.getFullYear(),ep(_.getMonth()+1),ep(_.getDate())].join("-"),v=["https://ris-info.bahn.de/rishttp/risinfo.xml?",`action=zuglauf&evanr=${p?.get("uic")}&`,`zugnummer=${g}&`,`ankunft=${y}T${Qs(_,!0)}`].join("");return N("div",{className:"border-b p-4 text-left text-xs",...e,children:["Zugnummer:",N("a",{href:v,rel:"noopener noreferrer",target:"_blank",children:g}),N("div",{children:["  State: ",N("b",{children:d}),N("br",{}),`Has fzo: ${o};`,N("br",{}),`Has realtime: ${i.has_realtime_journey};`,N("br",{}),`Time: ${Qs(m)};`,N("br",{}),`Arrival time: ${Qs(r)};`,N("br",{}),`Departure time: ${Qs(a)};`,N("br",{}),`FzO-Estimated: ${Qs(s)};`,N("br",{}),`RIS-Aimed: ${Qs(u)};`,N("br",{}),`RIS-Estimated: ${Qs(c)};`,N("br",{}),`Ref-Location: ${n};`,N("br",{}),`Normalized Distance: ${Qs(h)};`,N("br",{}),`Last Boarding: ${Qs(l)};`,N("br",{}),`Stationen until arrival: ${f};`]})]})}var sv=$F;function WF({departure:e,index:t,...i}){let{realtimeLayer:r,setFeaturesInfos:n,setStationId:a,setTrainId:s}=Ze(),o=nt(()=>({departure:e,index:t}),[e,t]);return N(ov.Provider,{value:o,children:[N("button",{className:"w-full cursor-pointer border-b",onClick:()=>{n(void 0),a(),r?.setVisible(!0),s(e.train_id)},...i,children:N("div",{className:"gap-4 py-4",style:{alignItems:"center",display:"flex",overflow:"hidden"},children:[N("div",{className:"pl-4",children:N(co,{departure:e})}),N("div",{className:"grow text-left",children:[...new Set(e.to)].join("/")}),N("div",{className:"pr-4",children:Qd(e.time)})]})}),N(sv,{})]})}var av=Fe(WF);function HF({children:e,station:t,...i}){let{name:r}=t?.properties||{};return N("div",{...i,children:[r,e]})}var lv=Fe(HF);function qF({station:e}){return N("div",{className:"flex items-center gap-x-4 bg-slate-100 p-4",children:N("div",{className:"flex grow flex-col",children:[N("span",{className:"font-bold",children:N(lv,{station:e})}),N(Jd,{accessibility:!0,airport:!0,barAndRestaurants:!0,bathroom:!0,bikeStorage:!0,className:"flex gap-2",elevator:!0,police:!0,station:e,waitingAreas:!0})]})})}var cv=Fe(qF);function XF(e){let{realtimeLayer:t}=Ze(),[i,r]=qe(),n=nt(()=>t?.api,[t?.api]);return Ae(()=>{if(!e||!n)return;n.wsApi.open||n.open();let t=ty(e=>(r(e),null),!1,180);return n.subscribeTimetable(e,t),()=>{r(null),n.unsubscribeTimetable(e)}},[e,n]),i}var mI=XF;function YF({className:e,...t}){let{stationId:i}=Ze(),r=Nm(i),n=mI(i);return r?N(Zt,{children:[N(cv,{station:r}),N(Js,{children:N("div",{className:Qe("flex flex-col p-2",e),...t,children:(n||[]).map((e,t)=>N(av,{departure:e,index:t},e.call_id))})})]}):null}var uv=Fe(YF),gI="";function KF({feature:e,featuresInfo:t,layer:i}){let{linesIds:r,linesNetworkPlanLayer:n,notificationId:a,notificationsLayer:s,realtimeLayer:o,stationId:l,stationsLayer:h,trainId:u}=Ze();return i?N(Zt,{children:[!!o&&i===o&&u&&N(nv,{}),!!h&&i===h&&l&&N(uv,{}),!!n&&i===n&&r&&N(Cx,{className:gI,features:t?.features||[]}),!!s&&i===s&&a&&N(Rx,{className:gI,feature:e})]}):null}var hv=Fe(KF);function JF(e){return N(mS,{size:24,...e})}var dv=JF;function QF({className:e,feature:t,layer:i,...r}){let n=Hu(i?.get("name"));if(!n?.link||!1===n?.link?.show)return null;let a=t?.get("id"),s=t?.get("situationId");return s&&(a=s),N("div",{...r,className:Qe("flex flex-row p-4",e),children:N(Td,{href:n.link.href.replace("{{id}}",a),target:"_blank",theme:"primary",children:[N("span",{children:n.link.text||"Mehr erfahren"}),N(dv,{})]})})}var pv=Fe(QF);function e3(e){return N(pS,{size:24,...e})}var sc=e3;function t3({children:e,className:t,onClose:i,title:r,...n}){return N("div",{...n,className:Qe("flex flex-row items-center justify-between gap-2 border-b p-2 pl-4",t),children:[e||N("span",{className:"text-base font-bold",children:r}),i&&N(Zi,{className:"!size-[32px] border-none shadow-none",onClick:i,children:N(sc,{})})]})}var ac=Fe(t3);function i3({layer:e,...t}){let{t:i}=Ct(),r=Hu(e?.get("name"));return e?N(ac,{title:i(r?.title||""),...t}):null}var fv=Fe(i3);function r3(){let{featuresInfos:e,linesIds:t,linesNetworkPlanLayer:i,notificationId:r,notificationsLayer:n,realtimeLayer:a,selectedFeature:s,setFeaturesInfos:o,setLinesIds:l,setNotificationId:h,setStationId:u,setTrainId:c,stationId:d,stationsLayer:p,trainId:f}=Ze(),m=nt(()=>e?.find(e=>e?.features.includes(s)),[e,s]),g=nt(()=>m?.layer?m.layer:f?a:d?p:t?i:r?n:void 0,[m?.layer,f,d,t,r,a,p,i,n]);return N(Zt,{children:[N(fv,{feature:s,layer:g,onClose:()=>{o(null),c(null),u(null),l(null),h(null)}}),N(hv,{feature:s,featuresInfo:m,layer:g}),N(pv,{feature:s,layer:g})]})}var mv=Fe(r3);function n3({childrenContainerClassName:e,className:t,inputContainerClassName:i,resultClassName:r,resultsContainerClassName:n,withResultsClassName:a,...s}){return N(gv,{childrenContainerClassName:Qe("max-h-[400px] rounded-b-2xl bg-white shadow overflow-hidden",e),className:Qe("border-grey @container m-0 h-[48px] rounded-2xl border text-base",t),inputContainerClassName:Qe("border-none",i),resultClassName:Qe("text-base  **:hover:cursor-pointer p-2",r),resultsContainerClassName:Qe("min-h-[50px] max-h-[200px] border border-t-0",n),withResultsClassName:Qe("text-base !rounded-b-none",a),...s})}var qu=Fe(n3);function o3(e){return N(MS,{size:24,...e})}var lc=o3,s3=Ef(({className:e,...t},i)=>N("input",{ref:i,...t,className:Qe("p-2 text-sm read-only:text-gray-400",e)})),cc=s3;function a3({cancelButtonClassName:e,cancelButtonProps:t,cancelIcon:i,children:r,className:n,inputClassName:a,inputContainerClassName:s,inputProps:o,searchIcon:l,searchIconContainerClassName:h,withResultsClassName:u}){let{t:c}=Ct(),d=Qi();return N(Zt,{children:[N("div",{className:Qe("flex h-12 items-center gap-1 rounded-md bg-white p-3 shadow",n,u),ref:d,children:[N("div",{className:Qe("text-grey flex items-center",h),children:l||N(lc,{})}),N("div",{className:Qe("@container/inputsearch relative flex grow items-center gap-2 border-b-2 border-solid",s),children:[N(cc,{autoComplete:"off",className:Qe("h-8 w-1 grow overflow-hidden text-ellipsis placeholder:text-zinc-400",a,o?.value?"pr-4":""),type:"text",...o||{}}),!!o.value&&N(Zi,{className:Qe("absolute right-0 flex h-full w-6 items-center rounded-none border-none bg-transparent p-0 px-1 shadow-none",e),title:c("search_input_cancel"),...t||{},children:i||N(sc,{})})]})]}),r]})}var _v=Fe(a3),ea=zs({open:!1,query:"",selectedQuery:"",setOpen:()=>{},setQuery:()=>{},setResults:()=>{},setSelectedQuery:()=>{}});function l3({autofocus:e,cancelButtonProps:t,children:i,childrenContainerClassName:r,inputProps:n,resultClassName:a,resultsClassName:s,resultsContainerClassName:o,withResultsClassName:l,...h}){let{t:u}=Ct(),[c,d]=qe(""),[p,f]=qe(""),[m,g]=qe(!1),[_,y]=qe(!1),v=Qi({}),x=Qi(null);Ae(()=>{e&&x.current&&x.current.focus()},[e]);let b=$t((e,t)=>{v.current[e]=t,g(_&&Object.values(v.current).some(e=>e.length>0))},[_]),w=nt(()=>({open:_,query:p,selectedQuery:c,setOpen:y,setQuery:f,setResults:b,setSelectedQuery:d}),[_,p,c,b]),T=nt(()=>({placeholder:u("search_placeholder"),ref:x,...n||{},onChange:e=>{f(e.target.value),d(""),y(!0)},onFocus:()=>{y(!0)},value:c||p}),[p,c,u,n]),S=nt(()=>({...t||{},onClick:()=>{d(""),f(""),y(!1)}}),[t]);return N(ea.Provider,{value:w,children:N(_v,{...h,cancelButtonProps:S,inputProps:T,withResultsClassName:m?l:"",children:N("div",{className:Qe("flex flex-col",r),children:ka(i)?.map(e=>Co(e,{resultClassName:a,resultsClassName:s,resultsContainerClassName:o}))})})})}var yv=Fe(l3);function c3({className:e,item:t,onSelectItem:i,...r}){let{linesNetworkPlanLayer:n}=Ze();return N("button",{...r,className:Qe("flex w-full cursor-pointer items-center gap-3 text-left",e),onClick:()=>{n?.setVisible(!0),i?.(t)},children:[N(co,{lineInfo:t}),N("div",{className:"grow",children:t?.long_name||t?.short_name})]})}var xv=Fe(c3);function u3({children:e,className:t,...i}){return N("li",{...i,className:Qe("border-b border-dashed border-slate-300 p-3 last:border-0",t),children:e})}var uc=Fe(u3);function h3({children:e,className:t,resultsClassName:i,searchResponse:r,...n}){let{t:a}=Ct(),s=jl(),{setResults:o}=Dn(ea);return Ae(()=>(r.isLoading||o(s,r?.results||[]),()=>{o(s,[])}),[r,s,o]),r?.results?.length>=0?N("div",{className:Qe("flex grow overflow-hidden",t),...n,children:[0===r.results.length&&N("div",{className:Qe("flex grow gap-3 border border-solid p-3 pt-2 text-zinc-400",i),style:{border:1},children:[N("div",{className:"size-6"}),N("div",{children:a("search_no_results")})]}),r.results.length>0&&N("ul",{className:Qe("grow overflow-y-auto",i),style:{border:1},children:e})]}):null}var hc=Fe(h3);function d3({children:e,className:t,...i}){return e?N("div",{...i,className:Qe("border-x bg-zinc-100 px-2 py-1 text-xs font-semibold",t),children:e}):null}var dc=Fe(d3);function p3(e){let{hasLnp:t}=Ze(),i=Hd();return{isLoading:!1,results:nt(()=>e&&i&&t?Object.values(i||{}).filter(t=>t?.short_name?.toLowerCase().includes(e.toLowerCase())||t?.long_name?.toLowerCase().includes(e.toLowerCase())||t?.id?.toLowerCase().includes(e.toLowerCase())||t?.external_id?.toLowerCase().includes(e.toLowerCase())||t?.mot?.toLowerCase().includes(e.toLowerCase())):[],[t,i,e])||[]}}var _I=p3,f3=(e,t)=>e.long_name===t.long_name?e.long_name<t.long_name?1:-1:e.short_name<t.short_name?1:-1;function m3({children:e,filter:t,resultClassName:i,resultsClassName:r,resultsContainerClassName:n,sort:a=f3}){let{open:s,query:o,setOpen:l,setSelectedQuery:h}=Dn(ea),u=_I(o),{t:c}=Ct(),d=$t(e=>{h(e.short_name||e.long_name),l(!1)},[l,h]),p=nt(()=>{let e=[...u?.results||[]];return t&&(e=e.filter(t)),a&&(e=e.sort(a)),e},[u,t,a]),f=nt(()=>({...u,results:p}),[p,u]);return nt(()=>s&&!!p?.length,[s,p])?N(Zt,{children:[N(dc,{children:c("search_lines_results")}),N(hc,{className:n,resultsClassName:r,searchResponse:f,children:p.map(t=>N(uc,{className:i,children:ka(e).map(e=>Co(e,{item:t,onSelectItem:(t,i)=>{d(t),e.props?.onSelectItem?.(t,i)}}))},t.short_name))})]}):null}var vv=Fe(m3);function g3({className:e,item:t,onSelectItem:i,...r}){let{stationsLayer:n}=Ze();return N("button",{className:Qe("flex w-full cursor-pointer items-center gap-3 text-left",e),onClick:e=>{n?.setVisible(!0),i?.(t,e)},...r,children:[N("div",{className:"size-6"}),N("div",{className:"grow",children:t?.properties.name})]})}var bv=Fe(g3),yI=Rn(Vo(),1);function _3(e,t){let{apikey:i,mots:r,stopsurl:n}=Ze(),[a,s]=qe(),[o,l]=qe(!1),h=nt(()=>i&&n?new Md({apiKey:i,url:n}):null,[i,n]),u=nt(()=>{let e;return(0,yI.default)(i=>{e?.abort(),e=new AbortController;let n={bbox:oS?.join(","),mots:r,q:i,...t??{}};l(!0),h.search(n,{signal:e.signal}).then(e=>{s(e.features),l(!1)}).catch(e=>{20===e.code?l(!1):console.error("Failed to fetch stations",e)})},150)},[h,r,t]);return Ae(()=>{e&&h?u(e):s([])},[h,u,e]),{isLoading:o,results:a||[]}}var xI=_3;function y3({children:e,filter:t,resultClassName:i,resultsClassName:r,resultsContainerClassName:n,sort:a}){let{open:s,query:o,setOpen:l,setSelectedQuery:h}=Dn(ea),u=xI(o),{t:c}=Ct(),d=$t(e=>{h(e.properties.name),l(!1)},[l,h]),p=nt(()=>{let e=[...u?.results||[]];return t&&(e=e.filter(t)),a&&(e=e.sort(a)),e},[u,t,a]),f=nt(()=>({...u,results:p}),[p,u]);return nt(()=>s&&!!p?.length,[s,p])?N(Zt,{children:[N(dc,{children:c("search_stops_results")}),N(hc,{className:n,resultsClassName:r,searchResponse:f,children:p.map(t=>N(uc,{className:i,children:ka(e).map(e=>Co(e,{item:t,onSelectItem:(t,i)=>{d(t),e.props?.onSelectItem?.(t,i)}}))},t.properties.uid))})]}):null}var wv=Fe(y3);function x3({className:e,item:t,onSelectItem:i,...r}){let{realtimeLayer:n}=Ze();return N("button",{...r,className:Qe("flex w-full cursor-pointer items-center gap-3 text-left",e),onClick:e=>{n?.setVisible(!0),i?.(t,e)},children:[N(co,{line:t.line}),N("div",{className:"grow",children:`${t.destination} (${t.route_identifier})`})]})}var Sv=Fe(x3),vI=Rn(Vo(),1);function v3(e){let{apikey:t,hasRealtime:i,realtimeresturl:r,realtimetenant:n,tenant:a}=Ze(),[s,o]=qe(),[l,h]=qe(!1),u=nt(()=>n||a,[n,a]),c=nt(()=>t&&u&&i?new Id({apiKey:t,tenant:u,url:r}):null,[t,u,i,r]),d=nt(()=>{let e;return(0,vI.default)(t=>{e?.abort(),e=new AbortController,h(!0),c.trainsByRouteIdentifier({exact_match:!1,query:t},{signal:e.signal}).then(e=>{o(e.matches),h(!1)}).catch(e=>{20===e.code?h(!1):console.error("Failed to fetch trains by route identifier",e)})},150)},[c]);return Ae(()=>{e&&c?d(e):o([])},[c,d,e]),{isLoading:l,results:s||[]}}var bI=v3;function b3({children:e,filter:t,resultClassName:i,resultsClassName:r,resultsContainerClassName:n,sort:a}){let{open:s,query:o,setOpen:l,setSelectedQuery:h}=Dn(ea),u=bI(o),{t:c}=Ct(),d=$t(e=>{h(e.route_identifier),l(!1)},[l,h]),p=nt(()=>{let e=[...u?.results||[]];return t&&(e=e.filter(t)),a&&(e=e.sort(a)),e},[u,t,a]),f=nt(()=>({...u,results:p}),[p,u]);return nt(()=>s&&!!p?.length,[s,p])?N(Zt,{children:[N(dc,{children:c("search_trains_results")}),N(hc,{className:n,resultsClassName:r,searchResponse:f,children:p.map(t=>N(uc,{className:i,children:ka(e).map(e=>Co(e,{item:t,onSelectItem:(t,i)=>{d(t),e.props?.onSelectItem?.(t,i)}}))},t.train_id))})]}):null}var Tv=Fe(b3);function w3({...e}){let{setLinesIds:t,setStationId:i,setTrainId:r,tenant:n}=Ze(),a=Mm(),s=$t(e=>{i(e.properties.uid),a.current?.(e,!!n)},[a,i,n]),o=$t(e=>{t([e.external_id]),a.current?.(e,!0)},[a,t]),l=$t(e=>{r(e.train_id),a.current?.(e,!0)},[a,r]);return N(yv,{...e,children:[N(wv,{children:N(bv,{onSelectItem:s})}),N(vv,{children:N(xv,{onSelectItem:o})}),N(Tv,{children:N(Sv,{onSelectItem:l})})]})}var gv=Fe(w3),Xt=Rn(EI()),AI='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 192"><defs><clipPath id="a"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="b"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="c"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="d"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="e"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="f"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="g"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="h"><path d="M192 192H0V0h192v192z"/></clipPath><clipPath id="i"><path d="M36 12v24.125H15.875v152.25h160.25V36.125H156V12h-44v24.125H80V12z" fill="red" stroke-width="23.686"/></clipPath></defs><g fill="red" stroke="%23000" stroke-linecap="round"><path d="M118 91.8v48.4M74 91.8v48.4" stroke-width="7.92"/><path d="M74 91.8l44 48.4" stroke-width="8.307"/></g><path d="M96 8.7L70.5 70.888l2.414 2.413L96 63.1l23.086 10.2 2.414-2.413z"/></svg>',LI='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 192"><defs><clipPath id="a"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="b"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="c"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="d"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="e"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="f"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="g"><path d="M0 192h192V0H0v192z"/></clipPath><clipPath id="h"><path d="M192 192H0V0h192v192z"/></clipPath><clipPath id="i"><path d="M36 12v24.125H15.875v152.25h160.25V36.125H156V12h-44v24.125H80V12z" fill="red" stroke-width="23.686"/></clipPath></defs><g fill="none"><circle cx="95.749" cy="96" r="76" clip-path="url(%23i)" stroke="%23000" stroke-width="6"/><path d="M81 8.125h30v27.751H81z"/><path d="M8.082 96h19.335M166.207 96h19.336M95.75 184.167v-19.335" stroke="%23000" stroke-width="6.04" stroke-linecap="round"/></g><g fill="red" stroke="%23000" stroke-linecap="round"><path d="M118 91.8v48.4M74 91.8v48.4" stroke-width="7.92"/><path d="M74 91.8l44 48.4" stroke-width="8.307"/></g><path d="M96 8.7L70.5 70.888l2.414 2.413L96 63.1l23.086 10.2 2.414-2.413z"/></svg>',Pv=Xt.default.shape({circled:Xt.default.bool,height:Xt.default.number,rotation:Xt.default.oneOfType([Xt.default.number,Xt.default.func]),src:Xt.default.string,width:Xt.default.number}),M3=typeof CanvasPattern>"u"?Function:CanvasPattern,C3={autoDownload:Xt.default.bool,children:Xt.default.node,coordinates:Xt.default.arrayOf(Xt.default.arrayOf(Xt.default.number)),extent:Xt.default.arrayOf(Xt.default.number),extraData:Xt.default.shape({copyright:Xt.default.shape({background:Xt.default.bool,fillStyle:Xt.default.oneOfType([Xt.default.string,Xt.default.instanceOf(M3)]),font:Xt.default.string,maxWidth:Xt.default.number,paddingBackground:Xt.default.number,paddingBottom:Xt.default.number,text:Xt.default.oneOfType([Xt.default.string,Xt.default.func])}),logo:Pv,northArrow:Pv,qrCode:Pv}),format:Xt.default.oneOf(["image/jpeg","image/png"]),getDownloadImageName:Xt.default.func,map:Xt.default.instanceOf(qf),margin:Xt.default.number,onSaveEnd:Xt.default.func,onSaveStart:Xt.default.func,padding:Xt.default.number,scale:Xt.default.number},E3=e=>e.width/100,A3=e=>{let t="image/jpeg"===e?"jpg":"png";return`${window.document.title.replace(/ /g,"_").toLowerCase()}.${t}`},Vm=!1,jm=0,L3=(e,t,i,r)=>{let n,a;do{n=e.font.match(/[0-9]+(?:\.[0-9]+)?(px)/i),a=parseInt(n[0].replace(n[1],""),10),e.font=e.font.replace(a,a-1),Vm=!1,a-1==8&&(Vm=!0)}while(a-1>8&&e.measureText(i).width*r>t);return e.font},R3=(e,t,i,r,n,a={})=>{e.save(),e.fillStyle="rgba(255,255,255,.8)","object"==typeof a&&Object.entries(a).forEach(([t,i])=>{e[t]=i}),e.fillRect(t,i,r,n),e.restore()},D3=(e,t,i,r,n,a,s)=>{let{background:o,fillStyle:l,font:h,text:u}=r.copyright,{paddingBackground:c=2,paddingBottom:d=s}=r.copyright,p="function"==typeof u?u():u?.trim();Array.isArray(p)&&(p=p.join()),e.save(),e.scale(n,n),e.font=h||"12px Arial",e.font=L3(e,i,p,n),e.textBaseline="bottom",e.scale(n,n),e.fillStyle=l||"black";let f=p,m=e.measureText(f);if(Vm){let t=p.split(" ").length;for(let r=0;r<t&&!(m.width*n<i);r+=1)f=f.substring(0,f.lastIndexOf(" ")),m=e.measureText(f)}let g=[f,p.replace(f,"").trim()].filter(e=>!!e).reverse(),_=a,y=t.height-d;g.forEach(t=>{let{fontBoundingBoxAscent:i,fontBoundingBoxDescent:r,width:n}=e.measureText(t),s=i+r,l=y-s;if(o){l-=2*c,R3(e,a,l,n+2*c,s+2*c,o),_+=c,y-=c}e.fillText(t,_,y),y=l}),jm=y,e.restore()},Iv=(e,t,i,r,n,a=[0,0],s="right")=>{let o=t.getContext("2d"),{height:l,rotation:h,src:u,width:c}=e;return new Promise(e=>{let d=new Image;d.crossOrigin="Anonymous",d.src=u,d.onload=()=>{o.save();let u=(c||80)*i,p=(l||80)*i,f="left"===s?r+u/2:t.width-r-u/2,m=("left"===s&&jm?jm-n:t.height)-r-p/2-a[1];if(o.translate(f,m),h){let e="function"==typeof h?h():h;o.rotate(e*(Math.PI/180))}o.drawImage(d,-u/2,-p/2,u,p),o.restore(),e([u+2*n,p+2*n])},d.onerror=()=>{e()}})},k3=(e,t,i)=>{let r,n;if(t?(r=Df(t),n=Rf(t)):i&&([r,,n]=i),r&&n){let t=e.getPixelFromCoordinate(r),i=e.getPixelFromCoordinate(n),a=[t[0]<=i[0]?t[0]:i[0],t[1]<=i[1]?t[1]:i[1]],s=[t[0]>i[0]?t[0]:i[0],t[1]>i[1]?t[1]:i[1]];return{h:s[1]-a[1],w:s[0]-a[0],x:a[0],y:a[1]}}return null},F3=(e,t,i,r,n,a,s)=>new Promise(o=>{e.once("rendercomplete",()=>{let l,h,u=e.getTargetElement().getElementsByTagName("canvas");for(let t=0;t<u.length;t+=1){let i=u[t];if(!i.width||!i.height)continue;let a=k3(e,r,n)||{h:i.height,w:i.width,x:0,y:0};l||(l=document.createElement("canvas"),l.width=a.w,l.height=a.h,h=l.getContext("2d")),h.drawImage(i,a.x,a.y,a.w,a.h,0,0,l.width,l.height)}a=a||E3(l);let c=Promise.resolve();h&&t&&t.logo&&(c=Iv(t.logo,l,i,a,s)),c.then((e=[0,0])=>{let r=Promise.resolve();h&&t&&t.northArrow&&(r=Iv({src:t.northArrow.circled?LI:AI,...t.northArrow},l,i,a,s,e)),r.then((r=[0,0])=>{let n=Math.max(e[0],r[0]);if(h&&t&&t.copyright&&t.copyright.text){let e=t.copyright.maxWidth||(n?h.canvas.width-n-a:h.canvas.width);D3(h,l,e,t,i,a,s)}let u=Promise.resolve();h&&t&&t.qrCode&&(u=Iv(t.qrCode,l,i,a,s,void 0,"left")),u.then(()=>o(l))})})}),e.renderSync()}),z3=(e,t,i)=>new Promise(r=>{if(/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())){let i=e.toDataURL(t);window.open("about:blank","").document.write(`<img src="${i}" alt="from canvas"/>`),r(i)}if(window.navigator.msSaveBlob){let n;try{n=e.msToBlob()}catch(e){console.log(e)}let a=new Blob([n],{type:t});r(a),window.navigator.msSaveBlob(a,i(t))}else e.toBlob(e=>{let n=document.createElement("a");n.download=i(t),n.href=URL.createObjectURL(e),document.body.appendChild(n),n.click(),r(e)},t)});function RI({autoDownload:e=!0,children:t=null,coordinates:i=null,extent:r=null,extraData:n=null,format:a="image/png",getDownloadImageName:s=A3,map:o=null,margin:l=null,onSaveEnd:h=()=>{},onSaveStart:u=e=>Promise.resolve(e),padding:c=5,scale:d=1}){let p=$t(t=>{window.navigator.msSaveBlob&&(t.preventDefault(),t.stopPropagation()),Vm=!1,jm=0,u(o).then(t=>F3(t||o,n,d,r,i,l,c).then(i=>{e?z3(i,a,s).then(e=>{h(t,i,e)}):h(t,i)}).catch(e=>{e&&console.error(e),h(t,e)}))},[e,i,r,n,a,o,l,h,u,c,d,s]);return dd.createElement(dd.Fragment,null,dd.Children.map(t,e=>dd.cloneElement(e,{onClick:p})))}RI.propTypes=C3;var Mv=RI;function O3(e){return N(xS,{size:24,...e})}var Cv=O3;function B3(e){return N(IS,{size:24,...e})}var Ev=B3;function N3(e){return N(_S,{size:24,...e})}var Av=N3,DI={};function V3({containerProps:e=DI,tooltipProps:t=DI,...i}){let{t:r}=Ct(),[n,a]=qe(),[s,o]=qe(!1),l=jl(),[h,u]=qe(null);return N("div",{ref:e=>{u(e)},...e,className:Qe("relative flex h-7 items-center",e?.className),children:[N(cc,{id:l,onFocus:()=>{h.querySelector(`#${l}`)?.select()},readOnly:!0,type:"text",...i,className:Qe("h-7 flex-1 border border-r-0",i?.className)}),N(Zi,{className:"size-7 rounded-none border p-2 shadow-none",onClick:e=>{a(e.currentTarget.getBoundingClientRect());let t=h.querySelector(`#${l}`);navigator.clipboard.writeText(t?.value).then(()=>{o(!0),setTimeout(()=>{o(!1)},1e3)}),t?.select()},children:N(Av,{size:20})}),N("div",{...t,className:Qe("fixed hidden rounded bg-gray-600 p-1 text-sm text-white",s&&"block",t?.className),style:{left:n?.left-30,top:n?.top-30},children:[r("input_copy_success"),"!"]})]})}var Lv=V3;function j3(e,t){let i=e||"";if(t?.forEach((e,t)=>{i=i.replace(`{{${t}}}`,e)}),i.startsWith("#"))i=`${window.location.href.split("#")[0]}${i}`;else if(i.startsWith("?")||!i){let t=new URLSearchParams(window.location.search);new URLSearchParams(i).forEach((e,i)=>{t.set(i,e)}),e?.includes("{{x}}")&&e?.includes("{{y}}")&&t.delete("center"),e?.includes("{{z}}")&&t.delete("zoom");let r=t.toString();!r.startsWith("?")&&i.length&&(r=`?${r}`),i=`${window.location.href.split("?")[0]}${r}${window.location.hash}`}return i}var kI=j3;function G3(){let{permalinktemplate:e,permalinkUrlSearchParams:t}=Ze();return kI(e,t)}var Xu=G3,U3={};function Z3({inputProps:e=U3,...t}){let{t:i}=Ct(),r=Xu();return N("div",{...t,children:[N(Lv,{value:r,...e,readonly:!0}),N("p",{className:"py-2",children:i("permalink_input_hint")})]})}var Rv=Fe(Z3);function $3({className:e="",...t}){let{map:i}=Ze(),{t:r}=Ct(),n=Xu();return N("div",{className:Qe(`flex flex-col gap-4 ${e}`),...t,children:[N(Td,{className:"w-fit",href:`mailto:?subject=Karte&body=${n}`,children:[N(Cv,{}),N("span",{children:r("share_email_send")})]}),N(Mv,{map:i,children:N(Td,{className:"w-fit",children:[N(Ev,{}),N("span",{children:r("share_image_save")})]})}),N(Rv,{})]})}var Dv=$3,W3="relative h-full overflow-x-hidden overflow-y-auto text-base bg-white",H3=Pw(()=>import("./ExportMenu-OYM5L7QS.js"));function q3({hasDetails:e,hasLayerTree:t,hasPrint:i,hasSearch:r,hasShare:n}){let{isExportMenuOpen:a,isLayerTreeOpen:s,isSearchOpen:o,isShareMenuOpen:l,setIsExportMenuOpen:h,setIsLayerTreeOpen:u,setIsShareMenuOpen:c}=Ze(),{t:d}=Ct();return N(Zt,{children:[e&&N(mv,{}),i&&a&&N(Zt,{children:[N(ac,{onClose:()=>{h(!1)},title:d("print_menu_title")}),N(Tw,{fallback:N("div",{className:"flex w-full items-center justify-start p-4",children:N(vx,{})}),children:N(H3,{className:Qe(W3,"flex flex-col gap-4 p-4")})})]}),t&&s&&N(Zt,{children:[N(ac,{onClose:()=>{u(!1)},title:d("layertree_menu_title")}),N(Ix,{className:"relative flex h-full flex-col overflow-x-hidden overflow-y-auto px-4 py-2 text-base *:not-last:border-b",treeItemProps:{childContainerClassName:"*:not-last:border-b"}})]}),n&&l&&N(Zt,{children:[N(ac,{onClose:()=>{c(!1)},title:d("share_menu_title")}),N(Dv,{className:"h-full overflow-x-hidden overflow-y-auto p-4 text-base"})]}),r&&o&&N(Zt,{children:N(qu,{className:"relative flex h-full flex-col overflow-x-hidden overflow-y-auto p-2 text-base"})})]})}var Gm=q3,FI=".ol-scale-line  {\n  position:relative;\n  left: unset;\n  bottom: unset;\n  background:unset;\n}";function X3({options:e,...t}){let{map:i}=Ze(),[r,n]=qe(),a=nt(()=>r?new $P({target:r,...e}):null,[e,r]);return Ae(()=>{if(i&&a)return i.addControl(a),()=>{i&&a&&i.removeControl(a)}},[i,a]),N("div",{ref:e=>{n(e)},...t,children:N("style",{children:FI})})}var kv=X3;function Y3({...e}){let{isSearchOpen:t,setIsSearchOpen:i}=Ze(),{t:r}=Ct(),n=$t(()=>{i(!t)},[t,i]);return N(Zi,{title:r("search_menu_title"),...e,onClick:n,selected:t,children:N(lc,{})})}var Fv=Fe(Y3);function K3(e){return N(wS,{size:24,...e})}var zv=K3;function J3({...e}){let{isShareMenuOpen:t,setIsShareMenuOpen:i}=Ze(),{t:r}=Ct(),n=$t(()=>{i(!t)},[t,i]);return N(Zi,{title:r("share_menu_title"),...e,onClick:n,selected:t,children:N(zv,{})})}var Ov=Fe(J3);function Q3(e){return N(gS,{size:24,...e})}var Bv=Q3;function ez(e){return N(yS,{size:24,...e})}var Nv=ez;function tz(){let{map:e}=Ze(),[t,i]=qe(!1),[r,n]=qe(!1),{t:a}=Ct(),s=$t(()=>{if(!e?.getView())return;let t=e.getView(),i=t.getZoom();t.setZoom(i+1)},[e]),o=$t(()=>{if(!e?.getView())return;let t=e.getView(),i=t.getZoom();t.setZoom(i-1)},[e]);return Ae(()=>{let t=e?.on("moveend",()=>{let t=e.getView(),r=t.getZoom(),a=t.getMaxZoom(),s=t.getMinZoom();a&&r===Number(a)?i(!0):i(!1),s&&r===Number(s)?n(!0):n(!1)});return()=>{Bt(t)}},[e]),N(Zt,{children:[N(Zi,{disabled:t,onClick:s,title:a("zoomin"),children:N(Nv,{})}),N(Zi,{disabled:r,onClick:o,title:a("zoomout"),children:N(Bv,{})})]})}var Vv=Fe(tz),zI={style:{width:"calc(100% - 60px)"}};function iz({className:e,...t}){let{hasDetails:i,hasGeolocation:r,hasLayerTree:n,hasPrint:a,hasRealtime:s,hasSearch:o,hasShare:l,hasToolbar:h,isEmbed:u,isOverlayOpen:c,isSearchOpen:d}=Ze();return N("div",{className:Qe("relative flex size-full flex-col @lg/main:flex-row-reverse",e),...t,children:[N(yx,{className:"relative flex-1 overflow-visible",children:[u&&N(hx,{}),N("div",{className:"absolute inset-x-2 bottom-2 z-10 flex items-end justify-between gap-2 text-[10px]",children:[N(kv,{className:"bg-slate-50/70"}),N(sx,{className:"bg-slate-50/70"})]}),N("div",{className:"absolute right-2 bottom-10 z-10 flex flex-col justify-between gap-2",children:N(Vv,{})}),r&&N("div",{className:"absolute top-2 right-2 z-10 flex flex-col gap-2",children:N(mx,{})}),!h&&o&&N("div",{className:Qe("absolute top-2 right-2 left-2 z-10 max-w-96",c&&"@lg:left-84"),children:N(qu,{})})]}),N("div",{className:"pointer-events-none absolute top-2 bottom-2 left-2 z-10 flex flex-col gap-2",children:[h&&N("div",{className:"pointer-events-none relative z-10 w-fit rounded-2xl bg-black/10 p-0 backdrop-blur-sm *:pointer-events-auto",children:[N("div",{className:Qe("border-grey relative z-10 flex h-[48px] gap-[1px] overflow-hidden rounded-2xl border","*:size-[46px] *:rounded-none *:border-none","*:first:!rounded-l-2xl","*:last:!rounded-r-2xl",d?"@sm:rounded-r-none @sm:border-r-0 @sm:*:last:!rounded-r-none @sm:*:last:border-r-0":""),children:[n&&N(_x,{}),a&&N(px,{}),l&&N(Ov,{}),o&&N(Fv,{})]}),o&&d&&N("div",{className:Qe("absolute top-14 left-0 z-5 w-0 p-0 opacity-0 transition-all @sm:top-0 @sm:left-[calc(100%-47px)]",d?"w-64 opacity-100":""),children:N(qu,{autofocus:!0,className:"@container @sm/main:gap-4 @sm/main:rounded-l-none @sm/main:rounded-r-2xl"})})]}),c&&N("div",{className:Qe("flex w-0 flex-1 flex-col overflow-hidden rounded-2xl @lg:min-w-[320px]"),style:{containerType:"normal"},children:N(Am,{className:"border-grey @container/overlay pointer-events-auto relative hidden flex-col overflow-hidden rounded-2xl border bg-white text-base shadow-lg @lg:flex",ScrollableHandlerProps:zI,children:N(Gm,{hasDetails:i,hasLayerTree:n,hasPrint:a,hasRealtime:s,hasSearch:!1,hasShare:l})})})]}),c&&N(Am,{className:"absolute bottom-0 z-20 flex max-h-[70%] min-h-[75px] w-full flex-col border-t bg-white @lg:hidden",ScrollableHandlerProps:zI,children:N(Gm,{hasDetails:i,hasLayerTree:n,hasPrint:a,hasRealtime:s,hasSearch:!1,hasShare:l})})]})}var jv=Fe(iz),rz=(e,t)=>{let i=t?.getView()?.getZoom(),r=e.get("minZoom"),n=e.get("maxZoom");return r>i||i>n};function nz(e){let{apikey:t,baseLayer:i,map:r,mapsetplanid:n,mapsettags:a,mapsettenants:s,mapsettimestamp:o,mapseturl:l,setMapsetLayer:h}=Ze(),u=nt(()=>i&&r?new D0({apiKey:t,name:tS,planId:n??void 0,tags:a?.split(",").map(e=>e.trim()),tenants:s?.split(",").map(e=>e.trim()),timestamp:o,url:l,...e||{}}):null,[i,r,t,l,n,a,s,o,e]);return Ae(()=>{h?.(u)},[u,h,r]),Ae(()=>{if(r&&u)return r.addLayer(u),()=>{r.removeLayer(u)}},[r,u]),Ae(()=>{let e=null;return u&&(e=u.on("updatefeatures",()=>{let e=u.getSource()?.getFeatures();e?.length&&e.forEach(e=>{let t=e.getStyleFunction();t&&e.setStyle((i,r)=>rz(i,u.getMapInternal())?null:t(e,r))})})),()=>{Bt(e)}},[u]),null}var Gv=Fe(nz);function oz(e){let{apikey:t,baseLayer:i,linesNetworkPlanLayer:r,map:n,notificationat:a,notificationtenant:s,notificationurl:o,previewNotifications:l,setNotificationsLayer:h}=Ze(),[u,c]=qe(!!r?.getVisible()),d=nt(()=>{if(!i)return null;let r=new O0({apiKey:t,apiParameters:{bbox:nS,contentMedium:!0},maplibreLayer:i,name:eS,publicAt:a?new Date(a):void 0,situations:l,tenant:s,url:o,...e||{},loadAll:!l});return l&&!r.getVisible()&&r.setVisible(!0),r},[i,t,a,l,s,o,e]);return Ae(()=>{h?.(d)},[d,h]),Ae(()=>{if(n&&d)return n.addLayer(d),()=>{n.removeLayer(d)}},[n,d]),Ae(()=>{let e=r?.on("change:visible",()=>{let e=r.getVisible();c(e)});return c(r?.getVisible()||!1),()=>{Bt(e)}},[r]),Ae(()=>{if(!d)return;let e=d.getVisible();return e&&d.setVisible(!1),d.layersFilter=u?e=>"moco.lnp"===e.metadata?.["general.filter"]:e=>"moco"===e.metadata?.["general.filter"],d.setVisible(e),()=>{d.applyLayoutVisibility()}},[u,d,r]),null}var Uv=Fe(oz),BI=Rn(Vo(),1),sz=(e,t=new URLSearchParams)=>{let i=e.getView().getZoom(),[r,n]=e.getView().getCenter()||[],a=Do(e.getLayers().getArray()).filter(e=>e.get("name")&&e.getVisible()).map(e=>e.get("name"));return t.set("layers",a.join(",")),r>=0&&t.set("x",r.toFixed(2)),n>=0&&t.set("y",n.toFixed(2)),i>=0&&t.set("z",i.toFixed(1)),t},OI=sz,az=({replaceState:e=!1})=>{let{map:t,setPermalinkUrlSearchParams:i}=Ze(),r=Xu(),n=$t(e=>{if(t.get(rS))return;let r=new URLSearchParams(window.location.search),n=OI(e,r);i(n)},[t,i]);return Ae(()=>{e&&r&&r!==window.location.href&&!r.includes(encodeURIComponent("{{"))&&window.history.replaceState(null,null,r)},[t,r,e]),Ae(()=>{let e,i,r,a=(0,BI.default)(n,1e3);return t&&(a(t),e=t?.on("moveend",e=>{a(e.map)}),i=t.once("loadend",e=>{a(e.map),r=Do(e.map.getLayers().getArray()).map(t=>t.on("change:visible",()=>{a(e.map)}))})),()=>{Bt(e),Bt(i),Bt(r)}},[t,n]),null},Zv=Fe(az),lz=async(e,t,i=0,r=!0)=>{if(!e)return Promise.reject(new Error("No vehicle provided"));let{geometry:n,properties:{coordinate:a}}=e,s=t.getView(),o=i||s.getZoom(),l=o>0?s.getResolutionForZoom(o):void 0,h=a?[...a]:null;if(!h&&n){let{coord:t}=Ed(Date.now(),e,!0);h=t?[...t]:null}return h?(r&&(h[0]-=160*l),s.cancelAnimations(),new Promise(e=>{s.animate({center:h,duration:1e3,easing:D2,resolution:l},t=>{e(t)})})):Promise.reject(new Error("No center found"))},$v=lz,cz=(e,t,i,r,n)=>r?n?"#dc2626":"#a0a0a0":null===i?"#a0a0a0":Yd(i),NI=cz,uz=(e,t,i,r=!1)=>{if(r)return String.fromCodePoint(215);let n=Kd(i);return"0"===n?"":`+${n}`},VI=uz,jI=16,hz=window.location?.href?.includes("graphs=true"),dz=new Xi;function pz(e){let{apikey:t,baseLayer:i,isFollowing:r,isTracking:n,linesNetworkPlanLayer:a,map:s,mots:o,realtimebboxparameters:l,realtimeurl:h,setIsFollowing:u,setIsTracking:c,setRealtimeLayer:d,tenant:p,trainId:f}=Ze(),[m,g]=qe([]),[_,y]=qe(!1),v=nt(()=>t&&h?new $0({apiKey:t,bboxParameters:l?.split(" ").reduce((e,t)=>{if(!t)return e;let[i,r]=t.split("=");return e[i]=r,e},{}),getMotsByZoom:o?()=>o.split(","):void 0,isQueryable:!0,minZoom:5,name:J2,tenant:p,url:h,zIndex:1,...e,styleOptions:{getColor:Wu,getDelayColor:NI,getDelayText:VI,getText:Fm,getTextColor:Dm,getTextFont:km,...e?.styleOptions||{}}}):null,[t,h,l,o,p,e]);return Ae(()=>{let e;if(s&&v)return s.getView()?.getCenter()?s.addLayer(v):e=s.once("moveend",()=>{s.addLayer(v)}),d(v),()=>{e&&Bt(e),s.removeLayer(v),d(null)}},[s,d,v]),Ae(()=>{f||u(!1)},[f,u]),Ae(()=>{let e=[];return n&&u(!1),()=>{Bt(e)}},[n,u]),Ae(()=>{if(!s)return;let e=null;return e=s.getView().on("change:center",e=>{e.target.getInteracting()&&(u(!1),c(!1))}),()=>{Bt(e)}},[s,u,c]),Ae(()=>{let e=null;return v&&(v.engine.useThrottle=!r,v.engine.isUpdateBboxOnMoveEnd=!r,v.allowRenderWhenAnimating=!!r),r&&f&&s&&v?(c(!1),(async t=>{let i=t&&v?.trajectories?.[t];if(!i){i=(await v.api.getTrajectory(f,v.mode))?.content;let e=await v.api.getFullTrajectory(f,v.mode,void 0);if(e?.content)try{let t=dz.readFeatures(e.content),i=new Gs({features:t}).getExtent();v.api.bbox=[...i,...v.api.bbox.slice(4)]}catch(t){console.warn("Error parsing full trajectory feature:",t,e?.content)}}!0===await $v(i,s,jI)&&(e=setInterval(()=>{$v(v?.trajectories?.[f],s,jI)},1e3))})(f),()=>{clearInterval(e)}):void 0},[r,s,v,f,c]),Ae(()=>{if(f){let e=v?.trajectories?.[f]?.properties?.coordinate;e&&s.getView().setCenter(e)}},[s,f,v]),Ae(()=>{if(f&&v?.api)return v.selectedVehicleId=f,v.highlightTrajectory(f).catch(e=>{console.error("Error highlighting trajectory:",e)}),()=>{v?.selectedVehicleId&&(v.api?.unsubscribeFullTrajectory(v.selectedVehicleId),v.selectedVehicleId=null,v.vectorLayer.getSource().clear())}},[f,v,v?.api]),Ae(()=>{if(!s||!i)return;let e=s.once("rendercomplete",()=>{let e=i.mapLibreMap?.getStyle()?.metadata,t=[];for(let i=0;i<26;i++)t.push(Uu(i,e?.graphs));g(t)});return()=>{Bt(e)}},[s,i,v]),Ae(()=>{let e=a?.on("change:visible",()=>{let e=a.getVisible();y(e)});return y(a?.getVisible()||!1),()=>{Bt(e)}},[a]),Ae(()=>{!v||!m?.length||(v.engine.graphByZoom=hz&&_?m:[],v.engine.setBbox())},[_,v,m,a]),null}var Wv=Fe(pz),GI=Rn(Vo(),1);function fz({debounceOptions:e,debounceTimeout:t=0,hover:i=!0}){let{map:r,mots:n,queryablelayers:a,setFeaturesInfos:s,setFeaturesInfosHovered:o,setLinesIds:l,setNotificationId:h,setStationId:u,setTrainId:c,stationsLayer:d,tenant:p}=Ze(),f=$t(async e=>{let t=e.map.getAllLayers().filter(e=>a.split(",").includes(e.get("name"))),i=await W0(e.coordinate,t,5,!0);if(d){let e=i?.find(e=>e.layer===d),t=e?.features||[],[r]=t.filter(e=>{let t=!1;return n?.split(",")?.length>0&&(t=!!n.split(",").find(t=>{if(1===e.get(t.trim().toLowerCase()))return!0})),!e.get("uid")&&e.get("external_id")&&e.set("uid",e.get("external_id")),t?!!e.get("tralis_network")?.includes(p):e.get("network")?e.get("network").toLowerCase().includes(p):t});e&&(e.features=r?[r]:[])}return i},[n,a,d,p]),m=$t(async e=>{let t=await f(e);o(t);let i=t.flatMap(e=>e.features);e.map.getTargetElement().style.cursor=i?.length?"pointer":"default"},[f,o]),g=$t(async e=>{let t=await f(e);s(t),0===t?.flatMap(e=>e.features).length&&(c(null),u(null),h(null),l(null))},[f,s,l,h,u,c]);return Ae(()=>{let e=r?.on("singleclick",g);return()=>{Bt(e)}},[r,g]),Ae(()=>{let n;if(i){let i=m;t&&(i=(0,GI.default)(m,t,e)),n=r?.on("pointermove",i)}return()=>{Bt(n)}},[e,t,i,r,m]),null}var Hv=fz;function mz(e){let{baseLayer:t,map:i,setStationsLayer:r}=Ze(),n=nt(()=>t?new Xs({layersFilter:({metadata:e})=>"station"===e?.["tralis.variable"]||"stations"===e?.["general.filter"]||"netzplan_stops"===e?.["geops.filter"],maplibreLayer:t,name:Q2,...e||{}}):null,[t,e]);return Ae(()=>{if(i&&n)return i.addLayer(n),r(n),()=>{i.removeLayer(n),n.detachFromMap()}},[i,r,n]),null}var qv=Fe(mz),UI=(e,t)=>{if(t.get("name")&&null!=e){let i=e?.split(",")||[],r=t.get("name"),n=i.includes(r);t.getVisible()!==n&&(t.getLayers?t.getLayers().getArray().forEach(t=>{UI(e,t)}):t.setVisible(n))}t.getLayers&&t.getVisible()&&!t.getLayers()?.getArray().find(e=>e.getVisible())&&t.setVisible(!1)},Xv=UI,gz=(e,t,i)=>{let r=Qi(!1),n=Qi(Em(i)?.layers);return Ae(()=>{if(!e)return;let i=t;null!==n.current&&void 0!==n.current&&!r.current&&(i=n.current,r.current=!0),Do(e.getLayers().getArray()).reverse().forEach(e=>{Xv(i,e)});let a=e.getLayers().on("add",e=>{Xv(i,e.element)});return()=>{Bt(a)}},[e,t]),null},ZI=gz,$I=["mwc:permalink","mwc:selectedfeature","mwc:singleclick","mwc:attribute"];function _z({eventNode:e}){let{setPreviewNotifications:t}=Ze();return Ae(()=>{let e=e=>{e.data.situations&&t(e.data.situations)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t]),Ae(()=>{if(!e)return;let t=e=>{"mwc:attribute"===e.type&&delete e.data.children,"mwc:selectedfeature"===e.type&&e.data?.properties?.olGeometry&&delete e.data.properties.olGeometry,window.parent?.postMessage({data:e.data,type:e.type},"*")};return $I.forEach(i=>{e.addEventListener(i,t)}),window.parent?.postMessage({data:!0,type:"mwc:messageready"},"*"),()=>{$I.forEach(i=>{e.removeEventListener(i,t)})}},[e]),null}var Yv=Fe(_z),Um='/*! tailwindcss v4.2.4 | MIT License | https://tailwindcss.com */\n@layer properties;\n@layer theme, base, components, utilities;\n@layer theme {\n  :root, :host {\n    --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",\n      "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",\n      "Courier New", monospace;\n    --color-red-600: oklch(57.7% 0.245 27.325);\n    --color-orange-600: oklch(64.6% 0.222 41.116);\n    --color-amber-600: oklch(66.6% 0.179 58.318);\n    --color-yellow-600: oklch(68.1% 0.162 75.834);\n    --color-green-600: oklch(62.7% 0.194 149.214);\n    --color-slate-50: oklch(98.4% 0.003 247.858);\n    --color-slate-100: oklch(96.8% 0.007 247.896);\n    --color-slate-200: oklch(92.9% 0.013 255.508);\n    --color-slate-300: oklch(86.9% 0.022 252.894);\n    --color-slate-800: oklch(27.9% 0.041 260.031);\n    --color-gray-200: oklch(92.8% 0.006 264.531);\n    --color-gray-300: oklch(87.2% 0.01 258.338);\n    --color-gray-400: oklch(70.7% 0.022 261.325);\n    --color-gray-500: oklch(55.1% 0.027 264.364);\n    --color-gray-600: oklch(44.6% 0.03 256.802);\n    --color-gray-700: oklch(37.3% 0.034 259.733);\n    --color-zinc-100: oklch(96.7% 0.001 286.375);\n    --color-zinc-400: oklch(70.5% 0.015 286.067);\n    --color-black: #000;\n    --color-white: #fff;\n    --spacing: 0.25rem;\n    --text-xs: 0.75rem;\n    --text-xs--line-height: calc(1 / 0.75);\n    --text-sm: 0.875rem;\n    --text-sm--line-height: calc(1.25 / 0.875);\n    --text-base: 1rem;\n    --text-base--line-height: calc(1.5 / 1);\n    --text-lg: 1.125rem;\n    --text-lg--line-height: calc(1.75 / 1.125);\n    --text-xl: 1.25rem;\n    --text-xl--line-height: calc(1.75 / 1.25);\n    --text-3xl: 1.875rem;\n    --text-3xl--line-height: calc(2.25 / 1.875);\n    --font-weight-medium: 500;\n    --font-weight-semibold: 600;\n    --font-weight-bold: 700;\n    --radius-sm: 0.25rem;\n    --radius-md: 0.375rem;\n    --radius-2xl: 1rem;\n    --animate-spin: spin 1s linear infinite;\n    --animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n    --blur-sm: 8px;\n    --default-transition-duration: 150ms;\n    --default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n    --default-font-family: var(--font-sans);\n    --default-mono-font-family: var(--font-mono);\n  }\n}\n@layer base {\n  *, ::after, ::before, ::backdrop, ::file-selector-button {\n    box-sizing: border-box;\n    margin: 0;\n    padding: 0;\n    border: 0 solid;\n  }\n  html, :host {\n    line-height: 1.5;\n    -webkit-text-size-adjust: 100%;\n    tab-size: 4;\n    font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");\n    font-feature-settings: var(--default-font-feature-settings, normal);\n    font-variation-settings: var(--default-font-variation-settings, normal);\n    -webkit-tap-highlight-color: transparent;\n  }\n  hr {\n    height: 0;\n    color: inherit;\n    border-top-width: 1px;\n  }\n  abbr:where([title]) {\n    -webkit-text-decoration: underline dotted;\n    text-decoration: underline dotted;\n  }\n  h1, h2, h3, h4, h5, h6 {\n    font-size: inherit;\n    font-weight: inherit;\n  }\n  a {\n    color: inherit;\n    -webkit-text-decoration: inherit;\n    text-decoration: inherit;\n  }\n  b, strong {\n    font-weight: bolder;\n  }\n  code, kbd, samp, pre {\n    font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);\n    font-feature-settings: var(--default-mono-font-feature-settings, normal);\n    font-variation-settings: var(--default-mono-font-variation-settings, normal);\n    font-size: 1em;\n  }\n  small {\n    font-size: 80%;\n  }\n  sub, sup {\n    font-size: 75%;\n    line-height: 0;\n    position: relative;\n    vertical-align: baseline;\n  }\n  sub {\n    bottom: -0.25em;\n  }\n  sup {\n    top: -0.5em;\n  }\n  table {\n    text-indent: 0;\n    border-color: inherit;\n    border-collapse: collapse;\n  }\n  :-moz-focusring {\n    outline: auto;\n  }\n  progress {\n    vertical-align: baseline;\n  }\n  summary {\n    display: list-item;\n  }\n  ol, ul, menu {\n    list-style: none;\n  }\n  img, svg, video, canvas, audio, iframe, embed, object {\n    display: block;\n    vertical-align: middle;\n  }\n  img, video {\n    max-width: 100%;\n    height: auto;\n  }\n  button, input, select, optgroup, textarea, ::file-selector-button {\n    font: inherit;\n    font-feature-settings: inherit;\n    font-variation-settings: inherit;\n    letter-spacing: inherit;\n    color: inherit;\n    border-radius: 0;\n    background-color: transparent;\n    opacity: 1;\n  }\n  :where(select:is([multiple], [size])) optgroup {\n    font-weight: bolder;\n  }\n  :where(select:is([multiple], [size])) optgroup option {\n    padding-inline-start: 20px;\n  }\n  ::file-selector-button {\n    margin-inline-end: 4px;\n  }\n  ::placeholder {\n    opacity: 1;\n  }\n  @supports (not (-webkit-appearance: -apple-pay-button))  or (contain-intrinsic-size: 1px) {\n    ::placeholder {\n      color: currentcolor;\n      @supports (color: color-mix(in lab, red, red)) {\n        color: color-mix(in oklab, currentcolor 50%, transparent);\n      }\n    }\n  }\n  textarea {\n    resize: vertical;\n  }\n  ::-webkit-search-decoration {\n    -webkit-appearance: none;\n  }\n  ::-webkit-date-and-time-value {\n    min-height: 1lh;\n    text-align: inherit;\n  }\n  ::-webkit-datetime-edit {\n    display: inline-flex;\n  }\n  ::-webkit-datetime-edit-fields-wrapper {\n    padding: 0;\n  }\n  ::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {\n    padding-block: 0;\n  }\n  ::-webkit-calendar-picker-indicator {\n    line-height: 1;\n  }\n  :-moz-ui-invalid {\n    box-shadow: none;\n  }\n  button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {\n    appearance: button;\n  }\n  ::-webkit-inner-spin-button, ::-webkit-outer-spin-button {\n    height: auto;\n  }\n  [hidden]:where(:not([hidden="until-found"])) {\n    display: none !important;\n  }\n}\n@layer utilities {\n  .\\@container\\/inputsearch {\n    container-type: inline-size;\n    container-name: inputsearch;\n  }\n  .\\@container\\/inputsearch {\n    container-type: inline-size;\n    container-name: inputsearch;\n  }\n  .\\@container\\/main {\n    container-type: inline-size;\n    container-name: main;\n  }\n  .\\@container\\/main {\n    container-type: inline-size;\n    container-name: main;\n  }\n  .\\@container\\/overlay {\n    container-type: inline-size;\n    container-name: overlay;\n  }\n  .\\@container\\/overlay {\n    container-type: inline-size;\n    container-name: overlay;\n  }\n  .\\@container {\n    container-type: inline-size;\n  }\n  .\\@container {\n    container-type: inline-size;\n  }\n  .pointer-events-auto {\n    pointer-events: auto;\n  }\n  .pointer-events-none {\n    pointer-events: none;\n  }\n  .visible {\n    visibility: visible;\n  }\n  .absolute {\n    position: absolute;\n  }\n  .fixed {\n    position: fixed;\n  }\n  .relative {\n    position: relative;\n  }\n  .static {\n    position: static;\n  }\n  .sticky {\n    position: sticky;\n  }\n  .inset-0 {\n    inset: calc(var(--spacing) * 0);\n  }\n  .inset-x-2 {\n    inset-inline: calc(var(--spacing) * 2);\n  }\n  .start {\n    inset-inline-start: var(--spacing);\n  }\n  .end {\n    inset-inline-end: var(--spacing);\n  }\n  .-top-3 {\n    top: calc(var(--spacing) * -3);\n  }\n  .top-0 {\n    top: calc(var(--spacing) * 0);\n  }\n  .top-2 {\n    top: calc(var(--spacing) * 2);\n  }\n  .top-14 {\n    top: calc(var(--spacing) * 14);\n  }\n  .-right-3 {\n    right: calc(var(--spacing) * -3);\n  }\n  .right-0 {\n    right: calc(var(--spacing) * 0);\n  }\n  .right-2 {\n    right: calc(var(--spacing) * 2);\n  }\n  .right-\\[8px\\] {\n    right: 8px;\n  }\n  .bottom-0 {\n    bottom: calc(var(--spacing) * 0);\n  }\n  .bottom-2 {\n    bottom: calc(var(--spacing) * 2);\n  }\n  .bottom-10 {\n    bottom: calc(var(--spacing) * 10);\n  }\n  .bottom-\\[-1px\\] {\n    bottom: -1px;\n  }\n  .left-0 {\n    left: calc(var(--spacing) * 0);\n  }\n  .left-2 {\n    left: calc(var(--spacing) * 2);\n  }\n  .z-5 {\n    z-index: 5;\n  }\n  .z-10 {\n    z-index: 10;\n  }\n  .z-20 {\n    z-index: 20;\n  }\n  .z-50 {\n    z-index: 50;\n  }\n  .z-9000 {\n    z-index: 9000;\n  }\n  .z-100000 {\n    z-index: 100000;\n  }\n  .container {\n    width: 100%;\n    @media (width >= 40rem) {\n      max-width: 40rem;\n    }\n    @media (width >= 48rem) {\n      max-width: 48rem;\n    }\n    @media (width >= 64rem) {\n      max-width: 64rem;\n    }\n    @media (width >= 80rem) {\n      max-width: 80rem;\n    }\n    @media (width >= 96rem) {\n      max-width: 96rem;\n    }\n  }\n  .m-0 {\n    margin: calc(var(--spacing) * 0);\n  }\n  .m-0\\! {\n    margin: calc(var(--spacing) * 0) !important;\n  }\n  .m-2 {\n    margin: calc(var(--spacing) * 2);\n  }\n  .m-4 {\n    margin: calc(var(--spacing) * 4);\n  }\n  .mx-auto {\n    margin-inline: auto;\n  }\n  .my-1 {\n    margin-block: calc(var(--spacing) * 1);\n  }\n  .my-4 {\n    margin-block: calc(var(--spacing) * 4);\n  }\n  .my-8 {\n    margin-block: calc(var(--spacing) * 8);\n  }\n  .my-12 {\n    margin-block: calc(var(--spacing) * 12);\n  }\n  .mt-2 {\n    margin-top: calc(var(--spacing) * 2);\n  }\n  .mr-4 {\n    margin-right: calc(var(--spacing) * 4);\n  }\n  .mr-\\[-60px\\] {\n    margin-right: -60px;\n  }\n  .mb-0 {\n    margin-bottom: calc(var(--spacing) * 0);\n  }\n  .mb-2 {\n    margin-bottom: calc(var(--spacing) * 2);\n  }\n  .mb-48 {\n    margin-bottom: calc(var(--spacing) * 48);\n  }\n  .ml-4 {\n    margin-left: calc(var(--spacing) * 4);\n  }\n  .box-border {\n    box-sizing: border-box;\n  }\n  .block {\n    display: block;\n  }\n  .contents {\n    display: contents;\n  }\n  .flex {\n    display: flex;\n  }\n  .hidden {\n    display: none;\n  }\n  .inline {\n    display: inline;\n  }\n  .inline-block {\n    display: inline-block;\n  }\n  .table {\n    display: table;\n  }\n  .\\!size-\\[32px\\] {\n    width: 32px !important;\n    height: 32px !important;\n  }\n  .size-6 {\n    width: calc(var(--spacing) * 6);\n    height: calc(var(--spacing) * 6);\n  }\n  .size-7 {\n    width: calc(var(--spacing) * 7);\n    height: calc(var(--spacing) * 7);\n  }\n  .size-8 {\n    width: calc(var(--spacing) * 8);\n    height: calc(var(--spacing) * 8);\n  }\n  .size-9 {\n    width: calc(var(--spacing) * 9);\n    height: calc(var(--spacing) * 9);\n  }\n  .size-\\[20px\\] {\n    width: 20px;\n    height: 20px;\n  }\n  .size-full {\n    width: 100%;\n    height: 100%;\n  }\n  .h-4 {\n    height: calc(var(--spacing) * 4);\n  }\n  .h-7 {\n    height: calc(var(--spacing) * 7);\n  }\n  .h-8 {\n    height: calc(var(--spacing) * 8);\n  }\n  .h-12 {\n    height: calc(var(--spacing) * 12);\n  }\n  .h-16 {\n    height: calc(var(--spacing) * 16);\n  }\n  .h-40 {\n    height: calc(var(--spacing) * 40);\n  }\n  .h-96 {\n    height: calc(var(--spacing) * 96);\n  }\n  .h-128 {\n    height: calc(var(--spacing) * 128);\n  }\n  .h-300 {\n    height: calc(var(--spacing) * 300);\n  }\n  .h-\\[32px\\] {\n    height: 32px;\n  }\n  .h-\\[40px\\] {\n    height: 40px;\n  }\n  .h-\\[48px\\] {\n    height: 48px;\n  }\n  .h-\\[65px\\] {\n    height: 65px;\n  }\n  .h-full {\n    height: 100%;\n  }\n  .max-h-\\[58px\\] {\n    max-height: 58px;\n  }\n  .max-h-\\[70\\%\\] {\n    max-height: 70%;\n  }\n  .max-h-\\[200px\\] {\n    max-height: 200px;\n  }\n  .max-h-\\[400px\\] {\n    max-height: 400px;\n  }\n  .min-h-\\[50px\\] {\n    min-height: 50px;\n  }\n  .min-h-\\[75px\\] {\n    min-height: 75px;\n  }\n  .w-0 {\n    width: calc(var(--spacing) * 0);\n  }\n  .w-1 {\n    width: calc(var(--spacing) * 1);\n  }\n  .w-1\\/5 {\n    width: calc(1 / 5 * 100%);\n  }\n  .w-2\\/5 {\n    width: calc(2 / 5 * 100%);\n  }\n  .w-4\\/5 {\n    width: calc(4 / 5 * 100%);\n  }\n  .w-6 {\n    width: calc(var(--spacing) * 6);\n  }\n  .w-8 {\n    width: calc(var(--spacing) * 8);\n  }\n  .w-10 {\n    width: calc(var(--spacing) * 10);\n  }\n  .w-24 {\n    width: calc(var(--spacing) * 24);\n  }\n  .w-64 {\n    width: calc(var(--spacing) * 64);\n  }\n  .w-\\[345px\\] {\n    width: 345px;\n  }\n  .w-fit {\n    width: fit-content;\n  }\n  .w-full {\n    width: 100%;\n  }\n  .w-screen {\n    width: 100vw;\n  }\n  .max-w-3xl {\n    max-width: 48rem;\n  }\n  .max-w-96 {\n    max-width: calc(var(--spacing) * 96);\n  }\n  .max-w-full {\n    max-width: 100%;\n  }\n  .min-w-\\[40px\\] {\n    min-width: 40px;\n  }\n  .min-w-\\[320px\\] {\n    min-width: 320px;\n  }\n  .flex-1 {\n    flex: 1;\n  }\n  .flex-none {\n    flex: none;\n  }\n  .shrink-0 {\n    flex-shrink: 0;\n  }\n  .grow {\n    flex-grow: 1;\n  }\n  .table-auto {\n    table-layout: auto;\n  }\n  .transform {\n    transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);\n  }\n  .animate-pulse {\n    animation: var(--animate-pulse);\n  }\n  .animate-spin {\n    animation: var(--animate-spin);\n  }\n  .cursor-pointer {\n    cursor: pointer;\n  }\n  .touch-none {\n    touch-action: none;\n  }\n  .resize {\n    resize: both;\n  }\n  .scroll-mt-20 {\n    scroll-margin-top: calc(var(--spacing) * 20);\n  }\n  .scroll-mt-\\[50px\\] {\n    scroll-margin-top: 50px;\n  }\n  .list-disc {\n    list-style-type: disc;\n  }\n  .appearance-none {\n    appearance: none;\n  }\n  .flex-col {\n    flex-direction: column;\n  }\n  .flex-row {\n    flex-direction: row;\n  }\n  .flex-wrap {\n    flex-wrap: wrap;\n  }\n  .flex-wrap-reverse {\n    flex-wrap: wrap-reverse;\n  }\n  .items-center {\n    align-items: center;\n  }\n  .items-end {\n    align-items: flex-end;\n  }\n  .items-stretch {\n    align-items: stretch;\n  }\n  .justify-between {\n    justify-content: space-between;\n  }\n  .justify-center {\n    justify-content: center;\n  }\n  .justify-end {\n    justify-content: flex-end;\n  }\n  .justify-start {\n    justify-content: flex-start;\n  }\n  .gap-1 {\n    gap: calc(var(--spacing) * 1);\n  }\n  .gap-2 {\n    gap: calc(var(--spacing) * 2);\n  }\n  .gap-3 {\n    gap: calc(var(--spacing) * 3);\n  }\n  .gap-4 {\n    gap: calc(var(--spacing) * 4);\n  }\n  .gap-6 {\n    gap: calc(var(--spacing) * 6);\n  }\n  .gap-\\[1px\\] {\n    gap: 1px;\n  }\n  .space-y-1 {\n    :where(& > :not(:last-child)) {\n      --tw-space-y-reverse: 0;\n      margin-block-start: calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));\n      margin-block-end: calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)));\n    }\n  }\n  .space-y-2 {\n    :where(& > :not(:last-child)) {\n      --tw-space-y-reverse: 0;\n      margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));\n      margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));\n    }\n  }\n  .space-y-4 {\n    :where(& > :not(:last-child)) {\n      --tw-space-y-reverse: 0;\n      margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));\n      margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));\n    }\n  }\n  .gap-x-4 {\n    column-gap: calc(var(--spacing) * 4);\n  }\n  .space-x-2 {\n    :where(& > :not(:last-child)) {\n      --tw-space-x-reverse: 0;\n      margin-inline-start: calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));\n      margin-inline-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)));\n    }\n  }\n  .overflow-auto {\n    overflow: auto;\n  }\n  .overflow-hidden {\n    overflow: hidden;\n  }\n  .overflow-visible {\n    overflow: visible;\n  }\n  .overflow-x-hidden {\n    overflow-x: hidden;\n  }\n  .overflow-y-auto {\n    overflow-y: auto;\n  }\n  .rounded {\n    border-radius: 0.25rem;\n  }\n  .rounded-2xl {\n    border-radius: var(--radius-2xl);\n  }\n  .rounded-\\[12px\\] {\n    border-radius: 12px;\n  }\n  .rounded-\\[16px\\] {\n    border-radius: 16px;\n  }\n  .rounded-full {\n    border-radius: calc(infinity * 1px);\n  }\n  .rounded-md {\n    border-radius: var(--radius-md);\n  }\n  .rounded-none {\n    border-radius: 0;\n  }\n  .rounded-sm {\n    border-radius: var(--radius-sm);\n  }\n  .rounded-t-none {\n    border-top-left-radius: 0;\n    border-top-right-radius: 0;\n  }\n  .\\!rounded-b-none {\n    border-bottom-right-radius: 0 !important;\n    border-bottom-left-radius: 0 !important;\n  }\n  .rounded-b-2xl {\n    border-bottom-right-radius: var(--radius-2xl);\n    border-bottom-left-radius: var(--radius-2xl);\n  }\n  .border {\n    border-style: var(--tw-border-style);\n    border-width: 1px;\n  }\n  .border-0 {\n    border-style: var(--tw-border-style);\n    border-width: 0px;\n  }\n  .border-2 {\n    border-style: var(--tw-border-style);\n    border-width: 2px;\n  }\n  .border-x {\n    border-inline-style: var(--tw-border-style);\n    border-inline-width: 1px;\n  }\n  .border-t {\n    border-top-style: var(--tw-border-style);\n    border-top-width: 1px;\n  }\n  .border-t-0 {\n    border-top-style: var(--tw-border-style);\n    border-top-width: 0px;\n  }\n  .border-r-0 {\n    border-right-style: var(--tw-border-style);\n    border-right-width: 0px;\n  }\n  .border-b {\n    border-bottom-style: var(--tw-border-style);\n    border-bottom-width: 1px;\n  }\n  .border-b-2 {\n    border-bottom-style: var(--tw-border-style);\n    border-bottom-width: 2px;\n  }\n  .border-dashed {\n    --tw-border-style: dashed;\n    border-style: dashed;\n  }\n  .border-none {\n    --tw-border-style: none;\n    border-style: none;\n  }\n  .border-solid {\n    --tw-border-style: solid;\n    border-style: solid;\n  }\n  .border-current {\n    border-color: currentcolor;\n  }\n  .border-slate-300 {\n    border-color: var(--color-slate-300);\n  }\n  .bg-black {\n    background-color: var(--color-black);\n  }\n  .bg-black\\/10 {\n    background-color: color-mix(in srgb, #000 10%, transparent);\n    @supports (color: color-mix(in lab, red, red)) {\n      background-color: color-mix(in oklab, var(--color-black) 10%, transparent);\n    }\n  }\n  .bg-black\\/60 {\n    background-color: color-mix(in srgb, #000 60%, transparent);\n    @supports (color: color-mix(in lab, red, red)) {\n      background-color: color-mix(in oklab, var(--color-black) 60%, transparent);\n    }\n  }\n  .bg-gray-300 {\n    background-color: var(--color-gray-300);\n  }\n  .bg-gray-600 {\n    background-color: var(--color-gray-600);\n  }\n  .bg-slate-50\\/70 {\n    background-color: color-mix(in srgb, oklch(98.4% 0.003 247.858) 70%, transparent);\n    @supports (color: color-mix(in lab, red, red)) {\n      background-color: color-mix(in oklab, var(--color-slate-50) 70%, transparent);\n    }\n  }\n  .bg-slate-100 {\n    background-color: var(--color-slate-100);\n  }\n  .bg-slate-800 {\n    background-color: var(--color-slate-800);\n  }\n  .bg-transparent {\n    background-color: transparent;\n  }\n  .bg-white {\n    background-color: var(--color-white);\n  }\n  .bg-zinc-100 {\n    background-color: var(--color-zinc-100);\n  }\n  .bg-gradient-to-b {\n    --tw-gradient-position: to bottom in oklab;\n    background-image: linear-gradient(var(--tw-gradient-stops));\n  }\n  .bg-gradient-to-t {\n    --tw-gradient-position: to top in oklab;\n    background-image: linear-gradient(var(--tw-gradient-stops));\n  }\n  .from-transparent {\n    --tw-gradient-from: transparent;\n    --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n  }\n  .to-white {\n    --tw-gradient-to: var(--color-white);\n    --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));\n  }\n  .bg-\\[length\\:18px\\] {\n    background-size: 18px;\n  }\n  .bg-contain {\n    background-size: contain;\n  }\n  .bg-center {\n    background-position: center;\n  }\n  .p-0 {\n    padding: calc(var(--spacing) * 0);\n  }\n  .p-1 {\n    padding: calc(var(--spacing) * 1);\n  }\n  .p-1\\.5 {\n    padding: calc(var(--spacing) * 1.5);\n  }\n  .p-2 {\n    padding: calc(var(--spacing) * 2);\n  }\n  .p-3 {\n    padding: calc(var(--spacing) * 3);\n  }\n  .p-4 {\n    padding: calc(var(--spacing) * 4);\n  }\n  .p-6 {\n    padding: calc(var(--spacing) * 6);\n  }\n  .p-8 {\n    padding: calc(var(--spacing) * 8);\n  }\n  .px-0\\.5 {\n    padding-inline: calc(var(--spacing) * 0.5);\n  }\n  .px-1 {\n    padding-inline: calc(var(--spacing) * 1);\n  }\n  .px-2 {\n    padding-inline: calc(var(--spacing) * 2);\n  }\n  .px-4 {\n    padding-inline: calc(var(--spacing) * 4);\n  }\n  .px-\\[13px\\] {\n    padding-inline: 13px;\n  }\n  .py-1 {\n    padding-block: calc(var(--spacing) * 1);\n  }\n  .py-2 {\n    padding-block: calc(var(--spacing) * 2);\n  }\n  .py-3 {\n    padding-block: calc(var(--spacing) * 3);\n  }\n  .py-4 {\n    padding-block: calc(var(--spacing) * 4);\n  }\n  .py-px {\n    padding-block: 1px;\n  }\n  .pt-2 {\n    padding-top: calc(var(--spacing) * 2);\n  }\n  .pt-3\\.5 {\n    padding-top: calc(var(--spacing) * 3.5);\n  }\n  .pr-2 {\n    padding-right: calc(var(--spacing) * 2);\n  }\n  .pr-4 {\n    padding-right: calc(var(--spacing) * 4);\n  }\n  .pl-1 {\n    padding-left: calc(var(--spacing) * 1);\n  }\n  .pl-4 {\n    padding-left: calc(var(--spacing) * 4);\n  }\n  .pl-6 {\n    padding-left: calc(var(--spacing) * 6);\n  }\n  .pl-8 {\n    padding-left: calc(var(--spacing) * 8);\n  }\n  .text-left {\n    text-align: left;\n  }\n  .align-middle {\n    vertical-align: middle;\n  }\n  .font-sans {\n    font-family: var(--font-sans);\n  }\n  .text-3xl {\n    font-size: var(--text-3xl);\n    line-height: var(--tw-leading, var(--text-3xl--line-height));\n  }\n  .text-base {\n    font-size: var(--text-base);\n    line-height: var(--tw-leading, var(--text-base--line-height));\n  }\n  .text-lg {\n    font-size: var(--text-lg);\n    line-height: var(--tw-leading, var(--text-lg--line-height));\n  }\n  .text-sm {\n    font-size: var(--text-sm);\n    line-height: var(--tw-leading, var(--text-sm--line-height));\n  }\n  .text-xl {\n    font-size: var(--text-xl);\n    line-height: var(--tw-leading, var(--text-xl--line-height));\n  }\n  .text-xs {\n    font-size: var(--text-xs);\n    line-height: var(--tw-leading, var(--text-xs--line-height));\n  }\n  .text-\\[0\\.6rem\\] {\n    font-size: 0.6rem;\n  }\n  .text-\\[10px\\] {\n    font-size: 10px;\n  }\n  .text-\\[14px\\] {\n    font-size: 14px;\n  }\n  .text-\\[16px\\] {\n    font-size: 16px;\n  }\n  .leading-\\[1\\.1\\] {\n    --tw-leading: 1.1;\n    line-height: 1.1;\n  }\n  .leading-\\[1\\.3\\] {\n    --tw-leading: 1.3;\n    line-height: 1.3;\n  }\n  .leading-\\[22px\\] {\n    --tw-leading: 22px;\n    line-height: 22px;\n  }\n  .font-bold {\n    --tw-font-weight: var(--font-weight-bold);\n    font-weight: var(--font-weight-bold);\n  }\n  .font-medium {\n    --tw-font-weight: var(--font-weight-medium);\n    font-weight: var(--font-weight-medium);\n  }\n  .font-semibold {\n    --tw-font-weight: var(--font-weight-semibold);\n    font-weight: var(--font-weight-semibold);\n  }\n  .text-balance {\n    text-wrap: balance;\n  }\n  .text-ellipsis {\n    text-overflow: ellipsis;\n  }\n  .whitespace-normal {\n    white-space: normal;\n  }\n  .text-amber-600 {\n    color: var(--color-amber-600);\n  }\n  .text-black {\n    color: var(--color-black);\n  }\n  .text-gray-500 {\n    color: var(--color-gray-500);\n  }\n  .text-gray-600 {\n    color: var(--color-gray-600);\n  }\n  .text-green-600 {\n    color: var(--color-green-600);\n  }\n  .text-orange-600 {\n    color: var(--color-orange-600);\n  }\n  .text-red-600 {\n    color: var(--color-red-600);\n  }\n  .text-slate-200 {\n    color: var(--color-slate-200);\n  }\n  .text-white {\n    color: var(--color-white);\n  }\n  .text-yellow-600 {\n    color: var(--color-yellow-600);\n  }\n  .text-zinc-400 {\n    color: var(--color-zinc-400);\n  }\n  .uppercase {\n    text-transform: uppercase;\n  }\n  .line-through {\n    text-decoration-line: line-through;\n  }\n  .underline {\n    text-decoration-line: underline;\n  }\n  .antialiased {\n    -webkit-font-smoothing: antialiased;\n    -moz-osx-font-smoothing: grayscale;\n  }\n  .opacity-0 {\n    opacity: 0%;\n  }\n  .opacity-100 {\n    opacity: 100%;\n  }\n  .shadow {\n    --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n    box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n  }\n  .shadow-lg {\n    --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));\n    box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n  }\n  .shadow-none {\n    --tw-shadow: 0 0 #0000;\n    box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n  }\n  .filter {\n    filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);\n  }\n  .backdrop-blur-sm {\n    --tw-backdrop-blur: blur(var(--blur-sm));\n    -webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n    backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);\n  }\n  .transition-\\[min-height\\,max-height\\] {\n    transition-property: min-height,max-height;\n    transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n    transition-duration: var(--tw-duration, var(--default-transition-duration));\n  }\n  .transition-all {\n    transition-property: all;\n    transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n    transition-duration: var(--tw-duration, var(--default-transition-duration));\n  }\n  .\\*\\:pointer-events-auto {\n    :is(& > *) {\n      pointer-events: auto;\n    }\n  }\n  .\\*\\:inline {\n    :is(& > *) {\n      display: inline;\n    }\n  }\n  .\\*\\:size-\\[46px\\] {\n    :is(& > *) {\n      width: 46px;\n      height: 46px;\n    }\n  }\n  .\\*\\:rounded-none {\n    :is(& > *) {\n      border-radius: 0;\n    }\n  }\n  .\\*\\:border-none {\n    :is(& > *) {\n      --tw-border-style: none;\n      border-style: none;\n    }\n  }\n  .\\*\\:not-last\\:border-b {\n    :is(& > *) {\n      &:not(*:last-child) {\n        border-bottom-style: var(--tw-border-style);\n        border-bottom-width: 1px;\n      }\n    }\n  }\n  .group-hover\\:bg-slate-50 {\n    &:is(:where(.group):hover *) {\n      @media (hover: hover) {\n        background-color: var(--color-slate-50);\n      }\n    }\n  }\n  .placeholder\\:text-zinc-400 {\n    &::placeholder {\n      color: var(--color-zinc-400);\n    }\n  }\n  .\\*\\:first\\:\\!rounded-l-2xl {\n    :is(& > *) {\n      &:first-child {\n        border-top-left-radius: var(--radius-2xl) !important;\n        border-bottom-left-radius: var(--radius-2xl) !important;\n      }\n    }\n  }\n  .last\\:border-0 {\n    &:last-child {\n      border-style: var(--tw-border-style);\n      border-width: 0px;\n    }\n  }\n  .\\*\\:last\\:\\!rounded-r-2xl {\n    :is(& > *) {\n      &:last-child {\n        border-top-right-radius: var(--radius-2xl) !important;\n        border-bottom-right-radius: var(--radius-2xl) !important;\n      }\n    }\n  }\n  .read-only\\:text-gray-400 {\n    &:read-only {\n      color: var(--color-gray-400);\n    }\n  }\n  .hover\\:border-black {\n    &:hover {\n      @media (hover: hover) {\n        border-color: var(--color-black);\n      }\n    }\n  }\n  .hover\\:bg-gray-700 {\n    &:hover {\n      @media (hover: hover) {\n        background-color: var(--color-gray-700);\n      }\n    }\n  }\n  .hover\\:bg-slate-100 {\n    &:hover {\n      @media (hover: hover) {\n        background-color: var(--color-slate-100);\n      }\n    }\n  }\n  .\\*\\*\\:hover\\:cursor-pointer {\n    :is(& *) {\n      &:hover {\n        @media (hover: hover) {\n          cursor: pointer;\n        }\n      }\n    }\n  }\n  .hover\\:not-disabled\\:cursor-pointer {\n    &:hover {\n      @media (hover: hover) {\n        &:not(*:disabled) {\n          cursor: pointer;\n        }\n      }\n    }\n  }\n  .disabled\\:cursor-default {\n    &:disabled {\n      cursor: default;\n    }\n  }\n  .\\@sm\\:top-0 {\n    @container (min-width: 24rem) {\n      top: calc(var(--spacing) * 0);\n    }\n  }\n  .\\@sm\\:left-\\[calc\\(100\\%-47px\\)\\] {\n    @container (min-width: 24rem) {\n      left: calc(100% - 47px);\n    }\n  }\n  .\\@sm\\/main\\:h-\\[36px\\] {\n    @container main (min-width: 24rem) {\n      height: 36px;\n    }\n  }\n  .\\@sm\\/main\\:gap-4 {\n    @container main (min-width: 24rem) {\n      gap: calc(var(--spacing) * 4);\n    }\n  }\n  .\\@sm\\/main\\:rounded-l-none {\n    @container main (min-width: 24rem) {\n      border-top-left-radius: 0;\n      border-bottom-left-radius: 0;\n    }\n  }\n  .\\@sm\\/main\\:rounded-r-2xl {\n    @container main (min-width: 24rem) {\n      border-top-right-radius: var(--radius-2xl);\n      border-bottom-right-radius: var(--radius-2xl);\n    }\n  }\n  .\\@sm\\:rounded-r-none {\n    @container (min-width: 24rem) {\n      border-top-right-radius: 0;\n      border-bottom-right-radius: 0;\n    }\n  }\n  .\\@sm\\:border-r-0 {\n    @container (min-width: 24rem) {\n      border-right-style: var(--tw-border-style);\n      border-right-width: 0px;\n    }\n  }\n  .\\@sm\\/main\\:text-\\[16px\\] {\n    @container main (min-width: 24rem) {\n      font-size: 16px;\n    }\n  }\n  .\\@sm\\:\\*\\:last\\:\\!rounded-r-none {\n    @container (min-width: 24rem) {\n      :is(& > *) {\n        &:last-child {\n          border-top-right-radius: 0 !important;\n          border-bottom-right-radius: 0 !important;\n        }\n      }\n    }\n  }\n  .\\@sm\\:\\*\\:last\\:border-r-0 {\n    @container (min-width: 24rem) {\n      :is(& > *) {\n        &:last-child {\n          border-right-style: var(--tw-border-style);\n          border-right-width: 0px;\n        }\n      }\n    }\n  }\n  .\\@md\\/main\\:h-\\[40px\\] {\n    @container main (min-width: 28rem) {\n      height: 40px;\n    }\n  }\n  .\\@md\\/main\\:text-\\[18px\\] {\n    @container main (min-width: 28rem) {\n      font-size: 18px;\n    }\n  }\n  .\\@lg\\:left-84 {\n    @container (min-width: 32rem) {\n      left: calc(var(--spacing) * 84);\n    }\n  }\n  .\\@lg\\/main\\:hidden {\n    @container main (min-width: 32rem) {\n      display: none;\n    }\n  }\n  .\\@lg\\:flex {\n    @container (min-width: 32rem) {\n      display: flex;\n    }\n  }\n  .\\@lg\\:hidden {\n    @container (min-width: 32rem) {\n      display: none;\n    }\n  }\n  .\\@lg\\:min-w-\\[320px\\] {\n    @container (min-width: 32rem) {\n      min-width: 320px;\n    }\n  }\n  .\\@lg\\/main\\:flex-row-reverse {\n    @container main (min-width: 32rem) {\n      flex-direction: row-reverse;\n    }\n  }\n  .\\@lg\\:transition-\\[width\\] {\n    @container (min-width: 32rem) {\n      transition-property: width;\n      transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n      transition-duration: var(--tw-duration, var(--default-transition-duration));\n    }\n  }\n}\n@layer base {\n  *, ::after, ::before, ::backdrop, ::file-selector-button {\n    border-color: var(--color-gray-200, currentColor);\n  }\n}\n::-webkit-scrollbar {\n  width: 3px;\n  height: 3px;\n}\n::-webkit-scrollbar-thumb {\n  background: lightgray;\n  z-index: 5;\n}\n::-webkit-scrollbar-track {\n  background: transparent;\n}\n@property --tw-rotate-x {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-rotate-y {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-rotate-z {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-skew-x {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-skew-y {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-space-y-reverse {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0;\n}\n@property --tw-space-x-reverse {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0;\n}\n@property --tw-border-style {\n  syntax: "*";\n  inherits: false;\n  initial-value: solid;\n}\n@property --tw-gradient-position {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-gradient-from {\n  syntax: "<color>";\n  inherits: false;\n  initial-value: #0000;\n}\n@property --tw-gradient-via {\n  syntax: "<color>";\n  inherits: false;\n  initial-value: #0000;\n}\n@property --tw-gradient-to {\n  syntax: "<color>";\n  inherits: false;\n  initial-value: #0000;\n}\n@property --tw-gradient-stops {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-gradient-via-stops {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-gradient-from-position {\n  syntax: "<length-percentage>";\n  inherits: false;\n  initial-value: 0%;\n}\n@property --tw-gradient-via-position {\n  syntax: "<length-percentage>";\n  inherits: false;\n  initial-value: 50%;\n}\n@property --tw-gradient-to-position {\n  syntax: "<length-percentage>";\n  inherits: false;\n  initial-value: 100%;\n}\n@property --tw-leading {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-font-weight {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-shadow {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0 0 #0000;\n}\n@property --tw-shadow-color {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-shadow-alpha {\n  syntax: "<percentage>";\n  inherits: false;\n  initial-value: 100%;\n}\n@property --tw-inset-shadow {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0 0 #0000;\n}\n@property --tw-inset-shadow-color {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-inset-shadow-alpha {\n  syntax: "<percentage>";\n  inherits: false;\n  initial-value: 100%;\n}\n@property --tw-ring-color {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-ring-shadow {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0 0 #0000;\n}\n@property --tw-inset-ring-color {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-inset-ring-shadow {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0 0 #0000;\n}\n@property --tw-ring-inset {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-ring-offset-width {\n  syntax: "<length>";\n  inherits: false;\n  initial-value: 0px;\n}\n@property --tw-ring-offset-color {\n  syntax: "*";\n  inherits: false;\n  initial-value: #fff;\n}\n@property --tw-ring-offset-shadow {\n  syntax: "*";\n  inherits: false;\n  initial-value: 0 0 #0000;\n}\n@property --tw-blur {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-brightness {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-contrast {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-grayscale {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-hue-rotate {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-invert {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-opacity {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-saturate {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-sepia {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-drop-shadow {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-drop-shadow-color {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-drop-shadow-alpha {\n  syntax: "<percentage>";\n  inherits: false;\n  initial-value: 100%;\n}\n@property --tw-drop-shadow-size {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-blur {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-brightness {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-contrast {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-grayscale {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-hue-rotate {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-invert {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-opacity {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-saturate {\n  syntax: "*";\n  inherits: false;\n}\n@property --tw-backdrop-sepia {\n  syntax: "*";\n  inherits: false;\n}\n@keyframes spin {\n  to {\n    transform: rotate(360deg);\n  }\n}\n@keyframes pulse {\n  50% {\n    opacity: 0.5;\n  }\n}\n@layer properties {\n  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {\n    *, ::before, ::after, ::backdrop {\n      --tw-rotate-x: initial;\n      --tw-rotate-y: initial;\n      --tw-rotate-z: initial;\n      --tw-skew-x: initial;\n      --tw-skew-y: initial;\n      --tw-space-y-reverse: 0;\n      --tw-space-x-reverse: 0;\n      --tw-border-style: solid;\n      --tw-gradient-position: initial;\n      --tw-gradient-from: #0000;\n      --tw-gradient-via: #0000;\n      --tw-gradient-to: #0000;\n      --tw-gradient-stops: initial;\n      --tw-gradient-via-stops: initial;\n      --tw-gradient-from-position: 0%;\n      --tw-gradient-via-position: 50%;\n      --tw-gradient-to-position: 100%;\n      --tw-leading: initial;\n      --tw-font-weight: initial;\n      --tw-shadow: 0 0 #0000;\n      --tw-shadow-color: initial;\n      --tw-shadow-alpha: 100%;\n      --tw-inset-shadow: 0 0 #0000;\n      --tw-inset-shadow-color: initial;\n      --tw-inset-shadow-alpha: 100%;\n      --tw-ring-color: initial;\n      --tw-ring-shadow: 0 0 #0000;\n      --tw-inset-ring-color: initial;\n      --tw-inset-ring-shadow: 0 0 #0000;\n      --tw-ring-inset: initial;\n      --tw-ring-offset-width: 0px;\n      --tw-ring-offset-color: #fff;\n      --tw-ring-offset-shadow: 0 0 #0000;\n      --tw-blur: initial;\n      --tw-brightness: initial;\n      --tw-contrast: initial;\n      --tw-grayscale: initial;\n      --tw-hue-rotate: initial;\n      --tw-invert: initial;\n      --tw-opacity: initial;\n      --tw-saturate: initial;\n      --tw-sepia: initial;\n      --tw-drop-shadow: initial;\n      --tw-drop-shadow-color: initial;\n      --tw-drop-shadow-alpha: 100%;\n      --tw-drop-shadow-size: initial;\n      --tw-backdrop-blur: initial;\n      --tw-backdrop-brightness: initial;\n      --tw-backdrop-contrast: initial;\n      --tw-backdrop-grayscale: initial;\n      --tw-backdrop-hue-rotate: initial;\n      --tw-backdrop-invert: initial;\n      --tw-backdrop-opacity: initial;\n      --tw-backdrop-saturate: initial;\n      --tw-backdrop-sepia: initial;\n    }\n  }\n}\n',WI="";function yz(e){let t=Qi(),[i,r]=qe(),[n,a]=qe(!1),[s,o]=qe(!1),[l,h]=qe(!1),[u,c]=qe(!1),[d,p]=qe(!1),[f,m]=qe(!1),[g,_]=qe(!1),[y,v]=qe(!1),[x,b]=qe(!1),[w,T]=qe(!1),[S,I]=qe(!1),[P,C]=qe(!1),[E,M]=qe(!1),[A,k]=qe(!1),[L,F]=qe(!1),[D,R]=qe(!1),[z,O]=qe(!1),[B,j]=qe(!1),[V,G]=qe(!1),[U,Z]=qe(!1),[$,q]=qe(!1),[W,H]=qe(),[X,Y]=qe(),[K,J]=qe(),[Q,ee]=qe(),[te,ie]=qe(),[re,ne]=qe(),[ae,se]=qe(),[oe,le]=qe(),[he,ue]=qe(),[ce,de]=qe(),[pe,fe]=qe(),[me,ge]=qe(),[_e,ye]=qe([]),[ve,xe]=qe([]),[be,we]=qe(null),[Te,Se]=qe([]),[Ie,Pe]=qe(),[Ce,Ee]=qe(),{lang:Me,layers:Ae,permalinktemplate:ke}=e;ZI(ae,Ae,ke);let Le=nt(()=>({...e,baseLayer:i,featuresInfos:_e,featuresInfosHovered:ve,hasDetails:f,hasGeolocation:u,hasLayerTree:D,hasLnp:d,hasMapset:g,hasNotification:y,hasPermalink:x,hasPrint:w,hasRealtime:S,hasSearch:P,hasShare:L,hasStations:E,hasToolbar:A,isEmbed:l,isExportMenuOpen:B,isFollowing:n,isLayerTreeOpen:U,isOverlayOpen:z,isSearchOpen:$,isShareMenuOpen:V,isTracking:s,linesIds:ce,linesNetworkPlanLayer:re,map:ae,mapsetLayer:te,notificationId:pe,notificationsLayer:Q,notificationSupportedLanguages:me,permalinkUrlSearchParams:Ie,previewNotifications:Ce,realtimeLayer:K,selectedFeature:be,selectedFeatures:Te,setBaseLayer:r,setFeaturesInfos:ye,setFeaturesInfosHovered:xe,setHasDetails:m,setHasGeolocation:c,setHasLayerTree:R,setHasLnp:p,setHasMapset:_,setHasNotification:v,setHasPermalink:b,setHasPrint:T,setHasRealtime:I,setHasSearch:C,setHasShare:F,setHasStations:M,setHasToolbar:k,setIsEmbed:h,setIsExportMenuOpen:j,setIsFollowing:a,setIsLayerTreeOpen:Z,setIsOverlayOpen:O,setIsSearchOpen:q,setIsShareMenuOpen:G,setIsTracking:o,setLinesIds:de,setLinesNetworkPlanLayer:ne,setMap:se,setMapsetLayer:ie,setNotificationId:fe,setNotificationsLayer:ee,setNotificationSupportedLanguages:ge,setPermalinkUrlSearchParams:Pe,setPreviewNotifications:Ee,setRealtimeLayer:J,setSelectedFeature:we,setSelectedFeatures:Se,setStation:Y,setStationId:le,setStationsLayer:H,setTrainId:ue,station:X,stationId:oe,stationsLayer:W,trainId:he}),[e,i,_e,ve,f,u,D,d,g,y,x,w,S,P,L,E,A,l,B,n,U,z,$,V,s,ce,re,ae,te,pe,me,Q,Ie,Ce,K,be,Te,X,oe,W,he]);return N(Wd,{locale:Me,children:[N("style",{children:":host {\n            --tw-divide-y-reverse: 0;\n            --tw-border-style: solid;\n            --tw-font-weight: initial;\n            --tw-tracking: initial;\n            --tw-translate-x: 0;\n            --tw-translate-y: 0;\n            --tw-translate-z: 0;\n            --tw-rotate-x: rotateX(0);\n            --tw-rotate-y: rotateY(0);\n            --tw-rotate-z: rotateZ(0);\n            --tw-skew-x: skewX(0);\n            --tw-skew-y: skewY(0);\n            --tw-space-x-reverse: 0;\n            --tw-gradient-position: initial;\n            --tw-gradient-from: #0000;\n            --tw-gradient-via: #0000;\n            --tw-gradient-to: #0000;\n            --tw-gradient-stops: initial;\n            --tw-gradient-via-stops: initial;\n            --tw-gradient-from-position: 0%;\n            --tw-gradient-via-position: 50%;\n            --tw-gradient-to-position: 100%;\n            --tw-shadow: 0 0 #0000;\n            --tw-shadow-color: initial;\n            --tw-inset-shadow: 0 0 #0000;\n            --tw-inset-shadow-color: initial;\n            --tw-ring-color: initial;\n            --tw-ring-shadow: 0 0 #0000;\n            --tw-inset-ring-color: initial;\n            --tw-inset-ring-shadow: 0 0 #0000;\n            --tw-ring-inset: initial;\n            --tw-ring-offset-width: 0px;\n            --tw-ring-offset-color: #fff;\n            --tw-ring-offset-shadow: 0 0 #0000;\n            --tw-blur: initial;\n            --tw-brightness: initial;\n            --tw-contrast: initial;\n            --tw-grayscale: initial;\n            --tw-hue-rotate: initial;\n            --tw-invert: initial;\n            --tw-opacity: initial;\n            --tw-saturate: initial;\n            --tw-sepia: initial;\n            --tw-drop-shadow: initial;\n            --tw-duration: initial;\n            --tw-ease: initial;\n        }"}),N("style",{children:Um}),N("style",{children:WI}),N(K2.Provider,{value:Le,children:[N(ex,{}),N(Zv,{replaceState:x}),N(ox,{node:t.current,wcAttributes:e}),N(Yv,{eventNode:t.current}),N(Hv,{}),N(q0,{}),N(H0,{}),y&&N(Uv,{}),S&&N(Wv,{}),E&&N(qv,{}),d&&N(tx,{}),d&&N(rx,{}),g&&N(Gv,{}),N("div",{className:"@container/main relative size-full border font-sans",ref:t,children:N(jv,{})})]})]})}var xz=Fe(yz),HI={};function vz(e){return N(xz,{...HI,...e})}Object.entries(Ru).forEach(([e])=>{HI[e]=Ru[e].defaultValue||null});var Kv=Fe(vz),XI=Rn(Vo(),1),qI=e=>e?.properties?.name||"";function bz({apikey:e,bbox:t,cancelButtonClassName:i,className:r,countrycode:n,event:a,field:s,inputClassName:o,inputContainerClassName:l,lang:h,limit:u,mots:c,onselect:d,params:p,prefagencies:f,reflocation:m,resultClassName:g,resultsClassName:_,resultsContainerClassName:y,searchIconContainerClassName:v,url:x="https://api.geops.io/stops/v1/",withResultsClassName:b}){let{t:w}=Ct(),[T,S]=qe(""),[I,P]=qe(),[C,E]=qe(),M=Qi();Ae(()=>{M.current?.dispatchEvent(new qd("mwc:attribute",{apikey:e,bbox:t,countrycode:n,event:a,field:s,lang:h,limit:u,mots:c,onselect:d,params:p,prefagencies:f,reflocation:m,url:x}))},[e,t,n,a,s,u,c,d,p,f,m,x,h]);let A=nt(()=>new Md({apiKey:e,url:x}),[e,x]),k=$t(e=>{let t=new qd(a||"mwc:stopssearchselect",e,{bubbles:!0});M.current?.dispatchEvent(t),d&&"function"==typeof d&&d(e)},[a,d]),L=nt(()=>{let e;return(0,XI.default)(i=>{e?.abort(),e=new AbortController;let r={bbox:t,field:s,limit:u,mots:c,prefagencies:f,q:i,ref_location:m,...JSON.parse(p||"{}")};A.search(r,{signal:e.signal}).then(e=>{E(e.features.filter(e=>!n||e.properties?.country_code===n))}).catch(e=>{20===e.code||console.error("Failed to fetch stations",e)})},150)},[A,t,n,s,u,c,p,f,m]);return Ae(()=>{if(!I||T!==qI(I))return T?(L(T),()=>{L.cancel()}):void P(void 0)},[T,I,L]),Ae(()=>{E(void 0),I&&S(qI(I)),k(I)},[k,I]),N(Zt,{children:[N("div",{className:Qe("flex h-16 items-center gap-4 rounded-md bg-white p-4 pt-3.5 shadow",r,C?b:""),ref:M,children:[N("div",{className:Qe("text-grey flex items-center",v),children:N(lc,{})}),N("div",{className:Qe("@container/inputsearch flex grow items-center border-b-2 border-solid",l),children:[N(cc,{autoComplete:"off",className:Qe("h-8 w-1 grow overflow-hidden text-ellipsis placeholder:text-zinc-400",o),onChange:e=>{S(e.target.value)},onKeyUp:e=>{"Enter"===e.key&&C?.length>0&&P(C[0])},placeholder:w("stops_search_placeholder"),type:"text",value:T||""}),T.length>0&&N(Zi,{className:Qe("flex !size-[32px] items-center rounded-none border-none bg-transparent shadow-none",i),onClick:()=>{S(""),E(void 0)},children:N(sc,{})})]})]}),C&&N("div",{className:Qe("flex grow overflow-auto rounded-md rounded-t-none bg-white shadow",y),children:[!C?.length&&N("div",{className:Qe("flex grow gap-3 border border-solid p-3 pt-2 text-zinc-400",_),style:{border:1},children:[N("div",{className:"size-6"}),N("div",{children:w("no_stops_found")})]}),!!C?.length&&N("ul",{className:Qe("grow rounded-md rounded-t-none border border-solid bg-white p-0",_),style:{border:1},children:C?.map(e=>N("li",{className:Qe("border-b border-dashed border-slate-300 p-3 last:border-0",g),children:N("button",{className:"flex w-full items-center gap-3 text-left",onClick:()=>{P(e)},children:[N("div",{className:"size-6"}),N("div",{className:"grow",children:e.properties.name})]})},e.properties.uid))})]})]})}var YI=Fe(bz);function wz(e){let{lang:t}=e;return N(Wd,{lang:t,children:[N("style",{children:Um}),N(YI,{...e})]})}var KI={};function Sz(e){return N(wz,{...KI,...e})}Object.entries(Du).forEach(([e])=>{KI[e]=Du[e].defaultValue||null});var Jv=Fe(Sz);O_(Kv,"geops-mobility",Object.keys(Ru),{mode:"open",shadow:!0}),O_(Jv,"geops-mobility-search",Object.keys(Du),{mode:"open",shadow:!0});
/*! Bundled license information:

maplibre-gl/dist/maplibre-gl.js:
  (**
   * MapLibre GL JS
   * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.24.0/LICENSE.txt
   *)
*/
//# sourceMappingURL=/sm/d5b210d4a31603ee2a7ab8e97410e5e5a1e5d4d56bf32cde069a8b22da84159c.map