PageSourceSearch

https://www.aponet.de/_assets/vite/assets/Main.entry-D_BpwyIS.js?1790268787

js aponet.de collected 2026-09-24 18:01:37 UTC 1,102,950 bytes, 825 lines download raw bytes

1var N_=Object.defineProperty;var Hf=R=>{throw TypeError(R)};var U_=(R,F,N)=>F in R?N_(R,F,{enumerable:!0,configurable:!0,writable:!0,value:N}):R[F]=N;var Ze=(R,F,N)=>U_(R,typeof F!="symbol"?F+"":F,N),Pd=(R,F,N)=>F.has(R)||Hf("Cannot "+N);var ze=(R,F,N)=>(Pd(R,F,"read from private field"),N?N.call(R):F.get(R)),wn=(R,F,N)=>F.has(R)?Hf("Cannot add the same private member more than once"):F instanceof WeakSet?F.add(R):F.set(R,N),Kr=(R,F,N,X)=>(Pd(R,F,"write to private field"),X?X.call(R,N):F.set(R,N),N),yi=(R,F,N)=>(Pd(R,F,"access private method"),N);var Xf=(R,F,N,X)=>({set _(pe){Kr(R,F,pe,N)},get _(){return ze(R,F,X)}});import"./owl.carousel-Dm9V108D.js";import{L as Yf,r as G_}from"./index-CMeLIv_H.js";import"./_commonjsHelpers-CqkleIqs.js";document.addEventListener("DOMContentLoaded",()=>{if($("#pharmacy-edit .custom-file-input").on("change",function(){var F=$(this).val().split("\\").pop();$(this).siblings(".custom-file-label").addClass("selected").html(F)}),$(".upload-field").each(function(){var F=$(this).find("input[type=hidden]"),N=$(this).find(".custom-file-input");$(this).find(".delete-image").on("change",function(){this.checked?F.remove():N.before(F)})}),document.getElementById("pharmacy-carousel")){const F=$("#pharmacy-carousel .owl-carousel").owlCarousel({loop:!0,items:1,nav:!1,dotsContainer:"#pharmacy-carousel .owl-dots"});$("#pharmacy-carousel .owl-dot").on("click",function(){F.trigger("to.owl.carousel",[$(this).index(),300])})}function R(F){var N=$(F).attr("maxlength"),X=$(F).val(),pe=N-X.length;$(F).next().find("#letter-count").html(pe)}$(".check-length").each(function(){R(this)}),$(".check-length").on("keyup",function(){R(this)})});var Yu={exports:{}};/**
2 * MapLibre GL JS
3 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.18.0/LICENSE.txt
4 */var q_=Yu.exports,Kf;function $_(){return Kf||(Kf=1,(function(R,F){(function(N,X){R.exports=X()})(q_,(function(){var N={},X={};function pe(C,c,be){if(X[C]=be,C==="index"){var Ne="var sharedModule = {}; ("+X.shared+")(sharedModule); ("+X.worker+")(sharedModule);",nt={};return X.shared(nt),X.index(N,nt),typeof window<"u"&&N.setWorkerUrl(window.URL.createObjectURL(new Blob([Ne],{type:"text/javascript"}))),N}}pe("shared",["exports"],(function(C){function c(r,e,i,a){return new(i||(i=Promise))((function(o,u){function h(y){try{g(a.next(y))}catch(v){u(v)}}function f(y){try{g(a.throw(y))}catch(v){u(v)}}function g(y){var v;y.done?o(y.value):(v=y.value,v instanceof i?v:new i((function(b){b(v)}))).then(h,f)}g((a=a.apply(r,e||[])).next())}))}function be(r,e){this.x=r,this.y=e}function Ne(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var nt,At;typeof SuppressedError=="function"&&SuppressedError,be.prototype={clone(){return new be(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),a=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=a,this}
vendor: 11,154 bytes, line 4
4,_rotateAround(r,e){const i=Math.cos(r),a=Math.sin(r),o=e.y+a*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-a*(this.y-e.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:be},be.convert=function(r){if(r instanceof be)return r;if(Array.isArray(r))return new be(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new be(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Lt=(function(){if(At)return nt;function r(e,i,a,o){this.cx=3*e,this.bx=3*(a-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=a,this.p2y=o}return At=1,nt=r,r.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,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,o=0;o<8;o++){var u=this.sampleCurveX(a)-e;if(Math.abs(u)<i)return a;var h=this.sampleCurveDerivativeX(a);if(Math.abs(h)<1e-6)break;a-=u/h}var f=0,g=1;for(a=e,o=0;o<20&&(u=this.sampleCurveX(a),!(Math.abs(u-e)<i));o++)e>u?f=a:g=a,a=.5*(g-f)+f;return a},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},nt})(),_t=Ne(Lt);let ki,st;function xe(){return ki==null&&(ki=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ki}function sr(){if(st==null&&(st=!1,xe())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let a=0;a<25;a++){const o=4*a;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(a%5,Math.floor(a/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let a=0;a<100;a++)if(a%4!=3&&i[a]!==a){st=!0;break}}}return st||!1}var St=1e-6,vt=typeof Float32Array<"u"?Float32Array:Array;function Mn(){var r=new vt(9);return vt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function na(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function $a(){var r=new vt(3);return vt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Ki(r){var e=r[0],i=r[1],a=r[2];return Math.sqrt(e*e+i*i+a*a)}function Za(r,e,i){var a=new vt(3);return a[0]=r,a[1]=e,a[2]=i,a}function Er(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function tn(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function In(r,e,i){var a=e[0],o=e[1],u=e[2],h=i[0],f=i[1],g=i[2];return r[0]=o*g-u*f,r[1]=u*h-a*g,r[2]=a*f-o*h,r}var rn,Cr=Ki;function nn(r,e,i){var a=e[0],o=e[1],u=e[2],h=e[3];return r[0]=i[0]*a+i[4]*o+i[8]*u+i[12]*h,r[1]=i[1]*a+i[5]*o+i[9]*u+i[13]*h,r[2]=i[2]*a+i[6]*o+i[10]*u+i[14]*h,r[3]=i[3]*a+i[7]*o+i[11]*u+i[15]*h,r}function Wa(){var r=new vt(4);return vt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function aa(r,e,i,a){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",u=Math.PI/360;e*=u,a*=u,i*=u;var h=Math.sin(e),f=Math.cos(e),g=Math.sin(i),y=Math.cos(i),v=Math.sin(a),b=Math.cos(a);switch(o){case"xyz":r[0]=h*y*b+f*g*v,r[1]=f*g*b-h*y*v,r[2]=f*y*v+h*g*b,r[3]=f*y*b-h*g*v;break;case"xzy":r[0]=h*y*b-f*g*v,r[1]=f*g*b-h*y*v,r[2]=f*y*v+h*g*b,r[3]=f*y*b+h*g*v;break;case"yxz":r[0]=h*y*b+f*g*v,r[1]=f*g*b-h*y*v,r[2]=f*y*v-h*g*b,r[3]=f*y*b+h*g*v;break;case"yzx":r[0]=h*y*b+f*g*v,r[1]=f*g*b+h*y*v,r[2]=f*y*v-h*g*b,r[3]=f*y*b-h*g*v;break;case"zxy":r[0]=h*y*b-f*g*v,r[1]=f*g*b+h*y*v,r[2]=f*y*v+h*g*b,r[3]=f*y*b-h*g*v;break;case"zyx":r[0]=h*y*b-f*g*v,r[1]=f*g*b+h*y*v,r[2]=f*y*v-h*g*b,r[3]=f*y*b+h*g*v;break;default:throw new Error("Unknown angle order "+o)}return r}function jr(){var r=new vt(2);return vt!=Float32Array&&(r[0]=0,r[1]=0),r}function ni(r,e){var i=new vt(2);return i[0]=r,i[1]=e,i}$a(),rn=new vt(4),vt!=Float32Array&&(rn[0]=0,rn[1]=0,rn[2]=0,rn[3]=0),$a(),Za(1,0,0),Za(0,1,0),Wa(),Wa(),Mn(),jr();const gt=8192;function En(r,e,i){return e*(gt/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function Ar(r,e){return(r%e+e)%e}function Ha(r,e,i){return r*(1-i)+e*i}function sa(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function an(r,e,i,a){const o=new _t(r,e,i,a);return u=>o.solve(u)}const Vr=an(.25,.1,.25,1);function or(r,e,i){return Math.min(i,Math.max(e,r))}function wi(r,e,i){const a=i-e,o=((r-e)%a+a)%a+e;return o===e?i:o}function Gi(r,...e){for(const i of e)for(const a in i)r[a]=i[a];return r}let oa=1;function Cn(r,e,i){const a={};for(const o in r)a[o]=e.call(this,r[o],o,r);return a}function An(r,e,i){const a={};for(const o in r)e.call(this,r[o],o,r)&&(a[o]=r[o]);return a}function Ti(r){return Array.isArray(r)?r.map(Ti):typeof r=="object"&&r?Cn(r,Ti):r}const Ws={};function Si(r){Ws[r]||(typeof console<"u"&&console.warn(r),Ws[r]=!0)}function Ji(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function zr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Ft=null;function Nr(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const la="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function zn(r,e,i,a,o){return c(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const u=new VideoFrame(r,{timestamp:0});try{const h=u==null?void 0:u.format;if(!h||!h.startsWith("BGR")&&!h.startsWith("RGB"))throw new Error(`Unrecognized format ${h}`);const f=h.startsWith("BGR"),g=new Uint8ClampedArray(a*o*4);if(yield u.copyTo(g,(function(y,v,b,S,P){const E=4*Math.max(-v,0),z=(Math.max(0,b)-b)*S*4+E,L=4*S,V=Math.max(0,v),W=Math.max(0,b);return{rect:{x:V,y:W,width:Math.min(y.width,v+S)-V,height:Math.min(y.height,b+P)-W},layout:[{offset:z,stride:L}]}})(r,e,i,a,o)),f)for(let y=0;y<g.length;y+=4){const v=g[y];g[y]=g[y+2],g[y+2]=v}return g}finally{u.close()}}))}let sn,_r;function ca(r,e,i,a){return r.addEventListener(e,i,a),{unsubscribe:()=>{r.removeEventListener(e,i,a)}}}function kn(r){return r*Math.PI/180}function Qi(r){return r/Math.PI*180}const Xa={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},on={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ua="AbortError";class Ya extends Error{constructor(e=ua){super(e instanceof Error?e.message:e),this.name=ua,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function Dn(r){return r.name===ua}const le={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function A(r){return le.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const D="global-dispatcher";class O extends Error{constructor(e,i,a,o){super(`AJAXError: ${i} (${e}): ${a}`),this.status=e,this.statusText=i,this.url=a,this.body=o}}const K=()=>zr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ae=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=A(r.url);if(a)return a(r,e);if(zr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:D},e)}if(!(/^file:/.test(i=r.url)||/^file:/.test(K())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(a,o){return c(this,void 0,void 0,(function*(){const u=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:K(),signal:o.signal});let h,f;a.type!=="json"||u.headers.has("Accept")||u.headers.set("Accept","application/json");try{h=yield fetch(u)}catch(y){throw Dn(y)?y:new O(0,y.message,a.url,new Blob)}if(!h.ok){const y=yield h.blob();throw new O(h.status,h.statusText,a.url,y)}f=a.type==="arrayBuffer"||a.type==="image"?h.arrayBuffer():a.type==="json"?h.json():h.text();const g=yield f;return o.signal.throwIfAborted(),{data:g,cacheControl:h.headers.get("Cache-Control"),expires:h.headers.get("Expires")}}))})(r,e);if(zr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:D},e)}var i;return(function(a,o){return new Promise(((u,h)=>{var f;const g=new XMLHttpRequest;g.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(g.responseType="arraybuffer");for(const y in a.headers)g.setRequestHeader(y,a.headers[y]);a.type==="json"&&(g.responseType="text",!((f=a.headers)===null||f===void 0)&&f.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=a.credentials==="include",g.onerror=()=>{h(new Error(g.statusText))},g.onload=()=>{if(!o.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let y=g.response;if(a.type==="json")try{y=JSON.parse(g.response)}catch(v){return void h(v)}u({data:y,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires")})}else{const y=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});h(new O(g.status,g.statusText,a.url,y))}},o.signal.addEventListener("abort",(()=>{g.abort(),h(new Ya(o.signal.reason))})),g.send(a.body)}))})(r,e)};function ce(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function fe(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function se(r,e,i){if(i&&i[r]){const a=i[r].indexOf(e);a!==-1&&i[r].splice(a,1)}}class ue{constructor(e,i={}){Gi(this,i),this.type=e}}class Pe extends ue{constructor(e,i={}){super("error",Gi({error:e},i))}}class ve{on(e,i){return this._listeners=this._listeners||{},fe(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return se(e,i,this._listeners),se(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},fe(e,i,this._oneTimeListeners),this):new Promise((a=>this.once(e,a)))}fire(e,i){typeof e=="string"&&(e=new ue(e,i||{}));const a=e.type;if(this.listens(a)){e.target=this;const o=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const f of o)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const f of u)se(a,f,this._oneTimeListeners),f.call(this,e);const h=this._eventedParent;h&&(Gi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof Pe&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ie={$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"}
vendor: 20,999 bytes, line 4
4,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"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",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
vendor: 8,689 bytes, line 4
4"},"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"},
4"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"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"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"}]}}}}};const Ge=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function it(r,e){const i={};for(const a in r)a!=="ref"&&(i[a]=r[a]);return Ge.forEach((a=>{a in e&&(i[a]=e[a])})),i}function Xe(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!Xe(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!Xe(r[i],e[i]))return!1;return!0}return r===e}function Ye(r,e){r.push(e)}
vendor: 80,560 bytes, line 4
4function Qe(r,e,i){Ye(i,{command:"addSource",args:[r,e[r]]})}function et(r,e,i){Ye(e,{command:"removeSource",args:[r]}),i[r]=!0}function yt(r,e,i,a){et(r,i,a),Qe(r,e,i)}function Kt(r,e,i){let a;for(a in r[i])if(Object.prototype.hasOwnProperty.call(r[i],a)&&a!=="data"&&!Xe(r[i][a],e[i][a]))return!1;for(a in e[i])if(Object.prototype.hasOwnProperty.call(e[i],a)&&a!=="data"&&!Xe(r[i][a],e[i][a]))return!1;return!0}function qt(r,e,i,a,o,u){r=r||{},e=e||{};for(const h in r)Object.prototype.hasOwnProperty.call(r,h)&&(Xe(r[h],e[h])||i.push({command:u,args:[a,h,e[h],o]}));for(const h in e)Object.prototype.hasOwnProperty.call(e,h)&&!Object.prototype.hasOwnProperty.call(r,h)&&(Xe(r[h],e[h])||i.push({command:u,args:[a,h,e[h],o]}))}function Pi(r){return r.id}function $t(r,e){return r[e.id]=e,r}class Ce{constructor(e,i,a,o){this.message=(e?`${e}: `:"")+a,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function ft(r,...e){for(const i of e)for(const a in i)r[a]=i[a];return r}class kt extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Rn{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[a,o]of i)this.bindings[a]=o}concat(e){return new Rn(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)}}const Di={kind:"null"},Re={kind:"number"},Je={kind:"string"},rt={kind:"boolean"},er={kind:"color"},Hs={kind:"projectionDefinition"},Ur={kind:"object"},ot={kind:"value"},Ka={kind:"collator"},Ja={kind:"formatted"},Xs={kind:"padding"},ha={kind:"colorArray"},Qa={kind:"numberArray"},da={kind:"resolvedImage"},es={kind:"variableAnchorOffsetCollection"};function Ri(r,e){return{kind:"array",itemType:r,N:e}}function bt(r){if(r.kind==="array"){const e=bt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ys=[Di,Re,Je,rt,er,Hs,Ja,Ur,Ri(ot),Xs,Qa,ha,da,es];function pa(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!pa(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Ys)if(!pa(i,e))return null}}return`Expected ${bt(r)} but found ${bt(e)} instead.`}function ts(r,e){return e.some((i=>i.kind===r.kind))}function Ln(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function yr(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const xc=.96422,Fn=.82521,Ks=4/29,Zt=6/29,vc=3*Zt*Zt,bc=Zt*Zt*Zt,is=Math.PI/180,wc=180/Math.PI;function Tc(r){return(r%=360)<0&&(r+=360),r}function Sc([r,e,i,a]){let o,u;const h=il((.2225045*(r=Js(r))+.7168786*(e=Js(e))+.0606169*(i=Js(i)))/1);r===e&&e===i?o=u=h:(o=il((.4360747*r+.3850649*e+.1430804*i)/xc),u=il((.0139322*r+.0971045*e+.7141733*i)/Fn));const f=116*h-16;return[f<0?0:f,500*(o-h),200*(h-u),a]}function Js(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function il(r){return r>bc?Math.pow(r,1/3):r/vc+Ks}function rl([r,e,i,a]){let o=(r+16)/116,u=isNaN(e)?o:o+e/500,h=isNaN(i)?o:o-i/200;return o=1*al(o),u=xc*al(u),h=Fn*al(h),[nl(3.1338561*u-1.6168667*o-.4906146*h),nl(-.9787684*u+1.9161415*o+.033454*h),nl(.0719453*u-.2289914*o+1.4052427*h),a]}function nl(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function al(r){return r>Zt?r*r*r:vc*(r-Ks)}const th=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function rs(r,e){return th(r,e)?r[e]:void 0}function Qs(r){return parseInt(r.padEnd(2,r),16)/255}function Pc(r,e){return fa(e?r/100:r,0,1)}function fa(r,e,i){return Math.min(Math.max(e,r),i)}function sl(r){return!r.some(Number.isNaN)}const ns={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 ln(r,e,i){return r+i*(e-r)}function ma(r,e,i){return r.map(((a,o)=>ln(a,e[o],i)))}class ut{constructor(e,i,a,o=1,u=!0){this.r=e,this.g=i,this.b=a,this.a=o,u||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,a,o]))}static parse(e){if(e instanceof ut)return e;if(typeof e!="string")return;const i=(function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=rs(ns,a);if(o){const[h,f,g]=o;return[h/255,f/255,g/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const h=a.length<6?1:2;let f=1;return[Qs(a.slice(f,f+=h)),Qs(a.slice(f,f+=h)),Qs(a.slice(f,f+=h)),Qs(a.slice(f,f+h)||"ff")]}if(a.startsWith("rgb")){const h=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[f,g,y,v,b,S,P,E,z,L,V,W]=h,j=[v||" ",P||" ",L].join("");if(j==="  "||j==="  /"||j===",,"||j===",,,"){const U=[y,S,z].join(""),Q=U==="%%%"?100:U===""?255:0;if(Q){const ne=[fa(+g/Q,0,1),fa(+b/Q,0,1),fa(+E/Q,0,1),V?Pc(+V,W):1];if(sl(ne))return ne}}return}}const u=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[h,f,g,y,v,b,S,P,E]=u,z=[g||" ",v||" ",S].join("");if(z==="  "||z==="  /"||z===",,"||z===",,,"){const L=[+f,fa(+y,0,100),fa(+b,0,100),P?Pc(+P,E):1];if(sl(L))return(function([V,W,j,U]){function Q(ne){const he=(ne+V/30)%12,we=W*Math.min(j,1-j);return j-we*Math.max(-1,Math.min(he-3,9-he,1))}return V=Tc(V),W/=100,j/=100,[Q(0),Q(8),Q(4),U]})(L)}}})(e);return i?new ut(...i,!1):void 0}get rgb(){const{r:e,g:i,b:a,a:o}=this,u=o||1/0;return this.overwriteGetter("rgb",[e/u,i/u,a/u,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,a,o,u]=Sc(e),h=Math.sqrt(a*a+o*o);return[Math.round(1e4*h)?Tc(Math.atan2(o,a)*wc):NaN,h,i,u]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Sc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,a,o]=this.rgb;return`rgba(${[e,i,a].map((u=>Math.round(255*u))).join(",")},${o})`}static interpolate(e,i,a,o="rgb"){switch(o){case"rgb":{const[u,h,f,g]=ma(e.rgb,i.rgb,a);return new ut(u,h,f,g,!1)}case"hcl":{const[u,h,f,g]=e.hcl,[y,v,b,S]=i.hcl;let P,E;if(isNaN(u)||isNaN(y))isNaN(u)?isNaN(y)?P=NaN:(P=y,f!==1&&f!==0||(E=v)):(P=u,b!==1&&b!==0||(E=h));else{let j=y-u;y>u&&j>180?j-=360:y<u&&u-y>180&&(j+=360),P=u+a*j}const[z,L,V,W]=(function([j,U,Q,ne]){return j=isNaN(j)?0:j*is,rl([Q,Math.cos(j)*U,Math.sin(j)*U,ne])})([P,E??ln(h,v,a),ln(f,b,a),ln(g,S,a)]);return new ut(z,L,V,W,!1)}case"lab":{const[u,h,f,g]=rl(ma(e.lab,i.lab,a));return new ut(u,h,f,g,!1)}}}}ut.black=new ut(0,0,0,1),ut.white=new ut(1,1,1,1),ut.transparent=new ut(0,0,0,0),ut.red=new ut(1,0,0,1);class ol{constructor(e,i,a){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ih=["bottom","center","top"];class ll{constructor(e,i,a,o,u,h){this.text=e,this.image=i,this.scale=a,this.fontStack=o,this.textColor=u,this.verticalAlign=h}}class qi{constructor(e){this.sections=e}static fromString(e){return new qi([new ll(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof qi?e:qi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Mi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Mi)return e;if(typeof e=="number")return new Mi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Mi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){return new Mi(ma(e.values,i.values,a))}}class Nt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Nt)return e;if(typeof e=="number")return new Nt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new Nt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){return new Nt(ma(e.values,i.values,a))}}class Ke{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ke)return e;if(typeof e=="string"){const a=ut.parse(e);return a?new Ke([a]):void 0}if(!Array.isArray(e))return;const i=[];for(const a of e){if(typeof a!="string")return;const o=ut.parse(a);if(!o)return;i.push(o)}return new Ke(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a,o="rgb"){const u=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let h=0;h<e.values.length;h++)u.push(ut.interpolate(e.values[h],i.values[h],a,o));return new Ke(u)}}class Pt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const cn=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const a=e[i],o=e[i+1];if(typeof a!="string"||!cn.has(a)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,a){const o=e.values,u=i.values;if(o.length!==u.length)throw new Pt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const h=[];for(let f=0;f<o.length;f+=2){if(o[f]!==u[f])throw new Pt(`Cannot interpolate values containing mismatched anchors. from[${f}]: ${o[f]}, to[${f}]: ${u[f]}`);h.push(o[f]);const[g,y]=o[f+1],[v,b]=u[f+1];h.push([ln(g,v,a),ln(y,b,a)])}return new Li(h)}}class tr{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new tr({name:e,available:!1}):null}}class Fi{constructor(e,i,a){this.from=e,this.to=i,this.transition=a}static interpolate(e,i,a){return new Fi(e,i,a)}static parse(e){return e instanceof Fi?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Fi(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Fi(e.from,e.to,e.transition):typeof e=="string"?new Fi(e,e,1):void 0}}function ga(r,e,i,a){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,e,i,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,e,i,a]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function un(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Fi||r instanceof ut||r instanceof ol||r instanceof qi||r instanceof Mi||r instanceof Nt||r instanceof Ke||r instanceof Li||r instanceof tr)return!0;if(Array.isArray(r)){for(const e of r)if(!un(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!un(r[e]))return!1;return!0}return!1}function Jt(r){if(r===null)return Di;if(typeof r=="string")return Je;if(typeof r=="boolean")return rt;if(typeof r=="number")return Re;if(r instanceof ut)return er;if(r instanceof Fi)return Hs;if(r instanceof ol)return Ka;if(r instanceof qi)return Ja;if(r instanceof Mi)return Xs;if(r instanceof Nt)return Qa;if(r instanceof Ke)return ha;if(r instanceof Li)return es;if(r instanceof tr)return da;if(Array.isArray(r)){const e=r.length;let i;for(const a of r){const o=Jt(a);if(i){if(i===o)continue;i=ot;break}i=o}return Ri(i||ot,e)}return Ur}function Bn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof ut||r instanceof Fi||r instanceof qi||r instanceof Mi||r instanceof Nt||r instanceof Ke||r instanceof Li||r instanceof tr?r.toString():JSON.stringify(r)}class kr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!un(e[1]))return i.error("invalid value");const a=e[1];let o=Jt(a);const u=i.expectedType;return o.kind!=="array"||o.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(o=u),new kr(o,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const eo={string:Je,number:Re,boolean:rt,object:Ur};class $i{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let a,o=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const y=e[1];if(typeof y!="string"||!(y in eo)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=eo[y],o++}else f=ot;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],o++}a=Ri(f,g)}else{if(!eo[u])throw new Error(`Types doesn't contain name = ${u}`);a=eo[u]}const h=[];for(;o<e.length;o++){const f=i.parse(e[o],o,ot);if(!f)return null;h.push(f)}return new $i(a,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const a=this.args[i].evaluate(e);if(!pa(this.type,Jt(a)))return a;if(i===this.args.length-1)throw new Pt(`Expected value to be of type ${bt(this.type)}, but found ${bt(Jt(a))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const On={"to-boolean":rt,"to-color":er,"to-number":Re,"to-string":Je};class Gr{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const a=e[0];if(!On[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&e.length!==2)return i.error("Expected one argument.");const o=On[a],u=[];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,ot);if(!f)return null;u.push(f)}return new Gr(o,u)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,a;for(const o of this.args){if(i=o.evaluate(e),a=null,i instanceof ut)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(a=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ga(i[0],i[1],i[2],i[3]),!a))return new ut(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Pt(a||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const a of this.args){i=a.evaluate(e);const o=Mi.parse(i);if(o)return o}throw new Pt(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const a of this.args){i=a.evaluate(e);const o=Nt.parse(i);if(o)return o}throw new Pt(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const a of this.args){i=a.evaluate(e);const o=Ke.parse(i);if(o)return o}throw new Pt(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const a of this.args){i=a.evaluate(e);const o=Li.parse(i);if(o)return o}throw new Pt(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const a of this.args){if(i=a.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new Pt(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return qi.fromString(Bn(this.args[0].evaluate(e)));case"resolvedImage":return tr.fromString(Bn(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Bn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Mc=["Unknown","Point","LineString","Polygon"];class cl{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Mc[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 i=this._parseColorCache.get(e);return i||(i=ut.parse(e),this._parseColorCache.set(e,i)),i}}class jn{constructor(e,i,a=[],o,u=new Rn,h=[]){this.registry=e,this.path=a,this.key=a.map((f=>`[${f}]`)).join(""),this.scope=u,this.errors=h,this.expectedType=o,this._isConstant=i}parse(e,i,a,o,u={}){return i?this.concat(i,a,o)._parse(e,u):this._parse(e,u)}_parse(e,i){function a(o,u,h){return h==="assert"?new $i(u,[o]):h==="coerce"?new Gr(u,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[o];if(u){let h=u.parse(e,this);if(!h)return null;if(this.expectedType){const f=this.expectedType,g=h.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value"){if(f.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(f.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(f.kind)&&["value","number","array"].includes(g.kind)||f.kind==="colorArray"&&["value","string","array"].includes(g.kind)||f.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))h=a(h,f,i.typeAnnotation||"coerce");else if(this.checkSubtype(f,g))return null}else h=a(h,f,i.typeAnnotation||"assert")}if(!(h instanceof kr)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){const f=new cl;try{h=new kr(h.type,h.evaluate(f))}catch(g){return this.error(g.message),null}}return h}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,a){const o=typeof e=="number"?this.path.concat(e):this.path,u=a?this.scope.concat(a):this.scope;return new jn(this.registry,this._isConstant,o,i||null,u,this.errors)}error(e,...i){const a=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new kt(a,e))}checkSubtype(e,i){const a=pa(e,i);return a&&this.error(a),a}}class Mt{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const a=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;a.push([h,f])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,a);return o?new Mt(a,o):null}outputDefined(){return this.result.outputDefined()}}class _a{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const a=e[1];return i.scope.has(a)?new _a(a,i.scope.get(a)):i.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class dt{constructor(e,i,a){this.type=e,this.index=i,this.input=a}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,Re),o=i.parse(e[2],2,Ri(i.expectedType||ot));return a&&o?new dt(o.type.itemType,a,o):null}evaluate(e){const i=this.index.evaluate(e),a=this.input.evaluate(e);if(i<0)throw new Pt(`Array index out of bounds: ${i} < 0.`);if(i>=a.length)throw new Pt(`Array index out of bounds: ${i} > ${a.length-1}.`);if(i!==Math.floor(i))throw new Pt(`Array index must be an integer, but found ${i} instead.`);return a[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class lt{constructor(e,i){this.type=rt,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,ot),o=i.parse(e[2],2,ot);return a&&o?ts(a.type,[rt,Je,Re,Di,ot])?new lt(a,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(a.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!a)return!1;if(!Ln(i,["boolean","string","number","null"]))throw new Pt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Jt(i))} instead.`);if(!Ln(a,["string","array"]))throw new Pt(`Expected second argument to be of type array or string, but found ${bt(Jt(a))} instead.`);return a.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ya{constructor(e,i,a){this.type=Re,this.needle=e,this.haystack=i,this.fromIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,ot),o=i.parse(e[2],2,ot);if(!a||!o)return null;if(!ts(a.type,[rt,Je,Re,Di,ot]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(a.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Re);return u?new ya(a,o,u):null}return new ya(a,o)}evaluate(e){const i=this.needle.evaluate(e),a=this.haystack.evaluate(e);if(!Ln(i,["boolean","string","number","null"]))throw new Pt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Jt(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),Ln(a,["string"])){const u=a.indexOf(i,o);return u===-1?-1:[...a.slice(0,u)].length}if(Ln(a,["array"]))return a.indexOf(i,o);throw new Pt(`Expected second argument to be of type array or string, but found ${bt(Jt(a))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class pt{constructor(e,i,a,o,u,h){this.inputType=e,this.type=i,this.input=a,this.cases=o,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let a,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const u={},h=[];for(let y=2;y<e.length-1;y+=2){let v=e[y];const b=e[y+1];Array.isArray(v)||(v=[v]);const S=i.concat(y);if(v.length===0)return S.error("Expected at least one branch label.");for(const E of v){if(typeof E!="number"&&typeof E!="string")return S.error("Branch labels must be numbers or strings.");if(typeof E=="number"&&Math.abs(E)>Number.MAX_SAFE_INTEGER)return S.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof E=="number"&&Math.floor(E)!==E)return S.error("Numeric branch labels must be integer values.");if(a){if(S.checkSubtype(a,Jt(E)))return null}else a=Jt(E);if(u[String(E)]!==void 0)return S.error("Branch labels must be unique.");u[String(E)]=h.length}const P=i.parse(b,y,o);if(!P)return null;o=o||P.type,h.push(P)}const f=i.parse(e[1],1,ot);if(!f)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?f.type.kind!=="value"&&i.concat(1).checkSubtype(a,f.type)?null:new pt(a,o,f,u,h,g):null}evaluate(e){const i=this.input.evaluate(e);return(Jt(i)===this.inputType&&this.outputs[this.cases[i]]||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 as{constructor(e,i,a){this.type=e,this.branches=i,this.otherwise=a}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const o=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,rt);if(!f)return null;const g=i.parse(e[h+1],h+1,a);if(!g)return null;o.push([f,g]),a=a||g.type}const u=i.parse(e[e.length-1],e.length-1,a);if(!u)return null;if(!a)throw new Error("Can't infer output type");return new as(a,o,u)}evaluate(e){for(const[i,a]of this.branches)if(i.evaluate(e))return a.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,a]of this.branches)e(i),e(a);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class lr{constructor(e,i,a,o){this.type=e,this.input=i,this.beginIndex=a,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const a=i.parse(e[1],1,ot),o=i.parse(e[2],2,Re);if(!a||!o)return null;if(!ts(a.type,[Ri(ot),Je,ot]))return i.error(`Expected first argument to be of type array or string, but found ${bt(a.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,Re);return u?new lr(a.type,a,o,u):null}return new lr(a.type,a,o)}evaluate(e){const i=this.input.evaluate(e),a=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),Ln(i,["string"]))return[...i].slice(a,o).join("");if(Ln(i,["array"]))return i.slice(a,o);throw new Pt(`Expected first argument to be of type array or string, but found ${bt(Jt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function xa(r,e){const i=r.length-1;let a,o,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),a=r[f],o=r[f+1],a<=e){if(f===i||e<o)return f;u=f+1}else{if(!(a>e))throw new Pt("Input is not a number.");h=f-1}return 0}class hn{constructor(e,i,a){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,u]of a)this.labels.push(o),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const a=i.parse(e[1],1,Re);if(!a)return null;const o=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],g=e[h+1],y=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',y);if(o.length&&o[o.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',y);const b=i.parse(g,v,u);if(!b)return null;u=u||b.type,o.push([f,b])}return new hn(u,a,o)}evaluate(e){const i=this.labels,a=this.outputs;if(i.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return a[0].evaluate(e);const u=i.length;return o>=i[u-1]?a[u-1].evaluate(e):a[xa(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ic(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ss,ul,rh=(function(){if(ul)return ss;function r(e,i,a,o){this.cx=3*e,this.bx=3*(a-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=a,this.p2y=o}return ul=1,ss=r,r.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,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var a=e,o=0;o<8;o++){var u=this.sampleCurveX(a)-e;if(Math.abs(u)<i)return a;var h=this.sampleCurveDerivativeX(a);if(Math.abs(h)<1e-6)break;a-=u/h}var f=0,g=1;for(a=e,o=0;o<20&&(u=this.sampleCurveX(a),!(Math.abs(u-e)<i));o++)e>u?f=a:g=a,a=.5*(g-f)+f;return a},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ss})(),Ec=Ic(rh);class Bi{constructor(e,i,a,o,u){this.type=e,this.operator=i,this.interpolation=a,this.input=o,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,a,o){let u=0;if(e.name==="exponential")u=Dr(i,e.base,a,o);else if(e.name==="linear")u=Dr(i,1,a,o);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new Ec(h[0],h[1],h[2],h[3]).solve(Dr(i,1,a,o))}return u}static parse(e,i){let[a,o,u,...h]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const y=o[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:y}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const y=o.slice(1);if(y.length!==4||y.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:y}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,Re),!u)return null;const f=[];let g=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||i.expectedType==ha?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=er;for(let y=0;y<h.length;y+=2){const v=h[y],b=h[y+1],S=y+3,P=y+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',S);const E=i.parse(b,P,g);if(!E)return null;g=g||E.type,f.push([v,E])}return yr(g,Re)||yr(g,Hs)||yr(g,er)||yr(g,Xs)||yr(g,Qa)||yr(g,ha)||yr(g,es)||yr(g,Ri(Re))?new Bi(g,a,o,u,f):i.error(`Type ${bt(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,a=this.outputs;if(i.length===1)return a[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return a[0].evaluate(e);const u=i.length;if(o>=i[u-1])return a[u-1].evaluate(e);const h=xa(i,o),f=Bi.interpolationFactor(this.interpolation,o,i[h],i[h+1]),g=a[h].evaluate(e),y=a[h+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ln(g,y,f);case"color":return ut.interpolate(g,y,f);case"padding":return Mi.interpolate(g,y,f);case"colorArray":return Ke.interpolate(g,y,f);case"numberArray":return Nt.interpolate(g,y,f);case"variableAnchorOffsetCollection":return Li.interpolate(g,y,f);case"array":return ma(g,y,f);case"projectionDefinition":return Fi.interpolate(g,y,f)}case"interpolate-hcl":switch(this.type.kind){case"color":return ut.interpolate(g,y,f,"hcl");case"colorArray":return Ke.interpolate(g,y,f,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return ut.interpolate(g,y,f,"lab");case"colorArray":return Ke.interpolate(g,y,f,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Dr(r,e,i,a){const o=a-i,u=r-i;return o===0?0:e===1?u/o:(Math.pow(e,u)-1)/(Math.pow(e,o)-1)}const Bt={color:ut.interpolate,number:ln,padding:Mi.interpolate,numberArray:Nt.interpolate,colorArray:Ke.interpolate,variableAnchorOffsetCollection:Li.interpolate,array:ma};class Vn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let a=null;const o=i.expectedType;o&&o.kind!=="value"&&(a=o);const u=[];for(const f of e.slice(1)){const g=i.parse(f,1+u.length,a,void 0,{typeAnnotation:"omit"});if(!g)return null;a=a||g.type,u.push(g)}if(!a)throw new Error("No output type");const h=o&&u.some((f=>pa(o,f.type)));return new Vn(h?ot:a,u)}evaluate(e){let i,a=null,o=0;for(const u of this.args)if(o++,a=u.evaluate(e),a&&a instanceof tr&&!a.available&&(i||(i=a.name),a=null,o===this.args.length&&(a=i)),a!==null)break;return a}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function hl(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function os(r,e,i,a){return a.compare(e,i)===0}function Wt(r,e,i){const a=r!=="=="&&r!=="!=";return class em{constructor(u,h,f){this.type=rt,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let g=h.parse(u[1],1,ot);if(!g)return null;if(!hl(f,g.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${bt(g.type)}'.`);let y=h.parse(u[2],2,ot);if(!y)return null;if(!hl(f,y.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${bt(y.type)}'.`);if(g.type.kind!==y.type.kind&&g.type.kind!=="value"&&y.type.kind!=="value")return h.error(`Cannot compare types '${bt(g.type)}' and '${bt(y.type)}'.`);a&&(g.type.kind==="value"&&y.type.kind!=="value"?g=new $i(y.type,[g]):g.type.kind!=="value"&&y.type.kind==="value"&&(y=new $i(g.type,[y])));let v=null;if(u.length===4){if(g.type.kind!=="string"&&y.type.kind!=="string"&&g.type.kind!=="value"&&y.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,Ka),!v)return null}return new em(g,y,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(a&&this.hasUntypedArgument){const g=Jt(h),y=Jt(f);if(g.kind!==y.kind||g.kind!=="string"&&g.kind!=="number")throw new Pt(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${y.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const g=Jt(h),y=Jt(f);if(g.kind!=="string"||y.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Cc=Wt("==",(function(r,e,i){return e===i}),os),dl=Wt("!=",(function(r,e,i){return e!==i}),(function(r,e,i,a){return!os(0,e,i,a)})),Ac=Wt("<",(function(r,e,i){return e<i}),(function(r,e,i,a){return a.compare(e,i)<0})),nh=Wt(">",(function(r,e,i){return e>i}),(function(r,e,i,a){return a.compare(e,i)>0})),va=Wt("<=",(function(r,e,i){return e<=i}),(function(r,e,i,a){return a.compare(e,i)<=0})),to=Wt(">=",(function(r,e,i){return e>=i}),(function(r,e,i,a){return a.compare(e,i)>=0}));class ba{constructor(e,i,a){this.type=Ka,this.locale=a,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const a=e[1];if(typeof a!="object"||Array.isArray(a))return i.error("Collator options argument must be an object.");const o=i.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,rt);if(!o)return null;const u=i.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,rt);if(!u)return null;let h=null;return a.locale&&(h=i.parse(a.locale,1,Je),!h)?null:new ba(o,u,h)}evaluate(e){return new ol(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 pl{constructor(e,i,a,o,u){this.type=Je,this.number=e,this.locale=i,this.currency=a,this.minFractionDigits=o,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const a=i.parse(e[1],1,Re);if(!a)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let u=null;if(o.locale&&(u=i.parse(o.locale,1,Je),!u))return null;let h=null;if(o.currency&&(h=i.parse(o.currency,1,Je),!h))return null;let f=null;if(o["min-fraction-digits"]&&(f=i.parse(o["min-fraction-digits"],1,Re),!f))return null;let g=null;return o["max-fraction-digits"]&&(g=i.parse(o["max-fraction-digits"],1,Re),!g)?null:new pl(a,u,h,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ls{constructor(e){this.type=Ja,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const a=e[1];if(!Array.isArray(a)&&typeof a=="object")return i.error("First argument must be an image or text section.");const o=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=i.parse(f["font-scale"],1,Re),!g))return null;let y=null;if(f["text-font"]&&(y=i.parse(f["text-font"],1,Ri(Je)),!y))return null;let v=null;if(f["text-color"]&&(v=i.parse(f["text-color"],1,er),!v))return null;let b=null;if(f["vertical-align"]){if(typeof f["vertical-align"]=="string"&&!ih.includes(f["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${f["vertical-align"]}' instead.`);if(b=i.parse(f["vertical-align"],1,Je),!b)return null}const S=o[o.length-1];S.scale=g,S.font=y,S.textColor=v,S.verticalAlign=b}else{const g=i.parse(e[h],1,ot);if(!g)return null;const y=g.type.kind;if(y!=="string"&&y!=="value"&&y!=="null"&&y!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new ls(o)}evaluate(e){return new qi(this.sections.map((i=>{const a=i.content.evaluate(e);return Jt(a)===da?new ll("",a,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new ll(Bn(a),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class wa{constructor(e){this.type=da,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const a=i.parse(e[1],1,Je);return a?new wa(a):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),a=tr.fromString(i);return a&&e.availableImages&&(a.available=e.availableImages.indexOf(i)>-1),a}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ta{constructor(e){this.type=Re,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=i.parse(e[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${bt(a.type)} instead.`):new Ta(a):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Pt(`Expected value to be of type string or array, but found ${bt(Jt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const oi=8192;function zc(r,e){const i=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*oi),Math.round(a*o*oi)]}function Sa(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/oi+e.x)/i,360*o-180),(a=(r[1]/oi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,o}function cs(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Nn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function ah(r,e,i){const a=r[0]-e[0],o=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return a*h-u*o==0&&a*u<=0&&o*h<=0}function io(r,e,i,a){return(o=[a[0]-i[0],a[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*u[0]!=0&&!(!fl(r,e,i,a)||!fl(i,a,r,e));var o,u}function sh(r,e,i){for(const a of i)for(let o=0;o<a.length-1;++o)if(io(r,e,a[o],a[o+1]))return!0;return!1}function Pa(r,e,i=!1){let a=!1;for(const f of e)for(let g=0;g<f.length-1;g++){if(ah(r,f[g],f[g+1]))return i;(u=f[g])[1]>(o=r)[1]!=(h=f[g+1])[1]>o[1]&&o[0]<(h[0]-u[0])*(o[1]-u[1])/(h[1]-u[1])+u[0]&&(a=!a)}var o,u,h;return a}function ro(r,e){for(const i of e)if(Pa(r,i))return!0;return!1}function kc(r,e){for(const i of r)if(!Pa(i,e))return!1;for(let i=0;i<r.length-1;++i)if(sh(r[i],r[i+1],e))return!1;return!0}function Dc(r,e){for(const i of e)if(kc(r,i))return!0;return!1}function fl(r,e,i,a){const o=a[0]-i[0],u=a[1]-i[1],h=(r[0]-i[0])*u-o*(r[1]-i[1]),f=(e[0]-i[0])*u-o*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function ml(r,e,i){const a=[];for(let o=0;o<r.length;o++){const u=[];for(let h=0;h<r[o].length;h++){const f=zc(r[o][h],i);cs(e,f),u.push(f)}a.push(u)}return a}function gl(r,e,i){const a=[];for(let o=0;o<r.length;o++){const u=ml(r[o],e,i);a.push(u)}return a}function Rc(r,e,i,a){if(r[0]<i[0]||r[0]>i[2]){const o=.5*a;let u=r[0]-i[0]>o?-a:i[0]-r[0]>o?a:0;u===0&&(u=r[0]-i[2]>o?-a:i[2]-r[0]>o?a:0),r[0]+=u}cs(e,r)}function Lc(r,e,i,a){const o=Math.pow(2,a.z)*oi,u=[a.x*oi,a.y*oi],h=[];for(const f of r)for(const g of f){const y=[g.x+u[0],g.y+u[1]];Rc(y,e,i,o),h.push(y)}return h}function Fc(r,e,i,a){const o=Math.pow(2,a.z)*oi,u=[a.x*oi,a.y*oi],h=[];for(const g of r){const y=[];for(const v of g){const b=[v.x+u[0],v.y+u[1]];cs(e,b),y.push(b)}h.push(y)}if(e[2]-e[0]<=o/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of h)for(const y of g)Rc(y,e,i,o)}var f;return h}class Un{constructor(e,i){this.type=rt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(un(e[1])){const a=e[1];if(a.type==="FeatureCollection"){const o=[];for(const u of a.features){const{type:h,coordinates:f}=u.geometry;h==="Polygon"&&o.push(f),h==="MultiPolygon"&&o.push(...f)}if(o.length)return new Un(a,{type:"MultiPolygon",coordinates:o})}else if(a.type==="Feature"){const o=a.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Un(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Un(a,a)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(a.type==="Polygon"){const f=ml(a.coordinates,u,h),g=Lc(i.geometry(),o,u,h);if(!Nn(o,u))return!1;for(const y of g)if(!Pa(y,f))return!1}if(a.type==="MultiPolygon"){const f=gl(a.coordinates,u,h),g=Lc(i.geometry(),o,u,h);if(!Nn(o,u))return!1;for(const y of g)if(!ro(y,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,a){const o=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(a.type==="Polygon"){const f=ml(a.coordinates,u,h),g=Fc(i.geometry(),o,u,h);if(!Nn(o,u))return!1;for(const y of g)if(!kc(y,f))return!1}if(a.type==="MultiPolygon"){const f=gl(a.coordinates,u,h),g=Fc(i.geometry(),o,u,h);if(!Nn(o,u))return!1;for(const y of g)if(!Dc(y,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Bc=class{constructor(r=[],e=(i,a)=>i<a?-1:i>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,a=e[r];for(;r>0;){const o=r-1>>1,u=e[o];if(i(a,u)>=0)break;e[r]=u,r=o}e[r]=a}_down(r){const{data:e,compare:i}=this,a=this.length>>1,o=e[r];for(;r<a;){let u=1+(r<<1);const h=u+1;if(h<this.length&&i(e[h],e[u])<0&&(u=h),i(e[u],o)>=0)break;e[r]=e[u],r=u}e[r]=o}};function _l(r,e,i=0,a=r.length-1,o=Oc){for(;a>i;){if(a-i>600){const g=a-i+1,y=e-i+1,v=Math.log(g),b=.5*Math.exp(2*v/3),S=.5*Math.sqrt(v*b*(g-b)/g)*(y-g/2<0?-1:1);_l(r,e,Math.max(i,Math.floor(e-y*b/g+S)),Math.min(a,Math.floor(e+(g-y)*b/g+S)),o)}const u=r[e];let h=i,f=a;for(Ma(r,i,e),o(r[a],u)>0&&Ma(r,i,a);h<f;){for(Ma(r,h,f),h++,f--;o(r[h],u)<0;)h++;for(;o(r[f],u)>0;)f--}o(r[i],u)===0?Ma(r,i,f):(f++,Ma(r,f,a)),f<=e&&(i=f+1),e<=f&&(a=f-1)}}function Ma(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}function Oc(r,e){return r<e?-1:r>e?1:0}function no(r,e){if(r.length<=1)return[r];const i=[];let a,o;for(const u of r){const h=lh(u);h!==0&&(u.area=Math.abs(h),o===void 0&&(o=h<0),o===h<0?(a&&i.push(a),a=[u]):a.push(u))}if(a&&i.push(a),e>1)for(let u=0;u<i.length;u++)i[u].length<=e||(_l(i[u],e,1,i[u].length-1,oh),i[u]=i[u].slice(0,e));return i}function oh(r,e){return e.area-r.area}function lh(r){let e=0;for(let i,a,o=0,u=r.length,h=u-1;o<u;h=o++)i=r[o],a=r[h],e+=(a.x-i.x)*(i.y+a.y);return e}const jc=1/298.257223563,us=jc*(2-jc),Vc=Math.PI/180;class yl{constructor(e){const i=6378.137*Vc*1e3,a=Math.cos(e*Vc),o=1/(1-us*(1-a*a)),u=Math.sqrt(o);this.kx=i*u*a,this.ky=i*u*o*(1-us)}distance(e,i){const a=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(a*a+o*o)}pointOnLine(e,i){let a,o,u,h,f=1/0;for(let g=0;g<e.length-1;g++){let y=e[g][0],v=e[g][1],b=this.wrap(e[g+1][0]-y)*this.kx,S=(e[g+1][1]-v)*this.ky,P=0;b===0&&S===0||(P=(this.wrap(i[0]-y)*this.kx*b+(i[1]-v)*this.ky*S)/(b*b+S*S),P>1?(y=e[g+1][0],v=e[g+1][1]):P>0&&(y+=b/this.kx*P,v+=S/this.ky*P)),b=this.wrap(i[0]-y)*this.kx,S=(i[1]-v)*this.ky;const E=b*b+S*S;E<f&&(f=E,a=y,o=v,u=g,h=P)}return{point:[a,o],index:u,t:Math.max(0,Math.min(1,h))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Nc(r,e){return e[0]-r[0]}function ao(r){return r[1]-r[0]+1}function xr(r,e){return r[1]>=r[0]&&r[1]<e}function so(r,e){if(r[0]>r[1])return[null,null];const i=ao(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}if(i===1)return[r,null];const a=Math.floor(i/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function xl(r,e){if(!xr(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let a=e[0];a<=e[1];++a)cs(i,r[a]);return i}function vl(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const a of i)cs(e,a);return e}function bl(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function oo(r,e,i){if(!bl(r)||!bl(e))return NaN;let a=0,o=0;return r[2]<e[0]&&(a=e[0]-r[2]),r[0]>e[2]&&(a=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[a,o])}function Gn(r,e,i){const a=i.pointOnLine(e,r);return i.distance(r,a.point)}function wl(r,e,i,a,o){const u=Math.min(Gn(r,[i,a],o),Gn(e,[i,a],o)),h=Math.min(Gn(i,[r,e],o),Gn(a,[r,e],o));return Math.min(u,h)}function ch(r,e,i,a,o){if(!xr(e,r.length)||!xr(a,i.length))return 1/0;let u=1/0;for(let h=e[0];h<e[1];++h){const f=r[h],g=r[h+1];for(let y=a[0];y<a[1];++y){const v=i[y],b=i[y+1];if(io(f,g,v,b))return 0;u=Math.min(u,wl(f,g,v,b,o))}}return u}function Uc(r,e,i,a,o){if(!xr(e,r.length)||!xr(a,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=a[0];f<=a[1];++f)if(u=Math.min(u,o.distance(r[h],i[f])),u===0)return u;return u}function uh(r,e,i){if(Pa(r,e,!0))return 0;let a=1/0;for(const o of e){const u=o[0],h=o[o.length-1];if(u!==h&&(a=Math.min(a,Gn(r,[h,u],i)),a===0))return a;const f=i.pointOnLine(o,r);if(a=Math.min(a,i.distance(r,f.point)),a===0)return a}return a}function hh(r,e,i,a){if(!xr(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(Pa(r[u],i,!0))return 0;let o=1/0;for(let u=e[0];u<e[1];++u){const h=r[u],f=r[u+1];for(const g of i)for(let y=0,v=g.length,b=v-1;y<v;b=y++){const S=g[b],P=g[y];if(io(h,f,S,P))return 0;o=Math.min(o,wl(h,f,S,P,a))}}return o}function Gc(r,e){for(const i of r)for(const a of i)if(Pa(a,e,!0))return!0;return!1}function dh(r,e,i,a=1/0){const o=vl(r),u=vl(e);if(a!==1/0&&oo(o,u,i)>=a)return a;if(Nn(o,u)){if(Gc(r,e))return 0}else if(Gc(e,r))return 0;let h=1/0;for(const f of r)for(let g=0,y=f.length,v=y-1;g<y;v=g++){const b=f[v],S=f[g];for(const P of e)for(let E=0,z=P.length,L=z-1;E<z;L=E++){const V=P[L],W=P[E];if(io(b,S,V,W))return 0;h=Math.min(h,wl(b,S,V,W,i))}}return h}function mt(r,e,i,a,o,u){if(!u)return;const h=oo(xl(a,u),o,i);h<e&&r.push([h,u,[0,0]])}function lo(r,e,i,a,o,u,h){if(!u||!h)return;const f=oo(xl(a,u),xl(o,h),i);f<e&&r.push([f,u,h])}function co(r,e,i,a,o=1/0){let u=Math.min(a.distance(r[0],i[0][0]),o);if(u===0)return u;const h=new Bc([[0,[0,r.length-1],[0,0]]],Nc),f=vl(i);for(;h.length>0;){const g=h.pop();if(g[0]>=u)continue;const y=g[1],v=e?50:100;if(ao(y)<=v){if(!xr(y,r.length))return NaN;if(e){const b=hh(r,y,i,a);if(isNaN(b)||b===0)return b;u=Math.min(u,b)}else for(let b=y[0];b<=y[1];++b){const S=uh(r[b],i,a);if(u=Math.min(u,S),u===0)return 0}}else{const b=so(y,e);mt(h,u,a,r,f,b[0]),mt(h,u,a,r,f,b[1])}}return u}function uo(r,e,i,a,o,u=1/0){let h=Math.min(u,o.distance(r[0],i[0]));if(h===0)return h;const f=new Bc([[0,[0,r.length-1],[0,i.length-1]]],Nc);for(;f.length>0;){const g=f.pop();if(g[0]>=h)continue;const y=g[1],v=g[2],b=e?50:100,S=a?50:100;if(ao(y)<=b&&ao(v)<=S){if(!xr(y,r.length)&&xr(v,i.length))return NaN;let P;if(e&&a)P=ch(r,y,i,v,o),h=Math.min(h,P);else if(e&&!a){const E=r.slice(y[0],y[1]+1);for(let z=v[0];z<=v[1];++z)if(P=Gn(i[z],E,o),h=Math.min(h,P),h===0)return h}else if(!e&&a){const E=i.slice(v[0],v[1]+1);for(let z=y[0];z<=y[1];++z)if(P=Gn(r[z],E,o),h=Math.min(h,P),h===0)return h}else P=Uc(r,y,i,v,o),h=Math.min(h,P)}else{const P=so(y,e),E=so(v,a);lo(f,h,o,r,i,P[0],E[0]),lo(f,h,o,r,i,P[0],E[1]),lo(f,h,o,r,i,P[1],E[0]),lo(f,h,o,r,i,P[1],E[1])}}return h}function Tl(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class qn{constructor(e,i){this.type=Re,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(un(e[1])){const a=e[1];if(a.type==="FeatureCollection")return new qn(a,a.features.map((o=>Tl(o.geometry))).flat());if(a.type==="Feature")return new qn(a,Tl(a.geometry));if("type"in a&&"coordinates"in a)return new qn(a,Tl(a))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,a){const o=i.geometry(),u=o.flat().map((g=>Sa([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new yl(u[0][1]);let f=1/0;for(const g of a){switch(g.type){case"Point":f=Math.min(f,uo(u,!1,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,uo(u,!1,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,co(u,!1,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,a){const o=i.geometry(),u=o.flat().map((g=>Sa([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new yl(u[0][1]);let f=1/0;for(const g of a){switch(g.type){case"Point":f=Math.min(f,uo(u,!0,[g.coordinates],!1,h,f));break;case"LineString":f=Math.min(f,uo(u,!0,g.coordinates,!0,h,f));break;case"Polygon":f=Math.min(f,co(u,!0,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,a){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const u=no(o,0).map((g=>g.map((y=>y.map((v=>Sa([v.x,v.y],i.canonical))))))),h=new yl(u[0][0][0][1]);let f=1/0;for(const g of a)for(const y of u){switch(g.type){case"Point":f=Math.min(f,co([g.coordinates],!1,y,h,f));break;case"LineString":f=Math.min(f,co(g.coordinates,!0,y,h,f));break;case"Polygon":f=Math.min(f,dh(y,g.coordinates,h,f))}if(f===0)return f}return f})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class hs{constructor(e){this.type=ot,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const a=e[1];return a==null?i.error("Global state property must be defined."):typeof a!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new hs(a)}evaluate(e){var i;const a=(i=e.globals)===null||i===void 0?void 0:i.globalState;return a&&Object.keys(a).length!==0?rs(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ia={"==":Cc,"!=":dl,">":nh,"<":Ac,">=":to,"<=":va,array:$i,at:dt,boolean:$i,case:as,coalesce:Vn,collator:ba,format:ls,image:wa,in:lt,"index-of":ya,interpolate:Bi,"interpolate-hcl":Bi,"interpolate-lab":Bi,length:Ta,let:Mt,literal:kr,match:pt,number:$i,"number-format":pl,object:$i,slice:lr,step:hn,string:$i,"to-boolean":Gr,"to-color":Gr,"to-number":Gr,"to-string":Gr,var:_a,within:Un,distance:qn,"global-state":hs};class cr{constructor(e,i,a,o){this.name=e,this.type=i,this._evaluate=a,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const a=e[0],o=cr.definitions[a];if(!o)return i.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(o)?o[0]:o.type,h=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,f=h.filter((([y])=>!Array.isArray(y)||y.length===e.length-1));let g=null;for(const[y,v]of f){g=new jn(i.registry,ho,i.path,null,i.scope);const b=[];let S=!1;for(let P=1;P<e.length;P++){const E=e[P],z=Array.isArray(y)?y[P-1]:y.type,L=g.parse(E,1+b.length,z);if(!L){S=!0;break}b.push(L)}if(!S)if(Array.isArray(y)&&y.length!==b.length)g.error(`Expected ${y.length} arguments, but found ${b.length} instead.`);else{for(let P=0;P<b.length;P++){const E=Array.isArray(y)?y[P]:y.type,z=b[P];g.concat(P+1).checkSubtype(E,z.type)}if(g.errors.length===0)return new cr(a,u,v,b)}}if(f.length===1)i.errors.push(...g.errors);else{const y=(f.length?f:h).map((([b])=>{return S=b,Array.isArray(S)?`(${S.map(bt).join(", ")})`:`(${bt(S.type)}...)`;var S})).join(" | "),v=[];for(let b=1;b<e.length;b++){const S=i.parse(e[b],1+v.length);if(!S)return null;v.push(bt(S.type))}i.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){cr.definitions=i;for(const a in i)e[a]=cr}}function qc(r,[e,i,a,o]){e=e.evaluate(r),i=i.evaluate(r),a=a.evaluate(r);const u=o?o.evaluate(r):1,h=ga(e,i,a,u);if(h)throw new Pt(h);return new ut(e/255,i/255,a/255,u,!1)}function $c(r,e){return r in e}function Sl(r,e){const i=e[r];return i===void 0?null:i}function $n(r){return{type:r}}function ho(r){if(r instanceof _a)return ho(r.boundExpression);if(r instanceof cr&&r.name==="error"||r instanceof ba||r instanceof Un||r instanceof qn||r instanceof hs)return!1;const e=r instanceof Gr||r instanceof $i;let i=!0;return r.eachChild((a=>{i=e?i&&ho(a):i&&a instanceof kr})),!!i&&po(r)&&fo(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function po(r){if(r instanceof cr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Un||r instanceof qn)return!1;let e=!0;return r.eachChild((i=>{e&&!po(i)&&(e=!1)})),e}function ds(r){if(r instanceof cr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!ds(i)&&(e=!1)})),e}function fo(r,e){if(r instanceof cr&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((a=>{i&&!fo(a,e)&&(i=!1)})),i}function Zc(r){return{result:"success",value:r}}function Ea(r){return{result:"error",value:r}}function Ca(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Wc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Pl(r){return!!r.expression&&r.expression.interpolated}function ht(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function mo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Jt(r)===Ur}function ph(r){return r}function Hc(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",a=i||!(i||r.property!==void 0),o=r.type||(Pl(e)?"exponential":"interval"),u=(function(v){switch(v.type){case"color":return ut.parse;case"padding":return Mi.parse;case"numberArray":return Nt.parse;case"colorArray":return Ke.parse;default:return null}})(e);if(u&&((r=ft({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],u(v[1])]))),r.default=u(r.default?r.default:e.default)),r.colorSpace&&(h=r.colorSpace)!=="rgb"&&h!=="hcl"&&h!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var h;const f=(function(v){switch(v){case"exponential":return Xc;case"interval":return mh;case"categorical":return fh;case"identity":return gh;default:throw new Error(`Unknown function type "${v}"`)}})(o);let g,y;if(o==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];y=typeof r.stops[0][0]}if(i){const v={},b=[];for(let E=0;E<r.stops.length;E++){const z=r.stops[E],L=z[0].zoom;v[L]===void 0&&(v[L]={zoom:L,type:r.type,property:r.property,default:r.default,stops:[]},b.push(L)),v[L].stops.push([z[0].value,z[1]])}const S=[];for(const E of b)S.push([v[E].zoom,Hc(v[E],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Bi.interpolationFactor.bind(void 0,P),zoomStops:S.map((E=>E[0])),evaluate:({zoom:E},z)=>Xc({stops:S,base:r.base},e,E).evaluate(E,z)}}if(a){const v=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Bi.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((b=>b[0])),evaluate:({zoom:b})=>f(r,e,b,g,y)}}return{kind:"source",evaluate(v,b){const S=b&&b.properties?b.properties[r.property]:void 0;return S===void 0?ps(r.default,e.default):f(r,e,S,g,y)}}}function ps(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function fh(r,e,i,a,o){return ps(typeof i===o?a[i]:void 0,r.default,e.default)}function mh(r,e,i){if(ht(i)!=="number")return ps(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const o=xa(r.stops.map((u=>u[0])),i);return r.stops[o][1]}function Xc(r,e,i){const a=r.base!==void 0?r.base:1;if(ht(i)!=="number")return ps(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const u=xa(r.stops.map((v=>v[0])),i),h=(function(v,b,S,P){const E=P-S,z=v-S;return E===0?0:b===1?z/E:(Math.pow(b,z)-1)/(Math.pow(b,E)-1)})(i,a,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],g=r.stops[u+1][1],y=Bt[e.type]||ph;return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),S=g.evaluate.apply(void 0,v);if(b!==void 0&&S!==void 0)return y(b,S,h,r.colorSpace)}}:y(f,g,h,r.colorSpace)}function gh(r,e,i){switch(e.type){case"color":i=ut.parse(i);break;case"formatted":i=qi.fromString(i.toString());break;case"resolvedImage":i=tr.fromString(i.toString());break;case"padding":i=Mi.parse(i);break;case"colorArray":i=Ke.parse(i);break;case"numberArray":i=Nt.parse(i);break;default:ht(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return ps(i,r.default,e.default)}cr.register(Ia,{error:[{kind:"error"},[Je],(r,[e])=>{throw new Pt(e.evaluate(r))}],typeof:[Je,[ot],(r,[e])=>bt(Jt(e.evaluate(r)))],"to-rgba":[Ri(Re,4),[er],(r,[e])=>{const[i,a,o,u]=e.evaluate(r).rgb;return[255*i,255*a,255*o,u]}],rgb:[er,[Re,Re,Re],qc],rgba:[er,[Re,Re,Re,Re],qc],has:{type:rt,overloads:[[[Je],(r,[e])=>$c(e.evaluate(r),r.properties())],[[Je,Ur],(r,[e,i])=>$c(e.evaluate(r),i.evaluate(r))]]},get:{type:ot,overloads:[[[Je],(r,[e])=>Sl(e.evaluate(r),r.properties())],[[Je,Ur],(r,[e,i])=>Sl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ot,[Je],(r,[e])=>Sl(e.evaluate(r),r.featureState||{})],properties:[Ur,[],r=>r.properties()],"geometry-type":[Je,[],r=>r.geometryType()],id:[ot,[],r=>r.id()],zoom:[Re,[],r=>r.globals.zoom],"heatmap-density":[Re,[],r=>r.globals.heatmapDensity||0],elevation:[Re,[],r=>r.globals.elevation||0],"line-progress":[Re,[],r=>r.globals.lineProgress||0],accumulated:[ot,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Re,$n(Re),(r,e)=>{let i=0;for(const a of e)i+=a.evaluate(r);return i}],"*":[Re,$n(Re),(r,e)=>{let i=1;for(const a of e)i*=a.evaluate(r);return i}],"-":{type:Re,overloads:[[[Re,Re],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[Re],(r,[e])=>-e.evaluate(r)]]},"/":[Re,[Re,Re],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[Re,[Re,Re],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[Re,[],()=>Math.LN2],pi:[Re,[],()=>Math.PI],e:[Re,[],()=>Math.E],"^":[Re,[Re,Re],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[Re,[Re],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Re,[Re],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Re,[Re],(r,[e])=>Math.log(e.evaluate(r))],log2:[Re,[Re],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Re,[Re],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Re,[Re],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Re,[Re],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Re,[Re],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Re,[Re],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Re,[Re],(r,[e])=>Math.atan(e.evaluate(r))],min:[Re,$n(Re),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[Re,$n(Re),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[Re,[Re],(r,[e])=>Math.abs(e.evaluate(r))],round:[Re,[Re],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[Re,[Re],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Re,[Re],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[rt,[Je,ot],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[rt,[ot],(r,[e])=>r.id()===e.value],"filter-type-==":[rt,[Je],(r,[e])=>r.geometryType()===e.value],"filter-<":[rt,[Je,ot],(r,[e,i])=>{const a=r.properties()[e.value],o=i.value;return typeof a==typeof o&&a<o}],"filter-id-<":[rt,[ot],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i<a}],"filter->":[rt,[Je,ot],(r,[e,i])=>{const a=r.properties()[e.value],o=i.value;return typeof a==typeof o&&a>o}],"filter-id->":[rt,[ot],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i>a}],"filter-<=":[rt,[Je,ot],(r,[e,i])=>{const a=r.properties()[e.value],o=i.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[rt,[ot],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i<=a}],"filter->=":[rt,[Je,ot],(r,[e,i])=>{const a=r.properties()[e.value],o=i.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[rt,[ot],(r,[e])=>{const i=r.id(),a=e.value;return typeof i==typeof a&&i>=a}],"filter-has":[rt,[ot],(r,[e])=>e.value in r.properties()],"filter-has-id":[rt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[rt,[Ri(Je)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[rt,[Ri(ot)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[rt,[Je,Ri(ot)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[rt,[Je,Ri(ot)],(r,[e,i])=>(function(a,o,u,h){for(;u<=h;){const f=u+h>>1;if(o[f]===a)return!0;o[f]>a?h=f-1:u=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[$n(rt),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[$n(rt),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[rt,[rt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[rt,[Je],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Je,[Je],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Je,[Je],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Je,$n(ot),(r,e)=>e.map((i=>Bn(i.evaluate(r)))).join("")],"resolved-locale":[Je,[Ka],(r,[e])=>e.evaluate(r).resolvedLocale()]});class Ml{constructor(e,i,a){this.expression=e,this._warningHistory={},this._evaluator=new cl,this._defaultValue=i?(function(o){if(o.type==="color"&&mo(o.default))return new ut(0,0,0,0);switch(o.type){case"color":return ut.parse(o.default)||null;case"padding":return Mi.parse(o.default)||null;case"numberArray":return Nt.parse(o.default)||null;case"colorArray":return Ke.parse(o.default)||null;case"variableAnchorOffsetCollection":return Li.parse(o.default)||null;case"projectionDefinition":return Fi.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=a}evaluateWithoutErrorHandling(e,i,a,o,u,h){return this._globalState&&(e=Zn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=a,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(e,i,a,o,u,h){this._globalState&&(e=Zn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=a||null,this._evaluator.canonical=o,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Pt(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Aa(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ia}function fs(r,e,i){const a=new jn(Ia,ho,[],e?(function(u){const h={color:er,string:Je,number:Re,enum:Je,boolean:rt,formatted:Ja,padding:Xs,numberArray:Qa,colorArray:ha,projectionDefinition:Hs,resolvedImage:da,variableAnchorOffsetCollection:es};return u.type==="array"?Ri(h[u.value]||ot,u.length):h[u.type]})(e):void 0),o=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Zc(new Ml(o,e,i)):Ea(a.errors)}class go{constructor(e,i,a){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!ds(i.expression),this.globalStateRefs=dn(i.expression),this._globalState=a}evaluateWithoutErrorHandling(e,i,a,o,u,h){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,a,o,u,h)}evaluate(e,i,a,o,u,h){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluate(e,i,a,o,u,h)}}class Il{constructor(e,i,a,o,u){this.kind=e,this.zoomStops=a,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!ds(i.expression),this.globalStateRefs=dn(i.expression),this.interpolationType=o,this._globalState=u}evaluateWithoutErrorHandling(e,i,a,o,u,h){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,a,o,u,h)}evaluate(e,i,a,o,u,h){return this._globalState&&(e=Zn(e,this._globalState)),this._styleExpression.evaluate(e,i,a,o,u,h)}interpolationFactor(e,i,a){return this.interpolationType?Bi.interpolationFactor(this.interpolationType,e,i,a):0}}function El(r,e,i){const a=fs(r,e,i);if(a.result==="error")return a;const o=a.value.expression,u=po(o);if(!u&&!Ca(e))return Ea([new kt("","data expressions not supported")]);const h=fo(o,["zoom"]);if(!h&&!Wc(e))return Ea([new kt("","zoom expressions not supported")]);const f=yo(o);return f||h?f instanceof kt?Ea([f]):f instanceof Bi&&!Pl(e)?Ea([new kt("",'"interpolate" expressions cannot be used with this property')]):Zc(f?new Il(u?"camera":"composite",a.value,f.labels,f instanceof Bi?f.interpolation:void 0,i):new go(u?"constant":"source",a.value,i)):Ea([new kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class _o{constructor(e,i){this._parameters=e,this._specification=i,ft(this,Hc(this._parameters,this._specification))}static deserialize(e){return new _o(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function yo(r){let e=null;if(r instanceof Mt)e=yo(r.result);else if(r instanceof Vn){for(const i of r.args)if(e=yo(i),e)break}else(r instanceof hn||r instanceof Bi)&&r.input instanceof cr&&r.input.name==="zoom"&&(e=r);return e instanceof kt||r.eachChild((i=>{const a=yo(i);a instanceof kt?e=a:!e&&a?e=new kt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&a&&e!==a&&(e=new kt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function dn(r,e=new Set){return r instanceof hs&&e.add(r.key),r.eachChild((i=>{dn(i,e)})),e}function Zn(r,e){const{zoom:i,heatmapDensity:a,elevation:o,lineProgress:u,isSupportedScript:h,accumulated:f}=r??{};return{zoom:i,heatmapDensity:a,elevation:o,lineProgress:u,isSupportedScript:h,accumulated:f,globalState:e}}function Cl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!Cl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const _h={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ms(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cl(r)||(r=gs(r));const i=fs(r,_h,e);if(i.result==="error")throw new Error(i.value.map((a=>`${a.key}: ${a.message}`)).join(", "));return{filter:(a,o,u)=>i.value.evaluate(a,o,{},u),needGeometry:Yc(r),getGlobalStateRefs:()=>dn(i.value.expression)}}function yh(r,e){return r<e?-1:r>e?1:0}function Yc(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Yc(r[e]))return!0;return!1}function gs(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?xo(r[1],r[2],"=="):e==="!="?_s(xo(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xo(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(gs))):e==="all"?["all"].concat(r.slice(1).map(gs)):e==="none"?["all"].concat(r.slice(1).map(gs).map(_s)):e==="in"?Kc(r[1],r.slice(2)):e==="!in"?_s(Kc(r[1],r.slice(2))):e==="has"?Jc(r[1]):e!=="!has"||_s(Jc(r[1]));var i}function xo(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Kc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(yh)]]:["filter-in-small",r,["literal",e]]}}function Jc(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function _s(r){return["!",r]}function vo(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const u of r)o+=`${vo(u)},`;return`${o}]`}const i=Object.keys(r).sort();let a="{";for(let o=0;o<i.length;o++)a+=`${JSON.stringify(i[o])}:${vo(r[i[o]])},`;return`${a}}`}function Qc(r){let e="";for(const i of Ge)e+=`/${vo(r[i])}`;return e}function eu(r){const e=r.value;return e?[new Ce(r.key,e,"constants have been deprecated as of v8")]:[]}function Qt(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Wn(r){if(Array.isArray(r))return r.map(Wn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Wn(r[i]);return e}return Qt(r)}function ir(r){const e=r.key,i=r.value,a=r.valueSpec||{},o=r.objectElementValidators||{},u=r.style,h=r.styleSpec,f=r.validateSpec;let g=[];const y=ht(i);if(y!=="object")return[new Ce(e,i,`object expected, ${y} found`)];for(const v in i){const b=v.split(".")[0],S=rs(a,b)||a["*"];let P;if(rs(o,b))P=o[b];else if(rs(a,b)){if(i[v]===void 0)continue;P=f}else if(o["*"])P=o["*"];else{if(!a["*"]){g.push(new Ce(e,i[v],`unknown property "${v}"`));continue}P=f}g=g.concat(P({key:(e&&`${e}.`)+v,value:i[v],valueSpec:S,style:u,styleSpec:h,object:i,objectKey:v,validateSpec:f},i))}for(const v in a)o[v]||a[v].required&&a[v].default===void 0&&i[v]===void 0&&g.push(new Ce(e,i,`missing required property "${v}"`));return g}function bo(r){const e=r.value,i=r.valueSpec,a=r.style,o=r.styleSpec,u=r.key,h=r.arrayElementValidator||r.validateSpec;if(ht(e)!=="array")return[new Ce(u,e,`array expected, ${ht(e)} found`)];if(i.length&&e.length!==i.length)return[new Ce(u,e,`array length ${i.length} expected, length ${e.length} found`)];let f={type:i.value,values:i.values};o.$version<7&&(f.function=i.function),ht(i.value)==="object"&&(f=i.value);let g=[];for(let y=0;y<e.length;y++)g=g.concat(h({array:e,arrayIndex:y,value:e[y],valueSpec:f,validateSpec:r.validateSpec,style:a,styleSpec:o,key:`${u}[${y}]`}));return g}function ys(r){const e=r.key,i=r.value,a=r.valueSpec;let o=ht(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new Ce(e,i,`number expected, ${o} found`)]:"minimum"in a&&i<a.minimum?[new Ce(e,i,`${i} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&i>a.maximum?[new Ce(e,i,`${i} is greater than the maximum value ${a.maximum}`)]:[]}function wo(r){const e=r.valueSpec,i=Qt(r.value.type);let a,o,u,h={};const f=i!=="categorical"&&r.value.property===void 0,g=!f,y=ht(r.value.stops)==="array"&&ht(r.value.stops[0])==="array"&&ht(r.value.stops[0][0])==="object",v=ir({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(P){if(i==="identity")return[new Ce(P.key,P.value,'identity function may not have a "stops" property')];let E=[];const z=P.value;return E=E.concat(bo({key:P.key,value:z,valueSpec:P.valueSpec,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,arrayElementValidator:b})),ht(z)==="array"&&z.length===0&&E.push(new Ce(P.key,z,"array must have at least one stop")),E},default:function(P){return P.validateSpec({key:P.key,value:P.value,valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec})}}});return i==="identity"&&f&&v.push(new Ce(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new Ce(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!Pl(r.valueSpec)&&v.push(new Ce(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!Ca(r.valueSpec)?v.push(new Ce(r.key,r.value,"property functions not supported")):f&&!Wc(r.valueSpec)&&v.push(new Ce(r.key,r.value,"zoom functions not supported"))),i!=="c
4ategorical"&&!y||r.value.property!==void 0||v.push(new Ce(r.key,r.value,'"property" property is required')),v;function b(P){let E=[];const z=P.value,L=P.key;if(ht(z)!=="array")return[new Ce(L,z,`array expected, ${ht(z)} found`)];if(z.length!==2)return[new Ce(L,z,`array length 2 expected, length ${z.length} found`)];if(y){if(ht(z[0])!=="object")return[new Ce(L,z,`object expected, ${ht(z[0])} found`)];if(z[0].zoom===void 0)return[new Ce(L,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new Ce(L,z,"object stop key must have value")];if(u&&u>Qt(z[0].zoom))return[new Ce(L,z[0].zoom,"stop zoom values must appear in ascending order")];Qt(z[0].zoom)!==u&&(u=Qt(z[0].zoom),o=void 0,h={}),E=E.concat(ir({key:`${L}[0]`,value:z[0],valueSpec:{zoom:{}},validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec,objectElementValidators:{zoom:ys,value:S}}))}else E=E.concat(S({key:`${L}[0]`,value:z[0],validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec},z));return Aa(Wn(z[1]))?E.concat([new Ce(`${L}[1]`,z[1],"expressions are not allowed in function stops.")]):E.concat(P.validateSpec({key:`${L}[1]`,value:z[1],valueSpec:e,validateSpec:P.validateSpec,style:P.style,styleSpec:P.styleSpec}))}function S(P,E){const z=ht(P.value),L=Qt(P.value),V=P.value!==null?P.value:E;if(a){if(z!==a)return[new Ce(P.key,V,`${z} stop domain type must match previous stop domain type ${a}`)]}else a=z;if(z!=="number"&&z!=="string"&&z!=="boolean")return[new Ce(P.key,V,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&i!=="categorical"){let W=`number expected, ${z} found`;return Ca(e)&&i===void 0&&(W+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(P.key,V,W)]}return i!=="categorical"||z!=="number"||isFinite(L)&&Math.floor(L)===L?i!=="categorical"&&z==="number"&&o!==void 0&&L<o?[new Ce(P.key,V,"stop domain values must appear in ascending order")]:(o=L,i==="categorical"&&L in h?[new Ce(P.key,V,"stop domain values must be unique")]:(h[L]=!0,[])):[new Ce(P.key,V,`integer expected, found ${L}`)]}}function pn(r){const e=(r.expressionContext==="property"?El:fs)(Wn(r.value),r.valueSpec);if(e.result==="error")return e.value.map((a=>new Ce(`${r.key}${a.key}`,r.value,a.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new Ce(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!ds(i))return[new Ce(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!ds(i))return[new Ce(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!fo(i,["zoom","feature-state"]))return[new Ce(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!po(i))return[new Ce(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function xs(r){const e=r.key,i=r.value,a=ht(i);return a!=="string"?[new Ce(e,i,`color expected, ${a} found`)]:ut.parse(String(i))?[]:[new Ce(e,i,`color expected, "${i}" found`)]}function Hn(r){const e=r.key,i=r.value,a=r.valueSpec,o=[];return Array.isArray(a.values)?a.values.indexOf(Qt(i))===-1&&o.push(new Ce(e,i,`expected one of [${a.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(a.values).indexOf(Qt(i))===-1&&o.push(new Ce(e,i,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function za(r){return Cl(Wn(r.value))?pn(ft({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):tu(r)}function tu(r){const e=r.value,i=r.key;if(ht(e)!=="array")return[new Ce(i,e,`array expected, ${ht(e)} found`)];const a=r.styleSpec;let o,u=[];if(e.length<1)return[new Ce(i,e,"filter array must have at least 1 element")];switch(u=u.concat(Hn({key:`${i}[0]`,value:e[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Qt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Qt(e[1])==="$type"&&u.push(new Ce(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new Ce(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>
vendor: 8,361 bytes, lines 4-5
4=2&&(o=ht(e[1]),o!=="string"&&u.push(new Ce(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let h=2;h<e.length;h++)o=ht(e[h]),Qt(e[1])==="$type"?u=u.concat(Hn({key:`${i}[${h}]`,value:e[h],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&u.push(new Ce(`${i}[${h}]`,e[h],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let h=1;h<e.length;h++)u=u.concat(tu({key:`${i}[${h}]`,value:e[h],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=ht(e[1]),e.length!==2?u.push(new Ce(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&u.push(new Ce(`${i}[1]`,e[1],`string expected, ${o} found`))}return u}function iu(r,e){const i=r.key,a=r.validateSpec,o=r.style,u=r.styleSpec,h=r.value,f=r.objectKey,g=u[`${e}_${r.layerType}`];if(!g)return[];const y=f.match(/^(.*)-transition$/);if(e==="paint"&&y&&g[y[1]]&&g[y[1]].transition)return a({key:i,value:h,valueSpec:u.transition,style:o,styleSpec:u});const v=r.valueSpec||g[f];if(!v)return[new Ce(i,h,`unknown property "${f}"`)];let b;if(ht(h)==="string"&&Ca(v)&&!v.tokens&&(b=/^{([^}]+)}$/.exec(h)))return[new Ce(i,h,`"${f}" does not support interpolation syntax
5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(b[1])} }\`.`)];const S=[];return r.layerType==="symbol"&&f==="text-font"&&mo(Wn(h))&&Qt(h.type)==="identity"&&S.push(new Ce(i,h,'"text-font" does not support identity functions')),S.concat(a({key:r.key,value:h,valueSpec:v,style:o,styleSpec:u,expressionContext:"property",propertyType:e,propertyKey:f}))}function ru(r){return iu(r,"paint")}function nu(r){return iu(r,"layout")}function au(r){let e=[];const i=r.value,a=r.key,o=r.style,u=r.styleSpec;if(ht(i)!=="object")return[new Ce(a,i,`object expected, ${ht(i)} found`)];i.type||i.ref||e.push(new Ce(a,i,'either "type" or "ref" is required'));let h=Qt(i.type);const f=Qt(i.ref);if(i.id){const g=Qt(i.id);for(let y=0;y<r.arrayIndex;y++){const v=o.layers[y];Qt(v.id)===g&&e.push(new Ce(a,i.id,`duplicate layer id "${i.id}", previously used at line ${v.id.__line__}`))}}if("ref"in i){let g;["type","source","source-layer","filter","layout"].forEach((y=>{y in i&&e.push(new Ce(a,i[y],`"${y}" is prohibited for ref layers`))})),o.layers.forEach((y=>{Qt(y.id)===f&&(g=y)})),g?g.ref?e.push(new Ce(a,i.ref,"ref cannot reference another ref layer")):h=Qt(g.type):e.push(new Ce(a,i.ref,`ref layer "${f}" not found`))}else if(h!=="background")if(i.source){const g=o.sources&&o.sources[i.source],y=g&&Qt(g.type);g?y==="vector"&&h==="raster"?e.push(new Ce(a,i.source,`layer "${i.id}" requires a raster source`)):y!=="raster-dem"&&h==="hillshade"||y!=="raster-dem"&&h==="color-relief"?e.push(new Ce(a,i.source,`layer "${i.id}" requires a raster-dem source`)):y==="raster"&&h!=="raster"?e.push(new Ce(a,i.source,`layer "${i.id}" requires a vector source`)):y!=="vector"||i["source-layer"]?y==="raster-dem"&&h!=="hillshade"&&h!=="color-relief"?e.push(new Ce(a,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):h!=="line"||!i.paint||!i.paint["line-gradient"]||y==="geojson"&&g.lineMetrics||e.push(new Ce(a,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ce(a,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new Ce(a,i.source,`source "${i.source}" not found`))}else e.push(new Ce(a,i,'missing required property "source"'));return e=e.concat(ir({key:a,value:i,valueSpec:u.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${a}.type`,value:i.type,valueSpec:u.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:i,objectKey:"type"}),filter:za,layout:g=>ir({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>nu(ft({layerType:h},y))}}),paint:g=>ir({layer:i,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":y=>ru(ft({layerType:h},y))}})}})),e}function fn(r){const e=r.value,i=r.key,a=ht(e);return a!=="string"?[new Ce(i,e,`string expected, ${a} found`)]:[]}const Al={promoteId:function({key:r,value:e}){if(ht(e)==="string")return fn({key:r,value:e});{const i=[];for(const a in e)i.push(...fn({key:`${r}.${a}`,value:e[a]}));return i}}};function zl(r){const e=r.value,i=r.key,a=r.styleSpec,o=r.style,u=r.validateSpec;if(!e.type)return[new Ce(i,e,'"type" is required')];const h=Qt(e.type);let f;switch(h){case"vector":case"raster":return f=ir({key:i,value:e,valueSpec:a[`source_${h.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:Al,validateSpec:u}),f;case"raster-dem":return f=(function(g){var y;const v=(y=g.sourceName)!==null&&y!==void 0?y:"",b=g.value,S=g.styleSpec,P=S.source_raster_dem,E=g.style;let z=[];const L=ht(b);if(b===void 0)return z;if(L!=="object")return z.push(new Ce("source_raster_dem",b,`object expected, ${L} found`)),z;const V=Qt(b.encoding)==="custom",W=["redFactor","greenFactor","blueFactor","baseShift"],j=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const U in b)!V&&W.includes(U)?z.push(new Ce(U,b[U],`In "${v}": "${U}" is only valid when "encoding" is set to "custom". ${j} encoding found`)):P[U]?z=z.concat(g.validateSpec({key:U,value:b[U],valueSpec:P[U],validateSpec:g.validateSpec,style:E,styleSpec:S})):z.push(new Ce(U,b[U],`unknown property "${U}"`));return z})({sourceName:i,value:e,style:r.style,styleSpec:a,validateSpec:u}),f;case"geojson":if(f=ir({key:i,value:e,valueSpec:a.source_geojson,style:o,styleSpec:a,validateSpec:u,objectElementValidators:Al}),e.cluster)for(const g in e.clusterProperties){const[y,v]=e.clusterProperties[g],b=typeof y=="string"?[y,["accumulated"],["get",g]]:y;f.push(...pn({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),f.push(...pn({key:`${i}.${g}.reduce`,value:b,expressionContext:"cluster-reduce"}))}return f;case"video":return ir({key:i,value:e,valueSpec:a.source_video,style:o,validateSpec:u,styleSpec:a});case"image":return ir({key:i,value:e,valueSpec:a.source_image,style:o,validateSpec:u,styleSpec:a});case"canvas":return[new Ce(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function vs(r){const e=r.value,i=r.styleSpec,a=i.light,o=r.style;let u=[];const h=ht(e);if(e===void 0)return u;if(h!=="object")return u=u.concat([new Ce("light",e,`object expected, ${h} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&a[g[1]]&&a[g[1]].transition?r.validateSpec({key:f,value:e[f],valueSpec:i.transition,validateSpec:r.validateSpec,style:o,styleSpec:i}):a[f]?r.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Ce(f,e[f],`unknown property "${f}"`)])}return u}function su(r){const e=r.value,i=r.styleSpec,a=i.sky,o=r.style,u=ht(e);if(e===void 0)return[];if(u!=="object")return[new Ce("sky",e,`object expected, ${u} found`)];let h=[];for(const f in e)h=h.concat(a[f]?r.validateSpec({key:f,value:e[f],valueSpec:a[f],style:o,styleSpec:i}):[new Ce(f,e[f],`unknown property "${f}"`)]);return h}function kl(r){const e=r.value,i=r.styleSpec,a=i.terrain,o=r.style;let u=[];const h=ht(e);if(e===void 0)return u;if(h!=="object")return u=u.concat([new Ce("terrain",e,`object expected, ${h} found`)]),u;for(const f in e)u=u.concat(a[f]?r.validateSpec({key:f,value:e[f],valueSpec:a[f],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Ce(f,e[f],`unknown property "${f}"`)]);return u}function Dl(r){let e=[];const i=r.value,a=r.key;if(Array.isArray(i)){const o=[],u=[];for(const h in i)i[h].id&&o.includes(i[h].id)&&e.push(new Ce(a,i,`all the sprites' ids must be unique, but ${i[h].id} is duplicated`)),o.push(i[h].id),i[h].url&&u.includes(i[h].url)&&e.push(new Ce(a,i,`all the sprites' URLs must be unique, but ${i[h].url} is duplicated`)),u.push(i[h].url),e=e.concat(ir({key:`${a}[${h}]`,value:i[h],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}
5return fn({key:a,value:i})}function ou(r){return!!r&&r.constructor===Object}function Rl(r){return ou(r.value)?[]:[new Ce(r.key,r.value,`object expected, ${ht(r.value)} found`)]}const Ll={"*":()=>[],array:bo,boolean:function(r){const e=r.value,i=r.key,a=ht(e);return a!=="boolean"?[new Ce(i,e,`boolean expected, ${a} found`)]:[]},number:ys,color:xs,constants:eu,enum:Hn,filter:za,function:wo,layer:au,object:ir,source:zl,light:vs,sky:su,terrain:kl,projection:function(r){const e=r.value,i=r.styleSpec,a=i.projection,o=r.style,u=ht(e);if(e===void 0)return[];if(u!=="object")return[new Ce("projection",e,`object expected, ${u} found`)];let h=[];for(const f in e)h=h.concat(a[f]?r.validateSpec({key:f,value:e[f],valueSpec:a[f],style:o,styleSpec:i}):[new Ce(f,e[f],`unknown property "${f}"`)]);return h},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const a=ht(i);return a!=="array"||(function(o){return Array.isArray(o)&&o.length===3&&typeof o[0]=="string"&&typeof o[1]=="string"&&typeof o[2]=="number"})(i)||(function(o){return!!["interpolate","step","literal"].includes(o[0])})(i)?["array","string"].includes(a)?[]:[new Ce(e,i,`projection expected, invalid type "${a}" found`)]:[new Ce(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:fn,formatted:function(r){return fn(r).length===0?[]:pn(r)},resolvedImage:function(r){return fn(r).length===0?[]:pn(r)},padding:function(r){const e=r.key,i=r.value;if(ht(i)==="array"){if(i.length<1||i.length>4)return[new Ce(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const a={type:"number"};let o=[];for(let u=0;u<i.length;u++)o=o.concat(r.validateSpec({key:`${e}[${u}]`,value:i[u],validateSpec:r.validateSpec,valueSpec:a}));return o}return ys({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(ht(i)==="array"){const a={type:"number"};if(i.length<1)return[new Ce(e,i,"array length at least 1 expected, length 0 found")];let o=[];for(let u=0;u<i.length;u++)o=o.concat(r.validateSpec({key:`${e}[${u}]`,value:i[u],validateSpec:r.validateSpec,valueSpec:a}));return o}return ys({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(ht(i)==="array"){if(i.length<1)return[new Ce(e,i,"array length at least 1 expected, length 0 found")];let a=[];for(let o=0;o<i.length;o++)a=a.concat(xs({key:`${e}[${o}]`,value:i[o]}));return a}return xs({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,a=ht(i),o=r.styleSpec;if(a!=="array"||i.length<1||i.length%2!=0)return[new Ce(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let u=[];for(let h=0;h<i.length;h+=2)u=u.concat(Hn({key:`${e}[${h}]`,value:i[h],valueSpec:o.layout_symbol["text-anchor"]})),u=u.concat(bo({key:`${e}[${h+1}]`,value:i[h+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:o}));return u},sprite:Dl,state:Rl,fontFaces:function(r){const e=r.key,i=r.value,a=r.validateSpec,o=r.styleSpec,u=r.style;if(!ou(i))return[new Ce(e,i,`object expected, ${ht(i)} found`)];const h=[];for(const f in i){const g=i[f],y=ht(g);if(y==="string")h.push(...fn({key:`${e}.${f}`,value:g}));else if(y==="array"){const v={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[b,S]of g.entries())h.push(...ir({key:`${e}.${f}[${b}]`,value:S,valueSpec:v,styleSpec:o,style:u,validateSpec:a}))}else h.push(new Ce(`${e}.${f}`,g,`string or array expected, ${y} found`))}return h}};function mn(r){const e=r.value,i=r.valueSpec,a=r.styleSpec;return r.validateSpec=mn,i.expression&&mo(Qt(e))?wo(r):i.expression&&Aa(Wn(e))?pn(r):i.type&&Ll[i.type]?Ll[i.type](r):ir(ft({},r,{valueSpec:i.type?a[i.type]:i}))}function lu(r){const e=r.value,i=r.key,a=fn(r);return a.length||(e.indexOf("{fontstack}")===-1&&a.push(new Ce(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&a.push(new Ce(i,e,'"glyphs" url must include a "{range}" token'))),a}function ur(r,e=ie){let i=[];return i=i.concat(mn({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:mn,objectElementValidators:{glyphs:lu,"*":()=>[]}})),r.constants&&(i=i.concat(eu({key:"constants",value:r.constants}))),cu(i)}function vr(r){return function(e){return r(Object.assign({},e,{validateSpec:mn}))}}function cu(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function br(r){return function(...e){return cu(r.apply(this,e))}}
vendor: 22,150 bytes, line 5
5ur.source=br(vr(zl)),ur.sprite=br(vr(Dl)),ur.glyphs=br(vr(lu)),ur.light=br(vr(vs)),ur.sky=br(vr(su)),ur.terrain=br(vr(kl)),ur.state=br(vr(Rl)),ur.layer=br(vr(au)),ur.filter=br(vr(za)),ur.paintProperty=br(vr(ru)),ur.layoutProperty=br(vr(nu));const xh={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class bs{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=fs(e,xh,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((a=>`${a.key}: ${a.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=dn(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const ws=ie,di=ur,Ts=di.light,uu=di.sky,vh=di.paintProperty,bh=di.layoutProperty;function ka(r,e){let i=!1;if(e&&e.length)for(const a of e)r.fire(new Pe(new Error(a.message))),i=!0;return i}class Da{constructor(e,i,a){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const h=new Int32Array(this.arrayBuffer);e=h[0],this.d=(i=h[1])+2*(a=h[2]);for(let g=0;g<this.d*this.d;g++){const y=h[3+g],v=h[3+g+1];o.push(y===v?null:h.subarray(y,v))}const f=h[3+o.length+1];this.keys=h.subarray(h[3+o.length],f),this.bboxes=h.subarray(f),this.insert=this._insertReadonly}else{this.d=i+2*a;for(let h=0;h<this.d*this.d;h++)o.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=a,this.scale=i/e,this.uid=0;const u=a/i*e;this.min=-u,this.max=e+u}insert(e,i,a,o,u){this._forEachCell(i,a,o,u,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(a),this.bboxes.push(o),this.bboxes.push(u)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,a,o,u,h){this.cells[u].push(h)}query(e,i,a,o,u){const h=this.min,f=this.max;if(e<=h&&i<=h&&f<=a&&f<=o&&!u)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,i,a,o,this._queryCell,g,{},u),g}}_queryCell(e,i,a,o,u,h,f,g){const y=this.cells[u];if(y!==null){const v=this.keys,b=this.bboxes;for(let S=0;S<y.length;S++){const P=y[S];if(f[P]===void 0){const E=4*P;(g?g(b[E+0],b[E+1],b[E+2],b[E+3]):e<=b[E+2]&&i<=b[E+3]&&a>=b[E+0]&&o>=b[E+1])?(f[P]=!0,h.push(v[P])):f[P]=!1}}}}_forEachCell(e,i,a,o,u,h,f,g){const y=this._convertToCellCoord(e),v=this._convertToCellCoord(i),b=this._convertToCellCoord(a),S=this._convertToCellCoord(o);for(let P=y;P<=b;P++)for(let E=v;E<=S;E++){const z=this.d*E+P;if((!g||g(this._convertFromCellCoord(P),this._convertFromCellCoord(E),this._convertFromCellCoord(P+1),this._convertFromCellCoord(E+1)))&&u.call(this,e,i,a,o,z,h,f,g))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;const e=this.cells,i=3+this.cells.length+1+1;let a=0;for(let h=0;h<this.cells.length;h++)a+=this.cells[h].length;const o=new Int32Array(i+a+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let u=i;for(let h=0;h<e.length;h++){const f=e[h];o[3+h]=u,o.set(f,u),u+=f.length}return o[3+e.length]=u,o.set(this.keys,u),u+=this.keys.length,o[3+e.length+1]=u,o.set(this.bboxes,u),u+=this.bboxes.length,o.buffer}static serialize(e,i){const a=e.toArrayBuffer();return i&&i.push(a),{buffer:a}}static deserialize(e){return new Da(e.buffer)}}const wr={};function Be(r,e,i={}){if(wr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),wr[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Be("Object",Object),Be("Set",Set),Be("TransferableGridIndex",Da),Be("Color",ut),Be("Error",Error),Be("AJAXError",O),Be("ResolvedImage",tr),Be("StylePropertyFunction",_o),Be("StyleExpression",Ml,{omit:["_evaluator"]}),Be("ZoomDependentExpression",Il),Be("ZoomConstantExpression",go),Be("CompoundExpression",cr,{omit:["_evaluate"]});for(const r in Ia)Ia[r]._classRegistryKey||Be(`Expression_${r}`,Ia[r]);function To(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Fl(r){return r.$name||r.constructor._classRegistryKey}function Ra(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=Fl(e);return!(!i||i==="Object")})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||To(r)||Nr(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Ss(r,e){if(Ra(r))return(To(r)||Nr(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const u=[];for(const h of r)u.push(Ss(h,e));return u}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=Fl(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!wr[i])throw new Error(`${i} is not registered.`);const{klass:a}=wr[i],o=a.serialize?a.serialize(r,e):{};if(a.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const u in r){if(!r.hasOwnProperty(u)||wr[i].omit.indexOf(u)>=0)continue;const h=r[u];o[u]=wr[i].shallow.indexOf(u)>=0?h:Ss(h,e)}r instanceof Error&&(o.message=r.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(o.$name=i),o}function Ps(r){if(Ra(r))return r;if(Array.isArray(r))return r.map(Ps);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=Fl(r)||"Object";if(!wr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=wr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const a=Object.create(i.prototype);for(const o of Object.keys(r)){if(o==="$name")continue;const u=r[o];a[o]=wr[e].shallow.indexOf(o)>=0?u:Ps(u)}return a}class Bl{constructor(){this.first=!0}update(e,i){const a=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=a,!0))}}function Ms(r){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(r))}function Ol(r){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(r))}function hu(r){return/\s/u.test(String.fromCodePoint(r))}function La(r){for(const e of r)if(Ol(e.codePointAt(0)))return!0;return!1}function wh(r){for(const e of r)if(!du(e.codePointAt(0)))return!1;return!0}function So(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const Po=So(["Arab","Dupl","Mong","Ougr","Syrc"]);function du(r){return!Po.test(String.fromCodePoint(r))}function jl(r){return!(Ol(r)||(e=r,/[\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(e))));var e}const pu=So(["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 Vl(r){return pu.test(String.fromCodePoint(r))}function Nl(r,e){return!(!e&&Vl(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function fu(r){for(const e of r)if(Vl(e.codePointAt(0)))return!0;return!1}const gn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(gn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return c(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,a=new Promise((u=>{this.loadScriptResolve=u}));e(i);const o=new Promise((u=>setTimeout((()=>u()),this.TIMEOUT)));if(yield Promise.race([a,o]),this.isParsed()){const u={pluginStatus:"loaded",pluginURL:i};return this.setState(u),u}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class Tt{constructor(e,i){this.isSupportedScript=Th,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Bl,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Bl,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),a=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*i}}}function Th(r){return(function(e,i){for(const a of e)if(!Nl(a.codePointAt(0),i))return!1;return!0})(r,gn.getRTLTextPluginStatus()==="loaded")}const Is="-transition";class Mo{constructor(e,i,a){this.property=e,this.value=i,this.expression=(function(o,u,h){if(mo(o))return new _o(o,u);if(Aa(o)){const f=El(o,u,h);if(f.result==="error")throw new Error(f.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return f.value}{let f=o;return u.type==="color"&&typeof o=="string"?f=ut.parse(o):u.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?u.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?u.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?u.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?f=Li.parse(o):u.type==="projectionDefinition"&&typeof o=="string"&&(f=Fi.parse(o)):f=Ke.parse(o):f=Nt.parse(o):f=Mi.parse(o),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>f}}})(i===void 0?e.specification.default:i,e.specification,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,a){return this.property.possiblyEvaluate(this,e,i,a)}}class Io{constructor(e,i){this.property=e,this.value=new Mo(e,void 0,i)}transitioned(e,i){return new mu(this.property,this.value,i,Gi({},e.transition,this.transition),e.now)}untransitioned(){return new mu(this.property,this.value,null,{},0)}}class Ul{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}getValue(e){return Ti(this._values[e].value.value)}setValue(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Io(this._values[e].property,this._globalState)),this._values[e].value=new Mo(this._values[e].property,i===null?void 0:Ti(i),this._globalState)}getTransition(e){return Ti(this._values[e].transition)}setTransition(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Io(this._values[e].property,this._globalState)),this._values[e].transition=Ti(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const a=this.getValue(i);a!==void 0&&(e[i]=a);const o=this.getTransition(i);o!==void 0&&(e[`${i}${Is}`]=o)}return e}transitioned(e,i){const a=new gu(this._properties);for(const o of Object.keys(this._values))a._values[o]=this._values[o].transitioned(e,i._values[o]);return a}untransitioned(){const e=new gu(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class mu{constructor(e,i,a,o,u){this.property=e,this.value=i,this.begin=u+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=a)}possiblyEvaluate(e,i,a){const o=e.now||0,u=this.value.possiblyEvaluate(e,i,a),h=this.prior;if(h){if(o>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(o<this.begin)return h.possiblyEvaluate(e,i,a);{const f=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,a),u,sa(f))}}return u}}class gu{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,a){const o=new Es(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,i,a);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class _u{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Ti(this._values[e].value)}setValue(e,i){this._values[e]=new Mo(this._values[e].property,i===null?void 0:Ti(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const a=this.getValue(i);a!==void 0&&(e[i]=a)}return e}possiblyEvaluate(e,i,a){const o=new Es(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].possiblyEvaluate(e,i,a);return o}}class Tr{constructor(e,i,a){this.property=e,this.value=i,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,a,o){return this.property.evaluate(this.value,this.parameters,e,i,a,o)}}class Es{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{constructor(e){this.specification=e}possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,a){const o=Bt[this.specification.type];return o?o(e,i,a):e}}class He{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,a,o){return new Tr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},a,o)}:e.expression,i)}interpolate(e,i,a){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Tr(this,{kind:"constant",value:void 0},e.parameters);const o=Bt[this.specification.type];if(o){const u=o(e.value.value,i.value.value,a);return new Tr(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,i,a,o,u,h){return e.kind==="constant"?e.value:e.evaluate(i,a,o,u,h)}}class Cs extends He{possiblyEvaluate(e,i,a,o){if(e.value===void 0)return new Tr(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const u=e.expression.evaluate(i,null,{},a,o),h=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(h,h,h,i);return new Tr(this,{kind:"constant",value:f},i)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new Tr(this,{kind:"constant",value:u},i)}return new Tr(this,e.expression,i)}evaluate(e,i,a,o,u,h){if(e.kind==="source"){const f=e.evaluate(i,a,o,u,h);return this._calculate(f,f,f,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},a,o),e.evaluate({zoom:Math.floor(i.zoom)},a,o),e.evaluate({zoom:Math.floor(i.zoom)+1},a,o),i):e.value}_calculate(e,i,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:a,to:i}}interpolate(e){return e}}class Eo{constructor(e){this.specification=e}possiblyEvaluate(e,i,a,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(i,null,{},a,o);return this._calculate(u,u,u,i)}return this._calculate(e.expression.evaluate(new Tt(Math.floor(i.zoom-1),i)),e.expression.evaluate(new Tt(Math.floor(i.zoom),i)),e.expression.evaluate(new Tt(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,a,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:a,to:i}}interpolate(e){return e}}class Co{constructor(e){this.specification=e}possiblyEvaluate(e,i,a,o){return!!e.expression.evaluate(i,null,{},a,o)}interpolate(){return!1}}class Oi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const a=e[i];a.specification.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new Mo(a,void 0,void 0),u=this.defaultTransitionablePropertyValues[i]=new Io(a,void 0);this.defaultTransitioningPropertyValues[i]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate({})}}}Be("DataDrivenProperty",He),Be("DataConstantProperty",qe),Be("CrossFadedDataDrivenProperty",Cs),Be("CrossFadedProperty",Eo),Be("ColorRampProperty",Co);class hr extends ve{constructor(e,i,a){if(super(),this.id=e.id,this.type=e.type,this._globalState=a,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(o,u){return new bs(o,u)})(this.visibility,a),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=ms(e.filter,a)),i.layout&&(this._unevaluatedLayout=new _u(i.layout,a)),i.paint)){this._transitionablePaint=new Ul(i.paint,a);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Es(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=ms(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const a=this._unevaluatedLayout._values[i];for(const o of a.getGlobalStateRefs())e.add(o)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const a in this._transitionablePaint._values){const o=this._transitionablePaint._values[a].value;for(const u of o.getGlobalStateRefs()){const h=(e=i.get(u))!==null&&e!==void 0?e:[];h.push({name:a,value:o.value}),i.set(u,h)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,a={}
5){if(i==null||!this._validate(bh,`layers.${this.id}.layout.${e}`,e,i,a))return e==="visibility"?(this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){return e.endsWith(Is)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i,a={}){if(i!=null&&this._validate(vh,`layers.${this.id}.paint.${e}`,e,i,a))return!1;if(e.endsWith(Is))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const o=this._transitionablePaint._values[e],u=o.property.specification["property-type"]==="cross-faded-data-driven",h=o.value.isDataDriven(),f=o.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||h||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,a){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 11,666 bytes, line 5
5serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),An(e,((i,a)=>!(i===void 0||a==="layout"&&!Object.keys(i).length||a==="paint"&&!Object.keys(i).length)))}_validate(e,i,a,o,u={}){return(!u||u.validate!==!1)&&ka(this,e.call(di,{key:i,layerType:this.type,objectKey:a,value:o,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Tr&&Ca(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let Gl;var yu={get paint(){return Gl=Gl||new Oi({"raster-opacity":new qe(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(ie.paint_raster["raster-saturation"]),"raster-contrast":new qe(ie.paint_raster["raster-contrast"]),"raster-resampling":new qe(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(ie.paint_raster["raster-fade-duration"])})}};class Sh extends hr{constructor(e,i){super(e,yu,i)}}const Ph={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class As{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ut{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ei(r,e=1){let i=0,a=0;return{members:r.map((o=>{const u=Ph[o.type].BYTES_PER_ELEMENT,h=i=Xn(i,Math.max(e,u)),f=o.components||1;return a=Math.max(a,u),i+=u*f,{name:o.name,type:o.type,components:f,offset:h}})),size:Xn(i,Math.max(a,e)),alignment:e}}function Xn(r,e){return Math.ceil(r/e)*e}class zs extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=a,e}}zs.prototype.bytesPerElement=4,Be("StructArrayLayout2i4",zs);class Ao extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,a)}emplace(e,i,a,o){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=a,this.int16[u+2]=o,e}}Ao.prototype.bytesPerElement=6,Be("StructArrayLayout3i6",Ao);class ql extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,a,o)}emplace(e,i,a,o,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=a,this.int16[h+2]=o,this.int16[h+3]=u,e}}ql.prototype.bytesPerElement=8,Be("StructArrayLayout4i8",ql);class zo extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,a,o,u,h)}emplace(e,i,a,o,u,h,f){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=a,this.int16[g+2]=o,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=f,e}}zo.prototype.bytesPerElement=12,Be("StructArrayLayout2i4i12",zo);class $l extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,a,o,u,h)}emplace(e,i,a,o,u,h,f){const g=4*e,y=8*e;return this.int16[g+0]=i,this.int16[g+1]=a,this.uint8[y+4]=o,this.uint8[y+5]=u,this.uint8[y+6]=h,this.uint8[y+7]=f,e}}$l.prototype.bytesPerElement=8,Be("StructArrayLayout2i4ub8",$l);class ks extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=a,e}}ks.prototype.bytesPerElement=8,Be("StructArrayLayout2f8",ks);class qr extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h,f,g,y,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,a,o,u,h,f,g,y,v)}emplace(e,i,a,o,u,h,f,g,y,v,b){const S=10*e;return this.uint16[S+0]=i,this.uint16[S+1]=a,this.uint16[S+2]=o,this.uint16[S+3]=u,this.uint16[S+4]=h,this.uint16[S+5]=f,this.uint16[S+6]=g,this.uint16[S+7]=y,this.uint16[S+8]=v,this.uint16[S+9]=b,e}}qr.prototype.bytesPerElement=20,Be("StructArrayLayout10ui20",qr);class ko extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h,f,g){const y=this.length;return this.resize(y+1),this.emplace(y,e,i,a,o,u,h,f,g)}emplace(e,i,a,o,u,h,f,g,y){const v=8*e;return this.uint16[v+0]=i,this.uint16[v+1]=a,this.uint16[v+2]=o,this.uint16[v+3]=u,this.uint16[v+4]=h,this.uint16[v+5]=f,this.uint16[v+6]=g,this.uint16[v+7]=y,e}}ko.prototype.bytesPerElement=16,Be("StructArrayLayout8ui16",ko);class Ds extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h,f,g,y,v,b,S){const P=this.length;return this.resize(P+1),this.emplace(P,e,i,a,o,u,h,f,g,y,v,b,S)}emplace(e,i,a,o,u,h,f,g,y,v,b,S,P){const E=12*e;return this.int16[E+0]=i,this.int16[E+1]=a,this.int16[E+2]=o,this.int16[E+3]=u,this.uint16[E+4]=h,this.uint16[E+5]=f,this.uint16[E+6]=g,this.uint16[E+7]=y,this.int16[E+8]=v,this.int16[E+9]=b,this.int16[E+10]=S,this.int16[E+11]=P,e}}Ds.prototype.bytesPerElement=24,Be("StructArrayLayout4i4ui4i24",Ds);class Do extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,a)}emplace(e,i,a,o){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=a,this.float32[u+2]=o,e}}Do.prototype.bytesPerElement=12,Be("StructArrayLayout3f12",Do);class Rs extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Rs.prototype.bytesPerElement=4,Be("StructArrayLayout1ul4",Rs);class Zl extends Ut{_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,i,a,o,u,h,f,g,y){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,a,o,u,h,f,g,y)}emplace(e,i,a,o,u,h,f,g,y,v){const b=10*e,S=5*e;return this.int16[b+0]=i,this.int16[b+1]=a,this.int16[b+2]=o,this.int16[b+3]=u,this.int16[b+4]=h,this.int16[b+5]=f,this.uint32[S+3]=g,this.uint16[b+8]=y,this.uint16[b+9]=v,e}}Zl.prototype.bytesPerElement=20,Be("StructArrayLayout6i1ul2ui20",Zl);class Fa extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,a,o,u,h)}emplace(e,i,a,o,u,h,f){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=a,this.int16[g+2]=o,this.int16[g+3]=u,this.int16[g+4]=h,this.int16[g+5]=f,e}}Fa.prototype.bytesPerElement=12,Be("StructArrayLayout2i2i2i12",Fa);class Yn extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,a,o,u)}emplace(e,i,a,o,u,h){const f=4*e,g=8*e;return this.float32[f+0]=i,this.float32[f+1]=a,this.float32[f+2]=o,this.int16[g+6]=u,this.int16[g+7]=h,e}}Yn.prototype.bytesPerElement=16,Be("StructArrayLayout2f1f2i16",Yn);class Wl extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,a,o,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,a,o,u,h)}emplace(e,i,a,o,u,h,f){const g=16*e,y=4*e,v=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=a,this.float32[y+1]=o,this.float32[y+2]=u,this.int16[v+6]=h,this.int16[v+7]=f,e}}Wl.prototype.bytesPerElement=16,Be("StructArrayLayout2ub2f2i16",Wl);class Ls extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,a)}emplace(e,i,a,o){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=a,this.uint16[u+2]=o,e}}Ls.prototype.bytesPerElement=6,Be("StructArrayLayout3ui6",Ls);class Kn extends Ut{_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,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V){const W=this.length;return this.resize(W+1),this.emplace(W,e,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V)}emplace(e,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V,W){const j=24*e,U=12*e,Q=48*e;return this.int16[j+0]=i,this.int16[j+1]=a,this.uint16[j+2]=o,this.uint16[j+3]=u,this.uint32[U+2]=h,this.uint32[U+3]=f,this.uint32[U+4]=g,this.uint16[j+10]=y,this.uint16[j+11]=v,this.uint16[j+12]=b,this.float32[U+7]=S,this.float32[U+8]=P,this.uint8[Q+36]=E,this.uint8[Q+37]=z,this.uint8[Q+38]=L,this.uint32[U+10]=V,this.int16[j+22]=W,e}}Kn.prototype.bytesPerElement=48,Be("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Kn);class Hl extends Ut{_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,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V,W,j,U,Q,ne,he,we,Te,Ie,De,Ee){const Se=this.length;return this.resize(Se+1),this.emplace(Se,e,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V,W,j,U,Q,ne,he,we,Te,Ie,De,Ee)}emplace(e,i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V,W,j,U,Q,ne,he,we,Te,Ie,De,Ee,
vendor: 5,748 bytes, line 5
5Se){const ye=32*e,je=16*e;return this.int16[ye+0]=i,this.int16[ye+1]=a,this.int16[ye+2]=o,this.int16[ye+3]=u,this.int16[ye+4]=h,this.int16[ye+5]=f,this.int16[ye+6]=g,this.int16[ye+7]=y,this.uint16[ye+8]=v,this.uint16[ye+9]=b,this.uint16[ye+10]=S,this.uint16[ye+11]=P,this.uint16[ye+12]=E,this.uint16[ye+13]=z,this.uint16[ye+14]=L,this.uint16[ye+15]=V,this.uint16[ye+16]=W,this.uint16[ye+17]=j,this.uint16[ye+18]=U,this.uint16[ye+19]=Q,this.uint16[ye+20]=ne,this.uint16[ye+21]=he,this.uint16[ye+22]=we,this.uint32[je+12]=Te,this.float32[je+13]=Ie,this.float32[je+14]=De,this.uint16[ye+30]=Ee,this.uint16[ye+31]=Se,e}}Hl.prototype.bytesPerElement=64,Be("StructArrayLayout8i15ui1ul2f2ui64",Hl);class Ro extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Ro.prototype.bytesPerElement=4,Be("StructArrayLayout1f4",Ro);class Lo extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,a)}emplace(e,i,a,o){const u=3*e;return this.uint16[6*e+0]=i,this.float32[u+1]=a,this.float32[u+2]=o,e}}Lo.prototype.bytesPerElement=12,Be("StructArrayLayout1ui2f12",Lo);class Xl extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,a){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,a)}emplace(e,i,a,o){const u=4*e;return this.uint32[2*e+0]=i,this.uint16[u+2]=a,this.uint16[u+3]=o,e}}Xl.prototype.bytesPerElement=8,Be("StructArrayLayout1ul2ui8",Xl);class d extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const a=this.length;return this.resize(a+1),this.emplace(a,e,i)}emplace(e,i,a){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=a,e}}d.prototype.bytesPerElement=4,Be("StructArrayLayout2ui4",d);class t extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}t.prototype.bytesPerElement=2,Be("StructArrayLayout1ui2",t);class n extends Ut{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,a,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,a,o)}emplace(e,i,a,o,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=a,this.float32[h+2]=o,this.float32[h+3]=u,e}}n.prototype.bytesPerElement=16,Be("StructArrayLayout4f16",n);class s 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 be(this.anchorPointX,this.anchorPointY)}}s.prototype.size=20;class l extends Zl{get(e){return new s(this,e)}}Be("CollisionBoxArray",l);class p 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]}}p.prototype.size=48;class m extends Kn{get(e){return new p(this,e)}}Be("PlacedSymbolArray",m);class _ 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]}
vendor: 37,939 bytes, line 5
5get 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]}}_.prototype.size=64;class x extends Hl{get(e){return new _(this,e)}}Be("SymbolInstanceArray",x);class w extends Ro{getoffsetX(e){return this.float32[1*e+0]}}Be("GlyphOffsetArray",w);class T extends Ao{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Be("SymbolLineVertexArray",T);class I 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]}}I.prototype.size=12;class M extends Lo{get(e){return new I(this,e)}}Be("TextAnchorOffsetArray",M);class k 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]}}k.prototype.size=8;class B extends Xl{get(e){return new k(this,e)}}Be("FeatureIndexArray",B);class G extends zs{}class Z extends zs{}class q extends zs{}class Y extends zo{}class te extends $l{}class H extends ks{}class ee extends qr{}class re extends ko{}class J extends Ds{}class oe extends Do{}class _e extends Rs{}class de extends Fa{}class me extends Wl{}class ge extends Ls{}class Ae extends d{}const ke=ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:Me}=ke;class Le{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,a,o){const u=this.segments[this.segments.length-1];return e>Le.MAX_VERTEX_ARRAY_LENGTH&&Si(`Max vertices per segment is ${Le.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Le.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!u||u.vertexLength+e>Le.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==o?this.createNewSegment(i,a,o):u}createNewSegment(e,i,a){const o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(o.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(o),o}getOrCreateLatestSegment(e,i,a){return this.prepareSegment(0,e,i,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,a,o){return new Le([{vertexOffset:e,primitiveOffset:i,vertexLength:a,primitiveLength:o,vaos:{},sortKey:0}])}}function tt(r,e){return 256*(r=or(Math.floor(r),0,255))+or(Math.floor(e),0,255)}Le.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Be("SegmentVector",Le);const xt=ei([{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"}]),Dt=ei([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var It,Ot,Et,Ht={exports:{}},jt={exports:{}},pi={exports:{}},ai=(function(){if(Et)return Ht.exports;Et=1;var r=(It||(It=1,jt.exports=function(i,a){var o,u,h,f,g,y,v,b;for(u=i.length-(o=3&i.length),h=a,g=3432918353,y=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,o){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*y+(((v>>>16)*y&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),jt.exports),e=(Ot||(Ot=1,pi.exports=function(i,a){for(var o,u=i.length,h=a^u,f=0;u>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(o>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),pi.exports);return Ht.exports=r,Ht.exports.murmur3=r,Ht.exports.murmur2=e,Ht.exports})(),ti=Ne(ai);class xi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,a,o){this.ids.push(_n(e)),this.positions.push(i,a,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=_n(e);let a=0,o=this.ids.length-1;for(;a<o;){const h=a+o>>1;this.ids[h]>=i?o=h:a=h+1}const u=[];for(;this.ids[a]===i;)u.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return u}static serialize(e,i){const a=new Float64Array(e.ids),o=new Uint32Array(e.positions);return $r(a,o,0,a.length-1),i&&i.push(a.buffer,o.buffer),{ids:a,positions:o}}static deserialize(e){const i=new xi;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function _n(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ti(String(r))}function $r(r,e,i,a){for(;i<a;){const o=r[i+a>>1];let u=i-1,h=a+1;for(;;){do u++;while(r[u]<o);do h--;while(r[h]>o);if(u>=h)break;Rr(r,u,h),Rr(e,3*u,3*h),Rr(e,3*u+1,3*h+1),Rr(e,3*u+2,3*h+2)}h-i<a-h?($r(r,e,i,h),i=h+1):($r(r,e,h+1,a),a=h)}}function Rr(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}Be("FeaturePositionMap",xi);class Zi{constructor(e,i){this.gl=e.gl,this.location=i}}class Jn extends Zi{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Fs extends Zi{constructor(e,i){super(e,i),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 Qn extends Zi{constructor(e,i){super(e,i),this.current=ut.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))}}const dr=new Float32Array(16);function Lr(r){return[tt(255*r.r,255*r.g),tt(255*r.b,255*r.a)]}class Sr{constructor(e,i,a){this.value=e,this.uniformNames=i.map((o=>`u_${o}`)),this.type=a}setUniform(e,i,a){e.set(a.constantOr(this.value))}getBinding(e,i,a){return this.type==="color"?new Qn(e,i):new Jn(e,i)}}class Pr{constructor(e,i){this.uniformNames=i.map((a=>`u_${a}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,a,o){let u=null;o==="u_pattern_to"?u=this.patternTo:o==="u_pattern_from"?u=this.patternFrom:o==="u_dasharray_to"?u=this.dashTo:o==="u_dasharray_from"?u=this.dashFrom:o==="u_pixel_ratio_to"?u=this.pixelRatioTo:o==="u_pixel_ratio_from"&&(u=this.pixelRatioFrom),u!==null&&e.set(u)}getBinding(e,i,a){return a.substr(0,9)==="u_pattern"||a.substr(0,12)==="u_dasharray_"?new Fs(e,i):new Jn(e,i)}}class zt{constructor(e,i,a,o){this.expression=e,this.type=a,this.maxValue=0,this.paintVertexAttributes=i.map((u=>({name:`a_${u}`,type:"Float32",components:a==="color"?2:1,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,i,a){const o=this.paintVertexArray.length,u=this.expression.evaluate(new Tt(0,a),i,{},a.canonical,[],a.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(o,e,u)}updatePaintArray(e,i,a,o,u){const h=this.expression.evaluate(new Tt(0,u),a,o);this._setPaintValue(e,i,h)}_setPaintValue(e,i,a){if(this.type==="color"){const o=Lr(a);for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o[0],o[1])}else{for(let o=e;o<i;o++)this.paintVertexArray.emplace(o,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ct{constructor(e,i,a,o,u,h){this.expression=e,this.uniformNames=i.map((f=>`u_${f}_t`)),this.type=a,this.useIntegerZoom=o,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=i.map((f=>({name:`a_${f}`,type:"Float32",components:a==="color"?4:2,offset:0}))),this.paintVertexArray=new h}populatePaintArray(e,i,a){const o=this.expression.evaluate(new Tt(this.zoom,a),i,{},a.canonical,[],a.formattedSection),u=this.expression.evaluate(new Tt(this.zoom+1,a),i,{},a.canonical,[],a.formattedSection),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,o,u)}updatePaintArray(e,i,a,o,u){const h=this.expression.evaluate(new Tt(this.zoom,u),a,o),f=this.expression.evaluate(new Tt(this.zoom+1,u),a,o);this._setPaintValue(e,i,h,f)}_setPaintValue(e,i,a,o){if(this.type==="color"){const u=Lr(a),h=Lr(o);for(let f=e;f<i;f++)this.paintVertexArray.emplace(f,u[0],u[1],h[0],h[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,a,o);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i){const a=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=or(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,i,a){return new Jn(e,i)}}class ui{constructor(e,i,a,o,u,h){this.expression=e,this.type=i,this.useIntegerZoom=a,this.zoom=o,this.layerId=h,this.zoomInPaintVertexArray=new u,this.zoomOutPaintVertexArray=new u}populatePaintArray(e,i,a){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,this.getPositionIds(i),a)}updatePaintArray(e,i,a,o,u){this._setPaintValues(e,i,this.getPositionIds(a),u)}_setPaintValues(e,i,a,o){const u=this.getPositions(o);if(!u||!a)return;const h=u[a.min],f=u[a.mid],g=u[a.max];if(h&&f&&g)for(let y=e;y<i;y++)this.emplace(this.zoomInPaintVertexArray,y,f,h),this.emplace(this.zoomOutPaintVertexArray,y,f,g)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class hi extends ui{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return xt.members}emplace(e,i,a,o){e.emplace(i,a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],a.pixelRatio,o.pixelRatio)}}class xu extends ui{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return Dt.members}emplace(e,i,a,o){e.emplace(i,0,a.y,a.height,a.width,0,o.y,o.height,o.width)}}class vu{constructor(e,i,a){this.binders={},this._buffers=[];const o=[];for(const u in e.paint._values){if(!a(u))continue;const h=e.paint.get(u);if(!(h instanceof Tr&&Ca(h.property.specification)))continue;const f=Mh(u,e.type),g=h.value,y=h.property.specification.type,v=h.property.useIntegerZoom,b=h.property.specification["property-type"],S=b==="cross-faded"||b==="cross-faded-data-driven";if(g.kind==="constant")this.binders[u]=S?new Pr(g.value,f):new Sr(g.value,f,y),o.push(`/u_${u}`);else if(g.kind==="source"||S){const P=bu(u,y,"source");this.binders[u]=S?u==="line-dasharray"?new xu(g,y,v,i,P,e.id):new hi(g,y,v,i,P,e.id):new zt(g,f,y,P),o.push(`/a_${u}`)}else{const P=bu(u,y,"composite");this.binders[u]=new Ct(g,f,y,v,i,P),o.push(`/z_${u}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof zt||i instanceof Ct?i.maxValue:0}populatePaintArrays(e,i,a){for(const o in this.binders){const u=this.binders[o];(u instanceof zt||u instanceof Ct||u instanceof ui)&&u.populatePaintArray(e,i,a)}}setConstantPatternPositions(e,i){for(const a in this.binders){const o=this.binders[a];o instanceof Pr&&o.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const a in this.binders){const o=this.binders[a];o instanceof Pr&&o.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,a,o,u){let h=!1;for(const f in e){const g=i.getPositions(f);for(const y of g){const v=a.feature(y.index);for(const b in this.binders){const S=this.binders[b];if((S instanceof zt||S instanceof Ct||S instanceof ui)&&S.expression.isStateDependent===!0){const P=o.paint.get(b);S.expression=P.value,S.updatePaintArray(y.start,y.end,v,e[f],u),h=!0}}}}return h}defines(){const e=[];for(const i in this.binders){const a=this.binders[i];(a instanceof Sr||a instanceof Pr)&&e.push(...a.uniformNames.map((o=>`#define HAS_UNIFORM_${o}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const a=this.binders[i];if(a instanceof zt||a instanceof Ct)for(let o=0;o<a.paintVertexAttributes.length;o++)e.push(a.paintVertexAttributes[o].name);else if(a instanceof ui){const o=a.getVertexAttributes();for(const u of o)e.push(u.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const a=this.binders[i];if(a instanceof Sr||a instanceof Pr||a instanceof Ct)for(const o of a.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const a=[];for(const o in this.binders){const u=this.binders[o];if(u instanceof Sr||u instanceof Pr||u instanceof Ct){for(const h of u.uniformNames)if(i[h]){const f=u.getBinding(e,i[h],h);a.push({name:h,property:o,binding:f})}}}return a}setUniforms(e,i,a,o){for(const{name:u,property:h,binding:f}of i)this.binders[h].setUniform(f,o,a.get(h),u)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const a=this.binders[i];if(e&&a instanceof ui){const o=e.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(a instanceof zt||a instanceof Ct)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(e){for(const i in this.binders){const a=this.binders[i];(a instanceof zt||a instanceof Ct||a instanceof ui)&&a.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof zt||i instanceof Ct||i instanceof ui)&&i.destroy()}}}class ea{constructor(e,i,a=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new vu(o,i,a);this.needsUpload=!1,this._featureMap=new xi,this._bufferOffset=0}populatePaintArrays(e,i,a,o){for(const u in this.programConfigurations)this.programConfigurations[u].populatePaintArrays(e,i,o);i.id!==void 0&&this._featureMap.add(i.id,a,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,a,o){for(const u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,i,u,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Mh(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function bu(r,e,i){const a={color:{source:ks,composite:n},number:{source:Ro,composite:ks}},o=(function(u){return{"line-pattern":{source:ee,composite:ee},"fill-pattern":{source:ee,composite:ee},"fill-extrusion-pattern":{source:ee,composite:ee},"line-dasharray":{source:re,composite:re}}[u]})(r);return o&&o[i]||a[e][i]}Be("ConstantBinder",Sr),Be("CrossFadedConstantBinder",Pr),Be("SourceExpressionBinder",zt),Be("CrossFadedPatternBinder",hi),Be("CrossFadedDasharrayBinder",xu),Be("CompositeExpressionBinder",Ct),Be("ProgramConfiguration",vu,{omit:["_buffers"]}),Be("ProgramConfigurationSet",ea);const Yl=Math.pow(2,14)-1,yn=-Yl-1;function xn(r){const e=gt/r.extent,i=r.loadGeometry();for(let a=0;a<i.length;a++){const o=i[a];for(let u=0;u<o.length;u++){const h=o[u],f=Math.round(h.x*e),g=Math.round(h.y*e);h.x=or(f,yn,Yl),h.y=or(g,yn,Yl),(f<h.x||f>h.x+1||g<h.y||g>h.y+1)&&Si("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function vn(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?xn(r):[]}}const Kl=-32768;function Jl(r,e,i,a,o){r.emplaceBack(Kl+8*e+a,Kl+8*i+o)}class Fo{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Z,this.indexArray=new ge,this.segments=new Le,this.programConfigurations=new ea(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){const o=this.layers[0],u=[];let h=null,f=!1,g=o.type==="heatmap";if(o.type==="circle"){const v=o;h=v.layout.get("circle-sort-key"),f=!h.isConstant(),g=g||v.paint.get("circle-pitch-alignment")==="map"}const y=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:b,index:S,sourceLayerIndex:P}of e){const E=this.layers[0]._featureFilter.needGeometry,z=vn(v,E);if(!this.layers[0]._featureFilter.filter(new Tt(this.zoom),z,a))continue;const L=f?h.evaluate(z,{},a):void 0,V={id:b,properties:v.properties,type:v.type,sourceLayerIndex:P,index:S,geometry:E?z.geometry:xn(v),patterns:{},sortKey:L};u.push(V)}f&&u.sort(((v,b)=>v.sortKey-b.sortKey));for(const v of u){const{geometry:b,index:S,sourceLayerIndex:P}=v,E=e[S].feature;this.addFeature(v,b,S,a,y),i.featureIndex.insert(E,b,S,P,this.index)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Me),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,i,a,o,u=1){let h;switch(u){case 1:h=[0,7];break;case 3:h=[0,2,5,7];break;case 5:h=[0,1,3,4,6,7];break;case 7:h=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${u}; valid values are 1, 3, 5, 7.`)}const f=h.length;for(const g of i)for(const y of g){const v=y.x,b=y.y;if(v<0||v>=gt||b<0||b>=gt)continue;const S=this.segments.prepareSegment(f*f,this.layoutVertexArray,this.indexArray,e.sortKey),P=S.vertexLength;for(let E=0;E<f;E++)for(let z=0;z<f;z++)Jl(this.layoutVertexArray,v,b,h[z],h[E]);for(let E=0;E<f-1;E++)for(let z=0;z<f-1;z++){const L=P+E*f+z,V=P+(E+1)*f+z;this.indexArray.emplaceBack(L,V+1,L+1),this.indexArray.emplaceBack(L,V,V+1)}S.vertexLength+=f*f,S.primitiveLength+=(f-1)*(f-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:{},canonical:o})}}function Bo(r,e){for(let i=0;i<r.length;i++)if(Oo(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Oo(r,e[i]))return!0;return!!Ih(r,e)}function wu(r,e,i){return!!Oo(r,e)||!!Eh(e,r,i)}function Fd(r,e){if(r.length===1)return Od(e,r[0]);for(let i=0;i<e.length;i++){const a=e[i];for(let o=0;o<a.length;o++)if(Oo(r,a[o]))return!0}for(let i=0;i<r.length;i++)if(Od(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Ih(r,e[i]))return!0;return!1}function _m(r,e,i){if(r.length>1){if(Ih(r,e))return!0;for(let a=0;a<e.length;a++)if(Eh(e[a],r,i))return!0}for(let a=0;a<r.length;a++)if(Eh(r[a],e,i))return!0;return!1}function Ih(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const a=r[i],o=r[i+1];for(let u=0;u<e.length-1;u++)if(ym(a,o,e[u],e[u+1]))return!0}return!1}function ym(r,e,i,a){return Ji(r,i,a)!==Ji(e,i,a)&&Ji(r,e,i)!==Ji(r,e,a)}function Eh(r,e,i){const a=i*i;if(e.length===1)return r.distSqr(e[0])<a;for(let o=1;o<e.length;o++)if(Bd(r,e[o-1],e[o])<a)return!0;return!1}function Bd(r,e,i){const a=e.distSqr(i);if(a===0)return r.distSqr(e);const o=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/a;return r.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function Od(r,e){let i,a,o,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,g=i.length-1;f<i.length;g=f++)a=i[f],o=i[g],a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(u=!u)}return u}function Oo(r,e){let i=!1;for(let a=0,o=r.length-1;a<r.length;o=a++){const u=r[a],h=r[o];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function xm(r,e,i){const a=i[0],o=i[2];if(r.x<a.x&&e.x<a.x||r.x>o.x&&e.x>o.x||r.y<a.y&&e.y<a.y||r.y>o.y&&e.y>o.y)return!1;const u=Ji(r,e,i[0]);return u!==Ji(r,e,i[1])||u!==Ji(r,e,i[2])||u!==Ji(r,e,i[3])}function jo(r,e,i){const a=e.paint.get(r).value;return a.kind==="constant"?a.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Tu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Su(r,e,i,a,o){if(!e[0]&&!e[1])return r;const u=be.convert(e)._mult(o);i==="viewport"&&u._rotate(-a);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function vm(r){const e=[];for(let i=0;i<r.length;i++){const a=r[i],o=e.at(-1);(i===0||o&&!a.equals(o))&&e.push(a)}return e}function bm({queryGeometry:r,size:e},i){return wu(r,i,e)}function wm({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:o},u){return wu(r,u,e*(i.projectTileCoordinates(u.x,u.y,a,o).signedDistanceFromCamera/i.cameraToCenterDistance))}function Tm({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:o},u){const h=i.projectTileCoordinates(u.x,u.y,a,o).signedDistanceFromCamera,f=e*(i.cameraToCenterDistance/h);return wu(r,Ch(u,i,a,o),f)}function Sm({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:o},u){return wu(r,Ch(u,i,a,o),e)}function jd({queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:o,pitchAlignment:u="map",pitchScale:h="map"},f){const g=u==="map"?h==="map"?bm:wm:h==="map"?Tm:Sm,y={queryGeometry:r,size:e,transform:i,unwrappedTileID:a,getElevation:o};for(const v of f)for(const b of v)if(g(y,b))return!0;return!1}function Ch(r,e,i,a){const o=e.projectTileCoordinates(r.x,r.y,i,a).point;return new be((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let Vd,Nd;Be("CircleBucket",Fo,{omit:["layers"]});var Pm={get paint(){return Nd=Nd||new Oi({"circle-radius":new He(ie.paint_circle["circle-radius"]),"circle-color":new He(ie.paint_circle["circle-color"]),"circle-blur":new He(ie.paint_circle["circle-blur"]),"circle-opacity":new He(ie.paint_circle["circle-opacity"]),"circle-translate":new qe(ie.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(ie.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(ie.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(ie.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new He(ie.paint_circle["circle-stroke-width"]),"circle-stroke-color":new He(ie.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new He(ie.paint_circle["circle-stroke-opacity"])})},get layout(){return Vd=Vd||new Oi({"circle-sort-key":new He(ie.layout_circle["circle-sort-key"])})}};class Mm extends hr{constructor(e,i){super(e,Pm,i)}createBucket(e){return new Fo(e)}queryRadius(e){const i=e;return jo("circle-radius",this,i)+jo("circle-stroke-width",this,i)+Tu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:o,transform:u,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){const y=Su(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-u.bearingInRadians,h),v=this.paint.get("circle-radius").evaluate(i,a)+this.paint.get("circle-stroke-width").evaluate(i,a),b=this.paint.get("circle-pitch-scale"),S=this.paint.get("circle-pitch-alignment");let P,E;return S==="map"?(P=y,E=v*h):(P=(function(z,L,V,W){return z.map((j=>Ch(j,L,V,W)))})(y,u,f,g),E=v),jd({queryGeometry:P,size:E,transform:u,unwrappedTileID:f,getElevation:g,pitchAlignment:S,pitchScale:b},o)}}class Ud extends Fo{}let Gd;Be("HeatmapBucket",Ud,{omit:["layers"]});var Im={get paint(){return Gd=Gd||new Oi({"heatmap-radius":new He(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new He(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Co(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(ie.paint_heatmap["heatmap-opacity"])})}};function Ah(r,{width:e,height:i},a,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*a)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*a}`)}else o=new Uint8Array(e*i*a);return r.width=e,r.height=i,r.data=o,r}function qd(r,{width:e,height:i},a){if(e===r.width&&i===r.height)return;const o=Ah({},{width:e,height:i},a);zh(r,o,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},a),r.width=e,r.height=i,r.data=o.data}function zh(r,e,i,a,o,u){if(o.width===0||o.height===0)return e;if(o.width>r.width||o.height>r.height||i.x>r.width-o.width||i.y>r.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||a.x>e.width-o.width||a.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const h=r.data,f=e.data;if(h===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<o.height;g++){const y=((i.y+g)*r.width+i.x)*u,v=((a.y+g)*e.width+a.x)*u;for(let b=0;b<o.width*u;b++)f[v+b]=h[y+b]}return e}class Ql{constructor(e,i){Ah(this,e,1,i)}resize(e){qd(this,e,1)}clone(){return new Ql({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,a,o,u){zh(e,i,a,o,u,1)}}class rr{constructor(e,i){Ah(this,e,4,i)}resize(e){qd(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new rr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,a,o,u){zh(e,i,a,o,u,4)}setPixel(e,i,a){const o=4*(e*this.width+i);this.data[o+0]=Math.round(255*a.r/a.a),this.data[o+1]=Math.round(255*a.g/a.a),this.data[o+2]=Math.round(255*a.b/a.a),this.data[o+3]=Math.round(255*a.a)}}function $d(r){const e={},i=r.resolution||256,a=r.clips?r.clips.length:1,o=r.image||new rr({width:i,height:a});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const u=(h,f,g)=>{e[r.evaluationKey]=g;const y=r.expression.evaluate(e);o.setPixel(h/4/i,f/4,y)};if(r.clips)for(let h=0,f=0;h<a;++h,f+=4*i)for(let g=0,y=0;g<i;g++,y+=4){const v=g/(i-1),{start:b,end:S}=r.clips[h];u(f,y,b*(1-v)+S*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return o}Be("AlphaImage",Ql),Be("RGBAImage",rr);const kh="big-fb";class Em extends hr{createBucket(e){return new Ud(e)}constructor(e,i){super(e,Im,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=$d({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(kh)&&this.heatmapFbos.delete(kh)}queryRadius(e){return jo("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:o,transform:u,pixelsToTileUnits:h,unwrappedTileID:f,getElevation:g}){return jd({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,a)*h,transform:u,unwrappedTileID:f,getElevation:g},o)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Zd;var Cm={get paint(){return Zd=Zd||new Oi({"hillshade-illumination-direction":new qe(ie.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new qe(ie.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new qe(ie.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(ie.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(ie.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(ie.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(ie.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new qe(ie.paint_hillshade["hillshade-method"])})}};class Am extends hr{constructor(e,i){super(e,Cm,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,o=this.paint.get("hillshade-shadow-color").values;const u=Math.max(e.length,i.length,a.length,o.length);e=e.concat(Array(u-e.length).fill(e.at(-1))),i=i.concat(Array(u-i.length).fill(i.at(-1))),a=a.concat(Array(u-a.length).fill(a.at(-1))),o=o.concat(Array(u-o.length).fill(o.at(-1)));const h=i.map(kn);return{directionRadians:e.map(kn),altitudeRadians:h,shadowColor:o,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Wd;var zm={get paint(){return Wd=Wd||new Oi({"color-relief-opacity":new qe(ie["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Co(ie["paint_color-relief"]["color-relief-color"])})}};class Dh{constructor(e,i,a,o){this.context=e,this.format=a,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,a){const{width:o,height:u}=e,h=!(this.size&&this.size[0]===o&&this.size[1]===u||a),{context:f}=this,{gl:g}=f;if(this.useMipmap=!!(i&&i.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(this.format===g.RGBA&&(!i||i.premultiply!==!1)),h)this.size=[o,u],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Nr(e)?g.texImage2D(g.TEXTURE_2D,0,this.format,this.format,g.UNSIGNED_BYTE,e):g.texImage2D(g.TEXTURE_2D,0,this.format,o,u,0,this.format,g.UNSIGNED_BYTE,e.data);else{const{x:y,y:v}=a||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Nr(e)?g.texSubImage2D(g.TEXTURE_2D,0,y,v,g.RGBA,g.UNSIGNED_BYTE,e):g.texSubImage2D(g.TEXTURE_2D,0,y,v,o,u,g.RGBA,g.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),f.pixelStoreUnpackFlipY.setDefault(),f.pixelStoreUnpack.setDefault(),f.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,a){const{context:o}=this,{gl:u}=o;u.bindTexture(u.TEXTURE_2D,this.texture),a!==u.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=u.LINEAR),e!==this.filter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,a||e),this.filter=e),i!==this.wrap&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Hd{constructor(e,i,a,o=1,u=1,h=1,f=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Si(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=o,this.greenFactor=u,this.blueFactor=h,this.baseShift=f;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let y=0;y<g;y++)this.data[this._idx(-1,y)]=this.data[this._idx(0,y)],this.data[this._idx(g,y)]=this.data[this._idx(g-1,y)],this.data[this._idx(y,-1)]=this.data[this._idx(y,0)],this.data[this._idx(y,g)]=this.data[this._idx(y,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let y=0;y<g;y++)for(let v=0;v<g;v++){const b=this.get(y,v);b>this.max&&(this.max=b),b<this.min&&(this.min=b)}}get(e,i){const a=new Uint8Array(this.data.buffer),o=4*this._idx(e,i);return this.unpack(a[o],a[o+1],a[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,a){return e*this.redFactor+i*this.greenFactor+a*this.blueFactor-this.baseShift}pack(e){return Xd(e,this.getUnpackVector())}getPixels(){return new rr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,a){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,u=i*this.dim+this.dim,h=a*this.dim,f=a*this.dim+this.dim;switch(i){case-1:o=u-1;break;case 1:u=o+1}switch(a){case-1:h=f-1;break;case 1:f=h+1}const g=-i*this.dim,y=-a*this.dim;for(let v=h;v<f;v++)for(let b=o;b<u;b++)this.data[this._idx(b,v)]=e.data[this._idx(b+g,v+y)]}}function Xd(r,e){const i=e[0],a=e[1],o=e[2],u=e[3],h=Math.min(i,a,o),f=Math.round((r+u)/h);return{r:Math.floor(f*h/i)%256,g:Math.floor(f*h/a)%256,b:Math.floor(f*h/o)%256}}Be("DEMData",Hd);class km extends hr{constructor(e,i){super(e,zm,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},a=this._transitionablePaint._values["color-relief-color"].value.expression;if(a instanceof go&&a._styleExpression.expression instanceof Bi){this.colorRampExpression=a;const h=a._styleExpression.expression;i.elevationStops=h.labels,i.colorStops=[];for(const f of i.elevationStops)i.colorStops.push(h.evaluate({globals:{elevation:f}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[ut.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const o={elevationStops:[],colorStops:[]},u=(i.elevationStops.length-1)/(e-1);for(let h=0;h<i.elevationStops.length-.5;h+=u)o.elevationStops.push(i.elevationStops[Math.round(h)]),o.colorStops.push(i.colorStops[Math.round(h)]);return Si(`Too many colors in specification of ${this.id}
5 color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),o}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,a){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const o=this._createColorRamp(i),u=new rr({width:o.colorStops.length,height:1}),h=new rr({width:o.colorStops.length,height:1});for(let f=0;f<o.elevationStops.length;f++){const g=Xd(o.elevationStops[f],a);h.setPixel(0,f,new ut(g.r/255,g.g/255,g.b/255,1)),u.setPixel(0,f,o.colorStops[f])}return this.colorRampTextures={elevationTexture:new Dh(e,h,e.gl.RGBA),colorTexture:new Dh(e,u,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Dm=ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:Rm}=Dm;function Pu(r,e,i){const a=i.patternDependencies;let o=!1;for(const u of e){const h=u.paint.get(`${r}-pattern`);h.isConstant()||(o=!0);const f=h.constantOr(null);f&&(o=!0,a[f.to]=!0,a[f.from]=!0)}return o}function Rh(r,e,i,a,o){const{zoom:u}=a,h=o.patternDependencies;for(const f of e){const g=f.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let y=g.evaluate({zoom:u-1},i,{},o.availableImages),v=g.evaluate({zoom:u},i,{},o.availableImages),b=g.evaluate({zoom:u+1},i,{},o.availableImages);y=y&&y.name?y.name:y,v=v&&v.name?v.name:v,b=b&&b.name?b.name:b,h[y]=!0,h[v]=!0,h[b]=!0,i.patterns[f.id]={min:y,mid:v,max:b}}}return i}function Yd(r,e,i,a,o){let u;if(o===(function(h,f,g,y){let v=0;for(let b=f,S=g-y;b<g;b+=y)v+=(h[S]-h[b])*(h[b+1]+h[S+1]),S=b;return v})(r,e,i,a)>0)for(let h=e;h<i;h+=a)u=ep(h/a|0,r[h],r[h+1],u);else for(let h=i-a;h>=e;h-=a)u=ep(h/a|0,r[h],r[h+1],u);return u&&Vo(u,u.next)&&(rc(u),u=u.next),u}function Bs(r,e){if(!r)return r;e||(e=r);let i,a=r;do if(i=!1,a.steiner||!Vo(a,a.next)&&si(a.prev,a,a.next)!==0)a=a.next;else{if(rc(a),a=e=a.prev,a===a.next)break;i=!0}while(i||a!==e);return e}function ec(r,e,i,a,o,u,h){if(!r)return;!h&&u&&(function(g,y,v,b){let S=g;do S.z===0&&(S.z=Lh(S.x,S.y,y,v,b)),S.prevZ=S.prev,S.nextZ=S.next,S=S.next;while(S!==g);S.prevZ.nextZ=null,S.prevZ=null,(function(P){let E,z=1;do{let L,V=P;P=null;let W=null;for(E=0;V;){E++;let j=V,U=0;for(let ne=0;ne<z&&(U++,j=j.nextZ,j);ne++);let Q=z;for(;U>0||Q>0&&j;)U!==0&&(Q===0||!j||V.z<=j.z)?(L=V,V=V.nextZ,U--):(L=j,j=j.nextZ,Q--),W?W.nextZ=L:P=L,L.prevZ=W,W=L;V=j}W.nextZ=null,z*=2}while(E>1)})(S)})(r,a,o,u);let f=r;for(;r.prev!==r.next;){const g=r.prev,y=r.next;if(u?Fm(r,a,o,u):Lm(r))e.push(g.i,r.i,y.i),rc(r),r=y.next,f=y.next;else if((r=y)===f){h?h===1?ec(r=Bm(Bs(r),e),e,i,a,o,u,2):h===2&&Om(r,e,i,a,o,u):ec(Bs(r),e,i,a,o,u,1);break}}}function Lm(r){const e=r.prev,i=r,a=r.next;if(si(e,i,a)>=0)return!1;const o=e.x,u=i.x,h=a.x,f=e.y,g=i.y,y=a.y,v=Math.min(o,u,h),b=Math.min(f,g,y),S=Math.max(o,u,h),P=Math.max(f,g,y);let E=a.next;for(;E!==e;){if(E.x>=v&&E.x<=S&&E.y>=b&&E.y<=P&&tc(o,f,u,g,h,y,E.x,E.y)&&si(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function Fm(r,e,i,a){const o=r.prev,u=r,h=r.next;if(si(o,u,h)>=0)return!1;const f=o.x,g=u.x,y=h.x,v=o.y,b=u.y,S=h.y,P=Math.min(f,g,y),E=Math.min(v,b,S),z=Math.max(f,g,y),L=Math.max(v,b,S),V=Lh(P,E,e,i,a),W=Lh(z,L,e,i,a);let j=r.prevZ,U=r.nextZ;for(;j&&j.z>=V&&U&&U.z<=W;){if(j.x>=P&&j.x<=z&&j.y>=E&&j.y<=L&&j!==o&&j!==h&&tc(f,v,g,b,y,S,j.x,j.y)&&si(j.prev,j,j.next)>=0||(j=j.prevZ,U.x>=P&&U.x<=z&&U.y>=E&&U.y<=L&&U!==o&&U!==h&&tc(f,v,g,b,y,S,U.x,U.y)&&si(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;j&&j.z>=V;){if(j.x>=P&&j.x<=z&&j.y>=E&&j.y<=L&&j!==o&&j!==h&&tc(f,v,g,b,y,S,j.x,j.y)&&si(j.prev,j,j.next)>=0)return!1;j=j.prevZ}for(;U&&U.z<=W;){if(U.x>=P&&U.x<=z&&U.y>=E&&U.y<=L&&U!==o&&U!==h&&tc(f,v,g,b,y,S,U.x,U.y)&&si(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function Bm(r,e){let i=r;do{const a=i.prev,o=i.next.next;!Vo(a,o)&&Jd(a,i,i.next,o)&&ic(a,o)&&ic(o,a)&&(e.push(a.i,i.i,o.i),rc(i),rc(i.next),i=r=o),i=i.next}while(i!==r);return Bs(i)}function Om(r,e,i,a,o,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&Gm(h,f)){let g=Qd(h,f);return h=Bs(h,h.next),g=Bs(g,g.next),ec(h,e,i,a,o,u,0),void ec(g,e,i,a,o,u,0)}f=f.next}h=h.next}while(h!==r)}function jm(r,e){let i=r.x-e.x;
vendor: 34,682 bytes, line 5
5return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function Vm(r,e){const i=(function(o,u){let h=u;const f=o.x,g=o.y;let y,v=-1/0;if(Vo(o,h))return h;do{if(Vo(o,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const z=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(z<=f&&z>v&&(v=z,y=h.x<h.next.x?h:h.next,z===f))return y}h=h.next}while(h!==u);if(!y)return null;const b=y,S=y.x,P=y.y;let E=1/0;h=y;do{if(f>=h.x&&h.x>=S&&f!==h.x&&Kd(g<P?f:v,g,S,P,g<P?v:f,g,h.x,h.y)){const z=Math.abs(g-h.y)/(f-h.x);ic(h,o)&&(z<E||z===E&&(h.x>y.x||h.x===y.x&&Nm(y,h)))&&(y=h,E=z)}h=h.next}while(h!==b);return y})(r,e);if(!i)return e;const a=Qd(i,r);return Bs(a,a.next),Bs(i,i.next)}function Nm(r,e){return si(r.prev,r,e.prev)<0&&si(e.next,r,r.next)<0}function Lh(r,e,i,a,o){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-a)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Um(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function Kd(r,e,i,a,o,u,h,f){return(o-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(a-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(o-h)*(a-f)}function tc(r,e,i,a,o,u,h,f){return!(r===h&&e===f)&&Kd(r,e,i,a,o,u,h,f)}function Gm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,a){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==a.i&&o.next.i!==a.i&&Jd(o,o.next,i,a))return!0;o=o.next}while(o!==i);return!1})(r,e)&&(ic(r,e)&&ic(e,r)&&(function(i,a){let o=i,u=!1;const h=(i.x+a.x)/2,f=(i.y+a.y)/2;do o.y>f!=o.next.y>f&&o.next.y!==o.y&&h<(o.next.x-o.x)*(f-o.y)/(o.next.y-o.y)+o.x&&(u=!u),o=o.next;while(o!==i);return u})(r,e)&&(si(r.prev,r,e.prev)||si(r,e.prev,e))||Vo(r,e)&&si(r.prev,r,r.next)>0&&si(e.prev,e,e.next)>0)}function si(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Vo(r,e){return r.x===e.x&&r.y===e.y}function Jd(r,e,i,a){const o=Iu(si(r,e,i)),u=Iu(si(r,e,a)),h=Iu(si(i,a,r)),f=Iu(si(i,a,e));return o!==u&&h!==f||!(o!==0||!Mu(r,i,e))||!(u!==0||!Mu(r,a,e))||!(h!==0||!Mu(i,r,a))||!(f!==0||!Mu(i,e,a))}function Mu(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Iu(r){return r>0?1:r<0?-1:0}function ic(r,e){return si(r.prev,r,r.next)<0?si(r,e,r.next)>=0&&si(r,r.prev,e)>=0:si(r,e,r.prev)<0||si(r,r.next,e)<0}function Qd(r,e){const i=Fh(r.i,r.x,r.y),a=Fh(e.i,e.x,e.y),o=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=o,o.prev=i,a.next=i,i.prev=a,u.next=a,a.prev=u,a}function ep(r,e,i,a){const o=Fh(r,e,i);return a?(o.next=a.next,o.prev=a,a.next.prev=o,a.next=o):(o.prev=o,o.next=o),o}function rc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Fh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class No{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Eu{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Eu.noSubdivision=new Eu({fill:new No(0,0),line:new No(0,0),tile:new No(0,0),stencil:new No(0,0),circle:1}),Be("SubdivisionGranularityExpression",No),Be("SubdivisionGranularitySetting",Eu);const Uo=-32768,nc=32767;class qm{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=gt/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(e),o=0|Math.round(i),u=this._getKey(a,o);if(this._vertexDictionary.has(u))return this._vertexDictionary.get(u);const h=this._vertexBuffer.length/2;return this._vertexDictionary.set(u,h),this._vertexBuffer.push(a,o),h}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(o,u){const h=[];for(let f=0;f<u.length;f+=3){const g=u[f],y=u[f+1],v=u[f+2],b=o[2*g],S=o[2*g+1];(o[2*y]-b)*(o[2*v+1]-S)-(o[2*y+1]-S)*(o[2*v]-b)>0?(h.push(g),h.push(v),h.push(y)):(h.push(g),h.push(y),h.push(v))}return h})(this._vertexBuffer,e);const i=[],a=e.length;for(let o=0;o<a;o+=3){const u=[e[o+0],e[o+1],e[o+2]],h=[this._vertexBuffer[2*e[o+0]+0],this._vertexBuffer[2*e[o+0]+1],this._vertexBuffer[2*e[o+1]+0],this._vertexBuffer[2*e[o+1]+1],this._vertexBuffer[2*e[o+2]+0],this._vertexBuffer[2*e[o+2]+1]];let f=1/0,g=1/0,y=-1/0,v=-1/0;for(let z=0;z<3;z++){const L=h[2*z],V=h[2*z+1];f=Math.min(f,L),y=Math.max(y,L),g=Math.min(g,V),v=Math.max(v,V)}if(f===y||g===v)continue;const b=Math.floor(f/this._granularityCellSize),S=Math.ceil(y/this._granularityCellSize),P=Math.floor(g/this._granularityCellSize),E=Math.ceil(v/this._granularityCellSize);if(b!==S||P!==E)for(let z=P;z<E;z++){const L=this._scanlineGenerateVertexRingForCellRow(z,h,u);$m(this._vertexBuffer,L,i)}else i.push(...u)}return i}_scanlineGenerateVertexRingForCellRow(e,i,a){const o=e*this._granularityCellSize,u=o+this._granularityCellSize,h=[];for(let f=0;f<3;f++){const g=i[2*f],y=i[2*f+1],v=i[2*(f+1)%6],b=i[(2*(f+1)+1)%6],S=i[2*(f+2)%6],P=i[(2*(f+2)+1)%6],E=v-g,z=b-y,L=E===0,V=z===0,W=(o-y)/z,j=(u-y)/z,U=Math.min(W,j),Q=Math.max(W,j);if(!V&&(U>=1||Q<=0)||V&&(y<o||y>u)){b>=o&&b<=u&&h.push(a[(f+1)%3]);continue}!V&&U>0&&h.push(this._vertexToIndex(g+E*U,y+z*U));const ne=g+E*Math.max(U,0),he=g+E*Math.min(Q,1);L||this._generateIntraEdgeVertices(h,g,y,v,b,ne,he),!V&&Q<1&&h.push(this._vertexToIndex(g+E*Q,y+z*Q)),(V||b>=o&&b<=u)&&h.push(a[(f+1)%3]),!V&&(b<=o||b>=u)&&this._generateInterEdgeVertices(h,g,y,v,b,S,P,he,o,u)}return h}_generateIntraEdgeVertices(e,i,a,o,u,h,f){const g=o-i,y=u-a,v=y===0,b=v?Math.min(i,o):Math.min(h,f),S=v?Math.max(i,o):Math.max(h,f),P=Math.floor(b/this._granularityCellSize)+1,E=Math.ceil(S/this._granularityCellSize)-1;if(v?i<o:h<f)for(let z=P;z<=E;z++){const L=z*this._granularityCellSize;e.push(this._vertexToIndex(L,a+y*(L-i)/g))}else for(let z=E;z>=P;z--){const L=z*this._granularityCellSize;e.push(this._vertexToIndex(L,a+y*(L-i)/g))}}_generateInterEdgeVertices(e,i,a,o,u,h,f,g,y,v){const b=u-a,S=h-o,P=f-u,E=(y-u)/P,z=(v-u)/P,L=Math.min(E,z),V=Math.max(E,z),W=o+S*L;let j=Math.floor(Math.min(W,g)/this._granularityCellSize)+1,U=Math.ceil(Math.max(W,g)/this._granularityCellSize)-1,Q=g<W;const ne=P===0;if(ne&&(f===y||f===v))return;if(ne||L>=1||V<=0){const we=a-f,Te=h+(i-h)*Math.min((y-f)/we,(v-f)/we);j=Math.floor(Math.min(Te,g)/this._granularityCellSize)+1,U=Math.ceil(Math.max(Te,g)/this._granularityCellSize)-1,Q=g<Te}const he=b>0?v:y;if(Q)for(let we=j;we<=U;we++)e.push(this._vertexToIndex(we*this._granularityCellSize,he));else for(let we=U;we>=j;we--)e.push(this._vertexToIndex(we*this._granularityCellSize,he))}_generateOutline(e){const i=[];for(const a of e){const o=Os(a,this._granularity,!0),u=this._pointArrayToIndices(o),h=[];for(let f=1;f<u.length;f++)h.push(u[f-1]),h.push(u[f]);i.push(h)}return i}_handlePoles(e){let i=!1,a=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(i||a)&&this._fillPoles(e,i,a)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const a=e[i+1];a===Uo&&(e[i+1]=-32767),a===nc&&(e[i+1]=32766)}}_generatePoleQuad(e,i,a,o,u,h){o>u!=(h===Uo)?(e.push(i),e.push(a),e.push(this._vertexToIndex(o,h)),e.push(a),e.push(this._vertexToIndex(u,h)),e.push(this._vertexToIndex(o,h))):(e.push(a),e.push(i),e.push(this._vertexToIndex(o,h)),e.push(this._vertexToIndex(u,h)),e.push(a),e.push(this._vertexToIndex(o,h)))}_fillPoles(e,i,a){const o=this._vertexBuffer,u=gt,h=e.length;for(let f=2;f<h;f+=3){const g=e[f-2],y=e[f-1],v=e[f],b=o[2*g],S=o[2*g+1],P=o[2*y],E=o[2*y+1],z=o[2*v],L=o[2*v+1];i&&(S===0&&E===0&&this._generatePoleQuad(e,g,y,b,P,Uo),E===0&&L===0&&this._generatePoleQuad(e,y,v,P,z,Uo),L===0&&S===0&&this._generatePoleQuad(e,v,g,z,b,Uo)),a&&(S===u&&E===u&&this._generatePoleQuad(e,g,y,b,P,nc),E===u&&L===u&&this._generatePoleQuad(e,y,v,P,z,nc),L===u&&S===u&&this._generatePoleQuad(e,v,g,z,b,nc))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:o}=(function(f){const g=[],y=[];for(const v of f)if(v.length!==0){v!==f[0]&&g.push(y.length/2);for(let b=0;b<v.length;b++)y.push(v[b].x),y.push(v[b].y)}return{flattened:y,holeIndices:g}})(e);let u;this._initializeVertices(a);try{const f=(function(y,v,b=2){const S=v&&v.length,P=S?v[0]*b:y.length;let E=Yd(y,0,P,b,!0);const z=[];if(!E||E.next===E.prev)return z;let L,V,W;if(S&&(E=(function(j,U,Q,ne){const he=[];for(let we=0,Te=U.length;we<Te;we++){const Ie=Yd(j,U[we]*ne,we<Te-1?U[we+1]*ne:j.length,ne,!1);Ie===Ie.next&&(Ie.steiner=!0),he.push(Um(Ie))}he.sort(jm);for(let we=0;we<he.length;we++)Q=Vm(he[we],Q);return Q})(y,v,E,b)),y.length>80*b){L=y[0],V=y[1];let j=L,U=V;for(let Q=b;Q<P;Q+=b){const ne=y[Q],he=y[Q+1];ne<L&&(L=ne),he<V&&(V=he),ne>j&&(j=ne),he>U&&(U=he)}W=Math.max(j-L,U-V),W=W!==0?32767/W:0}return ec(E,z,b,L,V,W,0),z})(a,o),g=this._convertIndices(a,f);u=this._subdivideTrianglesScanline(g)}catch(f){console.error(f)}let h=[];return i&&(h=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(u),{verticesFlattened:this._vertexBuffer,indicesTriangles:u,indicesLineList:h}}_convertIndices(e,i){const a=[];for(let o=0;o<i.length;o++)a.push(this._vertexToIndex(e[2*i[o]],e[2*i[o]+1]));return a}_pointArrayToIndices(e){const i=[];for(let a=0;a<e.length;a++){const o=e[a];i.push(this._vertexToIndex(o.x,o.y))}return i}}function tp(r,e,i,a=!0){return new qm(i,e).subdividePolygonInternal(r,a)}function Os(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],o=r[r.length-1],u=i&&(a.x!==o.x||a.y!==o.y);if(e<2)return u?[...r,r[0]]:[...r];const h=Math.floor(gt/e),f=[];f.push(new be(r[0].x,r[0].y));const g=r.length,y=u?g:g-1;for(let v=0;v<y;v++){const b=r[v],S=v<g-1?r[v+1]:r[0],P=b.x,E=b.y,z=S.x,L=S.y,V=P!==z,W=E!==L;if(!V&&!W)continue;const j=z-P,U=L-E,Q=Math.abs(j),ne=Math.abs(U);let he=P,we=E;for(;;){const Ie=j>0?(Math.floor(he/h)+1)*h:(Math.ceil(he/h)-1)*h,De=U>0?(Math.floor(we/h)+1)*h:(Math.ceil(we/h)-1)*h,Ee=Math.abs(he-Ie),Se=Math.abs(we-De),ye=Math.abs(he-z),je=Math.abs(we-L),Ve=V?Ee/Q:Number.POSITIVE_INFINITY,We=W?Se/ne:Number.POSITIVE_INFINITY;if((ye<=Ee||!V)&&(je<=Se||!W))break;if(Ve<We&&V||!W){he=Ie,we+=U*Ve;const Ue=new be(he,Math.round(we));f[f.length-1].x===Ue.x&&f[f.length-1].y===Ue.y||f.push(Ue)}else{he+=j*We,we=De;const Ue=new be(Math.round(he),we);f[f.length-1].x===Ue.x&&f[f.length-1].y===Ue.y||f.push(Ue)}}const Te=new be(z,L);f[f.length-1].x===Te.x&&f[f.length-1].y===Te.y||f.push(Te)}return f}function $m(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,o=r[2*e[0]];for(let g=1;g<e.length;g++){const y=r[2*e[g]];y<o&&(o=y,a=g)}const u=e.length;let h=a,f=(h+1)%u;for(;;){const g=h-1>=0?h-1:u-1,y=(f+1)%u,v=r[2*e[g]],b=r[2*e[y]],S=r[2*e[h]],P=r[2*e[h]+1],E=r[2*e[f]+1];let z=!1;if(v<b)z=!0;else if(v>b)z=!1;else{const L=E-P,V=-(r[2*e[f]]-S),W=P<E?1:-1;((v-S)*L+(r[2*e[g]+1]-P)*V)*W>((b-S)*L+(r[2*e[y]+1]-P)*V)*W&&(z=!0)}if(z){const L=e[g],V=e[h],W=e[f];L!==V&&L!==W&&V!==W&&i.push(W,V,L),h--,h<0&&(h=u-1)}else{const L=e[y],V=e[h],W=e[f];L!==V&&L!==W&&V!==W&&i.push(W,V,L),f++,f>=u&&(f=0)}if(g===y)break}}function ip(r,e,i,a,o,u,h,f,g){const y=o.length/2,v=h&&f&&g;if(y<Le.MAX_VERTEX_ARRAY_LENGTH){const b=e.prepareSegment(y,i,a),S=b.vertexLength;for(let z=0;z<u.length;z+=3)a.emplaceBack(S+u[z],S+u[z+1],S+u[z+2]);let P,E;b.vertexLength+=y,b.primitiveLength+=u.length/3,v&&(E=h.prepareSegment(y,i,f),P=E.vertexLength,E.vertexLength+=y);for(let z=0;z<o.length;z+=2)r(o[z],o[z+1]);if(v)for(let z=0;z<g.length;z++){const L=g[z];for(let V=1;V<L.length;V+=2)f.emplaceBack(P+L[V-1],P+L[V]);E.primitiveLength+=L.length/2}}else(function(b,S,P,E,z,L){const V=[];for(let ne=0;ne<E.length/2;ne++)V.push(-1);const W={count:0};let j=0,U=b.getOrCreateLatestSegment(S,P),Q=U.vertexLength;for(let ne=2;ne<z.length;ne+=3){const he=z[ne-2],we=z[ne-1],Te=z[ne];let Ie=V[he]<j,De=V[we]<j,Ee=V[Te]<j;U.vertexLength+((Ie?1:0)+(De?1:0)+(Ee?1:0))>Le.MAX_VERTEX_ARRAY_LENGTH&&(U=b.createNewSegment(S,P),j=W.count,Ie=!0,De=!0,Ee=!0,Q=0);const Se=ac(V,E,L,W,he,Ie,U),ye=ac(V,E,L,W,we,De,U),je=ac(V,E,L,W,Te,Ee,U);P.emplaceBack(Q+Se-j,Q+ye-j,Q+je-j),U.primitiveLength++}})(e,i,a,o,u,r),v&&(function(b,S,P,E,z,L){const V=[];for(let ne=0;ne<E.length/2;ne++)V.push(-1);const W={count:0};let j=0,U=b.getOrCreateLatestSegment(S,P),Q=U.vertexLength;for(let ne=0;ne<z.length;ne++){const he=z[ne];for(let we=1;we<z[ne].length;we+=2){const Te=he[we-1],Ie=he[we];let De=V[Te]<j,Ee=V[Ie]<j;U.vertexLength+((De?1:0)+(Ee?1:0))>Le.MAX_VERTEX_ARRAY_LENGTH&&(U=b.createNewSegment(S,P),j=W.count,De=!0,Ee=!0,Q=0);const Se=ac(V,E,L,W,Te,De,U),ye=ac(V,E,L,W,Ie,Ee,U);P.emplaceBack(Q+Se-j,Q+ye-j),U.primitiveLength++}}})(h,i,f,o,g,r),e.forceNewSegmentOnNextPrepare(),h==null||h.forceNewSegmentOnNextPrepare()}function ac(r,e,i,a,o,u,h){if(u){const f=a.count;return i(e[2*o],e[2*o+1]),r[o]=a.count,a.count++,h.vertexLength++,f}return r[o]}class Bh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new q,this.indexArray=new ge,this.indexArray2=new Ae,this.programConfigurations=new ea(e.layers,e.zoom),this.segments=new Le,this.segments2=new Le,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.hasDependencies=Pu("fill",this.layers,i);const o=this.layers[0].layout.get("fill-sort-key"),u=!o.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,S=vn(f,b);if(!this.layers[0]._featureFilter.filter(new Tt(this.zoom),S,a))continue;const P=u?o.evaluate(S,{},a,i.availableImages):void 0,E={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:b?S.geometry:xn(f),patterns:{},sortKey:P};h.push(E)}u&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:v}=f;if(this.hasDependencies){const b=Rh("fill",this.layers,f,{zoom:this.zoom},i);this.patternFeatures.push(b)}else this.addFeature(f,g,y,a,{},i.subdivisionGranularity);i.featureIndex.insert(e[y].feature,g,y,v,this.index)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}addFeatures(e,i,a){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,i,a,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Rm),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,i,a,o,u,h){for(const f of no(i,500)){const g=tp(f,o,h.fill.getGranularityForZoomLevel(o.z)),y=this.layoutVertexArray;ip(((v,b)=>{y.emplaceBack(v,b)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:u,canonical:o})}}let rp,np;Be("FillBucket",Bh,{omit:["layers","patternFeatures"]});var Zm={get paint(){return np=np||new Oi({"fill-antialias":new qe(ie.paint_fill["fill-antialias"]),"fill-opacity":new He(ie.paint_fill["fill-opacity"]),"fill-color":new He(ie.paint_fill["fill-color"]),"fill-outline-color":new He(ie.paint_fill["fill-outline-color"]),"fill-translate":new qe(ie.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(ie.paint_fill["fill-translate-anchor"]),"fill-pattern":new Cs(ie.paint_fill["fill-pattern"])})},get layout(){return rp=rp||new Oi({"fill-sort-key":new He(ie.layout_fill["fill-sort-key"])})}};class Wm extends hr{constructor(e,i){super(e,Zm,i)}recalculate(e,i){super.recalculate(e,i);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Bh(e)}queryRadius(){return Tu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:a,pixelsToTileUnits:o}){return Fd(Su(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,o),i)}isTileClipped(){return!0}}const Hm=ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Xm=ei([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ym}=Hm;class sc{constructor(e,i,a,o,u){this.properties={},this.extent=a,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=o,this._values=u,e.readFields(Km,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,a=[];let o,u=1,h=0,f=0,g=0;for(;e.pos<i;){if(h<=0){const y=e.readVarint();u=7&y,h=y>>3}if(h--,u===1||u===2)f+=e.readSVarint(),g+=e.readSVarint(),u===1&&(o&&a.push(o),o=[]),o&&o.push(new be(f,g));else{if(u!==7)throw new Error(`unknown command ${u}`);o&&o.push(o[0].clone())}}return o&&a.push(o),a}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let a=1,o=0,u=0,h=0,f=1/0,g=-1/0,y=1/0,v=-1/0;for(;e.pos<i;){if(o<=0){const b=e.readVarint();a=7&b,o=b>>3}if(o--,a===1||a===2)u+=e.readSVarint(),h+=e.readSVarint(),u<f&&(f=u),u>g&&(g=u),h<y&&(y=h),h>v&&(v=h);else if(a!==7)throw new Error(`unknown command ${a}`)}return[f,y,g,v]}toGeoJSON(e,i,a){const o=this.extent*Math.pow(2,a),u=this.extent*e,h=this.extent*i,f=this.loadGeometry();function g(S){return[360*(S.x+u)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(S.y+h)/o)*Math.PI))-90]}function y(S){return S.map(g)}let v;if(this.type===1){const S=[];for(const E of f)S.push(E[0]);const P=y(S);v=S.length===1?{type:"Point",coordinates:P[0]}:{type:"MultiPoint",coordinates:P}}else if(this.type===2){const S=f.map(y);v=S.length===1?{type:"LineString",coordinates:S[0]}:{type:"MultiLineString",coordinates:S}}else{if(this.type!==3)throw new Error("unknown feature type");{const S=ap(f),P=[];for(const E of S)P.push(E.map(y));v=P.length===1?{type:"Polygon",coordinates:P[0]}:{type:"MultiPolygon",coordinates:P}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function Km(r,e,i){r===1?e.id=i.readVarint():r===2?(function(a,o){const u=a.readVarint()+a.pos;for(;a.pos<u;){const h=o._keys[a.readVarint()],f=o._values[a.readVarint()];o.properties[h]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function ap(r){const e=r.length;if(e<=1)return[r];const i=[];let a,o;for(let u=0;u<e;u++){const h=Jm(r[u]);h!==0&&(o===void 0&&(o=h<0),o===h<0?(a&&i.push(a),a=[r[u]]):a&&a.push(r[u]))}return a&&i.push(a),i}function Jm(r){let e=0;for(let i,a,o=0,u=r.length,h=u-1;o<u;h=o++)i=r[o],a=r[h],e+=(a.x-i.x)*(i.y+a.y);return e}sc.types=["Unknown","Point","LineString","Polygon"];class Qm{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(eg,this,i),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];const i=this._pbf.readVarint()+this._pbf.pos;return new sc(this._pbf,i,this.extent,this._keys,this._values)}}function eg(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(a){let o=null;const u=a.readVarint()+a.pos;for(;a.pos<u;){const h=a.readVarint()>>3;o=h===1?a.readString():h===2?a.readFloat():h===3?a.readDouble():h===4?a.readVarint64():h===5?a.readVarint():h===6?a.readSVarint():h===7?a.readBoolean():null}if(o==null)throw new Error("unknown feature value");return o})(i))}class sp{constructor(e,i){this.layers=e.readFields(tg,{},i)}}function tg(r,e,i){if(r===3){const a=new Qm(i,i.readVarint()+i.pos);a.length&&(e[a.name]=a)}}const Oh=Math.pow(2,13);function oc(r,e,i,a,o,u,h,f){r.emplaceBack(e,i,2*Math.floor(a*Oh)+h,o*Oh*2,u*Oh*2,Math.round(f))}class jh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Y,this.centroidVertexArray=new G,this.indexArray=new ge,this.programConfigurations=new ea(e.layers,e.zoom),this.segments=new Le,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.features=[],this.hasDependencies=Pu("fill-extrusion",this.layers,i);for(const{feature:o,id:u,index:h,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,y=vn(o,g);if(!this.layers[0]._featureFilter.filter(new Tt(this.zoom),y,a))continue;const v={id:u,sourceLayerIndex:f,index:h,geometry:g?y.geometry:xn(o),properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Rh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,h,a,{},i.subdivisionGranularity),i.featureIndex.insert(o,v.geometry,h,f,this.index,!0)}}addFeatures(e,i,a){for(const o of this.features){const{geometry:u}=o;this.addFeature(o,u,o.index,i,a,e.subdivisionGranularity)}}update(e,i,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ym),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Xm.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,i,a,o,u,h){for(const f of no(i,500)){const g={x:0,y:0,sampleCount:0},y=this.layoutVertexArray.length;this.processPolygon(g,o,e,f,h);const v=this.layoutVertexArray.length-y,b=Math.floor(g.x/g.sampleCount),S=Math.floor(g.y/g.sampleCount);for(let P=0;P<v;P++)this.centroidVertexArray.emplaceBack(b,S)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:u,canonical:o})}processPolygon(e,i,a,o,u){if(o.length<1||op(o[0]))return;for(const b of o)b.length!==0&&ig(e,b);const h={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},f=u.fill.getGranularityForZoomLevel(i.z),g=sc.types[a.type]==="Polygon";for(const b of o){if(b.length===0||op(b))continue;const S=Os(b,f,g);this._generateSideFaces(S,h)}if(!g)return;const y=tp(o,i,f,!1),v=this.layoutVertexArray;ip(((b,S)=>{oc(v,b,S,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles)}_generateSideFaces(e,i){let a=0;for(let o=1;o<e.length;o++){const u=e[o],h=e[o-1];if(rg(u,h))continue;i.segment.vertexLength+4>Le.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const f=u.sub(h)._perp()._unit(),g=h.dist(u);a+g>32768&&(a=0),oc(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,0,a),oc(this.layoutVertexArray,u.x,u.y,f.x,f.y,0,1,a),a+=g,oc(this.layoutVertexArray,h.x,h.y,f.x,f.y,0,0,a),oc(this.layoutVertexArray,h.x,h.y,f.x,f.y,0,1,a);const y=i.segment.vertexLength;this.indexArray.emplaceBack(y,y+2,y+1),this.indexArray.emplaceBack(y+1,y+2,y+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function ig(r,e){for(let i=0;i<e.length;i++){const a=e[i];i===e.length-1&&e[0].x===a.x&&e[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function rg(r,e){return r.x===e.x&&(r.x<0||r.x>gt)||r.y===e.y&&(r.y<0||r.y>gt)}function op(r){return r.every((e=>e.x<0))||r.every((e=>e.x>gt))||r.every((e=>e.y<0))||r.every((e=>e.y>gt))}let lp;Be("FillExtrusionBucket",jh,{omit:["layers","features"]});var ng={get paint(){return lp=lp||new Oi({"fill-extrusion-opacity":new qe(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new He(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cs(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new He(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new He(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ag extends hr{constructor(e,i){super(e,ng,i)}createBucket(e){return new jh(e)}queryRadius(){return Tu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:o,transform:u,pixelsToTileUnits:h,pixelPosMatrix:f}){const g=Su(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-u.bearingInRadians,h),y=this.paint.get("fill-extrusion-height").evaluate(i,a),v=this.paint.get("fill-extrusion-base").evaluate(i,a),b=(function(P,E){const z=[];for(const L of P){const V=[L.x,L.y,0,1];nn(V,V,E),z.push(new be(V[0]/V[3],V[1]/V[3]))}return z})(g,f),S=(function(P,E,z,L){const V=[],W=[],j=L[8]*E,U=L[9]*E,Q=L[10]*E,ne=L[11]*E,he=L[8]*z,we=L[9]*z,Te=L[10]*z,Ie=L[11]*z;for(const De of P){const Ee=[],Se=[];for(const ye of De){const je=ye.x,Ve=ye.y,We=L[0]*je+L[4]*Ve+L[12],Ue=L[1]*je+L[5]*Ve+L[13],ct=L[2]*je+L[6]*Ve+L[14],Vt=L[3]*je+L[7]*Ve+L[15],li=ct+Q,Ci=Vt+ne,Fr=We+he,Xi=Ue+we,vi=ct+Te,Ai=Vt+Ie,ri=new be((We+j)/Ci,(Ue+U)/Ci);ri.z=li/Ci,Ee.push(ri);const bi=new be(Fr/Ai,Xi/Ai);bi.z=vi/Ai,Se.push(bi)}V.push(Ee),W.push(Se)}return[V,W]})(o,v,y,f);return(function(P,E,z){let L=1/0;Fd(z,E)&&(L=cp(z,E[0]));for(let V=0;V<E.length;V++){const W=E[V],j=P[V];for(let U=0;U<W.length-1;U++){const Q=W[U],ne=[Q,W[U+1],j[U+1],j[U],Q];Bo(z,ne)&&(L=Math.min(L,cp(z,ne)))}}return L!==1/0&&L})(S[0],S[1],b)}}function lc(r,e){return r.x*e.x+r.y*e.y}function cp(r,e){if(r.length===1){let i=0;const a=e[i++];let o;for(;!o||a.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=o.sub(a),g=u.sub(a),y=h.sub(a),v=lc(f,f),b=lc(f,g),S=lc(g,g),P=lc(y,f),E=lc(y,g),z=v*S-b*b,L=(S*P-b*E)/z,V=(v*E-b*P)/z,W=a.z*(1-L-V)+o.z*L+u.z*V;if(isFinite(W))return W}return 1/0}{let i=1/0;for(const a of e)i=Math.min(i,a.z);return i}}const sg=ei([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:og}=sg,lg=ei([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:cg}=lg,ug=Math.cos(Math.PI/180*37.5),up=Math.pow(2,14)/.5;class Vh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new te,this.layoutVertexArray2=new H,this.indexArray=new ge,this.programConfigurations=new ea(e.layers,e.zoom),this.segments=new Le,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,a){this.hasDependencies=Pu("line",this.layers,i)||this.hasLineDasharray(this.layers);const o=this.layers[0].layout.get("line-sort-key"),u=!o.isConstant(),h=[];for(const{feature:f,id:g,index:y,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,S=vn(f,b);if(!this.layers[0]._featureFilter.filter(new Tt(this.zoom),S,a))continue;const P=u?o.evaluate(S,{},a):void 0,E={id:g,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:b?S.geometry:xn(f),patterns:{},dashes:{},sortKey:P};h.push(E)}u&&h.sort(((f,g)=>f.sortKey-g.sortKey));for(const f of h){const{geometry:g,index:y,sourceLayerIndex:v}=f;this.hasDependencies?(Pu("line",this.layers,i)?Rh("line",this.layers,f,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,f,this.zoom,i),this.patternFeatures.push(f)):this.addFeature(f,g,y,a,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[y].feature,g,y,v,this.index)}}update(e,i,a,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:a,dashPositions:o})}addFeatures(e,i,a,o){for(const u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,i,a,o,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,cg)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,og),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,a,o,u,h,f){const g=this.layers[0].layout,y=g.get("line-join").evaluate(e,{}),v=g.get("line-cap"),b=g.get("line-miter-limit"),S=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const P of i)this.addLine(P,e,y,v,b,S,o,f);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,{imagePositions:u,dashPositions:h,canonical:o})}addLine(e,i,a,o,u,h,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Os(e,f?g.line.getGranularityForZoomLevel(f.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let j=0;j<e.length-1;j++)this.totalDistance+=e[j].dist(e[j+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const y=sc.types[i.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let b=0;for(;b<v-1&&e[b].equals(e[b+1]);)b++;if(v<(y?3:2))return;a==="bevel"&&(u=1.05);const S=this.overscaling<=16?122880/(512*this.overscaling):0,P=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let E,z,L,V,W;this.e1=this.e2=-1,y&&(E=e[v-2],W=e[b].sub(E)._unit()._perp());for(let j=b;j<v;j++){if(L=j===v-1?y?e[b+1]:void 0:e[j+1],L&&e[j].equals(L))continue;W&&(V=W),E&&(z=E),E=e[j],W=L?L.sub(E)._unit()._perp():V,V=V||W;let U=V.add(W);U.x===0&&U.y===0||U._unit();const Q=V.x*W.x+V.y*W.y,ne=U.x*W.x+U.y*W.y,he=ne!==0?1/ne:1/0,we=2*Math.sqrt(2-2*ne),Te=ne<ug&&z&&L,Ie=V.x*W.y-V.y*W.x>0;if(Te&&j>b){const Se=E.dist(z);if(Se>2*S){const ye=E.sub(E.sub(z)._mult(S/Se)._round());this.updateDistance(z,ye),this.addCurrentVertex(ye,V,0,0,P),z=ye}}const De=z&&L;let Ee=De?a:y?"butt":o;if(De&&Ee==="round"&&(he<h?Ee="miter":he<=2&&(Ee="fakeround")),Ee==="miter"&&he>u&&(Ee="bevel"),Ee==="bevel"&&(he>2&&(Ee="flipbevel"),he<u&&(Ee="miter")),z&&this.updateDistance(z,E),Ee==="miter")U._mult(he),this.addCurrentVertex(E,U,0,0,P);else if(Ee==="flipbevel"){if(he>100)U=W.mult(-1);else{const Se=he*V.add(W).mag()/V.sub(W).mag();U._perp()._mult(Se*(Ie?-1:1))}this.addCurrentVertex(E,U,0,0,P),this.addCurrentVertex(E,U.mult(-1),0,0,P)}else if(Ee==="bevel"||Ee==="fakeround"){const Se=-Math.sqrt(he*he-1),ye=Ie?Se:0,je=Ie?0:Se;if(z&&this.addCurrentVertex(E,V,ye,je,P),Ee==="fakeround"){const Ve=Math.round(180*we/Math.PI/20);for(let We=1;We<Ve;We++){let Ue=We/Ve;if(Ue!==.5){const Vt=Ue-.5;Ue+=Ue*Vt*(Ue-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*Vt*Vt+(.848013+Q*(.215638*Q-1.06021)))}const ct=W.sub(V)._mult(Ue)._add(V)._unit()._mult(Ie?-1:1);this.addHalfVertex(E,ct.x,ct.y,!1,Ie,0,P)}}L&&this.addCurrentVertex(E,W,-ye,-je,P)}else if(Ee==="butt")this.addCurrentVertex(E,U,0,0,P);else if(Ee==="square"){const Se=z?1:-1;this.addCurrentVertex(E,U,Se,Se,P)}else Ee==="round"&&(z&&(this.addCurrentVertex(E,V,0,0,P),this.addCurrentVertex(E,V,1,1,P,!0)),L&&(this.addCurrentVertex(E,W,-1,-1,P,!0),this.addCurrentVertex(E,W,0,0,P)));if(Te&&j<v-1){const Se=E.dist(L);if(Se>2*S){const ye=E.add(L.sub(E)._mult(S/Se)._round());this.updateDistance(E,ye),this.addCurrentVertex(ye,W,0,0,P),E=ye}}}}addCurrentVertex(e,i,a,o,u,h=!1){const f=i.y*o-i.x,g=-i.y-i.x*o;this.addHalfVertex(e,i.x+i.y*a,i.y-i.x*a,h,!1,a,u),this.addHalfVertex(e,f,g,h,!0,-o,u),this.distance>up/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,a,o,u,h))}addHalfVertex({x:e,y:i},a,o,u,h,f,g){const y=.5*(this.lineClips?this.scaledDistance*(up-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*a)+128,Math.round(63*o)+128,1+(f===0?0:f<0?-1:1)|(63&y)<<2,y>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),h?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const a=i.paint.get("line-dasharray");
5if(a&&!a.isConstant())return!0}return!1}addLineDashDependencies(e,i,a,o){for(const u of e){const h=u.paint.get("line-dasharray");if(!h||h.value.kind==="constant")continue;const f=u.layout.get("line-cap")==="round",g={dasharray:h.value.evaluate({zoom:a-1},i,{}),round:f},y={dasharray:h.value.evaluate({zoom:a},i,{}),round:f},v={dasharray:h.value.evaluate({zoom:a+1},i,{}),round:f},b=`${g.dasharray.join(",")},${g.round}`,S=`${y.dasharray.join(",")},${y.round}`,P=`${v.dasharray.join(",")},${v.round}`;o.dashDependencies[b]=g,o.dashDependencies[S]=y,o.dashDependencies[P]=v,i.dashes[u.id]={min:b,mid:S,max:P}}}}let hp,dp;Be("LineBucket",Vh,{omit:["layers","patternFeatures"]});var pp={get paint(){return dp=dp||new Oi({"line-opacity":new He(ie.paint_line["line-opacity"]),"line-color":new He(ie.paint_line["line-color"]),"line-translate":new qe(ie.paint_line["line-translate"]),"line-translate-anchor":new qe(ie.paint_line["line-translate-anchor"]),"line-width":new He(ie.paint_line["line-width"]),"line-gap-width":new He(ie.paint_line["line-gap-width"]),"line-offset":new He(ie.paint_line["line-offset"]),"line-blur":new He(ie.paint_line["line-blur"]),"line-dasharray":new Cs(ie.paint_line["line-dasharray"]),"line-pattern":new Cs(ie.paint_line["line-pattern"]),"line-gradient":new Co(ie.paint_line["line-gradient"])})},get layout(){return hp=hp||new Oi({"line-cap":new qe(ie.layout_line["line-cap"]),"line-join":new He(ie.layout_line["line-join"]),"line-miter-limit":new qe(ie.layout_line["line-miter-limit"]),"line-round-limit":new qe(ie.layout_line["line-round-limit"]),"line-sort-key":new He(ie.layout_line["line-sort-key"])})}};class hg extends He{possiblyEvaluate(e,i){return i=new Tt(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,a,o){return i=Gi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,a,o)}}let Cu;class dg extends hr{constructor(e,i){super(e,pp,i),this.gradientVersion=0,Cu||(Cu=new hg(pp.paint.properties["line-width"].specification),Cu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(a){return a._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof hn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=Cu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Vh(e)}queryRadius(e){const i=e,a=fp(jo("line-width",this,i),jo("line-gap-width",this,i)),o=jo("line-offset",this,i);return a/2+Math.abs(o)+Tu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:a,geometry:o,transform:u,pixelsToTileUnits:h}){const f=Su(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-u.bearingInRadians,h),g=h/2*fp(this.paint.get("line-width").evaluate(i,a),this.paint.get("line-gap-width").evaluate(i,a)),y=this.paint.get("line-offset").evaluate(i,a);return y&&(o=(function(v,b){const S=[];for(let P=0;P<v.length;P++){const E=vm(v[P]),z=[];for(let L=0;L<E.length;L++){const V=E[L],W=E[L-1],j=E[L+1],U=L===0?new be(0,0):V.sub(W)._unit()._perp(),Q=L===E.length-1?new be(0,0):j.sub(V)._unit()._perp(),ne=U._add(Q)._unit(),he=ne.x*Q.x+ne.y*Q.y;he!==0&&ne._mult(1/he),z.push(ne._mult(b)._add(V))}S.push(z)}return S})(o,y*h)),(function(v,b,S){for(let P=0;P<b.length;P++){const E=b[P];if(v.length>=3){for(let z=0;z<E.length;z++)if(Oo(v,E[z]))return!0}if(_m(v,E,S))return!0}return!1})(f,o,g)}isTileClipped(){return!0}}function fp(r,e){return e>0?e+2*r:r}const pg=ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),fg=ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const mg=ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ei([{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"}]);const mp=ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),gg=ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function _g(r,e,i){return r.sections.forEach((a=>{a.text=(function(o,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?o=o.toLocaleUpperCase():f==="lowercase"&&(o=o.toLocaleLowerCase()),gn.applyArabicShaping&&(o=gn.applyArabicShaping(o)),o})(a.text,e,i)})),r}ei([{name:"triangle",components:3,type:"Uint16"}]),ei([{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"}]),ei([{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"}]),ei([{type:"Float32",name:"offsetX"}]),ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var fi=24;const cc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},yg={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},xg={40:!0};function gp(r,e,i,a,o,u){if("fontStack"in e){const h=i[e.fontStack],f=h&&h[r];return f?f.metrics.advance*e.scale+o:0}{const h=a[e.imageName];return h?h.displaySize[0]*e.scale*fi/u+o:0}}function _p(r,e,i,a){const o=Math.pow(r-e,2);return a?r<e?o/2:2*o:o+Math.abs(i)*i}function vg(r,e,i){let a=0;return r===10&&(a-=1e4),i&&(a+=150),r!==40&&r!==65288||(a+=50),e!==41&&e!==65289||(a+=50),a}function yp(r,e,i,a,o,u){let h=null,f=_p(e,i,o,u);for(const g of a){const y=_p(e-g.x,i,o,u)+g.badness;y<=f&&(h=g,f=y)}return{index:r,x:e,priorBreak:h,badness:f}}function xp(r){return r?xp(r.priorBreak).concat(r.index):[]}class Go{constructor(e="",i=[],a=[]){this.text=e,this.sections=i,this.sectionIndex=a,this.imageSectionID=null}static fromFeature(e,i){const a=new Go;for(let o=0;o<e.sections.length;o++){const u=e.sections[o];u.image?a.addImageSection(u):a.addTextSection(u,i)}return a}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 i="",a={premature:!0,value:void 0};const o=e[Symbol.iterator]();let u=o.next();const h=e[Symbol.iterator]();h.next();let f=h.next();for(;!u.done;)i+=!f.done&&jl(f.value.codePointAt(0))&&!cc[f.value]||!a.premature&&jl(a.value.codePointAt(0))&&!cc[a.value]||!cc[u.value]?u.value:cc[u.value],a={value:u.value,premature:!1},u=o.next(),f=h.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,a=this.text.match(/\S\s*$/),o=a?a[0].length-1:0;this.text=this.text.substring(i,this.text.length-o),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-o)}substring(e,i){const a=[...this.text].slice(e,i).join(""),o=this.sectionIndex.slice(e,i);return new Go(a,this.sections,o)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,a=0;for(let o=0;o<this.length();o++){const u=this.getSection(o);if("imageName"in u){const h=e[u.imageName];if(!h)continue;const f=h.displaySize;i=Math.max(i,f[0]),a=Math.max(a,f[1])}}return{maxImageWidth:i,maxImageHeight:a}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const a=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>a)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void Si("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):Si("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,a,o,u){const h=[],f=this.determineAverageLineWidth(e,i,a,o,u),g=this.hasZeroWidthSpaces();let y=0,v=0;const b=this.text[Symbol.iterator]();let S=b.next();const P=this.text[Symbol.iterator]();P.next();let E=P.next();const z=this.text[Symbol.iterator]();z.next(),z.next();let L=z.next();for(;!S.done;){const V=this.getSection(v),W=S.value.codePointAt(0);if(hu(W)||(y+=gp(W,V,a,o,e,u)),!E.done){const j=Ms(W),U=E.value.codePointAt(0);(yg[W]||j||"imageName"in V||!L.done&&xg[U])&&h.push(yp(v+1,y,f,h,vg(W,U,j&&g),!1))}v++,S=b.next(),E=P.next(),L=z.next()}return xp(yp(this.length(),y,f,h,0,!0))}determineAverageLineWidth(e,i,a,o,u){let h=0,f=0;for(const g of this.text){const y=this.getSection(f);h+=gp(g.codePointAt(0),y,a,o,e,u),f++}return h/Math.max(1,Math.ceil(h/i))}}const Nh=4294967296,vp=1/Nh,bp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class Au{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,i,a=this.length){for(;this.pos<a;){const o=this.readVarint(),u=o>>3,h=this.pos;
vendor: 11,354 bytes, line 5
5this.type=7&o,e(u,i,this),this.pos===h&&this.skip(o)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Nh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Nh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let a,o;return o=i[this.pos++],a=127&o,o<128?a:(o=i[this.pos++],a|=(127&o)<<7,o<128?a:(o=i[this.pos++],a|=(127&o)<<14,o<128?a:(o=i[this.pos++],a|=(127&o)<<21,o<128?a:(o=i[this.pos],a|=(15&o)<<28,(function(u,h,f){const g=f.buf;let y,v;if(v=g[f.pos++],y=(112&v)>>4,v<128||(v=g[f.pos++],y|=(127&v)<<3,v<128)||(v=g[f.pos++],y|=(127&v)<<10,v<128)||(v=g[f.pos++],y|=(127&v)<<17,v<128)||(v=g[f.pos++],y|=(127&v)<<24,v<128)||(v=g[f.pos++],y|=(1&v)<<31,v<128))return qo(u,y,h);throw new Error("Expected varint not more than 10 bytes")})(a,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&bp?bp.decode(this.buf.subarray(i,e)):(function(a,o,u){let h="",f=o;for(;f<u;){const g=a[f];let y,v,b,S=null,P=g>239?4:g>223?3:g>191?2:1;if(f+P>u)break;P===1?g<128&&(S=g):P===2?(y=a[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):P===3?(y=a[f+1],v=a[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):P===4&&(y=a[f+1],v=a[f+2],b=a[f+3],(192&y)==128&&(192&v)==128&&(192&b)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&b,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),f+=P}return h})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const a=this.readPackedEnd();for(;this.pos<a;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const a=new Uint8Array(i);a.set(this.buf),this.buf=a,this.dataView=new DataView(a.buffer),this.length=i}}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*vp),!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*vp),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,a){let o,u;if(i>=0?(o=i%4294967296|0,u=i/4294967296|0):(o=~(-i%4294967296),u=~(-i/4294967296),4294967295^o?o=o+1|0:(o=0,u=u+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),(function(h,f,g){g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,g.buf[g.pos]=127&(h>>>=7)})(o,0,a),(function(h,f){const g=(7&h)<<4;f.buf[f.pos++]|=g|((h>>>=3)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h|((h>>>=7)?128:0),h&&(f.buf[f.pos++]=127&h)))))})(u,a)})(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++;const i=this.pos;this.pos=(function(o,u,h){for(let f,g,y=0;y<u.length;y++){if(f=u.charCodeAt(y),f>55295&&f<57344){if(!g){f>56319||y+1===u.length?(o[h++]=239,o[h++]=191,o[h++]=189):g=f;continue}if(f<56320){o[h++]=239,o[h++]=191,o[h++]=189,g=f;continue}f=g-55296<<10|f-56320|65536,g=null}else g&&(o[h++]=239,o[h++]=191,o[h++]=189,g=null);f<128?o[h++]=f:(f<2048?o[h++]=f>>6|192:(f<65536?o[h++]=f>>12|224:(o[h++]=f>>18|240,o[h++]=f>>12&63|128),o[h++]=f>>6&63|128),o[h++]=63&f|128)}return h})(this.buf,e,this.pos);const a=this.pos-i;a>=128&&wp(i,a,this),this.pos=i-1,this.writeVarint(a),this.pos+=a}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){const i=e.length;this.writeVarint(i),this.realloc(i);for(let a=0;a<i;a++)this.buf[this.pos++]=e[a]}writeRawMessage(e,i){this.pos++;const a=this.pos;e(i,this);const o=this.pos-a;o>=128&&wp(a,o,this),this.pos=a-1,this.writeVarint(o),this.pos+=o}writeMessage(e,i,a){this.writeTag(e,2),this.writeRawMessage(i,a)}writePackedVarint(e,i){i.length&&this.writeMessage(e,bg,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,wg,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,Pg,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,Tg,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,Sg,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,Mg,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,Ig,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,Eg,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,Cg,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function qo(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function wp(r,e,i){const a=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(a);for(let o=i.pos-1;o>=r;o--)i.buf[o+a]=i.buf[o]}function bg(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function wg(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function Tg(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function Sg(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function Pg(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function Mg(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function Ig(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function Eg(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function Cg(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function Ag(r,e,i){r===1&&i.readMessage(zg,e)}function zg(r,e,i){if(r===3){const{id:a,bitmap:o,width:u,height:h,left:f,top:g,advance:y}=i.readMessage(kg,{});e.push({id:a,bitmap:new Ql({width:u+6,height:h+6},o),metrics:{width:u,height:h,left:f,top:g,advance:y}})}}function kg(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function Tp(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort(((h,f)=>f.h-h.h));const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,u=0;for(const h of r)for(let f=a.length-1;f>=0;f--){const g=a[f];if(!(h.w>g.w||h.h>g.h)){if(h.x=g.x,h.y=g.y,u=Math.max(u,h.y+h.h),o=Math.max(o,h.x+h.w),h.w===g.w&&h.h===g.h){const y=a.pop();y&&f<a.length&&(a[f]=y)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(a.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:o,h:u,fill:e/(o*u)||0}}class Uh{constructor(e,{pixelRatio:i,version:a,stretchX:o,stretchY:u,content:h,textFitWidth:f,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=u,this.content=h,this.version=a,this.textFitWidth=f,this.textFitHeight=g}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 Sp{constructor(e,i){const a={},o={};this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,u),this.addImages(i,o,u);const{w:h,h:f}=Tp(u),g=new rr({width:h||1,height:f||1});for(const y in e){const v=e[y],b=a[y].paddedRect;rr.copy(v.data,g,{x:0,y:0},{x:b.x+1,y:b.y+1},v.data)}for(const y in i){const v=i[y],b=o[y].paddedRect,S=b.x+1,P=b.y+1,E=v.data.width,z=v.data.height;rr.copy(v.data,g,{x:0,y:0},{x:S,y:P},v.data),rr.copy(v.data,g,{x:0,y:z-1},{x:S,y:P-1},{width:E,height:1}),rr.copy(v.data,g,{x:0,y:0},{x:S,y:P+z},{width:E,height:1}),rr.copy(v.data,g,{x:E-1,y:0},{x:S-1,y:P},{width:1,height:z}),rr.copy(v.data,g,{x:0,y:0},{x:S+E,y:P},{width:1,height:z})}this.image=g,this.iconPositions=a,this.patternPositions=o}addImages(e,i,a){for(const o in e){const u=e[o],h={x:0,y:0,w:u.data.width+2,h:u.data.height+2};a.push(h),i[o]=new Uh(h,u),u.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in e.updatedImages)this.patchUpdatedImage(this.iconPositions[a],e.getImage(a),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a),i)}patchUpdatedImage(e,i,a){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,u]=e.tl;a.update(i.data,void 0,{x:o,y:u})}}var Ba;
5function zu(r,e,i,a,o,u,h,f,g,y,v,b,S,P,E){const z=Go.fromFeature(r,o);let L;b===C.az.vertical&&z.verticalizePunctuation();let V=z.determineLineBreaks(y,u,e,a,P);const{processBidirectionalText:W,processStyledBidirectionalText:j}=gn;if(W&&z.sections.length===1){L=[],V=V.map((he=>z.toCodeUnitIndex(he)));const ne=W(z.toString(),V);for(const he of ne){const we=[...he].map((()=>0));L.push(new Go(he,z.sections,we))}}else if(j){L=[],V=V.map((Te=>z.toCodeUnitIndex(Te)));let ne=0;const he=[];for(const Te of z.text)he.push(...Array(Te.length).fill(z.sectionIndex[ne])),ne++;const we=j(z.text,he,V);for(const Te of we){const Ie=[];let De="";for(const Ee of Te[0])Ie.push(Te[1][De.length]),De+=Ee;L.push(new Go(Te[0],z.sections,Ie))}}else L=(function(ne,he){const we=[];let Te=0;for(const Ie of he)we.push(ne.substring(Te,Ie)),Te=Ie;return Te<ne.length()&&we.push(ne.substring(Te,ne.length())),we})(z,V);const U=[],Q={positionedLines:U,text:z.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1};return(function(ne,he,we,Te,Ie,De,Ee,Se,ye,je,Ve,We){let Ue=0,ct=0,Vt=0,li=0;const Ci=Se==="right"?1:Se==="left"?0:.5,Fr=fi/We;let Xi=0;for(const ri of Ie){ri.trim();const bi=ri.getMaxScale(),Vi={positionedGlyphs:[],lineOffset:0};ne.positionedLines[Xi]=Vi;const Ni=Vi.positionedGlyphs;let nr=0;if(!ri.length()){ct+=De,++Xi;continue}const zi=Dg(Te,ri,Fr);let ar=0;for(const gi of ri.text){const Gt=ri.getSection(ar),ci=gi.codePointAt(0),Yt=Rg(ye,Ve,ci),_i={glyph:ci,imageName:null,x:Ue,y:ct+-17,vertical:Yt,scale:1,fontStack:"",sectionIndex:ri.getSectionIndex(ar),metrics:null,rect:null};let ia;if("fontStack"in Gt){if(ia=Lg(Gt,ci,Yt,zi,he,we),!ia)continue;_i.fontStack=Gt.fontStack}else{if(ne.iconsInText=!0,Gt.scale*=Fr,ia=Fg(Gt,Yt,bi,zi,Te),!ia)continue;nr=Math.max(nr,ia.imageOffset),_i.imageName=Gt.imageName}const{rect:Hr,metrics:gc,baselineOffset:Ga}=ia;_i.y+=Ga,_i.scale=Gt.scale,_i.metrics=gc,_i.rect=Hr,Ni.push(_i),Yt?(ne.verticalizable=!0,Ue+=("imageName"in Gt?gc.advance:fi)*Gt.scale+je):Ue+=gc.advance*Gt.scale+je,ar++}Ni.length!==0&&(Vt=Math.max(Ue-je,Vt),Bg(Ni,0,Ni.length-1,Ci)),Ue=0,Vi.lineOffset=Math.max(nr,(bi-1)*fi);const Br=De*bi+nr;ct+=Br,li=Math.max(Br,li),++Xi}const{horizontalAlign:vi,verticalAlign:Ai}=Gh(Ee);(function(ri,bi,Vi,Ni,nr,zi,ar,Br,gi){const Gt=(bi-Vi)*nr;let ci=0;ci=zi!==ar?-Br*Ni- -17:-Ni*gi*ar+.5*ar;for(const Yt of ri)for(const _i of Yt.positionedGlyphs)_i.x+=Gt,_i.y+=ci})(ne.positionedLines,Ci,vi,Ai,Vt,li,De,ct,Ie.length),ne.top+=-Ai*ct,ne.bottom=ne.top+ct,ne.left+=-vi*Vt,ne.right=ne.left+Vt})(Q,e,i,a,L,h,f,g,b,y,S,E),!(function(ne){for(const he of ne)if(he.positionedGlyphs.length!==0)return!1;return!0})(U)&&Q}function Gh(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Dg(r,e,i){const a=e.getMaxScale()*fi,{maxImageWidth:o,maxImageHeight:u}=e.getMaxImageSize(r),h=Math.max(a,u*i);return{verticalLineContentWidth:Math.max(a,o*i),horizontalLineContentHeight:h}}function Pp(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function Rg(r,e,i){return!(r===C.az.horizontal||!e&&!Ol(i)||e&&(hu(i)||(a=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function Lg(r,e,i,a,o,u){const h=u[r.fontStack],f=(function(y,v,b,S){if(y&&y.rect)return y;const P=v[b.fontStack],E=P&&P[S];return E?{rect:null,metrics:E.metrics}:null})(h&&h[e],o,r,e);if(f===null)return null;let g;if(i)g=a.verticalLineContentWidth-r.scale*fi;else{const y=Pp(r.verticalAlign);g=(a.horizontalLineContentHeight-r.scale*fi)*y}return{rect:f.rect,metrics:f.metrics,baselineOffset:g}}function Fg(r,e,i,a,o){const u=o[r.imageName];if(!u)return null;const h=u.paddedRect,f=u.displaySize,g={width:f[0],height:f[1],left:1,top:-3,advance:e?f[1]:f[0]};let y;if(e)y=a.verticalLineContentWidth-f[1]*r.scale;else{const v=Pp(r.verticalAlign);y=(a.horizontalLineContentHeight-f[1]*r.scale)*v}return{rect:h,metrics:g,baselineOffset:y,imageOffset:(e?f[0]:f[1])*r.scale-fi*i}}function Bg(r,e,i,a){if(a===0)return;const o=r[i],u=(r[i].x+o.metrics.advance*o.scale)*a;for(let h=e;h<=i;h++)r[h].x-=u}
vendor: 28,013 bytes, line 5
5function Og(r,e,i){const{horizontalAlign:a,verticalAlign:o}=Gh(i),u=e[0]-r.displaySize[0]*a,h=e[1]-r.displaySize[1]*o;return{image:r,top:h,bottom:h+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function Mp(r){var e,i;let a=r.left,o=r.top,u=r.right-a,h=r.bottom-o;const f=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",y=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(f==="stretchOnly"&&u/h<y||f==="proportional"){const v=Math.ceil(h*y);a*=v/u,u=v}}else if(f==="proportional"&&g==="stretchOnly"&&y!==0&&u/h>y){const v=Math.ceil(u/y);o*=v/h,h=v}return{x1:a,y1:o,x2:a+u,y2:o+h}}function Ip(r,e,i,a,o,u){const h=r.image;let f;if(h.content){const L=h.content,V=h.pixelRatio||1;f=[L[0]/V,L[1]/V,h.displaySize[0]-L[2]/V,h.displaySize[1]-L[3]/V]}const g=e.left*u,y=e.right*u;let v,b,S,P;i==="width"||i==="both"?(P=o[0]+g-a[3],b=o[0]+y+a[1]):(P=o[0]+(g+y-h.displaySize[0])/2,b=P+h.displaySize[0]);const E=e.top*u,z=e.bottom*u;return i==="height"||i==="both"?(v=o[1]+E-a[0],S=o[1]+z+a[2]):(v=o[1]+(E+z-h.displaySize[1])/2,S=v+h.displaySize[1]),{image:h,top:v,right:b,bottom:S,left:P,collisionPadding:f}}Be("ImagePosition",Uh),Be("ImageAtlas",Sp),C.az=void 0,(Ba=C.az||(C.az={}))[Ba.none=0]="none",Ba[Ba.horizontal=1]="horizontal",Ba[Ba.vertical=2]="vertical",Ba[Ba.horizontalOnly=3]="horizontalOnly";const ta=128,Oa=32640;function Ep(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Tt(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:o}=i;let u=0;for(;u<a.length&&a[u]<=r;)u++;u=Math.max(0,u-1);let h=u;for(;h<a.length&&a[h]<r+1;)h++;h=Math.min(a.length-1,h);const f=a[u],g=a[h];return i.kind==="composite"?{kind:"composite",minZoom:f,maxZoom:g,interpolationType:o}:{kind:"camera",minZoom:f,maxZoom:g,minSize:i.evaluate(new Tt(f)),maxSize:i.evaluate(new Tt(g)),interpolationType:o}}}function qh(r,e,i){let a="never";const o=r.get(e);return o?a=o:r.get(i)&&(a="always"),a}const jg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ku(r,e,i,a,o,u,h,f,g,y,v,b,S){const P=f?Math.min(Oa,Math.round(f[0])):0,E=f?Math.min(Oa,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*a),Math.round(32*o),u,h,(P<<1)+(g?1:0),E,16*y,16*v,256*b,256*S)}function $h(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function Vg(r){for(const e of r.sections)if(fu(e.text))return!0;return!1}class Zh{constructor(e){this.layoutVertexArray=new J,this.indexArray=new ge,this.programConfigurations=e,this.segments=new Le,this.dynamicLayoutVertexArray=new oe,this.opacityVertexArray=new _e,this.hasVisibleVertices=!1,this.placedSymbolArray=new m}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,a,o){this.isEmpty()||(a&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pg.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,fg.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,jg,!0),this.opacityVertexBuffer.itemSize=1),(a||o)&&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())}}Be("SymbolBuffers",Zh);class Wh{constructor(e,i,a){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new a,this.segments=new Le,this.collisionVertexArray=new me}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,mg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Be("CollisionBuffers",Wh);class $o{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((h=>h.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ep(this.zoom,i["text-size"]),this.iconSizeData=Ep(this.zoom,i["icon-size"]);const a=this.layers[0].layout,o=a.get("symbol-sort-key"),u=a.get("symbol-z-order");this.canOverlap=qh(a,"text-overlap","text-allow-overlap")!=="never"||qh(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map((h=>C.az[h]))),this.stateDependentLayerIds=this.layers.filter((h=>h.isStateDependent())).map((h=>h.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Zh(new ea(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Zh(new ea(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new w,this.lineVertexArray=new T,this.symbolInstances=new x,this.textAnchorOffsets=new M}calculateGlyphDependencies(e,i,a,o,u){for(const h of e)if(i[h.codePointAt(0)]=!0,(a||o)&&u){const f=cc[h];f&&(i[f.codePointAt(0)]=!0)}}populate(e,i,a){const o=this.layers[0],u=o.layout,h=u.get("text-font"),f=u.get("text-field"),g=u.get("icon-image"),y=(f.value.kind!=="constant"||f.value.value instanceof qi&&!f.value.value.isEmpty()||f.value.value.toString().length>0)&&(h.value.kind!=="constant"||h.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,b=u.get("symbol-sort-key");if(this.features=[],!y&&!v)return;const S=i.iconDependencies,P=i.glyphDependencies,E=i.availableImages,z=new Tt(this.zoom);for(const{feature:L,id:V,index:W,sourceLayerIndex:j}of e){const U=o._featureFilter.needGeometry,Q=vn(L,U);if(!o._featureFilter.filter(z,Q,a))continue;let ne,he;if(U||(Q.geometry=xn(L)),y){const Te=o.getValueAndResolveTokens("text-field",Q,a,E),Ie=qi.factory(Te),De=this.hasRTLText=this.hasRTLText||Vg(Ie);(!De||gn.getRTLTextPluginStatus()==="unavailable"||De&&gn.isParsed())&&(ne=_g(Ie,o,Q))}if(v){const Te=o.getValueAndResolveTokens("icon-image",Q,a,E);he=Te instanceof tr?Te:tr.fromString(Te)}if(!ne&&!he)continue;const we=this.sortFeaturesByKey?b.evaluate(Q,{},a):void 0;if(this.features.push({id:V,text:ne,icon:he,index:W,sourceLayerIndex:j,geometry:Q.geometry,properties:L.properties,type:sc.types[L.type],sortKey:we}),he&&(S[he.name]=!0),ne){const Te=h.evaluate(Q,{},a).join(","),Ie=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(C.az.vertical)>=0;for(const De of ne.sections)if(De.image)S[De.image.name]=!0;else{const Ee=La(ne.toString()),Se=De.fontStack||Te,ye=P[Se]=P[Se]||{};this.calculateGlyphDependencies(De.text,ye,Ie,this.allowVerticalPlacement,Ee)}}}u.get("symbol-placement")==="line"&&(this.features=(function(L){const V={},W={},j=[];let U=0;function Q(Te){j.push(L[Te]),U++}function ne(Te,Ie,De){const Ee=W[Te];return delete W[Te],W[Ie]=Ee,j[Ee].geometry[0].pop(),j[Ee].geometry[0]=j[Ee].geometry[0].concat(De[0]),Ee}function he(Te,Ie,De){const Ee=V[Ie];return delete V[Ie],V[Te]=Ee,j[Ee].geometry[0].shift(),j[Ee].geometry[0]=De[0].concat(j[Ee].geometry[0]),Ee}function we(Te,Ie,De){const Ee=De?Ie[0][Ie[0].length-1]:Ie[0][0];return`${Te}:${Ee.x}:${Ee.y}`}for(let Te=0;Te<L.length;Te++){const Ie=L[Te],De=Ie.geometry,Ee=Ie.text?Ie.text.toString():null;if(!Ee){Q(Te);continue}const Se=we(Ee,De),ye=we(Ee,De,!0);if(Se in W&&ye in V&&W[Se]!==V[ye]){const je=he(Se,ye,De),Ve=ne(Se,ye,j[je].geometry);delete V[Se],delete W[ye],W[we(Ee,j[Ve].geometry,!0)]=Ve,j[je].geometry=null}else Se in W?ne(Se,ye,De):ye in V?he(Se,ye,De):(Q(Te),V[Se]=U-1,W[ye]=U-1)}return j.filter((Te=>Te.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((L,V)=>L.sortKey-V.sortKey))}update(e,i,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:a}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:a}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const a=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(i[e.segment+1]),u=e.dist(i[e.segment]);const h={};for(let f=e.segment+1;f<i.length;f++)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:o},f<i.length-1&&(o+=i[f+1].dist(i[f]));for(let f=e.segment||0;f>=0;f--)h[f]={x:i[f].x,y:i[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=i[f-1].dist(i[f]));for(let f=0;f<i.length;f++){const g=h[f];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(e,i,a,o,u,h,f,g,y,v,b,S){const P=e.indexArray,E=e.layoutVertexArray,z=e.segments.prepareSegment(4*i.length,E,P,this.canOverlap?h.sortKey:void 0),L=this.glyphOffsetArray.length,V=z.vertexLength,W=this.allowVerticalPlacement&&f===C.az.vertical?Math.PI/2:0,j=h.text&&h.text.sections;for(let U=0;U<i.length;U++){const{tl:Q,tr:ne,bl:he,br:we,tex:Te,pixelOffsetTL:Ie,pixelOffsetBR:De,minFontScaleX:Ee,minFontScaleY:Se,glyphOffset:ye,isSDF:je,sectionIndex:Ve}=i[U],We=z.vertexLength,Ue=ye[1];ku(E,g.x,g.y,Q.x,Ue+Q.y,Te.x,Te.y,a,je,Ie.x,Ie.y,Ee,Se),ku(E,g.x,g.y,ne.x,Ue+ne.y,Te.x+Te.w,Te.y,a,je,De.x,Ie.y,Ee,Se),ku(E,g.x,g.y,he.x,Ue+he.y,Te.x,Te.y+Te.h,a,je,Ie.x,De.y,Ee,Se),ku(E,g.x,g.y,we.x,Ue+we.y,Te.x+Te.w,Te.y+Te.h,a,je,De.x,De.y,Ee,Se),$h(e.dynamicLayoutVertexArray,g,W),P.emplaceBack(We,We+2,We+1),P.emplaceBack(We+1,We+2,We+3),z.vertexLength+=4,z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ye[0]),U!==i.length-1&&Ve===i[U+1].sectionIndex||e.programConfigurations.populatePaintArrays(E.length,h,h.index,{imagePositions:{},canonical:S,formattedSection:j&&j[Ve]})}e.placedSymbolArray.emplaceBack(g.x,g.y,L,this.glyphOffsetArray.length-L,V,y,v,g.segment,a?a[0]:0,a?a[1]:0,o[0],o[1],f,0,!1,0,b)}_addCollisionDebugVertex(e,i,a,o,u,h){return i.emplaceBack(0,0),e.emplaceBack(a.x,a.y,o,u,Math.round(h.x),Math.round(h.y))}addCollisionDebugVertices(e,i,a,o,u,h,f){const g=u.segments.prepareSegment(4,u.layoutVertexArray,u.indexArray),y=g.vertexLength,v=u.layoutVertexArray,b=u.collisionVertexArray,S=f.anchorX,P=f.anchorY;this._addCollisionDebugVertex(v,b,h,S,P,new be(e,i)),this._addCollisionDebugVertex(v,b,h,S,P,new be(a,i)),this._addCollisionDebugVertex(v,b,h,S,P,new be(a,o)),this._addCollisionDebugVertex(v,b,h,S,P,new be(e,o)),g.vertexLength+=4;const E=u.indexArray;E.emplaceBack(y,y+1),E.emplaceBack(y+1,y+2),E.emplaceBack(y+2,y+3),E.emplaceBack(y+3,y),g.primitiveLength+=4}addDebugCollisionBoxes(e,i,a,o){for(let u=e;u<i;u++){const h=this.collisionBoxArray.get(u);this.addCollisionDebugVertices(h.x1,h.y1,h.x2,h.y2,o?this.textCollisionBox:this.iconCollisionBox,h.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Wh(de,mp.members,Ae),this.iconCollisionBox=new Wh(de,mp.members,Ae);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,a,o,u,h,f,g,y){const v={};for(let b=i;b<a;b++){const S=e.get(b);v.textBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.textFeatureIndex=S.featureIndex;break}for(let b=o;b<u;b++){const S=e.get(b);v.verticalTextBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalTextFeatureIndex=S.featureIndex;break}for(let b=h;b<f;b++){const S=e.get(b);v.iconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.iconFeatureIndex=S.featureIndex;break}for(let b=g;b<y;b++){const S=e.get(b);v.verticalIconBox={x1:S.x1,y1:S.y1,x2:S.x2,y2:S.y2,anchorPointX:S.anchorPointX,anchorPointY:S.anchorPointY},v.verticalIconFeatureIndex=S.featureIndex;break}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const a=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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,i){const a=e.placedSymbolArray.get(i),o=a.vertexStartIndex+4*a.numGlyphs;for(let u=a.vertexStartIndex;u<o;u+=4)e.indexArray.emplaceBack(u,u+2,u+1),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),a=Math.cos(e),o=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const g=this.symbolInstances.get(f);o.push(0|Math.round(i*g.anchorX+a*g.anchorY)),u.push(g.featureIndex)}return h.sort(((f,g)=>o[f]-o[g]||u[g]-u[f])),h}addToSortKeyRanges(e,i){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===i?a.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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(const i of this.symbolInstanceIndexes){const a=this.symbolInstances.get(i);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach(((o,u,h)=>{o>=0&&h.indexOf(o)===u&&this.addIndicesForPlacedSymbol(this.text,o)})),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Cp,Ap;Be("SymbolBucket",$o,{omit:["layers","collisionBoxArray","features","compareText"]}),$o.MAX_GLYPHS=65535,$o.addDynamicAttributes=$h;var Hh={get paint(){return Ap=Ap||new Oi({"icon-opacity":new He(ie.paint_symbol["icon-opacity"]),"icon-color":new He(ie.paint_symbol["icon-color"]),"icon-halo-color":new He(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new He(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new He(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new He(ie.paint_symbol["text-opacity"]),"text-color":new He(ie.paint_symbol["text-color"],{runtimeType:er,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new He(ie.paint_symbol["text-halo-color"]),"text-halo-width":new He(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new He(ie.paint_symbol["text-halo-blur"]),"text-translate":new qe(ie.paint_symbol["text-translate"]),"text-translate-anchor":new qe(ie.paint_symbol["text-translate-anchor"])})},get layout(){return Cp=Cp||new Oi({"symbol-placement":new qe(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new He(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new He(ie.layout_symbol["icon-size"]),"icon-text-fit":new qe(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new He(ie.layout_symbol["icon-image"]),"icon-rotate":new He(ie.layout_symbol["icon-rotate"]),"icon-padding":new He(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new He(ie.layout_symbol["icon-offset"]),"icon-anchor":new He(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(ie.layout_symbol["text-rotation-alignment"]),"text-field":new He(ie.layout_symbol["text-field"]),"text-font":new He(ie.layout_symbol["text-font"]),"text-size":new He(ie.layout_symbol["text-size"]),"text-max-width":new He(ie.layout_symbol["text-max-width"]),"text-line-height":new qe(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new He(ie.layout_symbol["text-letter-spacing"]),"text-justify":new He(ie.layout_symbol["text-justify"]),"text-radial-offset":new He(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new He(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new He(ie.layout_symbol["text-anchor"]),"text-max-angle":new qe(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(ie.layout_symbol["text-writing-mode"]),"text-rotate":new He(ie.layout_symbol["text-rotate"]),"text-padding":new qe(ie.layout_symbol["text-padding"]),"text-keep-upright":new qe(ie.layout_symbol["text-keep-upright"]),"text-transform":new He(ie.layout_symbol["text-transform"]),"text-offset":new He(ie.layout_symbol["text-offset"]),"text-allow-overlap":new qe(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(ie.layout_symbol["text-ignore-placement"]),"text-optional":new qe(ie.layout_symbol["text-optional"])})}};class zp{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Di,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}Be("FormatSectionOverride",zp,{omit:["defaultValue"]});class Du extends hr{constructor(e,i){super(e,Hh,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const o=[];for(const u of a)o.indexOf(u)<0&&o.push(u);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,a,o){const u=this.layout.get(e).evaluate(i,{},a,o),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Aa(h.value)||!u?u:(function(f,g){return g.replace(/{([^{}]+)}/g,((y,v)=>f&&v in f?String(f[v]):""))})(i.properties,u)}createBucket(e){return new $o(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Hh.paint.overridableProperties){if(!Du.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),a=new zp(i),o=new Ml(a,i.property.specification);let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new go("source",o):new Il("composite",o,i.value.zoomStops),this.paint._values[e]=new Tr(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,a){return!(!this.layout||i.isDataDriven()||a.isDataDriven())&&Du.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const a=e.get("text-field"),o=Hh.paint.properties[i];let u=!1;const h=f=>{for(const g of f)if(o.overrides&&o.overrides.hasOverride(g))return void(u=!0)};if(a.value.kind==="constant"&&a.value.value instanceof qi)h(a.value.value.sections);else if(a.value.kind==="source"||a.value.kind==="composite"){const f=y=>{u||(y instanceof kr&&Jt(y.value)===Ja?h(y.value.sections):y instanceof ls?h(y.sections):y.eachChild(f))},g=a.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let kp;var Ng={get paint(){return kp=kp||new Oi({"background-color":new qe(ie.paint_background["background-color"]),"background-pattern":new Eo(ie.paint_background["background-pattern"]),"background-opacity":new qe(ie.paint_background["background-opacity"])})}};class Ug extends hr{constructor(e,i){super(e,Ng,i)}}class Gg extends hr{constructor(e,i){super(e,{},i),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class qg{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const $g={once:!0},Xh=63710088e-1;class ja{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ja(wi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,a=this.lat*i,o=e.lat*i,u=Math.sin(a)*Math.sin(o)+Math.cos(a)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return Xh*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof ja)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ja(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ja(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>]")}}const Dp=2*Math.PI*Xh;function Rp(r){return Dp*Math.cos(r*Math.PI/180)}function Lp(r){return(180+r)/360}function Fp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Bp(r,e){return r/Rp(e)}function Op(r){return 360*r-180}function Ru(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function jp(r,e){return r*Rp(Ru(e))}class uc{constructor(e,i,a=0){this.x=+e,this.y=+i,this.z=+a}static fromLngLat(e,i=0){const a=ja.convert(e);return new uc(Lp(a.lng),Fp(a.lat),Bp(i,a.lat))}toLngLat(){return new ja(Op(this.x),Ru(this.y))}toAltitude(){return jp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Dp*(e=Ru(this.y),1/Math.cos(e*Math.PI/180));var e}}function Vp(r,e,i){var a=2*Math.PI*6378137/256/Math.pow(2,i);return[r*a-2*Math.PI*6378137/2,e*a-2*Math.PI*6378137/2]}class Yh{constructor(e,i,a){if(!(function(o,u,h){return!(o<0||o>25||h<0||h>=Math.pow(2,o)||u<0||u>=Math.pow(2,o))})(e,i,a))throw new Error(`x=${i}, y=${a}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=a,this.key=Zo(0,e,e,i,a)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,a){const o=(h=this.y,f=this.z,g=Vp(256*(u=this.x),256*(h=Math.pow(2,f)-h-1),f),y=Vp(256*(u+1),256*(h+1),f),g[0]+","+g[1]+","+y[0]+","+y[1]);var u,h,f,g,y;const v=(function(b,S,P){let E,z="";for(let L=b;L>0;L--)E=1<<L-1,z+=(S&E?1:0)+(P&E?2:0);return z})(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(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new be((e.x*i-this.x)*gt,(e.y*i-this.y)*gt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Np{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Zo(e,i.z,i.z,i.x,i.y)}}class pr{constructor(e,i,a,o,u){if(this.terrainRttPosMatrix32f=null,e<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${a}`);this.overscaledZ=e,this.wrap=i,this.canonical=new Yh(a,+o,+u),this.key=Zo(i,e,a,o,u)}clone(){return new pr(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>
5this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new pr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new pr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?Zo(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):Zo(this.wrap*+i,e,e,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new pr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,a=2*this.canonical.x,o=2*this.canonical.y;return[new pr(i,this.wrap,i,a,o),new pr(i,this.wrap,i,a+1,o),new pr(i,this.wrap,i,a,o+1),new pr(i,this.wrap,i,a+1,o+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 pr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new pr(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 Np(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new uc(e.x-this.wrap,e.y))}normalizeCoordinates(e,i,a=8192){if(e>=0&&e<a&&i>=0&&i<a)return{tileID:this,x:e,y:i};const o=Math.floor(e/a),u=Math.floor(i/a),h=e-o*a,f=i-u*a,g=this.canonical.z,y=1<<g,v=this.canonical.y+u;if(v<0||v>=y)return null;let b=this.canonical.x+o,S=this.wrap;return b<0?(S-=Math.ceil(-b/y),b=(b%y+y)%y):b>=y&&(S+=Math.floor(b/y),b%=y),{tileID:new pr(this.overscaledZ,S,g,b,v),x:h,y:f}}}function Zo(r,e,i,a,o){(r*=2)<0&&(r=-1*r-1);const u=1<<i;return(u*u*r+u*o+a).toString(36)+i.toString(36)+e.toString(36)}function Kh(r,e){return e?r.properties[e]:r.id}function Zg(r,e){const i={id:r.id};if(e.removeAllProperties&&(delete r.removeProperties,delete r.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const a of e.removeProperties){const o=r.addOrUpdateProperties.findIndex((u=>u.key===a));o>-1&&r.addOrUpdateProperties.splice(o,1)}return(r.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(r.removeProperties||e.removeProperties)&&(i.removeProperties=[...r.removeProperties||[],...e.removeProperties||[]]),(r.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...r.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(r.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||r.newGeometry),i}function Up(r){var e,i;if(!r)return{};const a={};return a.removeAll=r.removeAll,a.remove=new Set(r.remove||[]),a.add=new Map((e=r.add)===null||e===void 0?void 0:e.map((o=>[o.id,o]))),a.update=new Map((i=r.update)===null||i===void 0?void 0:i.map((o=>[o.id,o]))),a}Be("CanonicalTileID",Yh),Be("OverscaledTileID",pr,{omit:["terrainRttPosMatrix32f"]});class js{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){const i=new js;return i.extend(e(new be(this.minX,this.minY))),i.extend(e(new be(this.maxX,this.minY))),i.extend(e(new be(this.minX,this.maxY))),i.extend(e(new be(this.maxX,this.maxY))),i}static fromPoints(e){const i=new js;for(const a of e)i.extend(a);return i}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 Gp{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const a=e[i];this._stringToNumber[a]=i,this._numberToString[i]=a}}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 qp{constructor(e,i,a,o,u){this.type="Feature",this._vectorTileFeature=e,this._x=a,this._y=o,this._z=i,this.properties=e.properties,this.id=u}
5projectPoint(e,i,a,o){return[360*(e.x+i)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/o)*Math.PI))-90]}projectLine(e,i,a,o){return e.map((u=>this.projectPoint(u,i,a,o)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),a=e.extent*this._x,o=e.extent*this._y,u=e.loadGeometry();switch(e.type){case 1:{const h=[];for(const g of u)h.push(g[0]);const f=this.projectLine(h,a,o,i);this._geometry=h.length===1?{type:"Point",coordinates:f[0]}:{type:"MultiPoint",coordinates:f};break}case 2:{const h=u.map((f=>this.projectLine(f,a,o,i)));this._geometry=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h};break}case 3:{const h=ap(u),f=[];for(const g of h)f.push(g.map((y=>this.projectLine(y,a,o,i))));this._geometry=f.length===1?{type:"Polygon",coordinates:f[0]}:{type:"MultiPolygon",coordinates:f};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class Wo{constructor(e,i,a){Ze(this,"_name");Ze(this,"dataBuffer");Ze(this,"nullabilityBuffer");Ze(this,"_size");this._name=e,this.dataBuffer=i,typeof a=="number"?this._size=a:(this.nullabilityBuffer=a,this._size=a.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Lu extends Wo{}class Jh extends Lu{getValueFromBuffer(e){return this.dataBuffer[e]}}class Qh extends Lu{getValueFromBuffer(e){return this.dataBuffer[e]}}class $p extends Wo{constructor(i,a,o,u){super(i,a,u);Ze(this,"delta");this.delta=o}}class ed extends $p{constructor(e,i,a,o){super(e,Int32Array.of(i),a,o)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class td extends Wo{constructor(e,i,a){super(e,Int32Array.of(i),a)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Wg{constructor(e,i,a,o,u=4096){Ze(this,"_name");Ze(this,"_geometryVector");Ze(this,"_idVector");Ze(this,"_propertyVectors");Ze(this,"_extent");Ze(this,"propertyVectorsMap");this._name=e,this._geometryVector=i,this._idVector=a,this._propertyVectors=o,this._extent=u}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((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let i=0;for(;i<this.numFeatures;){let a;this.idVector&&(a=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));const o=e==null?void 0:e.next().value,u={};for(const h of this.propertyVectors){if(!h)continue;const f=h.name,g=h.getValue(i);g!==null&&(u[f]=g)}i++,yield{id:a,geometry:o,properties:u}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let a=0;a<this.numFeatures;a++){let o;this.idVector&&(o=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(a)):this.idVector.getValue(a));const u={coordinates:i[a],type:this.geometryVector.geometryType(a)},h={};for(const f of this.propertyVectors){if(!f)continue;const g=f.name,y=f.getValue(a);y!==null&&(h[g]=y)}e.push({id:o,geometry:u,properties:h})}return e}containsMaxSaveIntegerValues(e){return e instanceof Jh||e instanceof td&&e instanceof ed||e instanceof Qh}}class Hg{constructor(e){Ze(this,"value");this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var wt,Va,Ii,Zr,Vs,fr,ii,mi,Zp,Mr;function ji(r,e,i){const a=new Int32Array(i);let o=0,u=e.get();for(let h=0;h<a.length;h++){let f=r[u++],g=127&f;f<128||(f=r[u++],g|=(127&f)<<7,f<128||(f=r[u++],g|=(127&f)<<14,f<128||(f=r[u++],g|=(127&f)<<21,f<128||(f=r[u++],g|=(15&f)<<28)))),a[o++]=g}return e.set(u),a}function id(r,e,i){const a=new BigInt64Array(i);for(let o=0;o<a.length;o++)a[o]=Xg(r,e);return a}function Xg(r,e){let i=0n,a=0,o=e.get();for(;o<r.length;){const u=r[o++];if(i|=BigInt(127&u)<<BigInt(a),!(128&u))break;if(a+=7,a>=64)throw new Error("Varint too long")}return e.set(o),i}function Yg(r,e){let i,a;return a=r[e.get()],e.increment(),i=127&a,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<7,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<14,a<128?i:(a=r[e.get()],e.increment(),i|=(127&a)<<21,a<128?i:(a=r[e.get()],i|=(15&a)<<28,(function(o,u,h){let f,g;if(g=u[h.get()],h.increment(),f=(112&g)>>4,g<128||(g=u[h.get()],h.increment(),f|=(127&g)<<3,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<10,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<17,g<128)||(g=u[h.get()],h.increment(),f|=(127&g)<<24,g<128)||(g=u[h.get()],h.increment(),f|=(1&g)<<31,g<128))return 4294967296*f+(o>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function Xt(r){return r>>>1^-(1&r)}function mr(r){return r>>1n^-(1n&r)}function Ho(r){return r%2==1?(r+1)/-2:r/2}function Wp(r,e,i){if(i===void 0){i=0;for(let u=0;u<e;u++)i+=r[u]}const a=new Int32Array(i);let o=0;for(let u=0;u<e;u++){const h=r[u];a.fill(r[u+e],o,o+h),o+=h}return a}function Hp(r,e,i){if(i===void 0){i=0;for(let u=0;u<e;u++)i+=Number(r[u])}const a=new BigInt64Array(i);let o=0;for(let u=0;u<e;u++){const h=Number(r[u]);a.fill(r[u+e],o,o+h),o+=h}return a}function Xp(r,e,i){const a=new Float64Array(i);let o=0;for(let u=0;u<e;u++){const h=r[u];a.fill(r[u+e],o,o+h),o+=h}return a}function Yp(r){const e=r.length/4*4;let i=1;if(e>=4)for(let a=r[0];i<e-4;i+=4)a=r[i]+=a,a=r[i+1]+=a,a=r[i+2]+=a,a=r[i+3]+=a;for(;i!=r.length;)r[i]+=r[i-1],++i}(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(wt||(wt={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(Va||(Va={})),(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(Ii||(Ii={}));class rd{constructor(e,i,a){Ze(this,"_dictionaryType");Ze(this,"_offsetType");Ze(this,"_lengthType");this._dictionaryType=e,this._offsetType=i,this._lengthType=a}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function Wi(r,e){const i=(function(a,o){const u=a[o.get()],h=Object.values(Ii)[u>>4];let f=null;switch(h){case Ii.DATA:f=new rd(Object.values(Zr)[15&u]);break;case Ii.OFFSET:f=new rd(null,Object.values(Vs)[15&u]);break;case Ii.LENGTH:f=new rd(null,null,Object.values(fr)[15&u])}o.increment();const g=a[o.get()],y=Object.values(wt)[g>>5],v=Object.values(wt)[g>>2&7],b=Object.values(Va)[3&g];o.increment();const S=ji(a,o,2),P=S[0];return{physicalStreamType:h,logicalStreamType:f,logicalLevelTechnique1:y,logicalLevelTechnique2:v,physicalLevelTechnique:b,numValues:P,byteLength:S[1],decompressedCount:P}})(r,e);return i.logicalLevelTechnique1===wt.MORTON?(function(a,o,u){const h=ji(o,u,2);return{physicalStreamType:a.physicalStreamType,logicalStreamType:a.logicalStreamType,logicalLevelTechnique1:a.logicalLevelTechnique1,logicalLevelTechnique2:a.logicalLevelTechnique2,physicalLevelTechnique:a.physicalLevelTechnique,numValues:a.numValues,byteLength:a.byteLength,decompressedCount:a.decompressedCount,numBits:h[0],coordinateShift:h[1]}})(i,r,e):wt.RLE!==i.logicalLevelTechnique1&&wt.RLE!==i.logicalLevelTechnique2||Va.NONE===i.physicalLevelTechnique?i:(function(a,o,u){const h=ji(o,u,2);return{physicalStreamType:a.physicalStreamType,logicalStreamType:a.logicalStreamType,logicalLevelTechnique1:a.logicalLevelTechnique1,logicalLevelTechnique2:a.logicalLevelTechnique2,physicalLevelTechnique:a.physicalLevelTechnique,numValues:a.numValues,byteLength:a.byteLength,decompressedCount:h[1],runs:h[0],numRleValues:h[1]}})(i,r,e)}(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(Zr||(Zr={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(Vs||(Vs={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(fr||(fr={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ii||(ii={}));
5class Wr{constructor(e,i){Ze(this,"values");Ze(this,"_size");this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const a=Math.floor(e/8);this.values[a]=this.values[a]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Fu(r,e,i){if(!e)return r;const a=e.size(),o=new r.constructor(a);let u=0;for(let h=0;h<a;h++)o[h]=e.get(h)?r[u++]:i;return o}function Hi(r,e,i,a,o,u){return(function(h,f,g,y,v){switch(f.logicalLevelTechnique1){case wt.DELTA:if(f.logicalLevelTechnique2===wt.RLE){const b=f;if(!v)return(function(S,P,E){const z=new Int32Array(E);let L=0,V=0;for(let W=0;W<P;W++){const j=S[W],U=Xt(S[W+P]);for(let Q=0;Q<j;Q++)V+=U,z[L++]=V}return z})(h,b.runs,b.numRleValues);h=Wp(h,b.runs,b.numRleValues)}(function(b){b[0]=Xt(b[0]);const S=b.length/4*4;let P=1;if(S>=4)for(;P<S-4;P+=4){const E=b[P+1],z=b[P+2],L=b[P+3];b[P]=Xt(b[P])+b[P-1],b[P+1]=Xt(E)+b[P],b[P+2]=Xt(z)+b[P+1],b[P+3]=Xt(L)+b[P+2]}for(;P!=b.length;++P)b[P]=Xt(b[P])+b[P-1]})(h);break;case wt.RLE:h=(function(b,S,P){return P?(function(E,z,L){if(L===void 0){L=0;for(let j=0;j<z;j++)L+=E[j]}const V=new Int32Array(L);let W=0;for(let j=0;j<z;j++){const U=E[j];let Q=E[j+z];Q=Xt(Q),V.fill(Q,W,W+U),W+=U}return V})(b,S.runs,S.numRleValues):Wp(b,S.runs,S.numRleValues)})(h,f,g);break;case wt.MORTON:Yp(h);break;case wt.COMPONENTWISE_DELTA:(function(b){if(b.length<2)return;b[0]=Xt(b[0]),b[1]=Xt(b[1]);const S=b.length/4*4;let P=2;if(S>=4)for(;P<S-4;P+=4){const E=b[P+1],z=b[P+2],L=b[P+3];b[P]=Xt(b[P])+b[P-2],b[P+1]=Xt(E)+b[P-1],b[P+2]=Xt(z)+b[P],b[P+3]=Xt(L)+b[P+1]}for(;P!=b.length;P+=2)b[P]=Xt(b[P])+b[P-2],b[P+1]=Xt(b[P+1])+b[P-1]})(h);break;case wt.NONE:g&&(function(b){for(let S=0;S<b.length;S++)b[S]=Xt(b[S])})(h);break;default:throw new Error(`The specified Logical level technique is not supported: ${f.logicalLevelTechnique1}`)}return v?Fu(h,v,0):h})(Bu(r,e,i),i,a,0,u)}function Na(r,e,i){return(function(a,o){if(o.logicalLevelTechnique1===wt.DELTA&&o.logicalLevelTechnique2===wt.NONE)return(function(u){const h=new Int32Array(u.length+1);h[0]=0,h[1]=Xt(u[0]);let f=h[1];for(let g=2;g!=h.length;++g)f+=Xt(u[g-1]),h[g]=h[g-1]+f;return new Uint32Array(h)})(a);if(o.logicalLevelTechnique1===wt.RLE&&o.logicalLevelTechnique2===wt.NONE)return(function(u,h,f){const g=new Int32Array(f+1);g[0]=0;let y=1,v=g[0];for(let b=0;b<h;b++){const S=u[b],P=u[b+h];for(let E=y;E<y+S;E++)g[E]=P+v,v=g[E];y+=S}return new Uint32Array(g)})(a,o.runs,o.numRleValues);if(o.logicalLevelTechnique1===wt.NONE&&o.logicalLevelTechnique2===wt.NONE){(function(h){let f=0;for(let g=0;g<h.length;g++)h[g]+=f,f=h[g]})(a);const u=new Uint32Array(o.numValues+1);return u[0]=0,u.set(a,1),u}if(o.logicalLevelTechnique1===wt.DELTA&&o.logicalLevelTechnique2===wt.RLE){const u=(function(h,f,g){const y=new Int32Array(g+1);y[0]=0;let v=1,b=y[0];for(let S=0;S<f;S++){const P=h[S];let E=h[S+f];E=Xt(E);for(let z=v;z<v+P;z++)y[z]=E+b,b=y[z];v+=P}return new Uint32Array(y)})(a,o.runs,o.numRleValues);return Yp(u),u}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(Bu(r,e,i),i)}function Bu(r,e,i){const a=i.physicalLevelTechnique;if(a===Va.FAST_PFOR)return(function(){throw new Error("FastPFor is not implemented yet.")})();if(a===Va.VARINT)return ji(r,e,i.numValues);if(a===Va.NONE){const o=e.get();e.add(i.byteLength);const u=r.subarray(o,e.get());return new Int32Array(u)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function nd(r,e,i,a){const o=Bu(r,e,i);if(o.length===1){const u=o[0];return a?Xt(u):u}return a?(function(u){return Xt(u[1])})(o):(function(u){return u[1]})(o)}function Kp(r,e,i){return(function(a){if(a.length==2){const o=Xt(a[1]);return[o,o]}return[Xt(a[2]),Xt(a[3])]})(Bu(r,e,i))}function Jp(r,e,i){return(function(a){if(a.length==2){const o=mr(a[1]);return[o,o]}return[mr(a[2]),mr(a[3])]})(id(r,e,i.numValues))}function Qp(r,e,i,a,o){return(function(u,h,f,g){switch(h.logicalLevelTechnique1){case wt.DELTA:if(h.logicalLevelTechnique2===wt.RLE){const y=h;if(!g)return(function(v,b,S){const P=new BigInt64Array(S);let E=0,z=0n;for(let L=0;L<b;L++){const V=Number(v[L]),W=mr(v[L+b]);for(let j=0;j<V;j++)z+=W,P[E++]=z}return P})(u,y.runs,y.numRleValues);u=Hp(u,y.runs,y.numRleValues)}(function(y){y[0]=mr(y[0]);const v=y.length/4*4;let b=1;if(v>=4)for(;b<v-4;b+=4){const S=y[b+1],P=y[b+2],E=y[b+3];y[b]=mr(y[b])+y[b-1],y[b+1]=mr(S)+y[b],y[b+2]=mr(P)+y[b+1],y[b+3]=mr(E)+y[b+2]}for(;b!=y.length;++b)y[b]=mr(y[b])+y[b-1]})(u);break;case wt.RLE:u=(function(y,v,b){return b?(function(S,P,E){if(E===void 0){E=0;for(let V=0;V<P;V++)E+=Number(S[V])}const z=new BigInt64Array(E);let L=0;for(let V=0;V<P;V++){const W=Number(S[V]);let j=S[V+P];j=mr(j),z.fill(j,L,L+W),L+=W}return z})(y,v.runs,v.numRleValues):Hp(y,v.runs,v.numRleValues)})(u,h,f);break;case wt.NONE:f&&(function(y){for(let v=0;v<y.length;v++)y[v]=mr(y[v])})(u);break;default:throw new Error(`The specified Logical level technique is not supported: ${h.logicalLevelTechnique1}`)}return g?Fu(u,g,0n):u})(id(r,e,i.numValues),i,a,o)}function ef(r,e,i,a){const o=id(r,e,i.numValues);if(o.length===1){const u=o[0];return a?mr(u):u}return a?(function(u){return mr(u[1])})(o):(function(u){return u[1]})(o)}function Ou(r,e,i,a){const o=r.logicalLevelTechnique1;if(o===wt.RLE)return r.runs===1?ii.CONST:ii.FLAT;if(o!==wt.DELTA||r.logicalLevelTechnique2!==wt.RLE)return r.numValues===1?ii.CONST:ii.FLAT;const u=e instanceof Wr?e.size():e;if(r.numRleValues!==u)return ii.FLAT;if(r.runs===1)return ii.SEQUENCE;
vendor: 7,884 bytes, line 5
5if(r.runs!==2)return r.numValues===1?ii.CONST:ii.FLAT;const h=a.get();let f;if(r.physicalLevelTechnique===Va.VARINT)f=ji(i,a,4);else{const g=a.get();f=new Int32Array(i.buffer,i.byteOffset+g,4)}return a.set(h),f[2]===2&&f[3]===2?ii.SEQUENCE:r.numValues===1?ii.CONST:ii.FLAT}class tf extends Lu{getValueFromBuffer(e){return this.dataBuffer[e]}}class rf extends $p{constructor(e,i,a,o){super(e,BigInt64Array.of(i),a,o)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Xo{constructor(e,i,a){Ze(this,"_geometryOffsets");Ze(this,"_partOffsets");Ze(this,"_ringOffsets");this._geometryOffsets=e,this._partOffsets=i,this._ringOffsets=a}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function ad(r,e,i){return{x:nf(r,e)-i,y:nf(r>>1,e)-i}}function nf(r,e){let i=0;for(let a=0;a<e;a++)i|=(r&1<<2*a)>>a;return i}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(mi||(mi={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(Zp||(Zp={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(Mr||(Mr={}));class Kg{createPoint(e){return[[e]]}createMultiPoint(e){return e.map((i=>[i]))}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,i){return[e].concat(i)}createMultiPolygon(e){return e.flat()}}function af(r){const e=new Array(r.numGeometries);let i=1,a=1,o=1,u=0;const h=new Kg;let f=0,g=0;const y=r.mortonSettings,v=r.topologyVector,b=v.geometryOffsets,S=v.partOffsets,P=v.ringOffsets,E=r.vertexOffsets,z=r.containsPolygonGeometry(),L=r.vertexBuffer;for(let V=0;V<r.numGeometries;V++){const W=r.geometryType(V);if(W===mi.POINT){if(E&&E.length!==0)if(r.vertexBufferType===Mr.VEC_2){const j=2*E[g++],U=new be(L[j],L[j+1]);e[u++]=h.createPoint(U)}else{const j=ad(L[E[g++]],y.numBits,y.coordinateShift),U=new be(j.x,j.y);e[u++]=h.createPoint(U)}else{const j=new be(L[f++],L[f++]);e[u++]=h.createPoint(j)}b&&o++,S&&i++,P&&a++}else if(W===mi.MULTIPOINT){const j=b[o]-b[o-1];o++;const U=new Array(j);if(E&&E.length!==0){for(let Q=0;Q<j;Q++){const ne=2*E[g++];U[Q]=new be(L[ne],L[ne+1])}e[u++]=h.createMultiPoint(U)}else{for(let Q=0;Q<j;Q++){const ne=L[f++],he=L[f++];U[Q]=new be(ne,he)}e[u++]=h.createMultiPoint(U)}}else if(W===mi.LINESTRING){let j,U=0;z?(U=P[a]-P[a-1],a++):U=S[i]-S[i-1],i++,E&&E.length!==0?(j=r.vertexBufferType===Mr.VEC_2?od(L,E,g,U,!1):ld(L,E,g,U,!1,y),g+=U):(j=sd(L,f,U,!1),f+=2*U),e[u++]=h.createLineString(j),b&&o++}else if(W===mi.POLYGON){const j=S[i]-S[i-1];i++;const U=new Array(j-1);let Q=P[a]-P[a-1];if(a++,E&&E.length!==0){const ne=r.vertexBufferType===Mr.VEC_2?Vu(L,E,g,Q):Nu(L,E,g,Q,0,y);g+=Q;for(let he=0;he<U.length;he++)Q=P[a]-P[a-1],a++,U[he]=r.vertexBufferType===Mr.VEC_2?Vu(L,E,g,Q):Nu(L,E,g,Q,0,y),g+=Q;e[u++]=h.createPolygon(ne,U)}else{const ne=ju(L,f,Q);f+=2*Q;for(let he=0;he<U.length;he++)Q=P[a]-P[a-1],a++,U[he]=ju(L,f,Q),f+=2*Q;e[u++]=h.createPolygon(ne,U)}b&&o++}else if(W===mi.MULTILINESTRING){const j=b[o]-b[o-1];o++;const U=new Array(j);if(E&&E.length!==0){for(let Q=0;Q<j;Q++){let ne=0;z?(ne=P[a]-P[a-1],a++):ne=S[i]-S[i-1],i++;const he=r.vertexBufferType===Mr.VEC_2?od(L,E,g,ne,!1):ld(L,E,g,ne,!1,y);U[Q]=he,g+=ne}e[u++]=h.createMultiLineString(U)}else{for(let Q=0;Q<j;Q++){let ne=0;z?(ne=P[a]-P[a-1],a++):ne=S[i]-S[i-1],i++,U[Q]=sd(L,f,ne,!1),f+=2*ne}e[u++]=h.createMultiLineString(U)}}else{if(W!==mi.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const j=b[o]-b[o-1];o++;const U=new Array(j);let Q=0;if(E&&E.length!==0){for(let ne=0;ne<j;ne++){const he=S[i]-S[i-1];i++;const we=new Array(he-1);Q=P[a]-P[a-1],a++;const Te=r.vertexBufferType===Mr.VEC_2?Vu(L,E,g,Q):Nu(L,E,g,Q,0,y);g+=Q;for(let Ie=0;Ie<we.length;Ie++)Q=P[a]-P[a-1],a++,we[Ie]=r.vertexBufferType===Mr.VEC_2?Vu(L,E,g,Q):Nu(L,E,g,Q,0,y),g+=Q;U[ne]=h.createPolygon(Te,we)}e[u++]=h.createMultiPolygon(U)}else{for(let ne=0;ne<j;ne++){const he=S[i]-S[i-1];i++;const we=new Array(he-1);Q=P[a]-P[a-1],a++;const Te=ju(L,f,Q);f+=2*Q;for(let Ie=0;Ie<we.length;Ie++){const De=P[a]-P[a-1];a++,we[Ie]=ju(L,f,De),f+=2*De}U[ne]=h.createPolygon(Te,we)}e[u++]=h.createMultiPolygon(U)}}}}return e}function ju(r,e,i){return sd(r,e,i,!0)}function Vu(r,e,i,a){return od(r,e,i,a,!0)}function Nu(r,e,i,a,o,u){return ld(r,e,i,a,!0,u)}function sd(r,e,i,a){const o=new Array(a?i+1:i);for(let u=0;u<2*i;u+=2)o[u/2]=new be(r[e+u],r[e+u+1]);return a&&(o[o.length-1]=o[0]),o}function od(r,e,i,a,o){const u=new Array(o?a+1:a);for(let h=0;h<2*a;h+=2){const f=2*e[i+h/2];u[h/2]=new be(r[f],r[f+1])}return o&&(u[u.length-1]=u[0]),u}function ld(r,e,i,a,o,u){const h=new Array(o?a+1:a);for(let f=0;f<a;f++){const g=ad(r[e[i+f]],u.numBits,u.coordinateShift);h[f]=new be(g.x,g.y)}return o&&(h[h.length-1]=h[0]),h}class sf{constructor(e,i,a,o,u){Ze(this,"_vertexBufferType");Ze(this,"_topologyVector");Ze(this,"_vertexOffsets");Ze(this,"_vertexBuffer");Ze(this,"_mortonSettings");this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=a,this._vertexBuffer=o,this._mortonSettings=u}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=af(this);let i=0;for(;i<this.numGeometries;)yield{coordinates:e[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const a=ad(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return af(this)}get mortonSettings(){return this._mortonSettings}}class of extends sf{constructor(i,a,o,u,h,f,g){super(o,u,h,f,g);Ze(this,"_numGeometries");Ze(this,"_geometryType");this._numGeometries=i,this._geometryType=a}geometryType(i){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===mi.POLYGON||this._geometryType===mi.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class lf extends sf{constructor(i,a,o,u,h,f){super(i,o,u,h,f);Ze(this,"_geometryTypes");this._geometryTypes=a}geometryType(i){return this._geometryTypes[i]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let i=0;i<this.numGeometries;i++)if(this.geometryType(i)===mi.POLYGON||this.geometryType(i)===mi.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class cf{constructor(e,i,a,o){Ze(this,"_triangleOffsets");Ze(this,"_indexBuffer");Ze(this,"_vertexBuffer");Ze(this,"_topologyVector");this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=a,this._topologyVector=o}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");const e=new Array(this.numGeometries),i=this._topologyVector,a=i.partOffsets,o=i.ringOffsets,u=i.geometryOffsets;let h=0,f=1,g=1,y=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case mi.POLYGON:{const b=a[f]-a[f-1];f++;const S=[];for(let P=0;P<b;P++){const E=o[g]-o[g-1];g++;const z=[];for(let L=0;L<E;L++){const V=this._vertexBuffer[h++],W=this._vertexBuffer[h++];z.push(new be(V,W))}z.length>0&&z.push(z[0]),S.push(z)}e[v]=S,u&&y++}
5break;case mi.MULTIPOLYGON:{const b=u[y]-u[y-1];y++;const S=[];for(let P=0;P<b;P++){const E=a[f]-a[f-1];f++;for(let z=0;z<E;z++){const L=o[g]-o[g-1];g++;const V=[];for(let W=0;W<L;W++){const j=this._vertexBuffer[h++],U=this._vertexBuffer[h++];V.push(new be(j,U))}V.length>0&&V.push(V[0]),S.push(V)}}e[v]=S}}return e}[Symbol.iterator](){return null}}function uf(r,e,i,a,o,u){return new Jg(r,e,i,a,o,u)}class Jg extends cf{constructor(i,a,o,u,h,f){super(o,u,h,f);Ze(this,"_numGeometries");Ze(this,"_geometryType");this._numGeometries=i,this._geometryType=a}geometryType(i){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function hf(r,e,i,a,o){return new Qg(r,e,i,a,o)}class Qg extends cf{constructor(i,a,o,u,h){super(a,o,u,h);Ze(this,"_geometryTypes");this._geometryTypes=i}geometryType(i){return this._geometryTypes[i]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function e_(r,e,i,a,o){const u=Wi(r,i);let h=null,f=null,g=null,y=null;if(Ou(u,a,r,i)===ii.CONST){const W=nd(r,i,u,!1);let j=null,U=null,Q=null,ne=null;for(let he=0;he<e-1;he++){const we=Wi(r,i);switch(we.physicalStreamType){case Ii.LENGTH:switch(we.logicalStreamType.lengthType){case fr.GEOMETRIES:j=Na(r,i,we);break;case fr.PARTS:U=Na(r,i,we);break;case fr.RINGS:Q=Na(r,i,we);break;case fr.TRIANGLES:ne=Na(r,i,we)}break;case Ii.OFFSET:switch(we.logicalStreamType.offsetType){case Vs.VERTEX:h=Hi(r,i,we,!1);break;case Vs.INDEX:y=Hi(r,i,we,!1)}break;case Ii.DATA:Zr.VERTEX===we.logicalStreamType.dictionaryType?f=Hi(r,i,we,!0):(g={numBits:we.numBits,coordinateShift:we.coordinateShift},f=Hi(r,i,we,!1))}}return y!==null?j!=null||U!=null?uf(a,W,ne,y,f,new Xo(j,U,Q)):uf(a,W,ne,y,f):g===null?(function(he,we,Te,Ie,De){return new of(he,we,Mr.VEC_2,Te,Ie,De)})(a,W,new Xo(j,U,Q),h,f):(function(he,we,Te,Ie,De,Ee){return new of(he,we,Mr.MORTON,Te,Ie,De,Ee)})(a,W,new Xo(j,U,Q),h,f,g)}const v=Hi(r,i,u,!1);let b=null,S=null,P=null,E=null;for(let W=0;W<e-1;W++){const j=Wi(r,i);switch(j.physicalStreamType){case Ii.LENGTH:switch(j.logicalStreamType.lengthType){case fr.GEOMETRIES:b=Hi(r,i,j,!1);break;case fr.PARTS:S=Hi(r,i,j,!1);break;case fr.RINGS:P=Hi(r,i,j,!1);break;case fr.TRIANGLES:E=Na(r,i,j)}break;case Ii.OFFSET:switch(j.logicalStreamType.offsetType){case Vs.VERTEX:h=Hi(r,i,j,!1);break;case Vs.INDEX:y=Hi(r,i,j,!1)}break;case Ii.DATA:Zr.VERTEX===j.logicalStreamType.dictionaryType?f=Hi(r,i,j,!0):(g={numBits:j.numBits,coordinateShift:j.coordinateShift},f=Hi(r,i,j,!1))}}let z=null,L=null,V=null;return b!==null?(z=cd(v,b,2),S!==null&&P!==null?(L=df(v,z,S,!1),V=(function(W,j,U,Q){const ne=new Uint32Array(U[U.length-1]+1);let he=0;ne[0]=he;let we=1,Te=1,Ie=0;for(let De=0;De<W.length;De++){const Ee=W[De],Se=j[De+1]-j[De];if(Ee!==0&&Ee!==3)for(let ye=0;ye<Se;ye++){const je=U[we]-U[we-1];we++;for(let Ve=0;Ve<je;Ve++)he=ne[Te++]=he+Q[Ie++]}else for(let ye=0;ye<Se;ye++)ne[Te++]=++he,we++}return ne})(v,z,L,P)):S!==null&&(L=(function(W,j,U){const Q=new Uint32Array(j[j.length-1]+1);let ne=0;Q[0]=ne;let he=1,we=0;for(let Te=0;Te<W.length;Te++){const Ie=W[Te],De=j[Te+1]-j[Te];if(Ie===4||Ie===1)for(let Ee=0;Ee<De;Ee++)ne=Q[he++]=ne+U[we++];else for(let Ee=0;Ee<De;Ee++)Q[he++]=++ne}return Q})(v,z,S))):S!==null&&P!==null?(L=cd(v,S,1),V=df(v,L,P,!0)):S!==null&&(L=cd(v,S,0)),y!==null&&L===null?hf(v,E,y,f):y!==null?hf(v,E,y,f,new Xo(z,L,V)):g===null?(function(W,j,U,Q){return new lf(Mr.VEC_2,W,j,U,Q)})(v,new Xo(z,L,V),h,f):(function(W,j,U,Q,ne){return new lf(Mr.MORTON,W,j,U,Q,ne)})(v,new Xo(z,L,V),h,f,g)}function cd(r,e,i){const a=new Uint32Array(r.length+1);let o=0;a[0]=o;let u=0;for(let h=0;h<r.length;h++)o=a[h+1]=o+(r[h]>i?e[u++]:1);return a}function df(r,e,i,a){const o=new Uint32Array(e[e.length-1]+1);let u=0;o[0]=u;let h=1,f=0;for(let g=0;g<r.length;g++){const y=r[g],v=e[g+1]-e[g];if(y===5||y===2||a&&(y===4||y===1))for(let b=0;b<v;b++)u=o[h++]=u+i[f++];else for(let b=0;b<v;b++)o[h++]=++u}return o}class t_ extends Wo{constructor(i,a,o){super(i,a.getBuffer(),o);Ze(this,"dataVector");this.dataVector=a}getValueFromBuffer(i){return this.dataVector.get(i)}}class i_ extends Lu{getValueFromBuffer(e){return this.dataBuffer[e]}}class pf extends Wo{constructor(e,i,a){super(e,BigInt64Array.of(i),a)}getValueFromBuffer(e){return this.dataBuffer[0]}}function hc(r,e,i,a,o){const u=(function(h,f,g,y){const v=new Uint8Array(f);let b=0;const S=y.get()+g;
5for(;b<f&&!(y.get()>=S);){const P=h[y.increment()];if(P<=127){const E=P+3,z=h[y.increment()],L=Math.min(b+E,f);v.fill(z,b,L),b=L}else{const E=256-P;for(let z=0;z<E&&b<f;z++)v[b++]=h[y.increment()]}}return y.set(S),v})(r,Math.ceil(e/8),i,a);return o?(function(h,f,g){if(!g)return h;const y=g.size(),v=new Wr(h,f),b=new Wr(new Uint8Array(Math.ceil(y/8)),y);let S=0;for(let P=0;P<y;P++){const E=!!g.get(P)&&v.get(S++);b.set(P,E)}return b.getBuffer()})(u,e,o):u}const r_=new TextDecoder;function ud(r,e,i){return i-e>=12?r_.decode(r.subarray(e,i)):(function(a,o,u){let h="",f=o;for(;f<u;){const g=a[f];let y,v,b,S=null,P=g>239?4:g>223?3:g>191?2:1;if(f+P>u)break;P===1?g<128&&(S=g):P===2?(y=a[f+1],(192&y)==128&&(S=(31&g)<<6|63&y,S<=127&&(S=null))):P===3?(y=a[f+1],v=a[f+2],(192&y)==128&&(192&v)==128&&(S=(15&g)<<12|(63&y)<<6|63&v,(S<=2047||S>=55296&&S<=57343)&&(S=null))):P===4&&(y=a[f+1],v=a[f+2],b=a[f+3],(192&y)==128&&(192&v)==128&&(192&b)==128&&(S=(15&g)<<18|(63&y)<<12|(63&v)<<6|63&b,(S<=65535||S>=1114112)&&(S=null))),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),f+=P}return h})(r,e,i)}class hd extends Wo{constructor(i,a,o,u){super(i,o,u);Ze(this,"offsetBuffer");this.offsetBuffer=a}}class ff extends hd{constructor(i,a,o,u){super(i,a,o,u??a.length-1);Ze(this,"textEncoder");this.textEncoder=new TextEncoder}getValueFromBuffer(i){return ud(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class Yo extends hd{constructor(i,a,o,u,h){super(i,o,u,h??a.length);Ze(this,"indexBuffer");Ze(this,"textEncoder");this.indexBuffer=a,this.indexBuffer=a,this.textEncoder=new TextEncoder}getValueFromBuffer(i){const a=this.indexBuffer[i];return ud(this.dataBuffer,this.offsetBuffer[a],this.offsetBuffer[a+1])}}class mf extends hd{constructor(i,a,o,u,h,f,g){super(i,o,u,g);Ze(this,"indexBuffer");Ze(this,"symbolOffsetBuffer");Ze(this,"symbolTableBuffer");Ze(this,"textEncoder");Ze(this,"symbolLengthBuffer");Ze(this,"lengthBuffer");Ze(this,"decodedDictionary");this.indexBuffer=a,this.symbolOffsetBuffer=h,this.symbolTableBuffer=f,this.textEncoder=new TextEncoder}getValueFromBuffer(i){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=(function(o,u,h){const f=[],g=new Array(u.length).fill(0);for(let y=1;y<u.length;y++)g[y]=g[y-1]+u[y-1];for(let y=0;y<h.length;y++)if(h[y]===255)f.push(h[++y]);else{const v=u[h[y]],b=g[h[y]];for(let S=0;S<v;S++)f.push(o[b+S])}return new Uint8Array(f)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const a=this.indexBuffer[i];return ud(this.decodedDictionary,this.offsetBuffer[a],this.offsetBuffer[a+1])}offsetToLengthBuffer(i){const a=new Uint32Array(i.length-1);let o=i[0];for(let u=1;u<i.length;u++){const h=i[u];a[u-1]=h-o,o=h}return a}}function n_(r,e,i,a,o,u){return i.type==="scalarType"?(function(h,f,g,y,v,b){let S=null,P=0;if(h===0)return null;if(b.nullable){const z=Wi(f,g);P=z.numValues;const L=g.get(),V=hc(f,P,z.byteLength,g);g.set(L+z.byteLength),S=new Wr(V,z.numValues)}const E=S??y;switch(v.physicalType){case 4:case 3:return(function(z,L,V,W,j){const U=Wi(z,L),Q=Ou(U,j,z,L),ne=W.physicalType===3;if(Q===ii.FLAT){const he=Hi(z,L,U,ne,0,dc(j)?j:void 0);return new Jh(V.name,he,j)}if(Q===ii.SEQUENCE){const he=Kp(z,L,U);return new ed(V.name,he[0],he[1],U.numRleValues)}{const he=nd(z,L,U,ne);return new td(V.name,he,j)}})(f,g,b,v,E);case 9:return(function(z,L,V,W,j){let U=null,Q=null,ne=null,he=null,we=null,Te=null,Ie=null,De=null;for(let Ee=0;Ee<W;Ee++){const Se=Wi(L,V);if(Se.byteLength!==0)switch(Se.physicalStreamType){case Ii.PRESENT:{const ye=hc(L,Se.numValues,Se.byteLength,V);Te=new Wr(ye,Se.numValues);break}case Ii.OFFSET:Q=Hi(L,V,Se,!1,0,j!=null||Te!=null?j??Te:void 0);break;case Ii.LENGTH:{const ye=Na(L,V,Se);fr.DICTIONARY===Se.logicalStreamType.lengthType?U=ye:fr.SYMBOL===Se.logicalStreamType.lengthType?he=ye:Ie=ye;break}case Ii.DATA:{const ye=L.subarray(V.get(),V.get()+Se.byteLength);V.add(Se.byteLength);const je=Se.logicalStreamType.dictionaryType;Zr.FSST===je?we=ye:Zr.SINGLE===je||Zr.SHARED===je?ne=ye:Zr.NONE===je&&(De=ye);break}}}
5return(function(Ee,Se,ye,je,Ve,We,Ue){return Se?new mf(Ee,ye,je,Ve,We,Se,Ue):null})(z,we,Q,U,ne,he,j??Te)??(function(Ee,Se,ye,je,Ve){return Se?Ve?new Yo(Ee,ye,je,Se,Ve):new Yo(Ee,ye,je,Se):null})(z,ne,Q,U,j??Te)??(function(Ee,Se,ye,je,Ve){if(!Se||!ye)return null;if(je)return Ve?new Yo(Ee,je,Se,ye,Ve):new Yo(Ee,je,Se,ye);if(Ve&&Ve.size()!==Se.length-1){const We=new Int32Array(Ve.size());let Ue=0;for(let ct=0;ct<Ve.size();ct++)We[ct]=Ve.get(ct)?Ue++:0;return new Yo(Ee,We,Se,ye,Ve)}return Ve?new ff(Ee,Se,ye,Ve):new ff(Ee,Se,ye)})(z,Ie,De,Q,j??Te)})(b.name,f,g,b.nullable?h-1:h,S);case 0:return(function(z,L,V,W,j){const U=Wi(z,L),Q=U.numValues,ne=L.get(),he=dc(j)?j:void 0,we=hc(z,Q,U.byteLength,L,he);L.set(ne+U.byteLength);const Te=new Wr(we,Q);return new t_(V.name,Te,j)})(f,g,b,0,E);case 6:case 5:return(function(z,L,V,W,j){const U=Wi(z,L),Q=Ou(U,W,z,L),ne=j.physicalType===5;if(Q===ii.FLAT){const he=Qp(z,L,U,ne,dc(W)?W:void 0);return new tf(V.name,he,W)}if(Q===ii.SEQUENCE){const he=Jp(z,L,U);return new rf(V.name,he[0],he[1],U.numRleValues)}{const he=ef(z,L,U,ne);return new pf(V.name,he,W)}})(f,g,b,E,v);case 7:return(function(z,L,V,W){const j=Wi(z,L),U=dc(W)?W:void 0,Q=(function(ne,he,we,Te){const Ie=he.get(),De=Ie+we*Float32Array.BYTES_PER_ELEMENT,Ee=new Uint8Array(ne.subarray(Ie,De)).buffer,Se=new Float32Array(Ee);return he.set(De),Te?Fu(Se,Te,0):Se})(z,L,j.numValues,U);return new i_(V.name,Q,W)})(f,g,b,E);case 8:return(function(z,L,V,W){const j=Wi(z,L),U=dc(W)?W:void 0,Q=(function(ne,he,we,Te){const Ie=he.get(),De=Ie+we*Float64Array.BYTES_PER_ELEMENT,Ee=new Uint8Array(ne.subarray(Ie,De)).buffer,Se=new Float64Array(Ee);return he.set(De),Te?Fu(Se,Te,0):Se})(z,L,j.numValues,U);return new Qh(V.name,Q,W)})(f,g,b,E);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(a,r,e,o,i.scalarType,i):a===0?null:(function(h,f,g,y){let v=null,b=null,S=null,P=null,E=!1;for(;!E;){const W=Wi(h,f);switch(W.physicalStreamType){case Ii.LENGTH:fr.DICTIONARY===W.logicalStreamType.lengthType?v=Na(h,f,W):S=Na(h,f,W);break;case Ii.DATA:Zr.SINGLE===W.logicalStreamType.dictionaryType||Zr.SHARED===W.logicalStreamType.dictionaryType?(b=h.subarray(f.get(),f.get()+W.byteLength),E=!0):P=h.subarray(f.get(),f.get()+W.byteLength),f.add(W.byteLength)}}const z=g.complexType.children,L=[];let V=0;for(const W of z){const j=ji(h,f,1)[0];if(j==0)continue;const U=W.name?`${g.name}${W.name}`:g.name;if(j!==2||W.type!=="scalarField"||W.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const Q=Wi(h,f),ne=hc(h,Q.numValues,Q.byteLength,f),he=Wi(h,f),we=Hi(h,f,he,!1,0,he.decompressedCount!==y?new Wr(ne,Q.numValues):void 0);L[V++]=P?new mf(U,we,v,b,S,P,new Wr(ne,Q.numValues)):new Yo(U,we,v,b,new Wr(ne,Q.numValues))}return L})(r,e,i,o)}function dc(r){return r instanceof Wr}function gf(r){switch(r){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&r),e.columnScope=0;const i={};return i.physicalType=r>1?6:4,i.type="physicalType",e.scalarType=i,e.type="scalarType",e}case 4:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{const e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return(function(e){let i=null;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const a={};a.nullable=!!(1&e),a.columnScope=0;const o={type:"physicalType"};return o.physicalType=i,a.type="scalarType",a.scalarType=o,a})(r)}}function _f(r){return r>=10}function yf(r){return r===30}function a_(r){if(r.name==="id")return!1;if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.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}else if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}const s_=new TextDecoder;function dd(r,e){const i=ji(r,e,1)[0];if(i===0)return"";const a=e.get(),o=r.subarray(a,a+i);return e.add(i),s_.decode(o)}function xf(r,e){const i=ji(r,e,1)[0]>>>0;if(i<10||i>
530)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const a=gf(i);if(_f(i)&&(a.name=dd(r,e)),yf(i)){const o=ji(r,e,1)[0]>>>0;a.complexType.children=new Array(o);for(let u=0;u<o;u++)a.complexType.children[u]=xf(r,e)}return(function(o){return{name:o.name,nullable:o.nullable,scalarField:o.scalarType,complexField:o.complexType,type:o.type==="scalarType"?"scalarField":"complexField"}})(a)}function o_(r,e){const i=ji(r,e,1)[0]>>>0,a=gf(i);if(!a)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(_f(i)?a.name=dd(r,e):i>=0&&i<=3?a.name="id":i===4&&(a.name="geometry"),yf(i)){const o=ji(r,e,1)[0]>>>0,u=a.complexType;u.children=new Array(o);for(let h=0;h<o;h++)u.children[h]=xf(r,e)}return a}function l_(r,e){const i={featureTables:[]},a={};a.name=dd(r,e);const o=ji(r,e,1)[0]>>>0,u=ji(r,e,1)[0]>>>0;a.columns=new Array(u);for(let h=0;h<u;h++)a.columns[h]=o_(r,e);return i.featureTables.push(a),[i,o]}function c_(r,e,i,a,o,u,h=!1){const f=e.scalarType.physicalType,g=Ou(o,u,r,i);if(f===4)switch(g){case ii.FLAT:{const y=Hi(r,i,o,!1);return new Jh(a,y,u)}case ii.SEQUENCE:{const y=Kp(r,i,o);return new ed(a,y[0],y[1],o.numRleValues)}case ii.CONST:{const y=nd(r,i,o,!1);return new td(a,y,u)}}else switch(g){case ii.FLAT:{if(h){const v=(function(b,S,P){const E=(function(z,L,V){const W=new Float64Array(V);for(let j=0;j<V;j++)W[j]=Yg(z,L);return W})(b,S,P.numValues);return(function(z,L){switch(L.logicalLevelTechnique1){case wt.DELTA:return L.logicalLevelTechnique2===wt.RLE&&(z=Xp(z,L.runs,L.numRleValues)),(function(V){V[0]=Ho(V[0]);const W=V.length/4*4;let j=1;if(W>=4)for(;j<W-4;j+=4){const U=V[j+1],Q=V[j+2],ne=V[j+3];V[j]=Ho(V[j])+V[j-1],V[j+1]=Ho(U)+V[j],V[j+2]=Ho(Q)+V[j+1],V[j+3]=Ho(ne)+V[j+2]}for(;j!=V.length;++j)V[j]=Ho(V[j])+V[j-1]})(z),z;case wt.RLE:return(function(V,W){return Xp(V,W.runs,W.numRleValues)})(z,L);case wt.NONE:return z;default:throw new Error(`The specified Logical level technique is not supported: ${L.logicalLevelTechnique1}`)}})(E,P)})(r,i,o);return new Qh(a,v,u)}const y=Qp(r,i,o,!1);return new tf(a,y,u)}case ii.SEQUENCE:{const y=Jp(r,i,o);return new rf(a,y[0],y[1],o.numRleValues)}case ii.CONST:{const y=ef(r,i,o,!1);return new pf(a,y,u)}}throw new Error("Vector type not supported for id column.")}class u_{constructor(e,i){var a;switch(this._featureData=e,this.properties=this._featureData.properties||{},(a=this._featureData.geometry)===null||a===void 0?void 0:a.type){case mi.POINT:case mi.MULTIPOINT:this.type=1;break;case mi.LINESTRING:case mi.MULTILINESTRING:this.type=2;break;case mi.POLYGON:case mi.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const a=[];for(const o of i)a.push(new be(o.x,o.y));e.push(a)}return e}}class h_{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 u_(this.features[e],this.extent)}}class vf{constructor(e){this.layers={};const i=(function(a,o,u=!0){const h=new Hg(0),f=[];for(;h.get()<a.length;){const g=ji(a,h,1)[0]>>>0,y=h.get()+g;if(y>a.length)throw new Error(`Block overruns tile: ${y} > ${a.length}`);if(ji(a,h,1)[0]>>>0!=1){h.set(y);continue}const v=l_(a,h),b=v[1],S=v[0].featureTables[0];let P=null,E=null;const z=[];let L=0;for(const W of S.columns){const j=W.name;if(j==="id"){let U=null;if(W.nullable){const ne=Wi(a,h),he=h.get(),we=hc(a,ne.numValues,ne.byteLength,h);h.set(he+ne.byteLength),U=new Wr(we,ne.numValues)}const Q=Wi(a,h);L=Q.decompressedCount,P=c_(a,W,h,j,Q,U??L,u)}else if(j==="geometry"){const U=ji(a,h,1)[0];if(L===0){const Q=h.get();L=Wi(a,h).decompressedCount,h.set(Q)}E=e_(a,U,h,L)}else{const U=a_(W)?ji(a,h,1)[0]:1;if(U===0)continue;const Q=n_(a,h,W,U,L);if(Q)if(Array.isArray(Q))for(const ne of Q)z.push(ne);else z.push(Q)}}const V=new Wg(S.name,E,P,z,b);f.push(V),h.set(y)}return f})(new Uint8Array(e));this.layers=i.reduce(((a,o)=>Object.assign(Object.assign({}
vendor: 25,671 bytes, line 5
5,a),{[o.name]:new h_(o)})),{})}}class d_{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const a of i){const o=[];for(const u of a)o.push(new be(u[0],u[1]));e.push(o)}return e}}const pc="_geojsonTileLayer";function p_(r,e){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const i={keys:[],values:[],keycache:{},valuecache:{}};for(let u=0;u<r.length;u++)i.feature=r.feature(u),e.writeMessage(2,f_,i);const a=i.keys;for(const u of a)e.writeStringField(3,u);const o=i.values;for(const u of o)e.writeMessage(4,__,u)}function f_(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,m_,r),e.writeVarintField(3,i.type),e.writeMessage(4,g_,i)}function m_(r,e){var i;for(const a in(i=r.feature)==null?void 0:i.properties){let o=r.feature.properties[a],u=r.keycache[a];if(o==null)continue;u===void 0&&(r.keys.push(a),u=r.keys.length-1,r.keycache[a]=u),e.writeVarint(u),typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"&&(o=JSON.stringify(o));const h=typeof o+":"+o;let f=r.valuecache[h];f===void 0&&(r.values.push(o),f=r.values.length-1,r.valuecache[h]=f),e.writeVarint(f)}}function pd(r,e){return(e<<3)+(7&r)}function bf(r){return r<<1^r>>31}function g_(r,e){const i=r.loadGeometry(),a=r.type;let o=0,u=0;for(const h of i){let f=1;a===1&&(f=h.length),e.writeVarint(pd(1,f));const g=a===3?h.length-1:h.length;for(let y=0;y<g;y++){y===1&&a!==1&&e.writeVarint(pd(2,g-1));const v=h[y].x-o,b=h[y].y-u;e.writeVarint(bf(v)),e.writeVarint(bf(b)),o+=v,u+=b}r.type===3&&e.writeVarint(pd(7,1))}}function __(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class wf{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Da(gt,16,0),this.grid3D=new Da(gt,16,0),this.featureIndexArray=new B,this.promoteId=i}insert(e,i,a,o,u,h){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,o,u);const g=h?this.grid3D:this.grid;for(let y=0;y<i.length;y++){const v=i[y],b=[1/0,1/0,-1/0,-1/0];for(let S=0;S<v.length;S++){const P=v[S];b[0]=Math.min(b[0],P.x),b[1]=Math.min(b[1],P.y),b[2]=Math.max(b[2],P.x),b[3]=Math.max(b[3],P.y)}b[0]<gt&&b[1]<gt&&b[2]>=0&&b[3]>=0&&g.insert(f,b[0],b[1],b[2],b[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new sp(new Au(this.rawTileData)).layers:new vf(this.rawTileData).layers,this.sourceLayerCoder=new Gp(this.vtLayers?Object.keys(this.vtLayers).sort():[pc])),this.vtLayers}query(e,i,a,o){this.loadVTLayers();const u=e.params,h=gt/e.tileSize/e.scale,f=ms(u.filter,u.globalState),g=e.queryGeometry,y=e.queryPadding*h,v=js.fromPoints(g),b=this.grid.query(v.minX-y,v.minY-y,v.maxX+y,v.maxY+y),S=js.fromPoints(e.cameraQueryGeometry).expandBy(y),P=this.grid3D.query(S.minX,S.minY,S.maxX,S.maxY,((L,V,W,j)=>(function(U,Q,ne,he,we){for(const Ie of U)if(Q<=Ie.x&&ne<=Ie.y&&he>=Ie.x&&we>=Ie.y)return!0;const Te=[new be(Q,ne),new be(Q,we),new be(he,we),new be(he,ne)];if(U.length>2){for(const Ie of Te)if(Oo(U,Ie))return!0}for(let Ie=0;Ie<U.length-1;Ie++)if(xm(U[Ie],U[Ie+1],Te))return!0;return!1})(e.cameraQueryGeometry,L-y,V-y,W+y,j+y)));for(const L of P)b.push(L);b.sort(y_);const E={};let z;for(let L=0;L<b.length;L++){const V=b[L];if(V===z)continue;z=V;const W=this.featureIndexArray.get(V);let j=null;this.loadMatchingFeature(E,W.bucketIndex,W.sourceLayerIndex,W.featureIndex,f,u.layers,u.availableImages,i,a,o,((U,Q,ne)=>(j||(j=xn(U)),Q.queryIntersectsFeature({queryGeometry:g,feature:U,featureState:ne,geometry:j,zoom:this.z,transform:e.transform,pixelsToTileUnits:h,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return E}loadMatchingFeature(e,i,a,o,u,h,f,g,y,v,b){const S=this.bucketLayerIDs[i];if(h&&!S.some((L=>h.has(L))))return;const P=this.sourceLayerCoder.decode(a),E=this.vtLayers[P].feature(o);if(u.needGeometry){const L=vn(E,!0);if(!u.filter(new Tt(this.tileID.overscaledZ),L,this.tileID.canonical))return}else if(!u.filter(new Tt(this.tileID.overscaledZ),E))return;const z=this.getId(E,P);for(let L=0;L<S.length;L++){const V=S[L];if(h&&!h.has(V))continue;const W=g[V];if(!W)continue;let j={};z&&v&&(j=v.getState(W.sourceLayer||pc,z));const U=Gi({},y[V]);U.paint=Tf(U.paint,W.paint,E,j,f),U.layout=Tf(U.layout,W.layout,E,j,f);const Q=!b||b(E,W,j);if(!Q)continue;const ne=new qp(E,this.z,this.x,this.y,z);ne.layer=U;let he=e[V];he===void 0&&(he=e[V]=[]),he.push({featureIndex:o,feature:ne,intersectionZ:Q})}}lookupSymbolFeatures(e,i,a,o,u,h,f,g){const y={};this.loadVTLayers();const v=ms(u.filterSpec,u.globalState);for(const b of e)this.loadMatchingFeature(y,a,o,b,v,h,f,g,i);return y}hasLayer(e){for(const i of this.bucketLayerIDs)for(const a of i)if(e===a)return!0;return!1}getId(e,i){var a;let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof o=="boolean"&&(o=Number(o)),o===void 0&&(!((a=e.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(o=Number(e.properties.cluster_id))),o}}function Tf(r,e,i,a,o){return Cn(r,((u,h)=>{const f=e instanceof Es?e.get(h):null;return f&&f.evaluate?f.evaluate(i,a,o):f}))}function y_(r,e){return e-r}function Sf(r,e,i,a,o){const u=[];for(let h=0;h<r.length;h++){const f=r[h];let g;for(let y=0;y<f.length-1;y++){let v=f[y],b=f[y+1];v.x<e&&b.x<e||(v.x<e?v=new be(e,v.y+(e-v.x)/(b.x-v.x)*(b.y-v.y))._round():b.x<e&&(b=new be(e,v.y+(e-v.x)/(b.x-v.x)*(b.y-v.y))._round()),v.y<i&&b.y<i||(v.y<i?v=new be(v.x+(i-v.y)/(b.y-v.y)*(b.x-v.x),i)._round():b.y<i&&(b=new be(v.x+(i-v.y)/(b.y-v.y)*(b.x-v.x),i)._round()),v.x>=a&&b.x>=a||(v.x>=a?v=new be(a,v.y+(a-v.x)/(b.x-v.x)*(b.y-v.y))._round():b.x>=a&&(b=new be(a,v.y+(a-v.x)/(b.x-v.x)*(b.y-v.y))._round()),v.y>=o&&b.y>=o||(v.y>=o?v=new be(v.x+(o-v.y)/(b.y-v.y)*(b.x-v.x),o)._round():b.y>=o&&(b=new be(v.x+(o-v.y)/(b.y-v.y)*(b.x-v.x),o)._round()),g&&v.equals(g[g.length-1])||(g=[v],u.push(g)),g.push(b)))))}}return u}function Pf(r,e,i,a,o){switch(e){case 1:return(function(u,h,f,g){const y=[];for(const v of u)for(const b of v){const S=g===0?b.x:b.y;S>=h&&S<=f&&y.push([b])}return y})(r,i,a,o);case 2:return Mf(r,i,a,o,!1);case 3:return Mf(r,i,a,o,!0)}return[]}function x_(r,e,i,a,o){const u=a===0?v_:b_;let h=[];const f=[];for(let v=0;v<r.length-1;v++){const b=r[v],S=r[v+1],P=a===0?b.x:b.y,E=a===0?S.x:S.y;let z=!1;P<e?E>e&&h.push(u(b,S,e)):P>i?E<i&&h.push(u(b,S,i)):h.push(b),E<e&&P>=e&&(h.push(u(b,S,e)),z=!0),E>i&&P<=i&&(h.push(u(b,S,i)),z=!0),!o&&z&&(f.push(h),h=[])}const g=r.length-1,y=a===0?r[g].x:r[g].y;return y>=e&&y<=i&&h.push(r[g]),o&&h.length>0&&!h[0].equals(h[h.length-1])&&h.push(new be(h[0].x,h[0].y)),h.length>0&&f.push(h),f}function Mf(r,e,i,a,o){const u=[];for(const h of r){const f=x_(h,e,i,a,o);f.length>0&&u.push(...f)}return u}function v_(r,e,i){return new be(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function b_(r,e,i){return new be(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Be("FeatureIndex",wf,{omit:["rawTileData","sourceLayerCoder"]});class Ua extends be{constructor(e,i,a,o){super(e,i),this.angle=a,o!==void 0&&(this.segment=o)}clone(){return new Ua(this.x,this.y,this.angle,this.segment)}}function If(r,e,i,a,o){if(e.segment===void 0||i===0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const g=[];let y=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let S=r[h-1].angleTo(v)-v.angleTo(b);for(S=Math.abs((S+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:f,angleDelta:S}),y+=S;f-g[0].distance>a;)y-=g.shift().angleDelta;if(y>o)return!1;h++,f+=v.dist(b)}return!0}function Ef(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Cf(r,e,i){return r?.6*e*i:0}function Af(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function w_(r,e,i,a,o,u){const h=Cf(i,o,u),f=Af(i,a)*u;let g=0;const y=Ef(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],S=r[v+1],P=b.dist(S);if(g+P>y){const E=(y-g)/P,z=Bt.number(b.x,S.x,E),L=Bt.number(b.y,S.y,E),V=new Ua(z,L,S.angleTo(b),v);return V._round(),!h||If(r,V,f,h,e)?V:void 0}g+=P}}function T_(r,e,i,a,o,u,h,f,g){const y=Cf(a,u,h),v=Af(a,o),b=v*h,S=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-b<e/4&&(e=b+e/4),zf(r,S?e/2*f%e:(v/2+2*u)*h*f%e,e,y,i,b,S,!1,g)}function zf(r,e,i,a,o,u,h,f,g){const y=u/2,v=Ef(r);let b=0,S=e-i,P=[];for(let E=0;E<r.length-1;E++){const z=r[E],L=r[E+1],V=z.dist(L),W=L.angleTo(z);for(;S+i<b+V;){S+=i;const j=(S-b)/V,U=Bt.number(z.x,L.x,j),Q=Bt.number(z.y,L.y,j);if(U>=0&&U<g&&Q>=0&&Q<g&&S-y>=0&&S+y<=v){const ne=new Ua(U,Q,W,E);ne._round(),a&&!If(r,ne,u,a,o)||P.push(ne)}}b+=V}return f||P.length||h||(P=zf(r,b/2,i,a,o,u,h,!0,g)),P}function kf(r,e,i,a){const o=[],u=r.image,h=u.pixelRatio,f=u.paddedRect.w-2,g=u.paddedRect.h-2;let y={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=u.stretchX||[[0,f]],b=u.stretchY||[[0,g]],S=(ye,je)=>ye+je[1]-je[0],P=v.reduce(S,0),E=b.reduce(S,0),z=f-P,L=g-E;let V=0,W=P,j=0,U=E,Q=0,ne=z,he=0,we=L;if(u.content&&a){const ye=u.content,je=ye[2]-ye[0],Ve=ye[3]-ye[1];(u.textFitWidth||u.textFitHeight)&&(y=Mp(r)),V=Uu(v,0,ye[0]),j=Uu(b,0,ye[1]),W=Uu(v,ye[0],ye[2]),U=Uu(b,ye[1],ye[3]),Q=ye[0]-V,he=ye[1]-j,ne=je-W,we=Ve-U}const Te=y.x1,Ie=y.y1,De=y.x2-Te,Ee=y.y2-Ie,Se=(ye,je,Ve,We)=>{const Ue=Gu(ye.stretch-V,W,De,Te),ct=qu(ye.fixed-Q,ne,ye.stretch,P),Vt=Gu(je.stretch-j,U,Ee,Ie),li=qu(je.fixed-he,we,je.stretch,E),Ci=Gu(Ve.stretch-V,W,De,Te),Fr=qu(Ve.fixed-Q,ne,Ve.stretch,P),Xi=Gu(We.stretch-j,U,Ee,Ie),vi=qu(We.fixed-he,we,We.stretch,E),Ai=new be(Ue,Vt),ri=new be(Ci,Vt),bi=new be(Ci,Xi),Vi=new be(Ue,Xi),Ni=new be(ct/h,li/h),nr=new be(Fr/h,vi/h),zi=e*Math.PI/180;if(zi){const gi=Math.sin(zi),Gt=Math.cos(zi),ci=[Gt,-gi,gi,Gt];Ai._matMult(ci),ri._matMult(ci),Vi._matMult(ci),bi._matMult(ci)}const ar=ye.stretch+ye.fixed,Br=je.stretch+je.fixed;return{tl:Ai,tr:ri,bl:Vi,br:bi,tex:{x:u.paddedRect.x+1+ar,y:u.paddedRect.y+1+Br,w:Ve.stretch+Ve.fixed-ar,h:We.stretch+We.fixed-Br},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ni,pixelOffsetBR:nr,minFontScaleX:ne/h/De,minFontScaleY:we/h/Ee,isSDF:i}};if(a&&(u.stretchX||u.stretchY)){const ye=Df(v,z,P),je=Df(b,L,E);for(let Ve=0;Ve<ye.length-1;Ve++){const We=ye[Ve],Ue=ye[Ve+1];for(let ct=0;ct<je.length-1;ct++)o.push(Se(We,je[ct],Ue,je[ct+1]))}}else o.push(Se({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:f+1},{fixed:0,stretch:g+1}));return o}function Uu(r,e,i){let a=0;for(const o of r)a+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return a}function Df(r,e,i){const a=[{fixed:-1,stretch:0}];for(const[o,u]of r){const h=a[a.length-1];a.push({fixed:o-h.stretch,stretch:h.stretch}),a.push({fixed:o-h.stretch,stretch:h.stretch+(u-o)})}return a.push({fixed:e+1,stretch:i}),a}function Gu(r,e,i,a){return r/e*i+a}function qu(r,e,i,a){return r-e*i/a}Be("Anchor",Ua);class $u{constructor(e,i,a,o,u,h,f,g,y,v){var b;if(this.boxStartIndex=e.length,y){let S=h.top,P=h.bottom;const E=h.collisionPadding;E&&(S-=E[1],P+=E[3]);let z=P-S;z>0&&(z=Math.max(10,z),this.circleDiameter=z)}else{const S=!((b=h.image)===null||b===void 0)&&b.content&&(h.image.textFitWidth||h.image.textFitHeight)?Mp(h):{x1:h.left,y1:h.top,x2:h.right,y2:h.bottom};S.y1=S.y1*f-g[0],S.y2=S.y2*f+g[2],S.x1=S.x1*f-g[3],S.x2=S.x2*f+g[1];const P=h.collisionPadding;if(P&&(S.x1-=P[0]*f,S.y1-=P[1]*f,S.x2+=P[2]*f,S.y2+=P[3]*f),v){const E=new be(S.x1,S.y1),z=new be(S.x2,S.y1),L=new be(S.x1,S.y2),V=new be(S.x2,S.y2),W=v*Math.PI/180;E._rotate(W),z._rotate(W),L._rotate(W),V._rotate(W),S.x1=Math.min(E.x,z.x,L.x,V.x),S.x2=Math.max(E.x,z.x,L.x,V.x),S.y1=Math.min(E.y,z.y,L.y,V.y),S.y2=Math.max(E.y,z.y,L.y,V.y)}e.emplaceBack(i.x,i.y,S.x1,S.y1,S.x2,S.y2,a,o,u)}this.boxEndIndex=e.length}}class S_{constructor(e=[],i=(a,o)=>a<o?-1:a>o?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:a}=this,o=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(a(o,h)>=0)break;i[e]=h,e=u}i[e]=o}_down(e){const{data:i,compare:a}=this,o=this.length>>1,u=i[e];for(;e<o;){let h=1+(e<<1);const f=h+1;if(f<this.length&&a(i[f],i[h])<0&&(h=f),a(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}function P_(r,e=1,i=!1){const a=js.fromPoints(r[0]),o=Math.min(a.width(),a.height());let u=o/2;const h=new S_([],M_),{minX:f,minY:g,maxX:y,maxY:v}=a;if(o===0)return new be(f,g);for(let P=f;P<y;P+=o)for(let E=g;E<v;E+=o)h.push(new Ko(P+u,E+u,u,r));let b=(function(P){let E=0,z=0,L=0;const V=P[0];for(let W=0,j=V.length,U=j-1;W<j;U=W++){const Q=V[W],ne=V[U],he=Q.x*ne.y-ne.x*Q.y;z+=(Q.x+ne.x)*he,L+=(Q.y+ne.y)*he,E+=3*he}return new Ko(z/E,L/E,0,P)})(r),S=h.length;for(;h.length;){const P=h.pop();(P.d>b.d||!b.d)&&(b=P,i&&Math.round(1e4*P.d)/1e4),P.max-b.d<=e||(u=P.h/2,h.push(new Ko(P.p.x-u,P.p.y-u,u,r)),h.push(new Ko(P.p.x+u,P.p.y-u,u,r)),h.push(new Ko(P.p.x-u,P.p.y+u,u,r)),h.push(new Ko(P.p.x+u,P.p.y+u,u,r)),S+=4)}return i&&(`${S}`,`${b.d}`),b.p}function M_(r,e){return e.max-r.max}function Ko(r,e,i,a){this.p=new be(r,e),this.h=i,this.d=(function(o,u){let h=!1,f=1/0;for(let g=0;g<u.length;g++){const y=u[g];for(let v=0,b=y.length,S=b-1;v<b;S=v++){const P=y[v],E=y[S];P.y>o.y!=E.y>o.y&&o.x<(E.x-P.x)*(o.y-P.y)/(E.y-P.y)+P.x&&(h=!h),f=Math.min(f,Bd(o,P,E))}}return(h?1:-1)*Math.sqrt(f)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ei;C.aP=void 0,(Ei=C.aP||(C.aP={}))[Ei.center=1]="center",Ei[Ei.left=2]="left",Ei[Ei.right=3]="right",Ei[Ei.top=4]="top",Ei[Ei.bottom=5]="bottom",Ei[Ei["top-left"]=6]="top-left",Ei[Ei["top-right"]=7]="top-right",Ei[Ei["bottom-left"]=8]="bottom-left",Ei[Ei["bottom-right"]=9]="bottom-right";const fd=Number.POSITIVE_INFINITY;function Rf(r,e){return e[1]!==fd?(function(i,a,o){let u=0,h=0;switch(a=Math.abs(a),o=Math.abs(o),i){case"top-right":case"top-left":case"top":h=o-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-o}switch(i){case"top-right":case"bottom-right":case"right":u=-a;break;case"top-left":case"bottom-left":case"left":u=a}return[u,h]})(r,e[0],e[1]):(function(i,a){let o=0,u=0;a<0&&(a=0);const h=a/Math.SQRT2;switch(i){case"top-right":case"top-left":u=h-7;break;case"bottom-right":case"bottom-left":u=7-h;break;case"bottom":u=7-a;break;case"top":u=a-7}switch(i){case"top-right":case"bottom-right":o=-h;break;case"top-left":case"bottom-left":o=h;break;case"left":o=a;break;case"right":o=-a}return[o,u]})(r,e[0])}function Lf(r,e,i){var a;const o=r.layout,u=(a=o.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(e,{},i);if(u){const f=u.values,g=[];for(let y=0;y<f.length;y+=2){const v=g[y]=f[y],b=f[y+1].map((S=>S*fi));v.startsWith("top")?b[1]-=7:v.startsWith("bottom")&&(b[1]+=7),g[y+1]=b}return new Li(g)}const h=o.get("text-variable-anchor");if(h){let f;f=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},i)*fi,fd]:o.get("text-offset").evaluate(e,{},i).map((y=>y*fi));const g=[];for(const y of h)g.push(y,Rf(y,f));return new Li(g)}return null}function md(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function I_(r,e,i,a,o,u,h,f,g,y,v,b){let S=u.textMaxSize.evaluate(e,{});S===void 0&&(S=h);const P=r.layers[0].layout,E=P.get("icon-offset").evaluate(e,{},v),z=Bf(i.horizontal),L=h/24,V=r.tilePixelRatio*L,W=r.tilePixelRatio*S/24,j=r.tilePixelRatio*f,U=r.tilePixelRatio*P.get("symbol-spacing"),Q=P.get("text-padding")*r.tilePixelRatio,ne=(function(Ve,We,Ue,ct=1){const Vt=Ve.get("icon-padding").evaluate(We,{},Ue),li=Vt&&Vt.values;return[li[0]*ct,li[1]*ct,li[2]*ct,li[3]*ct]})(P,e,v,r.tilePixelRatio),he=P.get("text-max-angle")/180*Math.PI,we=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Te=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",Ie=P.get("symbol-placement"),De=U/2,Ee=P.get("icon-text-fit");let Se;a&&Ee!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(Se=Ip(a,i.vertical,Ee,P.get("icon-text-fit-padding"),E,L)),z&&(a=Ip(a,z,Ee,P.get("icon-text-fit-padding"),E,L)));const ye=v?b.line.getGranularityForZoomLevel(v.z):1,je=(Ve,We)=>{We.x<0||We.x>=gt||We.y<0||We.y>=gt||(function(Ue,ct,Vt,li,Ci,Fr,Xi,vi,Ai,ri,bi,Vi,Ni,nr,zi,ar,Br,gi,Gt,ci,Yt,_i,ia,Hr,gc){const Ga=Ue.addToLineVertexArray(ct,Vt);let Ns,Jo,Qo,el,Nf=0,Uf=0,Gf=0,qf=0,Td=-1,Sd=-1;const ra={};let $f=ti("");if(Ue.allowVerticalPlacement&&li.vertical){const Ui=vi.layout.get("text-rotate").evaluate(Yt,{},Hr)+90;Qo=new $u(Ai,ct,ri,bi,Vi,li.vertical,Ni,nr,zi,Ui),Xi&&(el=new $u(Ai,ct,ri,bi,Vi,Xi,Br,gi,zi,Ui))}if(Ci){const Ui=vi.layout.get("icon-rotate").evaluate(Yt,{}),Ir=vi.layout.get("icon-text-fit")!=="none",Us=kf(Ci,Ui,ia,Ir),Yr=Xi?kf(Xi,Ui,ia,Ir):void 0;Jo=new $u(Ai,ct,ri,bi,Vi,Ci,Br,gi,!1,Ui),Nf=4*Us.length;const Gs=Ue.iconSizeData;let bn=null;Gs.kind==="source"?(bn=[ta*vi.layout.get("icon-size").evaluate(Yt,{})],bn[0]>Oa&&Si(`${Ue.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Gs.kind==="composite"&&(bn=[ta*_i.compositeIconSizes[0].evaluate(Yt,{},Hr),ta*_i.compositeIconSizes[1].evaluate(Yt,{},Hr)],(bn[0]>Oa||bn[1]>Oa)&&Si(`${Ue.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ue.addSymbols(Ue.icon,Us,bn,ci,Gt,Yt,C.az.none,ct,Ga.lineStartIndex,Ga.lineLength,-1,Hr),Td=Ue.icon.placedSymbolArray.length-1,Yr&&(Uf=4*Yr.length,Ue.addSymbols(Ue.icon,Yr,bn,ci,Gt,Yt,C.az.vertical,ct,Ga.lineStartIndex,Ga.lineLength,-1,Hr),Sd=Ue.icon.placedSymbolArray.length-1)}const Zf=Object.keys(li.horizontal);for(const Ui of Zf){const Ir=li.horizontal[Ui];if(!Ns){$f=ti(Ir.text);const Yr=vi.layout.get("text-rotate").evaluate(Yt,{},Hr);Ns=new $u(Ai,ct,ri,bi,Vi,Ir,Ni,nr,zi,Yr)}const Us=Ir.positionedLines.length===1;if(Gf+=Ff(Ue,ct,Ir,Fr,vi,zi,Yt,ar,Ga,li.vertical?C.az.horizontal:C.az.horizontalOnly,Us?Zf:[Ui],ra,Td,_i,Hr),Us)break}li.vertical&&(qf+=Ff(Ue,ct,li.vertical,Fr,vi,zi,Yt,ar,Ga,C.az.vertical,["vertical"],ra,Sd,_i,Hr));const A_=Ns?Ns.boxStartIndex:Ue.collisionBoxArray.length,z_=Ns?Ns.boxEndIndex:Ue.collisionBoxArray.length,k_=Qo?Qo.boxStartIndex:Ue.collisionBoxArray.length,D_=Qo?Qo.boxEndIndex:Ue.collisionBoxArray.length,R_=Jo?Jo.boxStartIndex:Ue.collisionBoxArray.length,L_=Jo?Jo.boxEndIndex:Ue.collisionBoxArray.length,F_=el?el.boxStartIndex:Ue.collisionBoxArray.length,B_=el?el.boxEndIndex:Ue.collisionBoxArray.length;let Xr=-1;const Wu=(Ui,Ir)=>Ui&&Ui.circleDiameter?Math.max(Ui.circleDiameter,Ir):Ir;Xr=Wu(Ns,Xr),Xr=Wu(Qo,Xr),Xr=Wu(Jo,Xr),Xr=Wu(el,Xr);const Wf=Xr>-1?1:0;Wf&&(Xr*=gc/fi),Ue.glyphOffsetArray.length>=$o.MAX_GLYPHS&&Si("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Yt.sortKey!==void 0&&Ue.addToSortKeyRanges(Ue.symbolInstances.length,Yt.sortKey);const O_=Lf(vi,Yt,Hr),[j_,V_]=(function(Ui,Ir){const Us=Ui.length,Yr=Ir==null?void 0:Ir.values;if((Yr==null?void 0:Yr.length)>0)for(let Gs=0;Gs<Yr.length;Gs+=2){const bn=Yr[Gs+1];Ui.emplaceBack(C.aP[Yr[Gs]],bn[0],bn[1])}return[Us,Ui.length]})(Ue.textAnchorOffsets,O_);Ue.symbolInstances.emplaceBack(ct.x,ct.y,ra.right>=0?ra.right:-1,ra.center>=0?ra.center:-1,ra.left>=0?ra.left:-1,ra.vertical||-1,Td,Sd,$f,A_,z_,k_,D_,R_,L_,F_,B_,ri,Gf,qf,Nf,Uf,Wf,0,Ni,Xr,j_,V_)})(r,We,Ve,i,a,o,Se,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,V,[Q,Q,Q,Q],we,g,j,ne,Te,E,e,u,y,v,h)};if(Ie==="line")for(const Ve of Sf(e.geometry,0,0,gt,gt)){const We=Os(Ve,ye),Ue=T_(We,U,he,i.vertical||z,a,24,W,r.overscaling,gt);for(const ct of Ue)z&&E_(r,z.text,De,ct)||je(We,ct)}else if(Ie==="line-center"){for(const Ve of e.geometry)if(Ve.length>1){const We=Os(Ve,ye),Ue=w_(We,he,i.vertical||z,a,24,W);Ue&&je(We,Ue)}}else if(e.type==="Polygon")for(const Ve of no(e.geometry,0)){const We=P_(Ve,16);je(Os(Ve[0],ye,!0),new Ua(We.x,We.y,0))}else if(e.type==="LineString")for(const Ve of e.geometry){const We=Os(Ve,ye);je(We,new Ua(We[0].x,We[0].y,0))}else if(e.type==="Point")for(const Ve of e.geometry)for(const We of Ve)je([We],new Ua(We.x,We.y,0))}function Ff(r,e,i,a,o,u,h,f,g,y,v,b,S,P,E){const z=(function(W,j,U,Q,ne,he,we,Te){const Ie=Q.layout.get("text-rotate").evaluate(he,{})*Math.PI/180,De=[];for(const Ee of j.positionedLines)for(const Se of Ee.positionedGlyphs){if(!Se.rect)continue;const ye=Se.rect||{};let je=4,Ve=!0,We=1,Ue=0;const ct=(ne||Te)&&Se.vertical,Vt=Se.metrics.advance*Se.scale/2;if(Te&&j.verticalizable&&(Ue=Ee.lineOffset/2-(Se.imageName?-(fi-Se.metrics.width*Se.scale)/2:(Se.scale-1)*fi)),Se.imageName){const gi=we[Se.imageName];Ve=gi.sdf,We=gi.pixelRatio,je=1/We}const li=ne?[Se.x+Vt,Se.y]:[0,0];let Ci=ne?[0,0]:[Se.x+Vt+U[0],Se.y+U[1]-Ue],Fr=[0,0];ct&&(Fr=Ci,Ci=[0,0]);const Xi=Se.metrics.isDoubleResolution?2:1,vi=(Se.metrics.left-je)*Se.scale-Vt+Ci[0],Ai=(-Se.metrics.top-je)*Se.scale+Ci[1],ri=vi+ye.w/Xi*Se.scale/We,bi=Ai+ye.h/Xi*Se.scale/We,Vi=new be(vi,Ai),Ni=new be(ri,Ai),nr=new be(vi,bi),zi=new be(ri,bi);if(ct){const gi=new be(-Vt,Vt- -17),Gt=-Math.PI/2,ci=12-Vt,Yt=new be(22-ci,-(Se.imageName?ci:0)),_i=new be(...Fr);Vi._rotateAround(Gt,gi)._add(Yt)._add(_i),Ni._rotateAround(Gt,gi)._add(Yt)._add(_i),nr._rotateAround(Gt,gi)._add(Yt)._add(_i),zi._rotateAround(Gt,gi)._add(Yt)._add(_i)}if(Ie){const gi=Math.sin(Ie),Gt=Math.cos(Ie),ci=[Gt,-gi,gi,Gt];Vi._matMult(ci),Ni._matMult(ci),nr._matMult(ci),zi._matMult(ci)}const ar=new be(0,0),Br=new be(0,0);De.push({tl:Vi,tr:Ni,bl:nr,br:zi,tex:ye,writingMode:j.writingMode,glyphOffset:li,sectionIndex:Se.sectionIndex,isSDF:Ve,pixelOffsetTL:ar,pixelOffsetBR:Br,minFontScaleX:0,minFontScaleY:0})}return De})(0,i,f,o,u,h,a,r.allowVerticalPlacement),L=r.textSizeData;let V=null;L.kind==="source"?(V=[ta*o.layout.get("text-size").evaluate(h,{})],V[0]>Oa&&Si(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):L.kind==="composite"&&(V=[ta*P.compositeTextSizes[0].evaluate(h,{},E),ta*P.compositeTextSizes[1].evaluate(h,{},E)],(V[0]>Oa||V[1]>Oa)&&Si(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,z,V,f,u,h,y,e,g.lineStartIndex,g.lineLength,S,E);for(const W of v)b[W]=r.text.placedSymbolArray.length-1;return 4*z.length}function Bf(r){for(const e in r)return r[e];return null}function E_(r,e,i,a){const o=r.compareText;if(e in o){const u=o[e];for(let h=u.length-1;h>=0;h--)if(a.dist(u[h])<i)return!0}else o[e]=[];return o[e].push(a),!1}const Of=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class gd{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,a]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=a>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const u=Of[15&a];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new gd(f,h,u,e)}constructor(e,i=64,a=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=a,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Of.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${a}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=e,this.coords[this._pos++]=i,a}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return _d(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,a,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,g=[0,u.length-1,0],y=[];for(;g.length;){const v=g.pop()||0,b=g.pop()||0,S=g.pop()||0;if(b-S<=f){for(let L=S;L<=b;L++){const V=h[2*L],W=h[2*L+1];V>=e&&V<=a&&W>=i&&W<=o&&y.push(u[L])}continue}const P=S+b>>1,E=h[2*P],z=h[2*P+1];E>=e&&E<=a&&z>=i&&z<=o&&y.push(u[P]),(v===0?e<=E:i<=z)&&(g.push(S),g.push(P-1),g.push(1-v)),(v===0?a>=E:o>=z)&&(g.push(P+1),g.push(b),g.push(1-v))}return y}within(e,i,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:u,nodeSize:h}=this,f=[0,o.length-1,0],g=[],y=a*a;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,S=f.pop()||0;if(b-S<=h){for(let L=S;L<=b;L++)Vf(u[2*L],u[2*L+1],e,i)<=y&&g.push(o[L]);continue}const P=S+b>>1,E=u[2*P],z=u[2*P+1];Vf(E,z,e,i)<=y&&g.push(o[P]),(v===0?e-a<=E:i-a<=z)&&(f.push(S),f.push(P-1),f.push(1-v)),(v===0?e+
vendor: 1,344 bytes, line 5
5a>=E:i+a>=z)&&(f.push(P+1),f.push(b),f.push(1-v))}return g}}function _d(r,e,i,a,o,u){if(o-a<=i)return;const h=a+o>>1;jf(r,e,h,a,o,u),_d(r,e,i,a,h-1,1-u),_d(r,e,i,h+1,o,1-u)}function jf(r,e,i,a,o,u){for(;o>a;){if(o-a>600){const y=o-a+1,v=i-a+1,b=Math.log(y),S=.5*Math.exp(2*b/3),P=.5*Math.sqrt(b*S*(y-S)/y)*(v-y/2<0?-1:1);jf(r,e,i,Math.max(a,Math.floor(i-v*S/y+P)),Math.min(o,Math.floor(i+(y-v)*S/y+P)),u)}const h=e[2*i+u];let f=a,g=o;for(fc(r,e,a,i),e[2*o+u]>h&&fc(r,e,a,o);f<g;){for(fc(r,e,f,g),f++,g--;e[2*f+u]<h;)f++;for(;e[2*g+u]>h;)g--}e[2*a+u]===h?fc(r,e,a,g):(g++,fc(r,e,g,o)),g<=i&&(a=g+1),i<=g&&(o=g-1)}}function fc(r,e,i,a){yd(r,i,a),yd(e,2*i,2*a),yd(e,2*i+1,2*a+1)}function yd(r,e,i){const a=r[e];r[e]=r[i],r[i]=a}function Vf(r,e,i,a){const o=r-i,u=e-a;return o*o+u*u}var xd;C.cI=void 0,(xd=C.cI||(C.cI={})).create="create",xd.load="load",xd.fullLoad="fullLoad";let Zu=null,mc=[];const vd=1e3/60,bd="loadTime",wd="fullLoadTime",C_={mark(r){performance.mark(r)},recordStartOfFrameAt(r){Zu!=null&&mc.push(r-Zu),Zu=r},resetRuntimeMetrics(){Zu=null,mc=[]},clearInitializationMetrics(){performance.clearMeasures(bd),performance.clearMeasures(wd);for(const r in C.cI)performance.clearMarks(C.cI[r])},remove(){this.resetRuntimeMetrics(),this.clearInitializationMetrics()},getPerformanceMetrics(){performance.measure(bd,C.cI.create,C.cI.load
5),performance.measure(wd,C.cI.create,C.cI.fullLoad);const r=performance.getEntriesByName(bd)[0].duration,e=performance.getEntriesByName(wd)[0].duration,i=mc.length;return{loadTimeMs:r,fullLoadTimeMs:e,averageFramesPerSecond:1/(mc.reduce(((a,o)=>a+o),0)/i/1e3),virtualDroppedFramesCount:mc.filter((a=>a>vd)).reduce(((a,o)=>a+(o-vd)/vd),0),totalFramesCount:i}}};C.$=xe,C.A=vt,C.B=ka,C.C=di,C.D=qe,C.E=ve,C.F=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},C.G=Bt,C.H=Tt,C.I=Uh,C.J=uu,C.K=function(r){if(Ft==null){const e=r.navigator?r.navigator.userAgent:null;Ft=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ft},C.L=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new qg((()=>this.process())),this.subscription=ca(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=zr(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,a)=>{const o=Math.round(1e18*Math.random()).toString(36).substring(0,10),u=e?ca(e.signal,"abort",(()=>{u==null||u.unsubscribe(),delete this.resolveRejects[o];const g={id:o,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),$g):null;this.resolveRejects[o]={resolve:g=>{u==null||u.unsubscribe(),i(g)},reject:g=>{u==null||u.unsubscribe(),a(g)}};const h=[],f=Object.assign(Object.assign({},r),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Ss(r.data,h)});this.target.postMessage(f,{transfer:h})}))}receive(r){const e=r.data,i=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const a=this.abortControllers[i];return delete this.abortControllers[i],void(a&&a.abort())}if(zr(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return c(this,void 0,void 0,(function*(){if(e.type==="<response>"){const o=this.resolveRejects[r];return delete this.resolveRejects[r],o?void(e.error?o.reject(Ps(e.error)):o.resolve(Ps(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=Ps(e.data),a=new AbortController;this.abortControllers[r]=a;try{const o=yield this.messageHandlers[e.type](e.sourceMapId,i,a);this.completeTask(r,null,o)}catch(o){this.completeTask(r,o)}}))}completeTask(r,e,i){const a=[];delete this.abortControllers[r];const o={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Ss(e):null,data:Ss(i,a)};this.target.postMessage(o,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},C.M=D,C.N=function(){var r=new vt(16);return vt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},C.O=function(r,e,i){var a,o,u,h,f,g,y,v,b,S,P,E,z=i[0],L=i[1],V=i[2];return e===r?(r[12]=e[0]*z+e[4]*L+e[8]*V+e[12],r[13]=e[1]*z+e[5]*L+e[9]*V+e[13],r[14]=e[2]*z+e[6]*L+e[10]*V+e[14],r[15]=e[3]*z+e[7]*L+e[11]*V+e[15]):(o=e[1],u=e[2],h=e[3],f=e[4],g=e[5],y=e[6],v=e[7],b=e[8],S=e[9],P=e[10],E=e[11],r[0]=a=e[0],r[1]=o,r[2]=u,r[3]=h,r[4]=f,r[5]=g,r[6]=y,r[7]=v,r[8]=b,r[9]=S,r[10]=P,r[11]=E,r[12]=a*z+f*L+b*V+e[12],r[13]=o*z+g*L+S*V+e[13],r[14]=u*z+y*L+P*V+e[14],r[15]=h*z+v*L+E*V+e[15]),r},C.P=be,C.Q=function(r,e,i){var a=i[0],o=i[1],u=i[2];return r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r[3]=e[3]*a,r[4]=e[4]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},C.R=rr,C.S=function(r,e,i){var a=e[0],o=e[1],u=e[2],h=e[3],f=e[4],g=e[5],y=e[6],v=e[7],b=e[8],S=e[9],P=e[10],E=e[11],z=e[12],L=e[13],V=e[14],W=e[15],j=i[0],U=i[1],Q=i[2],ne=i[3];return r[0]=j*a+U*f+Q*b+ne*z,r[1]=j*o+U*g+Q*S+ne*L,r[2]=j*u+U*y+Q*P+ne*V,r[3]=j*h+U*v+Q*E+ne*W,r[4]=(j=i[4])*a+(U=i[5])*f+(Q=i[6])*b+(ne=i[7])*z,r[5]=j*o+U*g+Q*S+ne*L,r[6]=j*u+U*y+Q*P+ne*V,r[7]=j*h+U*v+Q*E+ne*W,r[8]=(j=i[8])*a+(U=i[9])*f+(Q=i[10])*b+(ne=i[11])*z,r[9]=j*o+U*g+Q*S+ne*L,r[10]=j*u+U*y+Q*P+ne*V,r[11]=j*h+U*v+Q*E+ne*W,r[12]=(j=i[12])*a+(U=i[13])*f+(Q=i[14])*b+(ne=i[15])*z,r[13]=j*o+U*g+Q*S+ne*L,r[14]=j*u+U*y+Q*P+ne*V,r[15]=j*h+U*v+Q*E+ne*W,r},C.T=Dh,C.U=function(r,e){const i={};for(let a=0;a<e.length;a++){const o=e[a];o in r&&(i[o]=r[o])}return i},C.V=ja,C.W=wi,C.X=Fp,C.Y=Lp,C.Z=Dn,C._=c,C.a=Ya,C.a$=tn,C.a0=sr,C.a1=zn,C.a2=pr,C.a3=Op,C.a4=Ru,C.a5=gt,C.a6=function(r,e,i){if(!r)return e||{};if(!e)return r||{};const a=Up(r),o=Up(e);(function(h,f){f.removeAll&&(h.add.clear(),h.update.clear(),h.remove.clear(),f.remove.clear());for(const g of f.remove)h.add.delete(g),h.update.delete(g);for(const[g,y]of f.update){const v=h.update.get(g);v&&(f.update.set(g,Zg(v,y)),h.update.delete(g))}})(a,o);const u={};
5if((a.removeAll||o.removeAll)&&(u.removeAll=!0),u.remove=new Set([...a.remove,...o.remove]),u.add=new Map([...a.add,...o.add]),u.update=new Map([...a.update,...o.update]),u.remove.size&&u.add.size)for(const h of u.add.keys())u.remove.delete(h);return(function(h){const f={};return h.removeAll&&(f.removeAll=h.removeAll),h.remove&&(f.remove=Array.from(h.remove)),h.add&&(f.add=Array.from(h.add.values())),h.update&&(f.update=Array.from(h.update.values())),f})(u)},C.a7=function(r,e){const i=new Map;if(r==null||r.type==null)return i;if(r.type==="Feature"){const a=Kh(r,e);return a==null?void 0:(i.set(a,r),i)}if(r.type==="FeatureCollection"){const a=new Set;for(const o of r.features){const u=Kh(o,e);if(u==null||a.has(u))return;a.add(u),i.set(u,o)}return i}},C.a8=function(r,e,i){var a,o;const u=[];if(e.removeAll)r.clear();else if(e.remove)for(const h of e.remove){const f=r.get(h);f&&(u.push(f.geometry),r.delete(h))}if(e.add)for(const h of e.add){const f=Kh(h,i);if(f==null)continue;const g=r.get(f);g&&u.push(g.geometry),u.push(h.geometry),r.set(f,h)}if(e.update)for(const h of e.update){const f=r.get(h.id);if(!f)continue;const g=!!h.newGeometry,y=h.removeAllProperties||((a=h.removeProperties)===null||a===void 0?void 0:a.length)>0||((o=h.addOrUpdateProperties)===null||o===void 0?void 0:o.length)>0;if(!g&&!y)continue;u.push(f.geometry);const v=Object.assign({},f);if(r.set(h.id,v),g&&(u.push(h.newGeometry),v.geometry=h.newGeometry),y){if(v.properties=h.removeAllProperties?{}:Object.assign({},v.properties||{}),h.removeProperties)for(const b of h.removeProperties)delete v.properties[b];if(h.addOrUpdateProperties)for(const{key:b,value:S}of h.addOrUpdateProperties)v.properties[b]=S}}return u},C.a9=uc,C.aA=function(r,{uSize:e,uSizeT:i},{lowerSize:a,upperSize:o}){return r.kind==="source"?a/ta:r.kind==="composite"?Bt.number(a/ta,o/ta,i):e},C.aB=function(r,e){var i=e[0],a=e[1],o=e[2],u=e[3],h=e[4],f=e[5],g=e[6],y=e[7],v=e[8],b=e[9],S=e[10],P=e[11],E=e[12],z=e[13],L=e[14],V=e[15],W=i*f-a*h,j=i*g-o*h,U=i*y-u*h,Q=a*g-o*f,ne=a*y-u*f,he=o*y-u*g,we=v*z-b*E,Te=v*L-S*E,Ie=v*V-P*E,De=b*L-S*z,Ee=b*V-P*z,Se=S*V-P*L,ye=W*Se-j*Ee+U*De+Q*Ie-ne*Te+he*we;return ye?(r[0]=(f*Se-g*Ee+y*De)*(ye=1/ye),r[1]=(o*Ee-a*Se-u*De)*ye,r[2]=(z*he-L*ne+V*Q)*ye,r[3]=(S*ne-b*he-P*Q)*ye,r[4]=(g*Ie-h*Se-y*Te)*ye,r[5]=(i*Se-o*Ie+u*Te)*ye,r[6]=(L*U-E*he-V*j)*ye,r[7]=(v*he-S*U+P*j)*ye,r[8]=(h*Ee-f*Ie+y*we)*ye,r[9]=(a*Ie-i*Ee-u*we)*ye,r[10]=(E*ne-z*U+V*W)*ye,r[11]=(b*U-v*ne-P*W)*ye,r[12]=(f*Te-h*De-g*we)*ye,r[13]=(i*De-a*Te+o*we)*ye,r[14]=(z*j-E*Q-L*W)*ye,r[15]=(v*Q-b*j+S*W)*ye,r):null},C.aC=jr,C.aD=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},C.aE=function(r){return r[0]=0,r[1]=0,r},C.aF=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},C.aG=$h,C.aH=nn,C.aI=function(r,e,i,a){const o=e.y-r.y,u=e.x-r.x,h=a.y-i.y,f=a.x-i.x,g=h*u-f*o;if(g===0)return null;const y=(f*(r.y-i.y)-h*(r.x-i.x))/g;return new be(r.x+y*u,r.y+y*o)},C.aJ=Sf,C.aK=Bo,C.aL=function(r){let e=1/0,i=1/0,a=-1/0,o=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),a=Math.max(a,u.x),o=Math.max(o,u.y);return[e,i,a,o]},C.aM=fi,C.aN=En,C.aO=function(r,e,i,a,o=!1){if(!i[0]&&!i[1])return[0,0];const u=o?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(u){const h=Math.sin(u),f=Math.cos(u);i=[i[0]*f-i[1]*h,i[0]*h+i[1]*f]}return[o?i[0]:En(e,i[0],r.zoom),o?i[1]:En(e,i[1],r.zoom)]},C.aQ=qh,C.aR=md,C.aS=Gh,C.aT=gd,C.aU=ei,C.aV=Eu,C.aW=G,C.aX=Le,C.aY=ge,C.aZ=Qi,C.a_=jp,C.aa=js,C.ab=25,C.ac=Yh,C.ad=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const a of r){const o=window.document.createElement("source");ce(a)||(e.crossOrigin="Anonymous"),o.src=a,e.appendChild(o)}}))},C.ae=Ce,C.af=function(){return oa++},C.ag=l,C.ah=$o,C.ai=pc,C.aj=ms,C.ak=vn,C.al=qp,C.am=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,a,o,u)=>{const h=o||u;return e[a]=!h||h.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},C.an=or,C.ao=85.051129,C.ap=kn,C.aq=function(r){return Math.pow(2,r)},C.ar=na,C.as=Bp,C.at=function(r){return Math.log(r)/Math.LN2},C.au=function(r){var e=r[0],i=r[1];return e*e+i*i}
vendor: 8,734 bytes, line 5
5,C.av=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,a=-1/0,o=1/0,u=-1/0;const h=[];for(const g of r){const{x:y,y:v,z:b}=g.canonical,S=Math.pow(2,e-b),P=y*S,E=v*S;h.push({id:g,x:P,y:E}),P<i&&(i=P),P>a&&(a=P),E<o&&(o=E),E>u&&(u=E)}const f=new Set;for(const g of h)g.x!==i&&g.x!==a&&g.y!==o&&g.y!==u||f.add(g.id);return f},C.aw=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||a-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},C.ax=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const a=r.wrapped().key;this.data[a]===void 0&&(this.data[a]=[]);const o={value:e,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout((()=>{this.remove(r,o)}),i)),this.data[a].push(o),this.order.push(a),this.order.length>this.max){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,a=e===void 0?0:this.data[i].indexOf(e),o=this.data[i][a];return this.data[i].splice(a,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const a of this.data[i])r(a.value)||e.push(a);for(const i of e)this.remove(i.value.tileID,i)}},C.ay=function(r,e){let i=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:o,minZoom:u,maxZoom:h}=r,f=o?or(Bi.interpolationFactor(o,e,u,h),0,1):0;r.kind==="camera"?a=Bt.number(r.minSize,r.maxSize,f):i=f}return{uSizeT:i,uSize:a}},C.b=Nr,C.b$=Qn,C.b0=Er,C.b1=function(r){var e=new vt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},C.b2=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},C.b3=function(r,e){var i=e[0],a=e[1],o=e[2],u=i*i+a*a+o*o;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r},C.b4=In,C.b5=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},C.b6=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},C.b7=Ki,C.b8=function(r,e,i){const a=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return a===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/a},C.b9=Cr,C.bA=function(){return new Float64Array(3)},C.bB=aa,C.bC=function(r,e,i){var a=i[0],o=i[1],u=i[2],h=i[3],f=e[0],g=e[1],y=e[2],v=o*y-u*g,b=u*f-a*y,S=a*g-o*f;return r[0]=f+h*(v+=v)+o*(S+=S)-u*(b+=b),r[1]=g+h*b+u*v-a*S,r[2]=y+h*S+a*b-o*v,r},C.bD=function(r,e,i){const a=(o=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((v=o[8])*(h=o[4])-(f=o[5])*(y=o[7]))+o[1]*(-v*(u=o[3])+f*(g=o[6]))+o[2]*(y*u-h*g);var o,u,h,f,g,y,v;if(a===0)return null;const b=In([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),S=In([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),P=In([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),E=tn([],b,-r[3]);return Er(E,E,tn([],S,-e[3])),Er(E,E,tn([],P,-i[3])),tn(E,E,1/a),E},C.bE=Xh,C.bF=function(){return new Float64Array(4)},C.bG=function(r,e,i,a){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[0]*Math.cos(a)-o[1]*Math.sin(a),u[1]=o[0]*Math.sin(a)+o[1]*Math.cos(a),u[2]=o[2],r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},C.bH=function(r,e,i,a){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[0],u[1]=o[1]*Math.cos(a)-o[2]*Math.sin(a),u[2]=o[1]*Math.sin(a)+o[2]*Math.cos(a),r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},C.bI=function(r,e,i,a){var o=[],u=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],u[0]=o[2]*Math.sin(a)+o[0]*Math.cos(a),u[1]=o[1],u[2]=o[2]*Math.cos(a)-o[0]*Math.sin(a),r[0]=u[0]+i[0],r[1]=u[1]+i[1],r[2]=u[2]+i[2],r},C.bJ=function(r,e,i){var a=Math.sin(i),o=Math.cos(i),u=e[0],h=e[1],f=e[2],g=e[3],y=e[8],v=e[9],b=e[10],S=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*o-y*a,r[1]=h*o-v*a,r[2]=f*o-b*a,r[3]=g*o-S*a,r[8]=u*a+y*o,r[9]=h*a+v*o,r[10]=f*a+b*o,r[11]=g*a+S*o,r},C.bK=function(r,e){const i=Ar(r,360),a=Ar(e,360),o=a-i,u=a>i?o-360:o+360;return Math.abs(o)<Math.abs(u)?o:u},C.bL=function(r){return r[0]=0,r[1]=0,r[2]=0,r},C.bM=function(r,e,i,a){const o=Math.sqrt(r*r+e*e),u=Math.sqrt(i*i+a*a);r/=o,e/=o,i/=u,a/=u;const h=Math.acos(r*i+e*a);return-e*i+r*a>0?h:-h},C.bN=function(r,e){const i=Ar(r,2*Math.PI),a=Ar(e,2*Math.PI);return Math.min(Math.abs(i-a),Math.abs(i-a+2*Math.PI),Math.abs(i-a-2*Math.PI))},C.bO=function(){const r={},e=ie.$version;for(const i in ie.$root){const a=ie.$root[i];if(a.required){let o=null;o=i==="version"?e:a.type==="array"?[]:{},o!=null&&(r[i]=o)}}return r},C.bP=K,C.bQ=Bl,C.bR=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let a=0;a<e.length;a++)if(!r(e[a],i[a]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const a in e)if(!r(e[a],i[a]))return!1;return!0}return e===i},C.bS=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=it(r[i],e[r[i].ref]));return r},C.bT=function(r,e){if(r.type==="custom")return new Gg(r,e);switch(r.type){case"background":return new Ug(r,e);case"circle":return new Mm(r,e);case"color-relief":return new km(r,e);case"fill":return new Wm(r,e);case"fill-extrusion":return new ag(r,e);case"heatmap":return new Em(r,e);case"hillshade":return new Am(r,e);case"line":return new dg(r,e);case"raster":return new Sh(r,e);case"symbol":return new Du(r,e)}},C.bU=r=>r.type==="raster",C.bV=Ti,C.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!Xe(r.version,e.version))return[{command:"setStyle",args:[e]}];Xe(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),Xe(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),Xe(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Xe(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),Xe(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),Xe(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),Xe(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),Xe(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),Xe(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),Xe(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),Xe(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),Xe(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),Xe(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),Xe(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const a={},o=[];(function(h,f,g,y){let v;for(v in f=f||{},h=h||{})Object.prototype.hasOwnProperty.call(h,v)&&(Object.prototype.hasOwnProperty.call(f,v)||et(v,g,y));for(v in f)Object.prototype.hasOwnProperty.call(f,v)&&(Object.prototype.hasOwnProperty.call(h,v)?Xe(h[v],f[v])||(h[v].type==="geojson"&&f[v].type==="geojson"&&Kt(h,f,v)?Ye(g,{command:"setGeoJSONSourceData",args:[v,f[v].data]}):yt(v,f,g,y)):Qe(v,f,g))})(r.sources,e.sources,o,a);const u=[];r.layers&&r.layers.forEach((h=>{"source"in h&&a[h.source]?i.push({command:"removeLayer",args:[h.id]}):u.push(h)})),i=i.concat(o),(function(h,f,g){f=f||[];const y=(h=h||[]).map(Pi),v=f.map(Pi),b=h.reduce($t,{}),S=f.reduce($t,{}),P=y.slice(),E=Object.create(null);let z,L,V,W,j;for(let U=0,Q=0;U<y.length;U++)z=y[U],Object.prototype.hasOwnProperty.call(S,z)?Q++:(Ye(g,{command:"removeLayer",args:[z]}),P.splice(P.indexOf(z,Q),1));for(let U=0,Q=0;U<v.length;U++)z=v[v.length-1-U],P[P.length-1-U]!==z&&(Object.prototype.hasOwnProperty.call(b,z)?(Ye(g,{command:"removeLayer",args:[z]}),P.splice(P.lastIndexOf(z,P.length-Q),1)):Q++,W=P[P.length-U],Ye(g,{command:"addLayer",args:[S[z],W]}),P.splice(P.length-U,0,z),E[z]=!0);for(let U=0;U<v.length;U++)if(z=v[U],L=b[z],V=S[z],!E[z]&&!Xe(L,V))if(Xe(L.source,V.source)&&Xe(L["s
5ource-layer"],V["source-layer"])&&Xe(L.type,V.type)){for(j in qt(L.layout,V.layout,g,z,null,"setLayoutProperty"),qt(L.paint,V.paint,g,z,null,"setPaintProperty"),Xe(L.filter,V.filter)||Ye(g,{command:"setFilter",args:[z,V.filter]}),Xe(L.minzoom,V.minzoom)&&Xe(L.maxzoom,V.maxzoom)||Ye(g,{command:"setLayerZoomRange",args:[z,V.minzoom,V.maxzoom]}),L)Object.prototype.hasOwnProperty.call(L,j)&&j!=="layout"&&j!=="paint"&&j!=="filter"&&j!=="metadata"&&j!=="minzoom"&&j!=="maxzoom"&&(j.indexOf("paint.")===0?qt(L[j],V[j],g,z,j.slice(6),"setPaintProperty"):Xe(L[j],V[j])||Ye(g,{command:"setLayerProperty",args:[z,j,V[j]]}));for(j in V)Object.prototype.hasOwnProperty.call(V,j)&&!Object.prototype.hasOwnProperty.call(L,j)&&j!=="layout"&&j!=="paint"&&j!=="filter"&&j!=="metadata"&&j!=="minzoom"&&j!=="maxzoom"&&(j.indexOf("paint.")===0?qt(L[j],V[j],g,z,j.slice(6),"setPaintProperty"):Xe(L[j],V[j])||Ye(g,{command:"setLayerProperty",args:[z,j,V[j]]}))}else Ye(g,{command:"removeLayer",args:[z]}),W=P[P.lastIndexOf(z)+1],Ye(g,{command:"addLayer",args:[V,W]})})(u,e.layers,i)}catch(a){console.warn("Unable to compute style diff:",a),i=[{command:"setStyle",args:[e]}]}return i},C.bX=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},C.bY=Cn,C.bZ=An,C.b_=class extends Zi{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},C.ba=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},C.bb=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},C.bc=Np,C.bd=Zo,C.be=function(r,e,i,a,o){var u=1/Math.tan(e/2);if(r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,o!=null&&o!==1/0){var h=1/(a-o);r[10]=(o+a)*h,r[14]=2*o*a*h}else r[10]=-1,r[14]=-2*a;return r},C.bf=function(r){var e=new vt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},C.bg=function(r,e,i){var a=Math.sin(i),o=Math.cos(i),u=e[0],h=e[1],f=e[2],g=e[3],y=e[4],v=e[5],b=e[6],S=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*o+y*a,r[1]=h*o+v*a,r[2]=f*o+b*a,r[3]=g*o+S*a,r[4]=y*o-u*a,r[5]=v*o-h*a,r[6]=b*o-f*a,r[7]=S*o-g*a,r},C.bh=function(r,e,i){var a=Math.sin(i),o=Math.cos(i),u=e[4],h=e[5],f=e[6],g=e[7],y=e[8],v=e[9],b=e[10],S=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*o+y*a,r[5]=h*o+v*a,r[6]=f*o+b*a,r[7]=g*o+S*a,r[8]=y*o-u*a,r[9]=v*o-h*a,r[10]=b*o-f*a,r[11]=S*o-g*a,r},C.bi=function(){const r=new Float32Array(16);return na(r),r},C.bj=function(){const r=new Float64Array(16);return na(r),r},C.bk=function(){return new Float64Array(16)},C.bl=function(r,e,i){const a=new Float64Array(4);return aa(a,r,e-90,i),a},C.bm=function(r,e,i,a){var o,u,h,f,g,y=e[0],v=e[1],b=e[2],S=e[3],P=i[0],E=i[1],z=i[2],L=i[3];return(u=y*P+v*E+b*z+S*L)<0&&(u=-u,P=-P,E=-E,z=-z,L=-L),1-u>St?(o=Math.acos(u),h=Math.sin(o),f=Math.sin((1-a)*o)/h,g=Math.sin(a*o)/h):(f=1-a,g=a),r[0]=f*y+g*P,r[1]=f*v+g*E,r[2]=f*b+g*z,r[3]=f*S+g*L,r},C.bn=function(r){const e=new Float64Array(9);var i,a,o,u,h,f,g,y,v,b,S,P,E,z,L,V,W,j;b=(o=(a=r)[0])*(g=o+o),S=(u=a[1])*g,E=(h=a[2])*g,z=h*(y=u+u),V=(f=a[3])*g,W=f*y,j=f*(v=h+h),(i=e)[0]=1-(P=u*y)-(L=h*v),i[3]=S-j,i[6]=E+W,i[1]=S+j,i[4]=1-b-L,i[7]=z-V,i[2]=E-W,i[5]=z+V,i[8]=1-b-P;const U=Qi(-Math.asin(or(e[2],-1,1)));let Q,ne;return Math.hypot(e[5],e[8])<.001?(Q=0,ne=-Qi(Math.atan2(e[3],e[4]))):(Q=Qi(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),ne=Qi(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:Q,pitch:U+90,bearing:ne}},C.bo=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},C.bp=ut,C.bq=Jn,C.br=Uo,C.bs=nc,C.bt=No,C.bu=Ha,C.bv=sa,C.bw=Fi,C.bx=function(r,e,i,a,o){return Ha(a,o,or((r-e)/(i-e),0,1))},C.by=function(r,e,i,a){return r[0]=e[0]+i[0]*a,r[1]=e[1]+i[1]*a,r[2]=e[2]+i[2]*a,r},C.bz=Ar,C.c=le,C.c$=class{constructor(r){this.start=`${r}#start`,this.end=`${r}#end`,this.measure=r,performance.mark(this.start)}finish(){performance.mark(this.end);let r=performance.getEntriesByName(this.measure);return r.length===0&&(performance.measure(this.measure,this.start,this.end),r=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),r}},C.c0=class extends Zi{constructor(r,e){super(r,e),this.current=dr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},C.c1=Fs,C.c2=class extends Zi{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},C.c3=class extends Zi{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},C.c4=Mn,C.c5=function(r,e){var i=Math.sin(e),a=Math.cos(e);return r[0]=a,r[1]=i,r[2]=0,r[3]=-i,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},C.c6=function(r,e,i){var a=e[0],o=e[1],u=e[2];return r[0]=a*i[0]+o*i[3]+u*i[6],r[1]=a*i[1]+o*i[4]+u*i[7],r[2]=a*i[2]+o*i[5]+u*i[8],r},C.c7=function(r,e,i,a,o,u,h){var f=1/(e-i),g=1/(a-o),y=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*y,r[11]=0,r[12]=(e+i)*f,r[13]=(o+a)*g,r[14]=(h+u)*y,r[15]=1,r},C.c8=class extends Zi{constructor(r,e){super(r,e),this.current=ne
vendor: 12,540 bytes, line 5
5w Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},C.c9=class extends Zi{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},C.cA=function(r,e){var i;if(!on[e])return!1;const a=r==null?void 0:r.target,o=((i=a==null?void 0:a.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof o.MouseEvent||r instanceof o.WheelEvent},C.cB=function(r,e){return Xa[e]&&"touches"in r},C.cC=function(r){return Xa[r]||on[r]},C.cD=function(r,e,i){var a=e[0],o=e[1];return r[0]=i[0]*a+i[4]*o+i[12],r[1]=i[1]*a+i[5]*o+i[13],r},C.cE=function(r,e){const{x:i,y:a}=uc.fromLngLat(e);return!(r<0||r>25||a<0||a>=1||i<0||i>=1)},C.cF=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},C.cG=class extends Ao{},C.cH=C_,C.cJ=O,C.cK=function(r,e){le.REGISTERED_PROTOCOLS[r]=e},C.cL=function(r){delete le.REGISTERED_PROTOCOLS[r]},C.cM=function(r,e){const i={};for(let o=0;o<r.length;o++){const u=e&&e[r[o].id]||Qc(r[o]);e&&(e[r[o].id]=u);let h=i[u];h||(h=i[u]=[]),h.push(r[o])}const a=[];for(const o in i)a.push(i[o]);return a},C.cN=Be,C.cO=Gp,C.cP=wf,C.cQ=Sp,C.cR=function(r){var e;r.bucket.createArrays(),r.bucket.tilePixelRatio=gt/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const i=r.bucket.layers[0],a=i.layout,o=i._unevaluatedLayout._values,u={layoutIconSize:o["icon-size"].possiblyEvaluate(new Tt(r.bucket.zoom+1),r.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new Tt(r.bucket.zoom+1),r.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new Tt(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:v,maxZoom:b}=r.bucket.textSizeData;u.compositeTextSizes=[o["text-size"].possiblyEvaluate(new Tt(v),r.canonical),o["text-size"].possiblyEvaluate(new Tt(b),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:v,maxZoom:b}=r.bucket.iconSizeData;u.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new Tt(v),r.canonical),o["icon-size"].possiblyEvaluate(new Tt(b),r.canonical)]}const h=a.get("text-line-height")*fi,f=a.get("text-rotation-alignment")!=="viewport"&&a.get("symbol-placement")!=="point",g=a.get("text-keep-upright"),y=a.get("text-size");for(const v of r.bucket.features){const b=a.get("text-font").evaluate(v,{},r.canonical).join(","),S=y.evaluate(v,{},r.canonical),P=u.layoutTextSize.evaluate(v,{},r.canonical),E=u.layoutIconSize.evaluate(v,{},r.canonical),z={horizontal:{},vertical:void 0},L=v.text;let V,W=[0,0];if(L){const Q=L.toString(),ne=a.get("text-letter-spacing").evaluate(v,{},r.canonical)*fi,he=wh(Q)?ne:0,we=a.get("text-anchor").evaluate(v,{},r.canonical),Te=Lf(i,v,r.canonical);if(!Te){const Se=a.get("text-radial-offset").evaluate(v,{},r.canonical);W=Se?Rf(we,[Se*fi,fd]):a.get("text-offset").evaluate(v,{},r.canonical).map((ye=>ye*fi))}let Ie=f?"center":a.get("text-justify").evaluate(v,{},r.canonical);const De=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(v,{},r.canonical)*fi:1/0,Ee=()=>{r.bucket.allowVerticalPlacement&&La(Q)&&(z.vertical=zu(L,r.glyphMap,r.glyphPositions,r.imagePositions,b,De,h,we,"left",he,W,C.az.vertical,!0,P,S))};if(!f&&Te){const Se=new Set;if(Ie==="auto")for(let je=0;je<Te.values.length;je+=2)Se.add(md(Te.values[je]));else Se.add(Ie);let ye=!1;for(const je of Se)if(!z.horizontal[je])if(ye)z.horizontal[je]=z.horizontal[0];else{const Ve=zu(L,r.glyphMap,r.glyphPositions,r.imagePositions,b,De,h,"center",je,he,W,C.az.horizontal,!1,P,S);Ve&&(z.horizontal[je]=Ve,ye=Ve.positionedLines.length===1)}Ee()}else{Ie==="auto"&&(Ie=md(we));const Se=zu(L,r.glyphMap,r.glyphPositions,r.imagePositions,b,De,h,we,Ie,he,W,C.az.horizontal,!1,P,S);Se&&(z.horizontal[Ie]=Se),Ee(),La(Q)&&f&&g&&(z.vertical=zu(L,r.glyphMap,r.glyphPositions,r.imagePositions,b,De,h,we,Ie,he,W,C.az.vertical,!1,P,S))}}let j=!1;if(v.icon&&v.icon.name){const Q=r.imageMap[v.icon.name];Q&&(V=Og(r.imagePositions[v.icon.name],a.get("icon-offset").evaluate(v,{},r.canonical),a.get("icon-anchor").evaluate(v,{},r.canonical)),j=!!Q.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=j:r.bucket.sdfIcons!==j&&Si("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Q.pixelRatio!==r.bucket.pixelRatio||a.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const U=Bf(z.horizontal)||z.vertical;(e=r.bucket).iconsInText||(e.iconsInText=!!U&&U.iconsInText),(U||V)&&I_(r.bucket,v,z,V,r.imageMap,u,P,E,W,j,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},C.cS=Bh,C.cT=jh,C.cU=Vh,C.cV=function(r){const e=new Au;return(function(i,a){for(const o in i.layers)a.writeMessage(3,p_,i.layers[o])})(r,e),e.finish()},C.cW=function(r,e,i,a,o,u){let h=Pf(r,e,i,o,0);return h=Pf(h,e,a,u,1),h},C.cX=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},C.cY=sp,C.cZ=Au,C.c_=vf,C.ca=class extends Yn{},C.cb=gg,C.cc=class extends Ls{},C.cd=kh,C.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},C.cf=$d,C.cg=function(r,e,i){var a=e[0],o=e[1],u=e[2],h=i[3]*a+i[7]*o+i[11]*u+i[15];return r[0]=(i[0]*a+i[4]*o+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*a+i[5]*o+i[9]*u+i[13])/h,r[2]=(i[2]*a+i[6]*o+i[10]*u+i[14])/h,r},C.ch=class extends ql{},C.ci=class extends t{},C.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},C.ck=function(r,e){var i=r[0],a=r[1],o=r[2],u=r[3],h=r[4],f=r[5],g=r[6],y=r[7],v=r[8],b=r[9],S=r[10],P=r[11],E=r[12],z=r[13],L=r[14],V=r[15],W=e[0],j=e[1],U=e[2],Q=e[3],ne=e[4],he=e[5],we=e[6],Te=e[7],Ie=e[8],De=e[9],Ee=e[10],Se=e[11],ye=e[12],je=e[13],Ve=e[14],We=e[15];return Math.abs(i-W)<=St*Math.max(1,Math.abs(i),Math.abs(W))&&Math.abs(a-j)<=St*Math.max(1,Math.abs(a),Math.abs(j))&&Math.abs(o-U)<=St*Math.max(1,Math.abs(o),Math.abs(U))&&Math.abs(u-Q)<=St*Math.max(1,Math.abs(u),Math.abs(Q))&&Math.abs(h-ne)<=St*Math.max(1,Math.abs(h),Math.abs(ne))&&Math.abs(f-he)<=St*Math.max(1,Math.abs(f),Math.abs(he))&&Math.abs(g-we)<=St*Math.max(1,Math.abs(g),Math.abs(we))&&Math.abs(y-Te)<=St*Math.max(1,Math.abs(y),Math.abs(Te))&&Math.abs(v-Ie)<=St*Math.max(1,Math.abs(v),Math.abs(Ie))&&Math.abs(b-De)<=St*Math.max(1,Math.abs(b),Math.abs(De))&&Math.abs(S-Ee)<=St*Math.max(1,Math.abs(S),Math.abs(Ee))&&Math.abs(P-Se)<=St*Math.max(1,Math.abs(P),Math.abs(Se))&&Math.abs(E-ye)<=St*Math.max(1,Math.abs(E),Math.abs(ye))&&Math.abs(z-je)<=St*Math.max(1,Math.abs(z),Math.abs(je))&&Math.abs(L-Ve)<=St*Math.max(1,Math.abs(L),Math.abs(Ve))&&Math.abs(V-We)<=St*Math.max(1,Math.abs(V),Math.abs(We))},C.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},C.cm=r=>r.type==="symbol",C.cn=r=>r.type==="circle",C.co=r=>r.type==="heatmap",C.cp=r=>r.type==="line",C.cq=r=>r.type==="fill",C.cr=r=>r.type==="fill-extrusion",C.cs=r=>r.type==="hillshade",C.ct=r=>r.type==="color-relief",C.cu=r=>r.type==="background",C.cv=r=>r.type==="custom",C.cw=an,C.cx=function(r,e,i){if(e<=0)return r;const a=1/e;return i===void 0||Math.abs(i)<1e-10?Math.round(r*a)/a:(i>0?Math.ceil(r*a-1e-9):Math.floor(r*a+1e-10))/a},C.cy=function(r,e,i){const a=ni(e.x-i.x,e.y-i.y),o=ni(r.x-i.x,r.y-i.y);var u,h;return Qi(Math.atan2(a[0]*o[1]-a[1]*o[0],(u=a)[0]*(h=o)[0]+u[1]*h[1]))},C.cz=Vr,C.d=ce,C.d0=function(r,e,i,a,o){return c(this,void 0,void 0,(function*(){if(sr())try{return yield zn(r,e,i,a,o)}catch{}return(function(u,h,f,g,y){const v=u.width,b=u.height;sn&&_r||(sn=new OffscreenCanvas(v,b),_r=sn.getContext("2d",{willReadFrequently:!0})),sn.width=v,sn.height=b,_r.drawImage(u,0,0,v,b);const S=_r.getImageData(h,f,g,y);return _r.clearRect(0,0,v,b),S.data})(r,e,i,a,o)}))},C.d1=Hd,C.d2=Ne,C.d3=class{constructor(r,e){this.layers={[pc]:this},this.name=pc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new d_(this.features[r],this.extent)}},C.d4=fs,C.d5=gn,C.e=Gi,C.f=r=>c(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),C.g=A,C.h=r=>new Promise(((e,i)=>{const a=new Image;a.onload=()=>{e(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame((()=>{a.src=la}))},a.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."));const o=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(o):la})),C.i=zr,C.j=(r,e)=>ae(Gi(r,{type:"json"}),e),C.k=Pe,C.l=ue,C.m=ae,C.n=(r,e)=>ae(Gi(r,{type:"arrayBuffer"}),e),C.o=function(r){return new Au(r).readFields(Ag,[])},C.p=Tp,C.q=function(r){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(r))},C.r=Ql,C.s=ca,C.t=Oi,C.u=ie,C.v=ws,C.w=Si,C.x=Ul,C.y=Ts,C.z=Is})),pe("worker",["./shared"],(function(C){class c{constructor(A,D){this.keyCache={},A&&this.replace(A,D)}replace(A,D){this._layerConfigs={},this._layers={},this.update(A,[],D)}update(A,D,O){for(const ae of A){this._layerConfigs[ae.id]=ae;const ce=this._layers[ae.id]=C.bT(ae,O);ce._featureFilter=C.aj(ce.filter,O),this.keyCache[ae.id]&&delete this.keyCache[ae.id]}for(const ae of D)delete this.keyCache[ae],delete this._layerConfigs[ae],delete this._layers[ae];this.familiesBySource={};const K=C.cM(Object.values(this._layerConfigs),this.keyCache);for(const ae of K){const ce=ae.map((ie=>this._layers[ie.id])),fe=ce[0];if(fe.isHidden())continue;const se=fe.source||"";let ue=this.familiesBySource[se];ue||(ue=this.familiesBySource[se]={});const Pe=fe.sourceLayer||C.ai;let ve=ue[Pe];ve||(ve=ue[Pe]=[]),ve.push(ce)}}}class be{constructor(A){const D={},O=[];for(const fe in A){const se=A[fe],ue=D[fe]={};for(const Pe in se){const ve=se[+Pe];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const ie={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};O.push(ie),ue[Pe]={rect:ie,metrics:ve.metrics}}}const{w:K,h:ae}=C.p(O),ce=new C.r({width:K||1,height:ae||1});for(const fe in A){const se=A[fe];for(const ue in se){const Pe=se[+ue];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const ve=D[fe][ue].rect;C.r.copy(Pe.bitmap,ce,{x:0,y:0},{x:ve.x+1,y:ve.y+1},Pe.bitmap)}}this.image=ce,this.positions=D}}C.cN("GlyphAtlas",be);class Ne{constructor(A){this.tileID=new C.a2(A.tileID.overscaledZ,A.tileID.wrap,A.tileID.canonical.z,A.tileID.canonical.x,A.tileID.canonical.y),this.uid=A.uid,this.zoom=A.zoom,this.pixelRatio=A.pixelRatio,this.tileSize=A.tileSize,this.source=A.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=A.showCollisionBoxes,this.collectResourceTiming=!!A.collectResourceTiming,this.returnDependencies=!!A.returnDependencies,this.promoteId=A.promoteId,this.inFlightDependencies=[]}parse(A,D,O,K,ae){return C._(this,void 0,void 0,(function*(){this.status="parsing",this.data=A,this.collisionBoxArray=new C.ag;
5const ce=new C.cO(Object.keys(A.layers).sort()),fe=new C.cP(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const se={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:O,subdivisionGranularity:ae},Pe=D.familiesBySource[this.source];for(const ft in Pe){const kt=A.layers[ft];if(!kt)continue;kt.version===1&&C.w(`Vector tile source "${this.source}" layer "${ft}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Rn=ce.encode(ft),Di=[];for(let Re=0;Re<kt.length;Re++){const Je=kt.feature(Re),rt=fe.getId(Je,ft);Di.push({feature:Je,id:rt,index:Re,sourceLayerIndex:Rn})}for(const Re of Pe[ft]){const Je=Re[0];Je.source!==this.source&&C.w(`layer.source = ${Je.source} does not equal this.source = ${this.source}`),Je.isHidden(this.zoom,!0)||(nt(Re,this.zoom,O),(se[Je.id]=Je.createBucket({index:fe.bucketLayerIDs.length,layers:Re,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Rn,sourceID:this.source})).populate(Di,ue,this.tileID.canonical),fe.bucketLayerIDs.push(Re.map((rt=>rt.id))))}}const ve=C.bY(ue.glyphDependencies,(ft=>Object.keys(ft).map(Number)));this.inFlightDependencies.forEach((ft=>ft==null?void 0:ft.abort())),this.inFlightDependencies=[];let ie=Promise.resolve({});if(Object.keys(ve).length){const ft=new AbortController;this.inFlightDependencies.push(ft),ie=K.sendAsync({type:"GG",data:{stacks:ve,source:this.source,tileID:this.tileID,type:"glyphs"}},ft)}const Ge=Object.keys(ue.iconDependencies);let it=Promise.resolve({});if(Ge.length){const ft=new AbortController;this.inFlightDependencies.push(ft),it=K.sendAsync({type:"GI",data:{icons:Ge,source:this.source,tileID:this.tileID,type:"icons"}},ft)}const Xe=Object.keys(ue.patternDependencies);let Ye=Promise.resolve({});if(Xe.length){const ft=new AbortController;this.inFlightDependencies.push(ft),Ye=K.sendAsync({type:"GI",data:{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"}},ft)}const Qe=ue.dashDependencies;let et=Promise.resolve({});if(Object.keys(Qe).length){const ft=new AbortController;this.inFlightDependencies.push(ft),et=K.sendAsync({type:"GDA",data:{dashes:Qe}},ft)}const[yt,Kt,qt,Pi]=yield Promise.all([ie,it,Ye,et]),$t=new be(yt),Ce=new C.cQ(Kt,qt);for(const ft in se){const kt=se[ft];kt instanceof C.ah?(nt(kt.layers,this.zoom,O),C.cR({bucket:kt,glyphMap:yt,glyphPositions:$t.positions,imageMap:Kt,imagePositions:Ce.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:ue.subdivisionGranularity})):kt.hasDependencies&&(kt instanceof C.cS||kt instanceof C.cT||kt instanceof C.cU)&&(nt(kt.layers,this.zoom,O),kt.addFeatures(ue,this.tileID.canonical,Ce.patternPositions,Pi))}return this.status="done",{buckets:Object.values(se).filter((ft=>!ft.isEmpty())),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:$t.image,imageAtlas:Ce,dashPositions:Pi,glyphMap:this.returnDependencies?yt:null,iconMap:this.returnDependencies?Kt:null,glyphPositions:this.returnDependencies?$t.positions:null}}))}}function nt(le,A,D){const O=new C.H(A);for(const K of le)K.recalculate(O,D)}class At{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(A,D){this.loading[A]=D}finishLoading(A){delete this.loading[A]}abort(A){const D=this.loading[A];D!=null&&D.abort&&(D.abort.abort(),delete this.loading[A])}setParsing(A,D){this.parsing[A]=D}consumeParsing(A){const D=this.parsing[A];if(D)return delete this.parsing[A],D}clearParsing(A){delete this.parsing[A]}markLoaded(A,D){this.loaded[A]=D}getLoaded(A){const D=this.loaded[A];if(D)return D}removeLoaded(A){delete this.loaded[A]}clearLoaded(){this.loaded={}}}class Lt{constructor(A,D,O,K,ae){this.type=A,this.properties=O||{},this.extent=ae,this.pointsArray=D,this.id=K}loadGeometry(){return this.pointsArray.map((A=>A.map((D=>new C.P(D.x,D.y)))))}}class _t{constructor(A,D,O){this.version=2,this._myFeatures=A,this.name=D,this.length=A.length,this.extent=O}feature(A){return this._myFeatures[A]}}class ki{constructor(){this.layers={}}addLayer(A){this.layers[A.name]=A}}function st(le){let A=C.cV(le);return A.byteOffset===0&&A.byteLength===A.buffer.byteLength||(A=new Uint8Array(A)),{vectorTile:le,rawData:A.buffer}}function xe(le,A,D){const{extent:O}=le,K=Math.pow(2,D.z-A.z),ae=(D.x-A.x*K)*O,ce=(D.y-A.y*K)*O,fe=[];for(let se=0;se<le.length;se++){const ue=le.feature(se);let Pe=ue.loadGeometry();for(const ie of Pe)for(const Ge of ie)Ge.x=Ge.x*K-ae,Ge.y=Ge.y*K-ce;const ve=128;Pe=C.cW(Pe,ue.type,-ve,-ve,O+ve,O+ve),Pe.length!==0&&fe.push(new Lt(ue.type,Pe,ue.properties,ue.id,O))}return new _t(fe,le.name,O)}class sr{constructor(A,D,O){this.actor=A,this.layerIndex=D,this.availableImages=O,this.tileState=new At,this.overzoomedTileResultCache=new C.cX(1e3)}loadVectorTile(A,D){return C._(this,void 0,void 0,(function*(){const O=yield C.n(A.request,D);try{return{vectorTile:A.encoding!=="mlt"?new C.cY(new C.cZ(O.data)):new C.c_(O.data),rawData:O.data,cacheControl:O.cacheControl,expires:O.expires}}catch(K){const ae=new Uint8Array(O.data);let ce=`Unable to parse the tile at ${A.request.url}, `;throw ce+=ae[0]===31&&ae[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${K.message}`,new Error(ce)}}))}loadTile(A){return C._(this,void 0,void 0,(function*(){const{uid:D,overzoomParameters:O}=A;O&&(A.request=O.overzoomRequest);const K=this._startRequestTiming(A),ae=new Ne(A);this.tileState.startLoading(D,ae);const ce=new AbortController;ae.abort=ce;try{const fe=yield this.loadVectorTile(A,ce);if(this.tileState.finishLoading(D),!fe)return null;let{vectorTile:se,rawData:ue}=fe;O&&({vectorTile:se,rawData:ue}=this._getOverzoomTile(A,fe.vectorTile));const Pe=this._getExpiryData(fe),ve=this._finishRequestTiming(K);ae.vectorTile=se,this.tileState.markLoaded(D,ae);const ie={rawData:ue,cacheControl:Pe,resourceTiming:ve};this.tileState.setParsing(D,ie);
5try{return yield this._parseWorkerTile(ae,A,ie)}finally{this.tileState.clearParsing(D)}}catch(fe){throw this.tileState.finishLoading(D),ae.status="done",this.tileState.markLoaded(D,ae),fe}}))}_parseWorkerTile(A,D,O){return C._(this,void 0,void 0,(function*(){let K=yield A.parse(A.vectorTile,this.layerIndex,this.availableImages,this.actor,D.subdivisionGranularity);if(O){const{rawData:ae,cacheControl:ce,resourceTiming:fe}=O;K=C.e({rawTileData:ae.slice(0),encoding:D.encoding},K,ce,fe)}return K}))}_getExpiryData(A){const{expires:D,cacheControl:O}=A,K={};return D&&(K.expires=D),O&&(K.cacheControl=O),K}_startRequestTiming(A){var D;if(!((D=A.request)===null||D===void 0)&&D.collectResourceTiming)return new C.c$(A.request.url)}_finishRequestTiming(A){const D=A==null?void 0:A.finish();return D?{resourceTiming:JSON.parse(JSON.stringify(D))}:{}}_getOverzoomTile(A,D){const{tileID:O,source:K,overzoomParameters:ae}=A,{maxZoomTileID:ce}=ae,fe=`${ce.key}_${O.key}`,se=this.overzoomedTileResultCache.get(fe);if(se)return se;const ue=new ki,Pe=this.layerIndex.familiesBySource[K];for(const ie in Pe){const Ge=D.layers[ie];if(!Ge)continue;const it=xe(Ge,ce,O.canonical);it.length>0&&ue.addLayer(it)}const ve=st(ue);return this.overzoomedTileResultCache.set(fe,ve),ve}reloadTile(A){return C._(this,void 0,void 0,(function*(){const D=A.uid,O=this.tileState.getLoaded(D);if(!O)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(O.showCollisionBoxes=A.showCollisionBoxes,O.status==="parsing"){const K=this.tileState.consumeParsing(D);return yield this._parseWorkerTile(O,A,K)}if(O.status==="done"&&O.vectorTile)return yield this._parseWorkerTile(O,A)}))}abortTile(A){return C._(this,void 0,void 0,(function*(){this.tileState.abort(A.uid)}))}removeTile(A){return C._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(A.uid)}))}}class St{constructor(){this.loaded={}}loadTile(A){return C._(this,void 0,void 0,(function*(){const{uid:D,encoding:O,rawImageData:K,redFactor:ae,greenFactor:ce,blueFactor:fe,baseShift:se}=A,ue=K.width+2,Pe=K.height+2,ve=C.b(K)?new C.R({width:ue,height:Pe},yield C.d0(K,-1,-1,ue,Pe)):K,ie=new C.d1(D,ve,O,ae,ce,fe,se);return this.loaded=this.loaded||{},this.loaded[D]=ie,ie}))}removeTile(A){const D=this.loaded,O=A.uid;D&&D[O]&&delete D[O]}}var vt,Mn,na=(function(){if(Mn)return vt;function le(D,O){if(D.length!==0){A(D[0],O);for(var K=1;K<D.length;K++)A(D[K],!O)}}function A(D,O){for(var K=0,ae=0,ce=0,fe=D.length,se=fe-1;ce<fe;se=ce++){var ue=(D[ce][0]-D[se][0])*(D[se][1]+D[ce][1]),Pe=K+ue;ae+=Math.abs(K)>=Math.abs(ue)?K-Pe+ue:ue-Pe+K,K=Pe}K+ae>=0!=!!O&&D.reverse()}return Mn=1,vt=function D(O,K){var ae,ce=O&&O.type;if(ce==="FeatureCollection")for(ae=0;ae<O.features.length;ae++)D(O.features[ae],K);else if(ce==="GeometryCollection")for(ae=0;ae<O.geometries.length;ae++)D(O.geometries[ae],K);else if(ce==="Feature")D(O.geometry,K);else if(ce==="Polygon")le(O.coordinates,K);else if(ce==="MultiPolygon")for(ae=0;ae<O.coordinates.length;ae++)le(O.coordinates[ae],K);return O}})(),$a=C.d2(na);const Ki={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:le=>le},Za=Math.fround||(Er=new Float32Array(1),le=>(Er[0]=+le,Er[0]));var Er;class tn{constructor(A){this.options=Object.assign(Object.create(Ki),A),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(A){const{log:D,minZoom:O,maxZoom:K}=this.options;D&&console.time("total time");const ae=`prepare ${A.length} points`;D&&console.time(ae),this.points=A;const ce=[];for(let se=0;se<A.length;se++){const ue=A[se];if(!ue.geometry)continue;const[Pe,ve]=ue.geometry.coordinates,ie=Za(Cr(Pe)),Ge=Za(nn(ve));
vendor: 6,133 bytes, line 5
5ce.push(ie,Ge,1/0,se,-1,1),this.options.reduce&&ce.push(0)}let fe=this.trees[K+1]=this._createTree(ce);D&&console.timeEnd(ae);for(let se=K;se>=O;se--){const ue=+Date.now();fe=this.trees[se]=this._createTree(this._cluster(fe,se)),D&&(fe.numItems,+Date.now()-ue)}return D&&console.timeEnd("total time"),this}getClusters(A,D){let O=((A[0]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,A[1]));let ae=A[2]===180?180:((A[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,A[3]));if(A[2]-A[0]>=360)O=-180,ae=180;else if(O>ae){const ve=this.getClusters([O,K,180,ce],D),ie=this.getClusters([-180,K,ae,ce],D);return ve.concat(ie)}const fe=this.trees[this._limitZoom(D)],se=fe.range(Cr(O),nn(ce),Cr(ae),nn(K)),ue=fe.data,Pe=[];for(const ve of se){const ie=this.stride*ve;Pe.push(ue[ie+5]>1?In(ue,ie,this.clusterProps):this.points[ue[ie+3]])}return Pe}getChildren(A){const D=this._getOriginId(A),O=this._getOriginZoom(A),K="No cluster with the specified id.",ae=this.trees[O];if(!ae)throw new Error(K);const ce=ae.data;if(D*this.stride>=ce.length)throw new Error(K);const fe=this.options.radius/(this.options.extent*Math.pow(2,O-1)),se=ae.within(ce[D*this.stride],ce[D*this.stride+1],fe),ue=[];for(const Pe of se){const ve=Pe*this.stride;ce[ve+4]===A&&ue.push(ce[ve+5]>1?In(ce,ve,this.clusterProps):this.points[ce[ve+3]])}if(ue.length===0)throw new Error(K);return ue}getLeaves(A,D,O){const K=[];return this._appendLeaves(K,A,D=D||10,O=O||0,0),K}getTile(A,D,O){const K=this.trees[this._limitZoom(A)],ae=Math.pow(2,A),{extent:ce,radius:fe}=this.options,se=fe/ce,ue=(O-se)/ae,Pe=(O+1+se)/ae,ve={features:[]};return this._addTileFeatures(K.range((D-se)/ae,ue,(D+1+se)/ae,Pe),K.data,D,O,ae,ve),D===0&&this._addTileFeatures(K.range(1-se/ae,ue,1,Pe),K.data,ae,O,ae,ve),D===ae-1&&this._addTileFeatures(K.range(0,ue,se/ae,Pe),K.data,-1,O,ae,ve),ve.features.length?ve:null}getClusterExpansionZoom(A){let D=this._getOriginZoom(A)-1;for(;D<=this.options.maxZoom;){const O=this.getChildren(A);if(D++,O.length!==1)break;A=O[0].properties.cluster_id}return D}_appendLeaves(A,D,O,K,ae){const ce=this.getChildren(D);for(const fe of ce){const se=fe.properties;if(se&&se.cluster?ae+se.point_count<=K?ae+=se.point_count:ae=this._appendLeaves(A,se.cluster_id,O,K,ae):ae<K?ae++:A.push(fe),A.length===O)break}return ae}_createTree(A){const D=new C.aT(A.length/this.stride|0,this.options.nodeSize,Float32Array);for(let O=0;O<A.length;O+=this.stride)D.add(A[O],A[O+1]);return D.finish(),D.data=A,D}_addTileFeatures(A,D,O,K,ae,ce){for(const fe of A){const se=fe*this.stride,ue=D[se+5]>1;let Pe,ve,ie;if(ue)Pe=rn(D,se,this.clusterProps),ve=D[se],ie=D[se+1];else{const Xe=this.points[D[se+3]];Pe=Xe.properties;const[Ye,Qe]=Xe.geometry.coordinates;ve=Cr(Ye),ie=nn(Qe)}const Ge={type:1,geometry:[[Math.round(this.options.extent*(ve*ae-O)),Math.round(this.options.extent*(ie*ae-K))]],tags:Pe};let it;it=ue||this.options.generateId?D[se+3]:this.points[D[se+3]].id,it!==void 0&&(Ge.id=it),ce.features.push(Ge)}}_limitZoom(A){return Math.max(this.options.minZoom,Math.min(Math.floor(+A),this.options.maxZoom+1))}_cluster(A,D){const{radius:O,extent:K,reduce:ae,minPoints:ce}=this.options,fe=O/(K*Math.pow(2,D)),se=A.data,ue=[],Pe=this.stride;for(let ve=0;ve<se.length;ve+=Pe){if(se[ve+2]<=D)continue;se[ve+2]=D;const ie=se[ve],Ge=se[ve+1],it=A.within(se[ve],se[ve+1],fe),Xe=se[ve+5];let Ye=Xe;for(const Qe of it){const et=Qe*Pe;se[et+2]>D&&(Ye+=se[et+5])}if(Ye>Xe&&Ye>=ce){let Qe,et=ie*Xe,yt=Ge*Xe,Kt=-1;const qt=(ve/Pe<<5)+(D+1)+this.points.length;for(const Pi of it){const $t=Pi*Pe;if(se[$t+2]<=D)continue;se[$t+2]=D;const Ce=se[$t+5];et+=se[$t]*Ce,yt+=se[$t+1]*Ce,se[$t+4]=qt,ae&&(Qe||(Qe=this._map(se,ve,!0),Kt=this.clusterProps.length,this.clusterProps.push(Qe)),ae(Qe,this._map(se,$t)))}se[ve+4]=qt,ue.push(et/Ye,yt/Ye,1/0,qt,-1,Ye),ae&&ue.push(Kt)}else{for(let Qe=0;Qe<Pe;Qe++)ue.push(se[ve+Qe]);if(Ye>1)for(const Qe of it){const et=Qe*Pe;if(!(se[et+2]<=D)){se[et+2]=D;for(let yt=0;yt<Pe;yt++)ue.push(se[et+yt])}}}}return ue}_getOriginId(A){return A-this.points.length>>5}_getOriginZoom(A){return(A-this.points.length)%32}_map(A,D,O){if(A[D+5]>1){const ce=this.clusterProps[A[D+6]];return O?Object.assign({},ce):ce}const K=this.points[A[D+3]].properties,ae=this.options.map(K);return O&&ae===K?Object.assign({},ae):ae}}function In(le,A,D){return{type:"Feature",id:le[A+3],properties:rn(le,A,D),geometry:{type:"Point",coordinates:[(O=le[A],360*(O-.5)),Wa(le[A+1])]}};var O}function rn(le,A,D){const O=le[A+5],K=O>=1e4?`${Math.round(O/1e3)}k`:O>=1e3?Math.round(O/100)/10+"k":O,ae=le[A+6],ce=ae===-1?{}:Object.assign({},D[ae]);return Object.assign(ce,{cluster:!0,cluster_id:le[A+3],point_count:O,point_count_abbreviated:K})}function Cr(le){return le/360+.5}function nn(le){const A=Math.sin(le*Math.PI/180),D=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return D<0?0:D>1?1:D}function Wa(le){const A=(180-360*le)*Math.PI/180;return 360*Math.atan(Math.exp(A))/Math.PI-90}function aa(le,A,D,O){let K=O;const ae=A+(D-A>>1);let ce,fe=D-A;const se=le[A],ue=le[A+1],Pe=le[D],ve=le[D+1];for(let ie=A+3;ie<D;ie+=3){const Ge=jr(le[ie],le[ie+1],se,ue,Pe,ve);if(Ge>K)ce=ie,K=Ge;else if(Ge===K){const it=Math.abs(ie-ae);it<fe&&(ce=ie,fe=it)}}K>O&&(ce-A>3&&aa(le,A,ce,O),le[ce+2]=K,D-ce>3&&aa(le,ce,D,O))}function jr(le,A,D,O,K,ae){let ce=K-D,fe=ae-O;if(ce!==0||fe!==0){const se=((le-D)*ce+(A-O)*fe)/(ce*ce+fe*fe);se>1?(D=K,O=ae):se>0&&(D+=ce*se,O+=fe*se)}return ce=le-D,fe=A-O,ce*ce+fe*fe}function ni(le,A,D,O){const K={type:A,geom:D},ae={id:le??null,type:K.type,geometry:K.geom,tags:O,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(K.type){case"Point":case"MultiPoint":case"LineString":gt(ae,K.geom);break;case"Polygon":gt(ae,K.geom[0]);break;case"MultiLineString":for(const ce of K.geom)gt(ae,ce);break;case"MultiPolygon":for(const ce of K.geom)gt(ae,ce[0])}return ae}function gt(le,A){for(let D=0;D<A.length;D+=3)le.minX=Math.min(le.minX,A[D]),le.minY=Math.min(le.minY,A[D+1]),le.maxX=Math.max(le.maxX,A[D]),le.maxY=Math.max(le.maxY,A[D+1])}function En(le,A){const D=[];switch(le.type){case"FeatureCollection":for(let O=0;O<le.features.length;O++)Ar(D,le.features[O],A,O);break;
5case"Feature":Ar(D,le,A);break;default:Ar(D,{geometry:le,properties:void 0},A)}return D}function Ar(le,A,D,O){var fe;if(!A.geometry)return;if(A.geometry.type==="GeometryCollection"){for(const se of A.geometry.geometries)Ar(le,{id:A.id,geometry:se,properties:A.properties},D,O);return}const K=A.geometry.coordinates;if(!(K!=null&&K.length))return;const ae=Math.pow(D.tolerance/((1<<D.maxZoom)*D.extent),2);let ce=A.id;switch(D.promoteId?ce=(fe=A.properties)==null?void 0:fe[D.promoteId]:D.generateId&&(ce=O||0),A.geometry.type){case"Point":{const se=[];return Ha(A.geometry.coordinates,se),void le.push(ni(ce,A.geometry.type,se,A.properties))}case"MultiPoint":{const se=[];for(const ue of A.geometry.coordinates)Ha(ue,se);return void le.push(ni(ce,A.geometry.type,se,A.properties))}case"LineString":{const se=[];return sa(A.geometry.coordinates,se,ae,!1),void le.push(ni(ce,A.geometry.type,se,A.properties))}case"MultiLineString":{if(D.lineMetrics){for(const ue of A.geometry.coordinates){const Pe=[];sa(ue,Pe,ae,!1),le.push(ni(ce,"LineString",Pe,A.properties))}return}const se=[];return an(A.geometry.coordinates,se,ae,!1),void le.push(ni(ce,A.geometry.type,se,A.properties))}case"Polygon":{const se=[];return an(A.geometry.coordinates,se,ae,!0),void le.push(ni(ce,A.geometry.type,se,A.properties))}case"MultiPolygon":{const se=[];for(const ue of A.geometry.coordinates){const Pe=[];an(ue,Pe,ae,!0),se.push(Pe)}return void le.push(ni(ce,A.geometry.type,se,A.properties))}default:throw new Error("Input data is not a valid GeoJSON object.")}}function Ha(le,A){A.push(Vr(le[0]),or(le[1]),0)}function sa(le,A,D,O){let K,ae,ce=0;for(let se=0;se<le.length;se++){const ue=Vr(le[se][0]),Pe=or(le[se][1]);A.push(ue,Pe,0),se>0&&(ce+=O?(K*Pe-ue*ae)/2:Math.sqrt(Math.pow(ue-K,2)+Math.pow(Pe-ae,2))),K=ue,ae=Pe}const fe=A.length-3;A[2]=1,D>0&&aa(A,0,fe,D),A[fe+2]=1,A.size=Math.abs(ce),A.start=0,A.end=A.size}function an(le,A,D,O){for(let K=0;K<le.length;K++){const ae=[];sa(le[K],ae,D,O),A.push(ae)}}function Vr(le){return le/360+.5}function or(le){const A=Math.sin(le*Math.PI/180),D=.5-.25*Math.log((1+A)/(1-A))/Math.PI;return D<0?0:D>1?1:D}function wi(le,A,D,O,K,ae,ce,fe){if(O/=A,ae>=(D/=A)&&ce<O)return le;if(ce<D||ae>=O)return null;const se=[];for(const ue of le){const Pe=K===0?ue.minX:ue.minY,ve=K===0?ue.maxX:ue.maxY;if(Pe>=D&&ve<O)se.push(ue);else if(!(ve<D||Pe>=O))switch(ue.type){case"Point":case"MultiPoint":{const ie=[];if(Gi(ue.geometry,ie,D,O,K),!ie.length)continue;
5se.push(ni(ue.id,ie.length===3?"Point":"MultiPoint",ie,ue.tags));continue}case"LineString":{const ie=[];if(oa(ue.geometry,ie,D,O,K,!1,fe.lineMetrics),!ie.length)continue;if(fe.lineMetrics){for(const Ge of ie)se.push(ni(ue.id,ue.type,Ge,ue.tags));continue}if(ie.length>1){se.push(ni(ue.id,"MultiLineString",ie,ue.tags));continue}se.push(ni(ue.id,ue.type,ie[0],ue.tags));continue}case"MultiLineString":{const ie=[];if(An(ue.geometry,ie,D,O,K,!1),!ie.length)continue;if(ie.length===1){se.push(ni(ue.id,"LineString",ie[0],ue.tags));continue}se.push(ni(ue.id,ue.type,ie,ue.tags));continue}case"Polygon":{const ie=[];if(An(ue.geometry,ie,D,O,K,!0),!ie.length)continue;se.push(ni(ue.id,ue.type,ie,ue.tags));continue}case"MultiPolygon":{const ie=[];for(const Ge of ue.geometry){const it=[];An(Ge,it,D,O,K,!0),it.length&&ie.push(it)}if(!ie.length)continue;se.push(ni(ue.id,ue.type,ie,ue.tags));continue}}}return se.length?se:null}function Gi(le,A,D,O,K){for(let ae=0;ae<le.length;ae+=3){const ce=le[ae+K];ce>=D&&ce<=O&&Ti(A,le[ae],le[ae+1],le[ae+2])}}function oa(le,A,D,O,K,ae,ce){let fe=Cn(le);const se=K===0?Ws:Si;let ue,Pe,ve=le.start;for(let Ye=0;Ye<le.length-3;Ye+=3){const Qe=le[Ye],et=le[Ye+1],yt=le[Ye+2],Kt=le[Ye+3],qt=le[Ye+4],Pi=K===0?Qe:et,$t=K===0?Kt:qt;let Ce=!1;ce&&(ue=Math.sqrt(Math.pow(Qe-Kt,2)+Math.pow(et-qt,2))),Pi<D?$t>D&&(Pe=se(fe,Qe,et,Kt,qt,D),ce&&(fe.start=ve+ue*Pe)):Pi>O?$t<O&&(Pe=se(fe,Qe,et,Kt,qt,O),ce&&(fe.start=ve+ue*Pe)):Ti(fe,Qe,et,yt),$t<D&&Pi>=D&&(Pe=se(fe,Qe,et,Kt,qt,D),Ce=!0),$t>O&&Pi<=O&&(Pe=se(fe,Qe,et,Kt,qt,O),Ce=!0),!ae&&Ce&&(ce&&(fe.end=ve+ue*Pe),A.push(fe),fe=Cn(le)),ce&&(ve+=ue)}let ie=le.length-3;const Ge=le[ie],it=le[ie+1],Xe=K===0?Ge:it;Xe>=D&&Xe<=O&&Ti(fe,Ge,it,le[ie+2]),ie=fe.length-3,ae&&ie>=3&&(fe[ie]!==fe[0]||fe[ie+1]!==fe[1])&&Ti(fe,fe[0],fe[1],fe[2]),fe.length&&A.push(fe)}function Cn(le){const A=[];return A.size=le.size,A.start=le.start,A.end=le.end,A}function An(le,A,D,O,K,ae){for(const ce of le)oa(ce,A,D,O,K,ae,!1)}function Ti(le,A,D,O){le.push(A,D,O)}function Ws(le,A,D,O,K,ae){const ce=(ae-A)/(O-A);return Ti(le,ae,D+(K-D)*ce,1),ce}function Si(le,A,D,O,K,ae){const ce=(ae-D)/(K-D);return Ti(le,A+(O-A)*ce,ae,1),ce}function Ji(le,A){const D=A.buffer/A.extent;let O=le;const K=wi(le,1,-1-D,D,0,-1,2,A),ae=wi(le,1,1-D,2+D,0,-1,2,A);return(K||ae)&&(O=wi(le,1,-D,1+D,0,-1,2,A)||[],K&&(O=zr(K,1).concat(O)),ae&&(O=O.concat(zr(ae,-1)))),O}function zr(le,A){const D=[];for(const O of le)switch(O.type){case"Point":case"MultiPoint":case"LineString":{const K=Ft(O.geometry,A);D.push(ni(O.id,O.type,K,O.tags));continue}case"MultiLineString":case"Polygon":{const K=[];for(const ae of O.geometry)K.push(Ft(ae,A));D.push(ni(O.id,O.type,K,O.tags));continue}case"MultiPolygon":{const K=[];for(const ae of O.geometry){const ce=[];for(const fe of ae)ce.push(Ft(fe,A));K.push(ce)}D.push(ni(O.id,O.type,K,O.tags));continue}}return D}function Ft(le,A){const D=[];D.size=le.size,le.start!==void 0&&(D.start=le.start,D.end=le.end);for(let O=0;O<le.length;O+=3)D.push(le[O]+A,le[O+1],le[O+2]);return D}function Nr(le,A){if(le.transformed)return le;const D=1<<le.z,O=le.x,K=le.y;for(const ae of le.features){if(ae.type===1){const fe=[];for(let se=0;se<ae.geometry.length;se+=2)fe.push(la(ae.geometry[se],ae.geometry[se+1],A,D,O,K));ae.geometry=fe;continue}const ce=[];for(const fe of ae.geometry){const se=[];for(let ue=0;ue<fe.length;ue+=2)se.push(la(fe[ue],fe[ue+1],A,D,O,K));ce.push(se)}ae.geometry=ce}return le.transformed=!0,le}function la(le,A,D,O,K,ae){return[Math.round(D*(le*O-K)),Math.round(D*(A*O-ae))]}function zn(le,A,D,O,K){const ae=A===K.maxZoom?0:K.tolerance/((1<<A)*K.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:le.length,source:null,x:D,y:O,z:A,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const fe of le)sn(ce,fe,ae,K);return ce}function sn(le,A,D,O){le.minX=Math.min(le.minX,A.minX),le.minY=Math.min(le.minY,A.minY),le.maxX=Math.max(le.maxX,A.maxX),le.maxY=Math.max(le.maxY,A.maxY);let K,ae=A.tags||null;switch(A.type){case"Point":case"MultiPoint":{const ce=[];for(let fe=0;fe<A.geometry.length;fe+=3)ce.push(A.geometry[fe],A.geometry[fe+1]),le.numPoints++,le.numSimplified++;if(!ce.length)return;K={type:1,tags:ae,geometry:ce};break}case"LineString":{const ce=[];if(_r(ce,A.geometry,le,D,!1,!1),!ce.length)return;if(O.lineMetrics){ae={};for(const fe in A.tags)ae[fe]=A.tags[fe];ae.mapbox_clip_start=A.geometry.start/A.geometry.size,ae.mapbox_clip_end=A.geometry.end/A.geometry.size}K={type:2,tags:ae,geometry:ce};break}case"MultiLineString":case"Polygon":{const ce=[];for(let fe=0;fe<A.geometry.length;fe++)_r(ce,A.geometry[fe],le,D,A.type==="Polygon",fe===0);if(!ce.length)return;K={type:A.type==="Polygon"?3:2,tags:ae,geometry:ce};break}case"MultiPolygon":{const ce=[];for(let fe=0;fe<A.geometry.length;fe++){const se=A.geometry[fe];for(let ue=0;ue<se.length;ue++)_r(ce,se[ue],le,D,!0,ue===0)}if(!ce.length)return;K={type:3,tags:ae,geometry:ce};break}}A.id!==null&&(K.id=A.id),le.features.push(K)}function _r(le,A,D,O,K,ae){const ce=O*O;if(O>0&&A.size<(K?ce:O))return void(D.numPoints+=A.length/3);const fe=[];for(let se=0;se<A.length;se+=3)(O===0||A[se+2]>ce)&&(D.numSimplified++,fe.push(A[se],A[se+1])),D.numPoints++;K&&(function(se,ue){let Pe=0;for(let ve=0,ie=se.length,Ge=ie-2;ve<ie;
5Ge=ve,ve+=2)Pe+=(se[ve]-se[Ge])*(se[ve+1]+se[Ge+1]);if(Pe>0===ue)for(let ve=0,ie=se.length;ve<ie/2;ve+=2){const Ge=se[ve],it=se[ve+1];se[ve]=se[ie-2-ve],se[ve+1]=se[ie-1-ve],se[ie-2-ve]=Ge,se[ie-1-ve]=it}})(fe,ae),le.push(fe)}function ca(le,A,D){var ae,ce;const O=!!A.newGeometry,K=A.removeAllProperties||((ae=A.removeProperties)==null?void 0:ae.length)>0||((ce=A.addOrUpdateProperties)==null?void 0:ce.length)>0;if(O){let fe=En({type:"FeatureCollection",features:[{type:"Feature",id:le.id,geometry:A.newGeometry,properties:K?kn(le.tags,A):le.tags}]},D);return fe=Ji(fe,D),fe[0]}if(K){const fe={...le};return fe.tags=kn(fe.tags,A),fe}return null}function kn(le,A){if(A.removeAllProperties)return{};const D={...le||{}};if(A.removeProperties)for(const O of A.removeProperties)delete D[O];if(A.addOrUpdateProperties)for(const{key:O,value:K}of A.addOrUpdateProperties)D[O]=K;return D}const Qi={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,debug:0};class Xa{constructor(A,D){Ze(this,"options");Ze(this,"tiles");Ze(this,"tileCoords");Ze(this,"stats",{});Ze(this,"total",0);Ze(this,"source");const O=(D=this.options=Object.assign({},Qi,D)).debug;if(O&&console.time("preprocess data"),D.maxZoom<0||D.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(D.promoteId&&D.generateId)throw new Error("promoteId and generateId cannot be used together.");let K=En(A,D);this.tiles={},this.tileCoords=[],O&&(console.timeEnd("preprocess data"),D.indexMaxZoom,D.indexMaxPoints,console.time("generate tiles"),this.stats={},this.total=0),K=Ji(K,D),K.length&&this.splitTile(K,0,0,0),D.updateable&&(this.source=K),O&&(K.length&&(this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),this.total,JSON.stringify(this.stats))}splitTile(A,D,O,K,ae,ce,fe){const se=[A,D,O,K],ue=this.options,Pe=ue.debug;for(;se.length;){K=se.pop(),O=se.pop(),D=se.pop(),A=se.pop();const ve=1<<D,ie=on(D,O,K);let Ge=this.tiles[ie];if(!Ge&&(Pe>1&&console.time("creation"),Ge=this.tiles[ie]=zn(A,D,O,K,ue),this.tileCoords.push({z:D,x:O,y:K,id:ie}),Pe)){Pe>1&&(Ge.numFeatures,Ge.numPoints,Ge.numSimplified,console.timeEnd("creation"));const Ce=`z${D}`;this.stats[Ce]=(this.stats[Ce]||0)+1,this.total++}if(Ge.source=A,ae==null){if(D===ue.indexMaxZoom||Ge.numPoints<=ue.indexMaxPoints)continue}else{if(D===ue.maxZoom||D===ae)continue;if(ae!=null){const Ce=ae-D;if(O!==ce>>Ce||K!==fe>>Ce)continue}}if(Ge.source=null,!A.length)continue;Pe>1&&console.time("clipping");const it=.5*ue.buffer/ue.extent,Xe=.5-it,Ye=.5+it,Qe=1+it;let et=null,yt=null,Kt=null,qt=null;const Pi=wi(A,ve,O-it,O+Ye,0,Ge.minX,Ge.maxX,ue),$t=wi(A,ve,O+Xe,O+Qe,0,Ge.minX,Ge.maxX,ue);Pi&&(et=wi(Pi,ve,K-it,K+Ye,1,Ge.minY,Ge.maxY,ue),yt=wi(Pi,ve,K+Xe,K+Qe,1,Ge.minY,Ge.maxY,ue)),$t&&(Kt=wi($t,ve,K-it,K+Ye,1,Ge.minY,Ge.maxY,ue),qt=wi($t,ve,K+Xe,K+Qe,1,Ge.minY,Ge.maxY,ue)),Pe>1&&console.timeEnd("clipping"),se.push(et||[],D+1,2*O,2*K),se.push(yt||[],D+1,2*O,2*K+1),se.push(Kt||[],D+1,2*O+1,2*K),se.push(qt||[],D+1,2*O+1,2*K+1)}}getTile(A,D,O){A=+A,D=+D,O=+O;const K=this.options,{extent:ae,debug:ce}=K;if(A<0||A>24)return null;const fe=1<<A,se=on(A,D=D+fe&fe-1,O);if(this.tiles[se])return Nr(this.tiles[se],ae);ce>1;let ue,Pe=A,ve=D,ie=O;for(;!ue&&Pe>0;)Pe--,ve>>=1,ie>>=1,ue=this.tiles[on(Pe,ve,ie)];return ue!=null&&ue.source?(ce>1&&console.time("drilling down"),this.splitTile(ue.source,Pe,ve,ie,A,D,O),ce>1&&console.timeEnd("drilling down"),this.tiles[se]?Nr(this.tiles[se],ae):null):null}invalidateTiles(A){const D=this.options,{debug:O}=D;let K=1/0,ae=-1/0,ce=1/0,fe=-1/0;for(const Pe of A)K=Math.min(K,Pe.minX),ae=Math.max(ae,Pe.maxX),ce=Math.min(ce,Pe.minY),fe=Math.max(fe,Pe.maxY);const se=D.buffer/D.extent,ue=new Set;for(const Pe in this.tiles){const ve=this.tiles[Pe],ie=1<<ve.z,Ge=(ve.x-se)/ie,it=(ve.x+1+se)/ie,Xe=(ve.y-se)/ie,Ye=(ve.y+1+se)/ie;if(ae<Ge||K>=it||fe<Xe||ce>=Ye)continue;let Qe=!1;for(const et of A)if(et.maxX>=Ge&&et.minX<it&&et.maxY>=Xe&&et.minY<Ye){Qe=!0;break}if(Qe){if(O){O>1&&(ve.z,ve.x,ve.y,ve.numFeatures,ve.numPoints,ve.numSimplified);const et=`z${ve.z}`;this.stats[et]=(this.stats[et]||0)-1,this.total--}delete this.tiles[Pe],ue.add(Pe)}}ue.size&&(this.tileCoords=this.tileCoords.filter((Pe=>!ue.has(Pe.id))))}updateData(A){const D=this.options,O=D.debug;if(!D.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");const{affected:K,source:ae}=(function(ve,ie,Ge){const it=(function(Ye){var Qe,et;
5return Ye?{removeAll:Ye.removeAll,remove:new Set(Ye.remove||[]),add:new Map((Qe=Ye.add)==null?void 0:Qe.map((yt=>[yt.id,yt]))),update:new Map((et=Ye.update)==null?void 0:et.map((yt=>[yt.id,yt])))}:{remove:new Set,add:new Map,update:new Map}})(ie);let Xe=[];if(it.removeAll&&(Xe=ve,ve=[]),it.remove.size||it.add.size){const Ye=[];for(const Qe of ve){const{id:et}=Qe;(it.remove.has(et)||it.add.has(et))&&Ye.push(Qe)}if(Ye.length){Xe.push(...Ye);const Qe=new Set(Ye.map((et=>et.id)));ve=ve.filter((et=>!Qe.has(et.id)))}if(it.add.size){let Qe=En({type:"FeatureCollection",features:Array.from(it.add.values())},Ge);Qe=Ji(Qe,Ge),Xe.push(...Qe),ve.push(...Qe)}}if(it.update.size)for(const[Ye,Qe]of it.update){const et=ve.findIndex((qt=>qt.id===Ye));if(et===-1)continue;const yt=ve[et],Kt=ca(yt,Qe,Ge);Kt&&(Xe.push(yt,Kt),ve[et]=Kt)}return{affected:Xe,source:ve}})(this.source,A,D);if(!K.length)return;this.source=ae,O>1&&console.time("invalidating"),this.invalidateTiles(K),O>1&&console.timeEnd("invalidating");const[ce,fe,se]=[0,0,0],ue=zn(this.source,ce,fe,se,this.options);ue.source=this.source;const Pe=on(ce,fe,se);if(this.tiles[Pe]=ue,this.tileCoords.push({z:ce,x:fe,y:se,id:Pe}),O){const ve=`z${ce}`;this.stats[ve]=(this.stats[ve]||0)+1,this.total++}}}function on(le,A,D){return 32*((1<<le)*D+A)+le}class ua{constructor(A,D,O,K=Ya){this._dataUpdateable=new Map,this.actor=A,this.layerIndex=D,this.availableImages=O,this.tileState=new At,this._createGeoJSONIndex=K}loadVectorTile(A){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:D,x:O,y:K}=A.tileID.canonical,ae=this._geoJSONIndex.getTile(D,O,K);return ae?st(new C.d3(ae.features,{version:2,extent:C.a5})):null}loadTile(A){return C._(this,void 0,void 0,(function*(){const{uid:D}=A,O=new Ne(A);O.abort=new AbortController;try{const K=this.loadVectorTile(A);if(!K)return null;const{vectorTile:ae,rawData:ce}=K;O.vectorTile=ae,this.tileState.markLoaded(D,O);const fe={rawData:ce};this.tileState.setParsing(D,fe);try{return yield this._parseWorkerTile(O,A,fe)}finally{this.tileState.clearParsing(D)}}catch(K){throw O.status="done",this.tileState.markLoaded(D,O),K}}))}_reloadLoadedTile(A){return C._(this,void 0,void 0,(function*(){const D=A.uid,O=this.tileState.getLoaded(D);if(!O)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(O.showCollisionBoxes=A.showCollisionBoxes,O.status==="parsing"){const K=this.tileState.consumeParsing(D);return yield this._parseWorkerTile(O,A,K)}if(O.status==="done"&&O.vectorTile)return yield this._parseWorkerTile(O,A)}))}_parseWorkerTile(A,D,O){return C._(this,void 0,void 0,(function*(){let K=yield A.parse(A.vectorTile,this.layerIndex,this.availableImages,this.actor,D.subdivisionGranularity);if(O){const{rawData:ae}=O;K=C.e({rawTileData:ae.slice(0)},K)}return K}))}abortTile(A){return C._(this,void 0,void 0,(function*(){this.tileState.abort(A.uid)}))}removeTile(A){return C._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(A.uid)}))}loadData(A){return C._(this,void 0,void 0,(function*(){var D;(D=this._pendingRequest)===null||D===void 0||D.abort();const O=this._startRequestTiming(A);this._pendingRequest=new AbortController;try{(!this._pendingData||A.request||A.data||A.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(A,this._pendingRequest));const K=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(K,A),this.tileState.clearLoaded();const ae={};return A.request&&(ae.data=K),this._finishRequestTiming(O,A,ae),ae}catch(K){if(delete this._pendingRequest,C.Z(K))return{abandoned:!0};throw K}}))}_startRequestTiming(A){var D;if(!((D=A.request)===null||D===void 0)&&D.collectResourceTiming)return new C.c$(A.request.url)}_finishRequestTiming(A,D,O){const K=A==null?void 0:A.finish();K&&(O.resourceTiming={[D.source]:JSON.parse(JSON.stringify(K))})}getData(){return C._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(A){return this.tileState.getLoaded(A.uid)?this._reloadLoadedTile(A):this.loadTile(A)}loadAndProcessGeoJSON(A,D){return C._(this,void 0,void 0,(function*(){let O;if(A.request?O=yield this.loadGeoJSONFromUrl(A.request,A.promoteId,D):A.data?O=this._loadGeoJSONFromObject(A.data,A.promoteId):A.dataDiff&&(O=this._loadGeoJSONFromDiff(A.dataDiff,A.promoteId,A.source)),delete this._pendingRequest,typeof O!="object")throw new Error(`Input data given to '${A.source}' is not a valid GeoJSON object.`);return $a(O,!0),A.filter&&(O=this._filterGeoJSON(O,A.filter)),O}))}loadGeoJSONFromUrl(A,D,O){return C._(this,void 0,void 0,(function*(){const K=yield C.j(A,O);return this._dataUpdateable=C.a7(K.data,D),K.data}))}_loadGeoJSONFromObject(A,D){return this._dataUpdateable=C.a7(A,D),A}_loadGeoJSONFromDiff(A,D,O){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${O}`);C.a8(this._dataUpdateable,A,D);const K=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(K)}
vendor: 14,402 bytes, line 5
5_filterGeoJSON(A,D){const O=C.d4(D,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(O.result==="error")throw new Error(O.value.map((ae=>`${ae.key}: ${ae.message}`)).join(", "));const K=A.features.filter((ae=>O.value.evaluate({zoom:0},ae)));return this._toFeatureCollection(K)}_toFeatureCollection(A){return{type:"FeatureCollection",features:A}}removeSource(A){return C._(this,void 0,void 0,(function*(){var D;(D=this._pendingRequest)===null||D===void 0||D.abort()}))}getClusterExpansionZoom(A){return this._geoJSONIndex.getClusterExpansionZoom(A.clusterId)}getClusterChildren(A){return this._geoJSONIndex.getChildren(A.clusterId)}getClusterLeaves(A){return this._geoJSONIndex.getLeaves(A.clusterId,A.limit,A.offset)}}function Ya(le,A){return A.cluster?new tn((function({superclusterOptions:D,clusterProperties:O}){if(!O||!D)return D;const K={},ae={},ce={accumulated:null,zoom:0},fe={properties:null},se=Object.keys(O);for(const ue of se){const[Pe,ve]=O[ue],ie=C.d4(ve),Ge=C.d4(typeof Pe=="string"?[Pe,["accumulated"],["get",ue]]:Pe);K[ue]=ie.value,ae[ue]=Ge.value}return D.map=ue=>{fe.properties=ue;const Pe={};for(const ve of se)Pe[ve]=K[ve].evaluate(ce,fe);return Pe},D.reduce=(ue,Pe)=>{fe.properties=Pe;for(const ve of se)ce.accumulated=ue[ve],ue[ve]=ae[ve].evaluate(ce,fe)},D})(A)).load(le.features):(function(D,O){return new Xa(D,O)})(le,A.geojsonVtOptions)}class Dn{constructor(A){this.self=A,this.actor=new C.L(A),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(D,O)=>{if(this.externalWorkerSourceTypes[D])throw new Error(`Worker source with name "${D}" already registered.`);this.externalWorkerSourceTypes[D]=O},this.self.addProtocol=C.cK,this.self.removeProtocol=C.cL,this.self.registerRTLTextPlugin=D=>{C.d5.setMethods(D)},this.actor.registerMessageHandler("LDT",((D,O)=>this._getDEMWorkerSource(D,O.source).loadTile(O))),this.actor.registerMessageHandler("RDT",((D,O)=>C._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(D,O.source).removeTile(O)})))),this.actor.registerMessageHandler("GCEZ",((D,O)=>C._(this,void 0,void 0,(function*(){return this._getWorkerSource(D,O.type,O.source).getClusterExpansionZoom(O)})))),this.actor.registerMessageHandler("GCC",((D,O)=>C._(this,void 0,void 0,(function*(){return this._getWorkerSource(D,O.type,O.source).getClusterChildren(O)})))),this.actor.registerMessageHandler("GCL",((D,O)=>C._(this,void 0,void 0,(function*(){return this._getWorkerSource(D,O.type,O.source).getClusterLeaves(O)})))),this.actor.registerMessageHandler("LD",((D,O)=>this._getWorkerSource(D,O.type,O.source).loadData(O))),this.actor.registerMessageHandler("GD",((D,O)=>this._getWorkerSource(D,O.type,O.source).getData())),this.actor.registerMessageHandler("LT",((D,O)=>this._getWorkerSource(D,O.type,O.source).loadTile(O))),this.actor.registerMessageHandler("RT",((D,O)=>this._getWorkerSource(D,O.type,O.source).reloadTile(O))),this.actor.registerMessageHandler("AT",((D,O)=>this._getWorkerSource(D,O.type,O.source).abortTile(O))),this.actor.registerMessageHandler("RMT",((D,O)=>this._getWorkerSource(D,O.type,O.source).removeTile(O))),this.actor.registerMessageHandler("RS",((D,O)=>C._(this,void 0,void 0,(function*(){if(!this.workerSources[D]||!this.workerSources[D][O.type]||!this.workerSources[D][O.type][O.source])return;const K=this.workerSources[D][O.type][O.source];delete this.workerSources[D][O.type][O.source],K.removeSource!==void 0&&K.removeSource(O)})))),this.actor.registerMessageHandler("RM",(D=>C._(this,void 0,void 0,(function*(){delete this.layerIndexes[D],delete this.availableImages[D],delete this.workerSources[D],delete this.demWorkerSources[D],this.globalStates.delete(D)})))),this.actor.registerMessageHandler("SR",((D,O)=>C._(this,void 0,void 0,(function*(){this.referrer=O})))),this.actor.registerMessageHandler("SRPS",((D,O)=>this._syncRTLPluginState(D,O))),this.actor.registerMessageHandler("IS",((D,O)=>C._(this,void 0,void 0,(function*(){this.self.importScripts(O)})))),this.actor.registerMessageHandler("SI",((D,O)=>this._setImages(D,O))),this.actor.registerMessageHandler("UL",((D,O)=>C._(this,void 0,void 0,(function*(){this._getLayerIndex(D).update(O.layers,O.removedIds,this._getGlobalState(D))})))),this.actor.registerMessageHandler("UGS",((D,O)=>C._(this,void 0,void 0,(function*(){const K=this._getGlobalState(D);for(const ae in O)K[ae]=O[ae]})))),this.actor.registerMessageHandler("SL",((D,O)=>C._(this,void 0,void 0,(function*(){this._getLayerIndex(D).replace(O,this._getGlobalState(D))}))))}_getGlobalState(A){let D=this.globalStates.get(A);return D||(D={},this.globalStates.set(A,D)),D}_setImages(A,D){return C._(this,void 0,void 0,(function*(){this.availableImages[A]=D;for(const O in this.workerSources[A]){const K=this.workerSources[A][O];for(const ae in K)K[ae].availableImages=D}}))}_syncRTLPluginState(A,D){return C._(this,void 0,void 0,(function*(){return yield C.d5.syncState(D,this.self.importScripts)}))}_getAvailableImages(A){let D=this.availableImages[A];return D||(D=[]),D}_getLayerIndex(A){let D=this.layerIndexes[A];return D||(D=this.layerIndexes[A]=new c),D}_getWorkerSource(A,D,O){if(this.workerSources[A]||(this.workerSources[A]={}),this.workerSources[A][D]||(this.workerSources[A][D]={}),!this.workerSources[A][D][O]){const K={sendAsync:(ae,ce)=>(ae.targetMapId=A,this.actor.sendAsync(ae,ce))};switch(D){case"vector":this.workerSources[A][D][O]=new sr(K,this._getLayerIndex(A),this._getAvailableImages(A));break;case"geojson":this.workerSources[A][D][O]=new ua(K,this._getLayerIndex(A),this._getAvailableImages(A));break;default:this.workerSources[A][D][O]=new this.externalWorkerSourceTypes[D](K,this._getLayerIndex(A),this._getAvailableImages(A))}}return this.workerSources[A][D][O]}_getDEMWorkerSource(A,D){return this.demWorkerSources[A]||(this.demWorkerSources[A]={}),this.demWorkerSources[A][D]||(this.demWorkerSources[A][D]=new St),this.demWorkerSources[A][D]}}return C.i(self)&&(self.worker=new Dn(self)),Dn})),pe("index",["exports","./shared"],(function(C,c){var be="5.18.0";function Ne(){var d=new c.A(4);return c.A!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}let nt,At,Lt;const _t={frame(d,t,n,s){const l=s||window,p=l.requestAnimationFrame((_=>{m(),t(_)})),{unsubscribe:m}=c.s(d.signal,"abort",(()=>{m(),l.cancelAnimationFrame(p),n(new c.a(d.signal.reason))}),!1)},frameAsync(d,t){return new Promise(((n,s)=>{this.frame(d,n,s,t)}))},getImageData(d,t=0){return this.getImageCanvasContext(d).getImageData(-t,-t,d.width+2*t,d.height+2*t)},getImageCanvasContext(d){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=d.width,t.height=d.height,n.drawImage(d,0,0,d.width,d.height),n},resolveURL:d=>(nt||(nt=document.createElement("a")),nt.href=d,nt.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Lt!==void 0?Lt:!!matchMedia&&(At==null&&(At=matchMedia("(prefers-reduced-motion: reduce)")),At.matches)},set prefersReducedMotion(d){Lt=d}},ki=new class{constructor(){this._realTime=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:this._realTime()}setNow(d){this._frozenAt=d}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function st(){return ki.getCurrentTime()}class xe{static testProp(t){if(!xe.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in xe.docStyle)return t[n];return t[0]}static create(t,n,s){const l=window.document.createElement(t);return n!==void 0&&(l.className=n),s&&s.appendChild(l),l}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){xe.docStyle&&xe.selectProp&&(xe.userSelect=xe.docStyle[xe.selectProp],xe.docStyle[xe.selectProp]="none")}static enableDrag(){xe.docStyle&&xe.selectProp&&(xe.docStyle[xe.selectProp]=xe.userSelect)}static setTransform(t,n){t.style[xe.transformProp]=n}static addEventListener(t,n,s,l={}){t.addEventListener(n,s,"passive"in l?l:l.capture)}static removeEventListener(t,n,s,l={}){t.removeEventListener(n,s,"passive"in l?l:l.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",xe.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",xe.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",xe.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,s){const l=n.boundingClientRect;return new c.P((s.clientX-l.left)/n.x-t.clientLeft,(s.clientY-l.top)/n.y-t.clientTop)}static mousePos(t,n){const s=xe.getScale(t);return xe.getPoint(t,s,n)}static touchPos(t,n){const s=[],l=xe.getScale(t);for(let p=0;p<n.length;p++)s.push(xe.getPoint(t,l,n[p]));return s}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),s=n.querySelectorAll("script");for(const l of s)l.remove();return xe.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const s=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!s.includes("javascript:")&&!s.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const s of n)xe.removeAttributes(s),xe.clean(s)}static removeAttributes(t){for(const{name:n,value:s}of t.attributes)xe.isPossiblyDangerous(n,s)&&t.removeAttribute(n)}}xe.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,xe.selectProp=xe.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),xe.transformProp=xe.testProp(["transform","WebkitTransform"]);const sr={supported:!1,testSupport:function(d){!Mn&&vt&&(na?$a(d):St=d)}};let St,vt,Mn=!1,na=!1;function $a(d){const t=d.createTexture();d.bindTexture(d.TEXTURE_2D,t);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,vt),d.isContextLost())return;sr.supported=!0}catch{}d.deleteTexture(t),Mn=!0}var Ki;typeof document<"u"&&(vt=document.createElement("img"),vt.onload=()=>{St&&$a(St),St=null,na=!0},vt.onerror=()=>{Mn=!0,St=null},vt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(d){let t,n,s,l;d.resetRequestQueue=()=>{t=[],n=0,s=0,l={}},d.addThrottleControl=x=>{const w=s++;return l[w]=x,w},d.removeThrottleControl=x=>{delete l[x],m()},d.getImage=(x,w,T=!0)=>new Promise(((I,M)=>{sr.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),c.e(x,{type:"image"}),t.push({abortController:w,requestParameters:x,supportImageRefresh:T,state:"queued",onError:k=>{M(k)},onSuccess:k=>{I(k)}}),m()}));const p=x=>c._(this,void 0,void 0,(function*(){x.state="running";const{requestParameters:w,supportImageRefresh:T,onError:I,onSuccess:M,abortController:k}=x,B=T===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce(((q,Y)=>q&&Y==="accept"),!0));n++;const G=B?_(w,k):c.m(w,k);try{const q=yield G;delete x.abortController,x.state="completed",q.data instanceof HTMLImageElement||c.b(q.data)?M(q):q.data&&M({data:yield(Z=q.data,typeof createImageBitmap=="function"?c.f(Z):c.h(Z)),cacheControl:q.cacheControl,expires:q.expires})}catch(q){delete x.abortController,I(q)}finally{n--,m()}var Z})),m=()=>{const x=(()=>{for(const w of Object.keys(l))if(l[w]())return!0;return!1})()?c.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=n;w<x&&t.length>0;w++){const T=t.shift();T.abortController.signal.aborted?w--:p(T)}},_=(x,w)=>new Promise(((T,I)=>{const M=new Image,k=x.url,B=x.credentials;B&&B==="include"?M.crossOrigin="use-credentials":(B&&B==="same-origin"||!c.d(k))&&(M.crossOrigin="anonymous"),w.signal.addEventListener("abort",(()=>{M.src="",I(new c.a(w.signal.reason))})),M.fetchPriority="high",M.onload=()=>{M.onerror=M.onload=null,T({data:M})},M.onerror=()=>{M.onerror=M.onload=null,w.signal.aborted||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."))},M.src=k}))})(Ki||(Ki={})),Ki.resetRequestQueue();class Za{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Er(d){const t=[];if(typeof d=="string")t.push({id:"default",url:d});else if(d&&d.length>0){const n=[];for(const{id:s,url:l}of d){const p=`${s}${l}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:s,url:l}))}}return t}function tn(d,t,n){try{const s=new URL(d);return s.pathname+=`${t}${n}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${d}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function In(d){const{userImage:t}=d;return!!(t&&t.render&&t.render())&&(d.data.replace(new Uint8Array(t.data.buffer)),!0)}class rn extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:s}of this.requestors)s(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const s=n.spriteData;n.data=new c.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;const l=n.data||n.spriteData;return this._validateStretch(n.stretchX,l&&l.width)||(this.fire(new c.k(new Error(`Image "${t}
5" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,l&&l.height)||(this.fire(new c.k(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new c.k(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const l of t){if(l[0]<s||l[1]<l[0]||n<l[1])return!1;s=l[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const s=n.spriteData,l=s&&s.width||n.data.width,p=s&&s.height||n.data.height;return!(t[0]<0||l<t[0]||t[1]<0||p<t[1]||t[2]<0||l<t[2]||t[3]<0||p<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,s=!0){const l=this.getImage(t);if(s&&(l.data.width!==n.data.width||l.data.height!==n.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=l.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,s)=>{let l=!0;if(!this.isLoaded())for(const p of t)this.images[p]||(l=!1);this.isLoaded()||l?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}
vendor: 28,977 bytes, line 5
5))}_getImagesForIds(t){const n={};for(const s of t){let l=this.getImage(s);l||(this.fire(new c.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?n[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:c.w(`Image "${s}" 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 n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},p=new c.I(l,s);this.patterns[t]={bin:l,position:p}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new c.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=c.p(t),l=this.atlasImage;l.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:m}=this.patterns[p],_=m.x+1,x=m.y+1,w=this.getImage(p).data,T=w.width,I=w.height;c.R.copy(w,l,{x:0,y:0},{x:_,y:x},{width:T,height:I}),c.R.copy(w,l,{x:0,y:I-1},{x:_,y:x-1},{width:T,height:1}),c.R.copy(w,l,{x:0,y:0},{x:_,y:x+I},{width:T,height:1}),c.R.copy(w,l,{x:T-1,y:0},{x:_-1,y:x},{width:1,height:I}),c.R.copy(w,l,{x:0,y:0},{x:_+T,y:x},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.getImage(n);s||c.w(`Image with ID: "${n}" was not found`),In(s)&&this.updateImage(n,s)}}cloneImages(){const t={};for(const n in this.images){const s=this.images[n];t[n]=Object.assign(Object.assign({},s),{data:s.data?s.data.clone():null})}return t}}const Cr=1e20;function nn(d,t,n,s,l,p,m,_,x){for(let w=t;w<t+s;w++)Wa(d,n*p+w,p,l,m,_,x);for(let w=n;w<n+l;w++)Wa(d,w*p+t,1,s,m,_,x)}function Wa(d,t,n,s,l,p,m){p[0]=0,m[0]=-Cr,m[1]=Cr,l[0]=d[t];for(let _=1,x=0,w=0;_<s;_++){l[_]=d[t+_*n];const T=_*_;do{const I=p[x];w=(l[_]-l[I]+T-I*I)/(_-I)/2}while(w<=m[x]&&--x>-1);x++,p[x]=_,m[x]=w,m[x+1]=Cr}for(let _=0,x=0;_<s;_++){for(;m[x+1]<_;)x++;const w=p[x],T=_-w;d[t+_*n]=l[w]+T*T}}const aa=c.v.layout_symbol["text-font"].default.join(",");class jr{constructor(t,n,s){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=s}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,(function*(){const n=[];for(const p in t)for(const m of t[p])n.push(this._getAndCacheGlyphsPromise(p,m));const s=yield Promise.all(n),l={};for(const{stack:p,id:m,glyph:_}of s)l[p]||(l[p]={}),l[p][m]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l}))}_getAndCacheGlyphsPromise(t,n){return c._(this,void 0,void 0,(function*(){let s=this.entries[t];s||(s=this.entries[t]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[n];return l!==void 0?{stack:t,id:n,glyph:l}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(l=s.glyphs[n]=this._drawGlyph(s,t,n),{stack:t,id:n,glyph:l}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return c._(this,void 0,void 0,(function*(){const s=this.entries[t],l=Math.floor(n/256);if(s.ranges[l])return{stack:t,id:n,glyph:null};if(!s.requests[l]){const p=jr.loadGlyphRange(t,l,this.url,this.requestManager);s.requests[l]=p}try{const p=yield s.requests[l];for(const m in p)s.glyphs[+m]=p[+m];return s.ranges[l]=!0,{stack:t,id:n,glyph:p[n]||null}}catch(p){const m=s.glyphs[n]=this._drawGlyph(s,t,n);return this._warnOnMissingGlyphRange(m,l,n,p),{stack:t,id:n,glyph:m}}}))}_warnOnMissingGlyphRange(t,n,s,l){const p=256*n,m=p+255,_=s.toString(16).padStart(4,"0").toUpperCase();c.w(`Unable to load glyph range ${n}, ${p}-${m}. Rendering codepoint U+${_} locally instead. ${l}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&c.q(t)}_drawGlyph(t,n,s){const l=n===aa&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(s),p=l?"ideographTinySDF":"tinySDF";t[p]||(t[p]=this._createTinySDF(l?this.localIdeographFontFamily:n));const m=t[p].draw(String.fromCodePoint(s)),_=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(s));return{id:s,bitmap:new c.r({width:m.width||60,height:m.height||60},m.data),metrics:{width:_?0:m.glyphWidth/2||24,height:m.glyphHeight/2||24,left:m.glyphLeft/2+.5||0,top:m.glyphTop/2-27.5||-8,advance:_?0:m.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const s=n.map((l=>/[-\w]+/.test(l)?l:`'${CSS.escape(l)}'`)).join(",");return new jr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:s,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={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};let s;for(const[l,p]of Object.entries(n))new RegExp(`\\b${l}\\b`,"i").test(t)&&(s=`${p}`);return s}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}jr.loadGlyphRange=function(d,t,n,s){return c._(this,void 0,void 0,(function*(){const l=256*t,p=l+255,m=s.transformRequest(n.replace("{fontstack}",d).replace("{range}",`${l}-${p}`),"Glyphs"),_=yield c.n(m,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${t}, ${l}-${p}`);const x={};for(const w of c.o(_.data))x[w.id]=w;return x}))},jr.TinySDF=class{constructor({fontSize:d=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:p="normal",fontStyle:m="normal",lang:_=null}={}){this.buffer=t,this.cutoff=s,this.radius=n,this.lang=_;const x=this.size=d+4*t,w=this._createCanvas(x),T=this.ctx=w.getContext("2d",{willReadFrequently:!0});T.font=`${m} ${p} ${d}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(d){const t=document.createElement("canvas");return t.width=t.height=d,t}draw(d){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:p}=this.ctx.measureText(d),m=Math.ceil(n),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-l))),x=Math.min(this.size-this.buffer,m+Math.ceil(s)),w=_+2*this.buffer,T=x+2*this.buffer,I=Math.max(w*T,0),M=new Uint8ClampedArray(I),k={data:M,width:w,height:T,glyphWidth:_,glyphHeight:x,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(_===0||x===0)return k;const{ctx:B,buffer:G,gridInner:Z,gridOuter:q}=this;this.lang&&(B.lang=this.lang),B.clearRect(G,G,_,x),B.fillText(d,G,G+m);const Y=B.getImageData(G,G,_,x);q.fill(Cr,0,I),Z.fill(0,0,I);for(let te=0;te<x;te++)for(let H=0;H<_;H++){const ee=Y.data[4*(te*_+H)+3]/255;if(ee===0)continue;const re=(te+G)*w+H+G;if(ee===1)q[re]=0,Z[re]=Cr;else{const J=.5-ee;q[re]=J>0?J*J:0,Z[re]=J<0?J*J:0}}nn(q,0,0,w,T,w,this.f,this.v,this.z),nn(Z,G,G,_,x,w,this.f,this.v,this.z);for(let te=0;te<I;te++){const H=Math.sqrt(q[te])-Math.sqrt(Z[te]);M[te]=Math.round(255-255*(H/this.radius+this.cutoff))}return k}};class ni{constructor(){this.specification=c.u.light.position}possiblyEvaluate(t,n){return c.F(t.expression.evaluate(n))}interpolate(t,n,s){return{x:c.G.number(t.x,n.x,s),y:c.G.number(t.y,n.y,s),z:c.G.number(t.z,n.z,s)}}}let gt;class En extends c.E{constructor(t){super(),gt=gt||new c.t({anchor:new c.D(c.u.light.anchor),position:new ni,color:new c.D(c.u.light.color),intensity:new c.D(c.u.light.intensity)}),this._transitionable=new c.x(gt,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.y,t,n))for(const s in t){const l=t[s];s.endsWith(c.z)?this._transitionable.setTransition(s.slice(0,-c.z.length),l):this._transitionable.setValue(s,l)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&c.B(this,t.call(c.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u}))}}const Ar=new c.t({"sky-color":new c.D(c.u.sky["sky-color"]),"horizon-color":new c.D(c.u.sky["horizon-color"]),"fog-color":new c.D(c.u.sky["fog-color"]),"fog-ground-blend":new c.D(c.u.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.u.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.u.sky["atmosphere-blend"])});class Ha extends c.E{constructor(t){super(),this._transitionable=new c.x(Ar,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0))}setSky(t,n={}){if(!this._validate(c.J,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in t){const l=t[s];s.endsWith(c.z)?this._transitionable.setTransition(s.slice(0,-c.z.length),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s={}){return(s==null?void 0:s.validate)!==!1&&c.B(this,t.call(c.C,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class sa{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const l=[];let p=t.length%2==1?-t[t.length-1]*s:0,m=t[0]*s,_=!0;l.push({left:p,right:m,isDash:_,zeroLength:t[0]===0});let x=t[0];for(let w=1;w<t.length;w++){_=!_;const T=t[w];p=x*s,x+=T,m=x*s,l.push({left:p,right:m,isDash:_,zeroLength:T===0})}return l}addRoundDash(t,n,s){const l=n/2;for(let p=-s;p<=s;p++){const m=this.width*(this.nextRow+s+p);let _=0,x=t[_];for(let w=0;w<this.width;w++){w/x.right>1&&(x=t[++_]);const T=Math.abs(w-x.left),I=Math.abs(w-x.right),M=Math.min(T,I);let k;const B=p/s*(l+1);if(x.isDash){const G=l-Math.abs(B);k=Math.sqrt(M*M+G*G)}else k=l-Math.sqrt(M*M+B*B);this.data[m+w]=Math.max(0,Math.min(255,k+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const x=t[_],w=t[_+1];x.zeroLength?t.splice(_,1):w&&w.isDash===x.isDash&&(w.left=x.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const l=this.width*this.nextRow;let p=0,m=t[p];for(let _=0;_<this.width;_++){_/m.right>1&&(m=t[++p]);const x=Math.abs(_-m.left),w=Math.abs(_-m.right),T=Math.min(x,w);this.data[l+_]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,n){const s=n?7:0,l=2*s+1;if(this.nextRow+l>this.height)return c.w("LineAtlas out of space"),null;let p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,x=this.getDashRanges(t,this.width,_);n?this.addRoundDash(x,_,s):this.addRegularDash(x)}const m={y:this.nextRow+s,height:2*s,width:p};return this.nextRow+=l,this.dirty=!0,m}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const an="maplibre_preloaded_worker_pool";class Vr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Vr.workerCount;)this.workers.push(new Worker(c.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[an]}numActive(){return Object.keys(this.active).length}}const or=Math.floor(_t.hardwareConcurrency/2);let wi,Gi;function oa(){return wi||(wi=new Vr),wi}Vr.workerCount=c.K(globalThis)?Math.max(Math.min(or,3),1):1;class Cn{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const s=this.workerPool.acquire(n);for(let l=0;l<s.length;l++){const p=new c.L(s[l],n);p.name=`Worker ${l}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:t,data:n}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const s of this.actors)s.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function An(){return Gi||(Gi=new Cn(oa(),c.M),Gi.registerMessageHandler("GR",((d,t,n)=>c.m(t,n)))),Gi}function Ti(d,t){const n=c.N();return c.O(n,n,[1,1,0]),c.Q(n,n,[.5*d.width,.5*d.height,1]),d.calculatePosMatrix?c.S(n,n,d.calculatePosMatrix(t.toUnwrapped())):n}function Ws(d,t,n,s,l,p,m){var _;const x=(function(M,k,B){if(M)for(const G of M){const Z=k[G];if(Z&&Z.source===B&&Z.type==="fill-extrusion")return!0}else for(const G in k){const Z=k[G];if(Z.source===B&&Z.type==="fill-extrusion")return!0}return!1})((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,t,d.id),w=p.maxPitchScaleFactor(),T=d.tilesIn(s,w,x);T.sort(Si);const I=[];for(const M of T)I.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,d.getState(),M.queryGeometry,M.cameraQueryGeometry,M.scale,l,p,w,Ti(p,M.tileID),m?(k,B)=>m(M.tileID,k,B):void 0)});return(function(M,k){for(const B in M)for(const G of M[B])Ji(G,k);return M})((function(M){const k={},B={};for(const G of M){const Z=G.queryResults,q=G.wrappedTileID,Y=B[q]=B[q]||{};for(const te in Z){const H=Z[te],ee=Y[te]=Y[te]||{},re=k[te]=k[te]||[];for(const J of H)ee[J.featureIndex]||(ee[J.featureIndex]=!0,re.push(J))}}return k})(I),d)}function Si(d,t){const n=d.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}function Ji(d,t){const n=d.feature,s=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=s}function zr(d,t,n,s){return c._(this,void 0,void 0,(function*(){let l=d;if(d.url?l=(yield c.j(t.transformRequest(d.url,"Source"),n)).data:yield _t.frameAsync(n,s),!l)return null;const p=c.U(c.e(l,d),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in l&&l.vector_layers&&(p.vectorLayerIds=l.vector_layers.map((m=>m.id))),p}))}class Ft{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof c.V?new c.V(t.lng,t.lat):c.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.V?new c.V(t.lng,t.lat):c.V.convert(t),this}extend(t){const n=this._sw,s=this._ne;let l,p;if(t instanceof c.V)l=t,p=t;else{if(!(t instanceof Ft))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Ft.convert(t)):this.extend(c.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.V.convert(t)):this;if(l=t._sw,p=t._ne,!l||!p)return this}return n||s?(n.lng=Math.min(l.lng,n.lng),n.lat=Math.min(l.lat,n.lat),s.lng=Math.max(p.lng,s.lng),s.lat=Math.max(p.lat,s.lat)):(this._sw=new c.V(l.lng,l.lat),this._ne=new c.V(p.lng,p.lat)),this}getCenter(){return new c.V((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 c.V(this.getWest(),this.getNorth())}getSouthEast(){return new c.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:n,lat:s}=c.V.convert(t);let l=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}intersects(t){if(!((t=Ft.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),s=Math.abs(t.getEast()-t.getWest());if(n>=360||s>=360)return!0;const l=c.W(this.getWest(),-180,180),p=c.W(this.getEast(),-180,180),m=c.W(t.getWest(),-180,180),_=c.W(t.getEast(),-180,180),x=l>p,w=m>_;return!(!x||!w)||(x?_>=l||m<=p:w?p>=m||l<=_:m<=p&&_>=l)}static convert(t){return t instanceof Ft?t:t&&new Ft(t)}static fromLngLat(t,n=0){const s=360*n/40075017,l=s/Math.cos(Math.PI/180*t.lat);return new Ft(new c.V(t.lng-l,t.lat-s),new c.V(t.lng+l,t.lat+s))}adjustAntiMeridian(){const t=new c.V(this._sw.lng,this._sw.lat),n=new c.V(this._ne.lng,this._ne.lat);return new Ft(t,t.lng>n.lng?new c.V(n.lng+360,n.lat):n)}}class Nr{constructor(t,n,s){this.bounds=Ft.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(c.Y(this.bounds.getWest())*n),l=Math.floor(c.X(this.bounds.getNorth())*n),p=Math.ceil(c.Y(this.bounds.getEast())*n),m=Math.ceil(c.X(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=l&&t.y<m}}class la extends c.E{constructor(t,n,s,l){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=c.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return c._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield zr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(c.e(this,t),t.bounds&&(this.tileBounds=new Nr(t.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,c.Z(t)||this.fire(new c.k(t))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.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:this._getOverzoomParameters(t)};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((p,m)=>{t.reloadPromise={resolve:p,reject:m}}))}else t.actor=this.dispatcher.getActor(),l="LT";t.abortController=new AbortController;try{const p=yield t.actor.sendAsync({type:l,data:s},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,p)}catch(p){if(delete t.abortController,t.aborted)return;if(p&&p.status!==404)throw p;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,s=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:this.map._requestManager.transformRequest(s,"Tile")}}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const s=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(s.resolve).catch(s.reject)}}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class zn extends c.E{constructor(t,n,s,l){super(),this.id=t,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.U(n,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield zr(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(c.e(this,n),n.bounds&&(this.tileBounds=new Nr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,c.Z(n)||this.fire(new c.k(n))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const s=yield Ki.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&(s.cacheControl||s.expires)&&t.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,p=l.gl,m=s.data;t.texture=this.map.painter.getTileTexture(m.width),t.texture?t.texture.update(m,{useMipmap:!0}):(t.texture=new c.T(l,m,p.RGBA,{useMipmap:!0}),t.texture.bind(p.LINEAR,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(s){if(delete t.abortController,t.aborted)t.state="unloaded";else if(s)throw t.state="errored",s}}))}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class sn extends zn{constructor(t,n,s,l){super(t,n,s,l),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const l=yield Ki.getImage(s,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(l&&l.data){const p=l.data;this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&t.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const m=c.b(p)&&c.$()?p:yield this.readImageNow(p),_={type:this.type,uid:t.uid,source:this.id,rawImageData:m,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const x=yield t.actor.sendAsync({type:"LDT",data:_});t.dem=x,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(l){if(delete t.abortController,t.aborted)t.state="unloaded";else if(l)throw t.state="errored",l}}))}readImageNow(t){return c._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&c.a0()){const n=t.width+2,s=t.height+2;try{return new c.R({width:n,height:s},yield c.a1(t,-1,-1,n,s))}catch{}}return _t.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),l=(n.x-1+s)%s,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,x={};return x[new c.a2(t.overscaledZ,p,n.z,l,n.y).key]={backfilled:!1},x[new c.a2(t.overscaledZ,_,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(x[new c.a2(t.overscaledZ,p,n.z,l,n.y-1).key]={backfilled:!1},x[new c.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},x[new c.a2(t.overscaledZ,_,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1<s&&(x[new c.a2(t.overscaledZ,p,n.z,l,n.y+1).key]={backfilled:!1},x[new c.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},x[new c.a2(t.overscaledZ,_,n.z,m,n.y+1).key]={backfilled:!1}),x}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function _r(d){return d.type==="GeometryCollection"?d.geometries.map((t=>t.coordinates)).flat(1/0):d.coordinates.flat(1/0)}function ca(d){const t=new Ft;let n;switch(d.type){case"FeatureCollection":n=d.features.map((s=>_r(s.geometry))).flat(1/0);break;case"Feature":n=_r(d.geometry);break;default:n=_r(d)}if(n.length==0)return t;for(let s=0;s<n.length-1;s+=2)t.extend([n[s],n[s+1]]);return t}class kn extends c.E{constructor(t,n,s,l){super(),this.id=t,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:n.data},this.actor=s.getActor(),this.setEventedParent(l),this._data=typeof n.data=="str
5ing"?{url:n.data}:{geojson:n.data},this._options=c.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&c.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=c.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:c.a5,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.a5,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(c.a5/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||c.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return c._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const s=this._updateWorkerData();return n?s:this}updateData(t,n){this._pendingWorkerUpdate.diff=c.a6(this._pendingWorkerUpdate.diff,t);const s=this._updateWorkerData();return n?s:this}getData(){return c._(this,void 0,void 0,(function*(){const t=c.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getBounds(){return c._(this,void 0,void 0,(function*(){return ca(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMa
5xZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:s}})}_updateWorkerData(){return c._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void c.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n}=this._pendingWorkerUpdate,s=this._getLoadGeoJSONParameters(t,n);t!==void 0?this._pendingWorkerUpdate.data=void 0:n&&(this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,yield this._dispatchWorkerUpdate(s)}))}_getLoadGeoJSONParameters(t,n){const s=c.e({type:this.type},this.workerOptions);return typeof t=="string"?(s.request=this.map._requestManager.transformRequest(_t.resolveURL(t),"Source"),s.request.collectResourceTiming=this._collectResourceTiming,s):t!==void 0?(s.data=t,s):(n&&(s.dataDiff=n),s)}_dispatchWorkerUpdate(t){return c._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new c.l("dataloading",{dataType:"source"}));try{const n=yield this.actor.sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||n.abandoned)return void this.fire(new c.l("dataabort",{dataType:"source"}));n.data&&(this._data={geojson:n.data});const s=this._applyDiffToSource(t.dataDiff),l=this._getShouldReloadTileOptions(s),p={dataType:"source"};this._applyResourceTiming(p,n),this.fire(new c.l("data",Object.assign(Object.assign({},p),{sourceDataType:"metadata"}))),this.fire(new c.l("data",Object.assign(Object.assign({},p),{sourceDataType:"content",shouldReloadTileOptions:l})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new c.l("dataabort",{dataType:"source"}));this.fire(new c.k(n))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var s;if(!this._collectResourceTiming)return;const l=(s=n.resourceTiming)===null||s===void 0?void 0:s[this.id];if(!l)return;const p=l.slice(0);p!=null&&p.length&&c.e(t,{resourceTiming:p})}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const l=c.a7(this._data.geojson,n);if(!l)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:l}}if(!this._data.updateable)return;const s=c.a8(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:s}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>ca(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:s,extent:l}=this.workerOptions.geojsonVtOptions,p=(function({x:m,y:_,z:x},w=0){const T=c.a3((m-w)/Math.pow(2,x)),I=c.a4((_+1+w)/Math.pow(2,x)),M=c.a3((m+1+w)/Math.pow(2,x)),k=c.a4((_-w)/Math.pow(2,x));return new Ft([T,I],[M,k])})(t.tileID.canonical,s/l);for(const m of n)if(p.intersects(m))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const s={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.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};t.abortController=new AbortController;const l=yield this.actor.sendAsync({type:n,data:s},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(l,this.map.painter,n==="RT")}))}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
vendor: 8,442 bytes, line 5
5ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.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 Qi extends c.E{constructor(t,n,s,l){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=n}load(t){return c._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Ki.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,c.Z(n)||this.fire(new c.k(n))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.a9.fromLngLat);var s;return this.tileID=(function(l){const p=c.aa.fromPoints(l),m=p.width(),_=p.height(),x=Math.max(m,_),w=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),T=Math.pow(2,w);return new c.ac(w,Math.floor((p.minX+p.maxX)/2*T),Math.floor((p.minY+p.maxY)/2*T))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((l=>this.tileID.getTilePoint(l)._round())),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new c.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const p=this.tiles[l];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,s=!0)}s&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return c._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:s,maxX:l,maxY:p}=c.aa.fromPoints(t),m={};for(let _=0;_<=c.ab;_++){const x=Math.pow(2,_),w=Math.floor(n*x),T=Math.floor(s*x),I=Math.floor(l*x),M=Math.floor(p*x),k=(w%x+x)%x,B=I%x,G=Math.floor(w/x),Z=Math.floor(I/x);m[_]={minWrap:G,maxWrap:Z,minTileXWrapped:k,maxTileXWrapped:B,minTileY:T,maxTileY:M}}return m}}class Xa extends Qi{constructor(t,n,s,l){super(t,n,s,l),this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield c.ad(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new c.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new c.k(new c.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new c.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const p=this.tiles[l];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,s=!0)}s&&this.fire(new c.l("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 on extends Qi{constructor(t,n,s,l){super(t,n,s,l),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((p=>!Array.isArray(p)||p.length!==2||p.some((m=>typeof m!="number"))))||this.fire(new c.k(new c.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.k(new c.ae(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.k(new c.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.k(new c.ae(`sources.${t}`,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 c.k(new c.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(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 c.k(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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new c.T(n,this.canvas,s.RGBA,{premultiply:!0}),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));let l=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,l=!0)}l&&this.fire(new c.l("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(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ua={},Ya=d=>{switch(d){case"geojson":return kn;case"image":return Qi;case"raster":return zn;case"raster-dem":return sn;case"vector":return la;case"video":return Xa;case"canvas":return on}return ua[d]},Dn="RTLPluginLoaded";class le extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=An()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,(function*(n,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=_t.resolveURL(n),!this.url)throw new Error(`requested url ${n}
5 is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return c._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.l(Dn))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let A=null;function D(){return A||(A=new le),A}var O,K;(function(d){d[d.Base=0]="Base",d[d.Parent=1]="Parent"})(O||(O={})),(function(d){d[d.Departing=0]="Departing",d[d.Incoming=1]="Incoming"})(K||(K={}));class ae{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=c.af(),this.uses=0,this.tileSize=n,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(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:s,fadeEndTime:l}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=s,this.fadeEndTime=l}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=st(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(l,p){const m={};if(!p)return m;for(const _ of l){const x=_.layerIds.map((w=>p.getLayer(w))).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map((w=>x.filter((T=>T.id===w))[0])));for(const w of x)m[w.id]=_}}return m})(t.buckets,n==null?void 0:n.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const p=this.buckets[l];if(p instanceof c.ah){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const p=this.buckets[l];if(p instanceof c.ah&&p.hasRTLText){this.hasRTLText=!0,D().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const p=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(l).queryRadius(
vendor: 8,732 bytes, line 5
5p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new c.ag}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new c.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new c.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,l,p,m,_,x,w,T,I){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:x,params:_,queryPadding:this.queryPadding*w,getElevation:I},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=l[c.ai]||l[p];if(!m)return;const _=c.aj(n==null?void 0:n.filter,n==null?void 0:n.globalState),{z:x,x:w,y:T}=this.tileID.canonical,I={z:x,x:w,y:T};for(let M=0;M<m.length;M++){const k=m.feature(M);if(_.needGeometry){const Z=c.ak(k,!0);if(!_.filter(new c.H(this.tileID.overscaledZ),Z,this.tileID.canonical))continue}else if(!_.filter(new c.H(this.tileID.overscaledZ),k))continue;const B=s.getId(k,p),G=new c.al(k,x,w,T,B);G.tile=I,t.push(G)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=c.am(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(n)if(this.expirationTime<n)l=!0;else{const p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,3e4):l=!0}else l=!0;l?(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(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!n.style.hasLayer(l))continue;const p=this.buckets[l],m=p.layers[0].sourceLayer||c.ai,_=s[m],x=t[m];if(!_||!x||Object.keys(x).length===0)continue;p.update(x,_,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const w=n&&n.style&&n.style.getLayer(l);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(p)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<st()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=st()+t}setDependencies(t,n){const s={};for(const l of n)s[l]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const l=this.dependencies[s];if(l){for(const p of n)if(l[p])return!0}}return!1}}class ce{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,s){const l=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][l]=this.stateChanges[t][l]||{},c.e(this.stateChanges[t][l],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==l&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][l]===null){this.deletedStates[t][l]={};for(const p in this.state[t][l])s[p]||(this.deletedStates[t][l][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][l]&&this.deletedStates[t][l][p]===null&&delete this.deletedStates[t][l][p]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const l=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][l]!==null&&(this.deletedStates[t][l]=this.deletedStates[t][l]||{},this.deletedStates[t][l][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][l])for(s in this.deletedStates[t][l]={},this.stateChanges[t][l])this.deletedStates[t][l][s]=null;else this.deletedStates[t][l]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),l=c.e({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete l[m]}return l}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const p={};for(const m in this.stateChanges[l])this.state[l][m]||(this.state[l][m]={}),c.e(this.state[l][m],this.stateChanges[l][m]),p[m]=this.state[l][m];s[l]=p}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const p={};if(this.deletedStates[l]===null)for(const m in this.state[l])p[m]={},this.state[l][m]={};else for(const m in this.deletedStates[l]){if(this.deletedStates[l][m]===null)this.state[l][m]={};else for(const _ of Object.keys(this.deletedStates[l][m]))delete this.state[l][m][_];p[m]=this.state[l][m]}s[l]=s[l]||{},c.e(s[l],p)}this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0&&(this.revision++,t.setFeatureState(s,n))}}const fe=89.25;function se(d,t){const n=c.an(t.lat,-c.ao,c.ao);return new c.P(c.Y(t.lng)*d,c.X(n)*d)}function ue(d,t){return new c.a9(t.x/d,t.y/d).toLngLat()}function Pe(d){return d.cameraToCenterDistance*Math.min(.85*Math.tan(c.ap(90-d.pitch)),Math.tan(c.ap(fe-d.pitch)))}function ve(d,t){const n=d.canonical,s=t/c.aq(n.z),l=n.x+Math.pow(2,n.z)*d.wrap,p=c.ar(new Float64Array(16));return c.O(p,p,[l*s,n.y*s,0]),c.Q(p,p,[s/c.a5,s/c.a5,1]),p}function ie(d,t,n,s,l){const p=c.a9.fromLngLat(d,t),m=l*c.as(1,d.lat),{x:_,y:x,z:w}=Ge(n,s);return new c.a9(p.x+m*-_,p.y+m*-x,p.z+m*-w)}function Ge(d,t){const n=c.ap(d),s=c.ap(t),l=Math.cos(-n),p=Math.sin(n);return{x:p*Math.sin(s),y:-p*Math.cos(s),z:l}}function it(d,t,n){const s=t.intersectsFrustum(d);if(!n||s===0)return s;const l=t.intersectsPlane(n);return l===0?0:s===2&&l===2?2:1}function Xe(d,t,n){let s=0;const l=(n-t)/10;for(let p=0;p<10;p++)s+=l*Math.pow(Math.cos(t+(p+.5)/10*(n-t)),d);return s}function Ye(d,t){return function(n,s,l,p,m){const _=2*((d-1)/c.at(Math.cos(c.ap(fe-m))/Math.cos(c.ap(fe)))-1),x=Math.acos(l/p),w=2*Xe(_-1,0,c.ap(m/2)),T=Math.min(c.ap(fe),x+c.ap(m/2)),I=Xe(_-1,Math.min(T,x-c.ap(m/2)),T),M=Math.atan(s/l),k=Math.hypot(s,l);let B=n;return B+=c.at(p/k/Math.max(.5,Math.cos(c.ap(m/2)))),B+=_*c.at(Math.cos(M))/2,B-=c.at(Math.max(1,I/w/t))/2,B}}const Qe=Ye(9.314,3);function et(d,t){const n=(t.roundZoom?Math.round:Math.floor)(d.zoom+c.at(d.tileSize/t.tileSize));return Math.max(0,n)}function yt(d,t){const n=d.getCameraFrustum(),s=d.getClippingPlane(),l=d.screenPointToMercatorCoordinate(d.getCameraPoint()),p=c.a9.fromLngLat(d.center,d.elevation);l.z=p.z+Math.cos(d.pitchInRadians)*d.cameraToCenterDistance/d.worldSize;const m=d.getCoveringTilesDetailsProvider(),_=m.allowVariableZoom(d,t),x=et(d,t),w=t.minzoom||0,T=t.maxzoom!==void 0?t.maxzoom:d.maxZoom,I=Math.min(Math.max(0,x),T),M=Math.pow(2,I),k=[M*l.x,M*l.y,0],B=[M*p.x,M*p.y,0],G=Math.hypot(p.x-l.x,p.y-l.y),Z=Math.abs(p.z-l.z),q=Math.hypot(G,Z),Y=ee=>({zoom:0,x:0,y:0,wrap:ee,fullyVisible:!1}),te=[],H=[];if(d.renderWorldCopies&&m.allowWorldCopies())for(let ee=1;ee<=3;ee++)te.push(Y(-ee)),te.push(Y(ee));for(te.push(Y(0));te.length>0;){const ee=te.pop(),re=ee.x,J=ee.y;let oe=ee.fullyVisible;const _e={x:re,y:J,z:ee.zoom},de=m.getTileBoundingVolume(_e,ee.wrap,d.elevation,t);if(!oe){const ke=it(n,de,s);if(ke===0)continue;oe=ke===2}const me=m.distanceToTile2d(l.x,l.y,_e,de);let ge=x;_&&(ge=(t.calculateTileZoom||Qe)(d.zoom+c.at(d.tileSize/t.tileSize),me,Z,q,d.fov)),ge=(t.roundZoom?Math.round:Math.floor)(ge),ge=Math.max(0,ge);const Ae=Math.min(ge,T);if(ee.wrap=m.getWrap(p,_e,ee.wrap),ee.zoom>=Ae){if(ee.zoom<w)continue;
5const ke=I-ee.zoom,Me=k[0]-.5-(re<<ke),Le=k[1]-.5-(J<<ke),tt=t.reparseOverscaled?Math.max(ee.zoom,ge):ee.zoom;H.push({tileID:new c.a2(ee.zoom===T?tt:ee.zoom,ee.wrap,ee.zoom,re,J),distanceSq:c.au([B[0]-.5-re,B[1]-.5-J]),tileDistanceToCamera:Math.sqrt(Me*Me+Le*Le)})}else for(let ke=0;ke<4;ke++)te.push({zoom:ee.zoom+1,x:(re<<1)+ke%2,y:(J<<1)+(ke>>1),wrap:ee.wrap,fullyVisible:oe})}return H.sort(((ee,re)=>ee.distanceSq-re.distanceSq)).map((ee=>ee.tileID))}const Kt=c.aa.fromPoints([new c.P(0,0),new c.P(c.a5,c.a5)]);function qt(d){return d==="raster"||d==="image"||d==="video"}function Pi(d,t,n,s,l,p,m){if(!t.hasData())return!1;const{tileID:_,fadingRole:x,fadingDirection:w,fadingParentID:T}=t;if(x===O.Base&&w===K.Incoming&&T)return n[T.key]=T,!0;const I=Math.max(_.overscaledZ-l,p);for(let M=_.overscaledZ-1;M>=I;M--){const k=_.scaledTo(M),B=d.getLoadedTile(k);if(B)return t.setCrossFadeLogic({fadingRole:O.Base,fadingDirection:K.Incoming,fadingParentID:B.tileID,fadeEndTime:s+m}),B.setCrossFadeLogic({fadingRole:O.Parent,fadingDirection:K.Departing,fadeEndTime:s+m}),n[k.key]=k,!0}return!1}function $t(d,t,n,s,l,p){if(!t.hasData())return!1;const m=t.tileID.children(l);let _=Ce(d,t,m,n,s,l,p);if(_)return!0;for(const x of m)Ce(d,t,x.children(l),n,s,l,p)&&(_=!0);return _}function Ce(d,t,n,s,l,p,m){if(n[0].overscaledZ>=p)return!1;let _=!1;for(const x of n){const w=d.getLoadedTile(x);if(!w)continue;const{fadingRole:T,fadingDirection:I,fadingParentID:M}=w;T===O.Base&&I===K.Departing&&M||(w.setCrossFadeLogic({fadingRole:O.Base,fadingDirection:K.Departing,fadingParentID:t.tileID,fadeEndTime:l+m}),t.setCrossFadeLogic({fadingRole:O.Parent,fadingDirection:K.Incoming,fadeEndTime:l+m})),s[x.key]=x,_=!0}return _}function ft(d,t,n,s){const l=d.tileID;return!!d.selfFading||!d.hasData()&&!!t.has(l)&&(d.setSelfFadeLogic(n+s),!0)}function kt(d,t){var n;d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let s=t.tileID.canonical.x-d.tileID.canonical.x;const l=t.tileID.canonical.y-d.tileID.canonical.y,p=Math.pow(2,d.tileID.canonical.z),m=t.tileID.key;s===0&&l===0||Math.abs(l)>1||(Math.abs(s)>1&&(Math.abs(s+p)===1?s+=p:Math.abs(s-p)===1&&(s-=p)),t.dem&&d.dem&&(d.dem.backfillBorder(t.dem,s,l),!((n=d.neighboringTiles)===null||n===void 0)&&n[m]&&(d.neighboringTiles[m].backfilled=!0)))}class Rn{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const s in this._tiles){const l=this._tiles[s];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+t),n[l.tileID.key]=l}this._tiles=n}setFeatureState(t,n){for(const s in this._tiles)this._tiles[s].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(c.aw).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n!=null&&n.hasData()?n:null}isIdRenderable(t,n=!1){var s;return(s=this.getTileById(t))===null||s===void 0?void 0:s.isRenderable(n)}getRenderableIds(t=0,n){const s=[];for(const l of this.getAllIds())this.isIdRenderable(l,n)&&s.push(this.getTileById(l));return n?s.sort(((l,p)=>{const m=l.tileID,_=p.tileID,x=new c.P(m.canonical.x,m.canonical.y)._rotate(-t),w=new c.P(_.canonical.x,_.canonical.y)._rotate(-t);return m.overscaledZ-_.overscaledZ||w.y-x.y||w.x-x.x})).map((l=>l.tileID.key)):s.map((l=>l.tileID)).sort(c.aw).map((l=>l.key))}}class Di extends c.E{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",(l=>this._dataHandler(l))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((l,p,m,_)=>{const x=new(Ya(p.type))(l,p,m,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(t,n,s,this),this._inViewTiles=new Rn,this._outOfViewCache=new c.ax(0,(l=>this._unloadTile(l))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ce,this._didEmitContent=!1,this._updated=!1}
5onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const n of this._inViewTiles.getAllTiles())n.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Rn}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n,s){return c._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,s)}catch(l){t.state="errored",l.status!==404?this._source.fire(new c.k(l,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new c.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const s=this.getLoadedTile(t.scaledTo(n));if(s)return this._inViewTiles.isIdRenderable(s.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const s of this._inViewTiles.getAllIds()){const l=this._inViewTiles.getTileById(s);n&&!this._source.shouldReloadTile(l,n)||(t?this._reloadTile(s,"expired"):l.state!=="errored"&&this._reloadTile(s,"reloading"))}}}_reloadTile(t,n){return c._(this,void 0,void 0,(function*(){const s=this._inViewTiles.getTileById(t);s&&(s.state!=="loading"&&(s.state=n),yield this._loadTile(s,t,n))}))}_tileLoaded(t,n,s){t.timeAdded=st(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&(function(l,p){var m,_;const x=p.getRenderableIds();for(const w of x){if(!l.neighboringTiles||!l.neighboringTiles[w])continue;const T=p.getTileById(w);l.neighboringTiles[w].backfilled||kt(l,T),!((_=(m=T.neighboringTiles)===null||m===void 0?void 0:m[l.tileID.key])===null||_===void 0)&&_.backfilled||kt(T,l)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.l("data",{dataType:"source",tile:t,coord:t.tileID}))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const s=this._getLoadedDescendents(n),l=new Set;for(const p of n){const m=s[p.key];if(!(m!=null&&m.length)){l.add(p);continue}const _=p.overscaledZ+Di.maxOverzooming,x=m.filter((I=>I.tileID.overscaledZ<=_));if(!x.length){l.add(p);continue}const w=Math.min(...x.map((I=>I.tileID.overscaledZ))),T=x.filter((I=>I.tileID.overscaledZ===w)).map((I=>I.tileID));for(const I of T)t[I.key]=I;this._areDescendentsComplete(T,w,p.overscaledZ)||l.add(p)}return l}_getLoadedDescendents(t){var n;const s={};for(const l of this._inViewTiles.getAllTiles().filter((p=>p.hasData())))for(const p of t)l.tileID.isChildOf(p)&&(s[n=p.key]||(s[n]=[])).push(l);return s}_areDescendentsComplete(t,n,s){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-s)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,l=Math.floor(n*s*(this._maxTileC
5acheZoomLevels===null?c.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._outOfViewCache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let s;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((x=>new c.a2(x.canonical.z,x.wrap,x.canonical.z,x.canonical.x,x.canonical.y))):(s=yt(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter((x=>this._source.hasTile(x))))):s=[],this.usedForTerrain&&(s=this._addTerrainIdealTiles(s));const l=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,l&&this.fire(new c.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const p=et(t,this._source),m=this._updateRetainedTiles(s,p),_=qt(this._source.type);_&&this._rasterFadeDuration>0&&!n&&(function(x,w,T,I,M,k,B){const G=st(),Z=c.av(w);for(const q of w){const Y=x.getTileById(q.key);Y.fadingDirection!==K.Departing&&Y.fadeOpacity!==0||Y.resetFadeLogic(),Pi(x,Y,T,G,I,M,B)||$t(x,Y,T,G,k,B)||ft(Y,Z,G,B)||Y.resetFadeLogic()}})(this._inViewTiles,s,m,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),_?this._cleanUpRasterTiles(m):this._cleanUpVectorTiles(m)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const s=this._inViewTiles.getTileById(n);t[n]?s.clearSymbolFadeHold():s.hasSymbolBuckets?s.holdingForSymbolFade()?s.symbolFadeFinished()&&this._removeTile(n):s.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const s of t)if(s.canonical.z>this._source.minzoom){const l=s.scaledTo(s.canonical.z-1);n.push(l);const p=s.scaledTo(Math.max(this._source.minzoom,Math.min(s.canonical.z,5)));n.push(p)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var s;const l=new Set;for(const w of t)this._addTile(w).hasData()||l.add(w);const p=t.reduce(((w,T)=>(w[T.key]=T,w)),{}),m=this._retainLoadedChildren(p,l),_={},x=Math.max(n-Di.maxUnderzooming,this._source.minzoom);for(const w of m){let T=this._inViewTiles.getTileById(w.key),I=T==null?void 0:T.wasRequested();for(let M=w.overscaledZ-1;M>=x;--M){const k=w.scaledTo(M);if(_[k.key])break;if(_[k.key]=!0,T=this.getTile(k),!T&&I&&(T=this._addTile(k)),T){const B=T.hasData();if((B||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||I)&&(p[k.key]=k),I=T.wasRequested(),B)break}}}return p}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const s=n;return n||(n=new ae(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),s||this._source.fire(new c.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),s))}_clearTileReloadTimer(t){const n=this._timers[t];
5n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const s=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||s.state=="errored")&&t.some((l=>l.equals(s.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,s){const l=[],p=this.transform;if(!p)return l;const m=p.getCoveringTilesDetailsProvider().allowWorldCopies(),_=s?p.getCameraQueryGeometry(t):t,x=k=>p.screenPointToMercatorCoordinate(k,this.terrain),w=this.transformBbox(t,x,!m),T=this.transformBbox(_,x,!m),I=this.getIds(),M=c.aa.fromPoints(T);for(let k=0;k<I.length;k++){const B=this._inViewTiles.getTileById(I[k]);if(B.holdingForSymbolFade())continue;const G=m?[B.tileID]:[B.tileID.unwrapTo(-1),B.tileID.unwrapTo(0)],Z=Math.pow(2,p.zoom-B.tileID.overscaledZ),q=n*B.queryPadding*c.a5/B.tileSize/Z;for(const Y of G){const te=M.map((H=>Y.getTilePoint(new c.a9(H.x,H.y))));if(te.expandBy(q),te.intersects(Kt)){const H=w.map((re=>Y.getTilePoint(re))),ee=T.map((re=>Y.getTilePoint(re)));l.push({tile:B,tileID:m?Y:Y.unwrapTo(0),queryGeometry:H,cameraQueryGeometry:ee,scale:Z})}}}return l}transformBbox(t,n,s){let l=t.map(n);if(s){const p=c.aa.fromPoints(t);p.shrinkBy(.001*Math.min(p.width(),p.height()));const m=p.map(n);c.aa.fromPoints(l).covers(m)||(l=l.map((_=>_.x>.5?new c.a9(_.x-1,_.y,_.z):_)))}return l}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((s=>this._inViewTiles.getTileById(s).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||!(!qt(this._source.type)||!(function(t,n){if(n<=0)return!1;const s=st();for(const l of t.getAllTiles())if(l.fadeEndTime>=s)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,s){this._state.updateState(t=t||c.ai,n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||c.ai,n,s)}getFeatureState(t,n){return this._state.getState(t=t||c.ai,n)}setDependencies(t,n,s){const l=this._inViewTiles.getTileById(t);l&&l.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(s).hasDependency(t,n)&&this._reloadTile(s,"reloading");this._outOfViewCache.filter((s=>!s.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Di.maxUnderzooming=10,Di.maxOverzooming=3;class Re{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.an(t,0,1);let n=1,s=this._distances[n];const l=t*this.paddedLength+this.padding;for(;s<l&&n<this._distances.length;)s=this._distances[++n];const p=n-1,m=this._distances[p],_=s-m,x=_>0?(l-m)/_:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}function Je(d,t){let n=!0;return d==="always"||d!=="never"&&t!=="never"||(n=!1),n}class rt{constructor(t,n,s){const l=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let m=0;m<this.xCellCount*this.yCellCount;m++)l.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}
vendor: 42,390 bytes, lines 5-32
5insert(t,n,s,l,p){this._forEachCell(n,s,l,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(p)}insertCircle(t,n,s,l){this._forEachCell(n-l,s-l,n+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(l)}_insertBoxCell(t,n,s,l,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,s,l,p,m){this.circleCells[p].push(m)}_query(t,n,s,l,p,m,_){if(s<0||t>this.width||l<0||n>this.height)return[];const x=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=l){if(p)return[{key:null,x1:t,y1:n,x2:s,y2:l}];for(let w=0;w<this.boxKeys.length;w++)x.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const T=this.circles[3*w],I=this.circles[3*w+1],M=this.circles[3*w+2];x.push({key:this.circleKeys[w],x1:T-M,y1:I-M,x2:T+M,y2:I+M})}}else this._forEachCell(t,n,s,l,this._queryCell,x,{hitTest:p,overlapMode:m,seenUids:{box:{},circle:{}}},_);return x}query(t,n,s,l){return this._query(t,n,s,l,!1,null)}hitTest(t,n,s,l,p,m){return this._query(t,n,s,l,!0,p,m).length>0}hitTestCircle(t,n,s,l,p){const m=t-s,_=t+s,x=n-s,w=n+s;if(_<0||m>this.width||w<0||x>this.height)return!1;const T=[];return this._forEachCell(m,x,_,w,this._queryCellCircle,T,{hitTest:!0,overlapMode:l,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,s,l,p,m,_,x){const{seenUids:w,hitTest:T,overlapMode:I}=_,M=this.boxCells[p];if(M!==null){const B=this.bboxes;for(const G of M)if(!w.box[G]){w.box[G]=!0;const Z=4*G,q=this.boxKeys[G];if(t<=B[Z+2]&&n<=B[Z+3]&&s>=B[Z+0]&&l>=B[Z+1]&&(!x||x(q))&&(!T||!Je(I,q.overlapMode))&&(m.push({key:q,x1:B[Z],y1:B[Z+1],x2:B[Z+2],y2:B[Z+3]}),T))return!0}}const k=this.circleCells[p];if(k!==null){const B=this.circles;for(const G of k)if(!w.circle[G]){w.circle[G]=!0;const Z=3*G,q=this.circleKeys[G];if(this._circleAndRectCollide(B[Z],B[Z+1],B[Z+2],t,n,s,l)&&(!x||x(q))&&(!T||!Je(I,q.overlapMode))){const Y=B[Z],te=B[Z+1],H=B[Z+2];if(m.push({key:q,x1:Y-H,y1:te-H,x2:Y+H,y2:te+H}),T)return!0}}}return!1}_queryCellCircle(t,n,s,l,p,m,_,x){const{circle:w,seenUids:T,overlapMode:I}=_,M=this.boxCells[p];if(M!==null){const B=this.bboxes;for(const G of M)if(!T.box[G]){T.box[G]=!0;const Z=4*G,q=this.boxKeys[G];if(this._circleAndRectCollide(w.x,w.y,w.radius,B[Z+0],B[Z+1],B[Z+2],B[Z+3])&&(!x||x(q))&&!Je(I,q.overlapMode))return m.push(!0),!0}}const k=this.circleCells[p];if(k!==null){const B=this.circles;for(const G of k)if(!T.circle[G]){T.circle[G]=!0;const Z=3*G,q=this.circleKeys[G];if(this._circlesCollide(B[Z],B[Z+1],B[Z+2],w.x,w.y,w.radius)&&(!x||x(q))&&!Je(I,q.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,s,l,p,m,_,x){const w=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),M=this._convertToYCellCoord(l);for(let k=w;k<=I;k++)for(let B=T;B<=M;B++)if(p.call(this,t,n,s,l,this.xCellCount*B+k,m,_,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,s,l,p,m){const _=l-t,x=p-n,w=s+m;return w*w>_*_+x*x}_circleAndRectCollide(t,n,s,l,p,m,_){const x=(m-l)/2,w=Math.abs(t-(l+x));if(w>x+s)return!1;const T=(_-p)/2,I=Math.abs(n-(p+T));if(I>T+s)return!1;if(w<=x||I<=T)return!0;const M=w-x,k=I-T;return M*M+k*k<=s*s}}function er(d,t,n){const s=c.N();if(!d){const{vecSouth:I,vecEast:M}=Ur(t),k=Ne();k[0]=M[0],k[1]=M[1],k[2]=I[0],k[3]=I[1],l=k,(T=(m=(p=k)[0])*(w=p[3])-(x=p[2])*(_=p[1]))&&(l[0]=w*(T=1/T),l[1]=-_*T,l[2]=-x*T,l[3]=m*T),s[0]=k[0],s[1]=k[1],s[4]=k[2],s[5]=k[3]}var l,p,m,_,x,w,T;return c.Q(s,s,[1/n,1/n,1]),s}function Hs(d,t,n,s){if(d){const l=c.N();if(!t){const{vecSouth:p,vecEast:m}=Ur(n);l[0]=m[0],l[1]=m[1],l[4]=p[0],l[5]=p[1]}return c.Q(l,l,[s,s,1]),l}return n.pixelsToClipSpaceMatrix}function Ur(d){const t=Math.cos(d.rollInRadians),n=Math.sin(d.rollInRadians),s=Math.cos(d.pitchInRadians),l=Math.cos(d.bearingInRadians),p=Math.sin(d.bearingInRadians),m=c.aC();m[0]=-l*s*n-p*t,m[1]=-p*s*n+l*t;const _=c.aD(m);_<1e-9?c.aE(m):c.aF(m,m,1/_);const x=c.aC();x[0]=l*s*t-p*n,x[1]=p*s*t+l*n;const w=c.aD(x);return w<1e-9?c.aE(x):c.aF(x,x,1/w),{vecEast:x,vecSouth:m}}function ot(d,t,n,s){let l;s?(l=[d,t,s(d,t),1],c.aH(l,l,n)):(l=[d,t,0,1],Ks(l,l,n));const p=l[3];return{point:new c.P(l[0]/p,l[1]/p),signedDistanceFromCamera:p,isOccluded:!1}}function Ka(d,t){return .5+d/t*.5}function Ja(d,t){return d.x>=-t[0]&&d.x<=t[0]&&d.y>=-t[1]&&d.y<=t[1]}function Xs(d,t,n,s,l,p,m,_,x,w,T,I,M){const k=n?d.textSizeData:d.iconSizeData,B=c.ay(k,t.transform.zoom),G=[256/t.width*2+1,256/t.height*2+1],Z=n?d.text.dynamicLayoutVertexArray:d.icon.dynamicLayoutVertexArray;Z.clear();const q=d.lineVertexArray,Y=n?d.text.placedSymbolArray:d.icon.placedSymbolArray,te=t.transform.width/t.transform.height;let H=!1;for(let ee=0;ee<Y.length;ee++){const re=Y.get(ee);if(re.hidden||re.writingMode===c.az.vertical&&!H){Fn(re.numGlyphs,Z);continue}H=!1;const J=new c.P(re.anchorX,re.anchorY),oe={getElevation:M,pitchedLabelPlaneMatrix:s,lineVertexArray:q,pitchWithMap:p,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:J,unwrappedTileID:x,width:w,height:T,translation:I},_e=pa(re.anchorX,re.anchorY,oe);if(!Ja(_e.point,G)){Fn(re.numGlyphs,Z);continue}const de=Ka(t.transform.cameraToCenterDistance,_e.signedDistanceFromCamera),me=c.aA(k,B,re),ge=p?me*t.transform.getPitchedTextCorrection(re.anchorX,re.anchorY,x)/de:me*de,Ae=da({projectionContext:oe,pitchedLabelPlaneMatrixInverse:l,symbol:re,fontSize:ge,flip:!1,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:Z,aspectRatio:te,rotateToLine:_});H=Ae.useVertical,(Ae.notEnoughRoom||H||Ae.needsFlipping&&da({projectionContext:oe,pitchedLabelPlaneMatrixInverse:l,symbol:re,fontSize:ge,flip:!0,keepUpright:m,glyphOffsetArray:d.glyphOffsetArray,dynamicLayoutVertexArray:Z,aspectRatio:te,rotateToLine:_}).notEnoughRoom)&&Fn(re.numGlyphs,Z)}n?d.text.dynamicLayoutVertexBuffer.updateData(Z):d.icon.dynamicLayoutVertexBuffer.updateData(Z)}function ha(d,t,n,s,l,p,m,_){const x=p.glyphStartIndex+p.numGlyphs,w=p.lineStartIndex,T=p.lineStartIndex+p.lineLength,I=t.getoffsetX(p.glyphStartIndex),M=t.getoffsetX(x-1),k=yr(d*I,n,s,l,p.segment,w,T,_,m);if(!k)return null;const B=yr(d*M,n,s,l,p.segment,w,T,_,m);return B?_.projectionCache.anyProjectionOccluded?null:{first:k,last:B}:null}function Qa(d,t,n,s){return d===c.az.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(d===c.az.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function da(d){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:s,fontSize:l,flip:p,keepUpright:m,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:w,rotateToLine:T}=d,I=l/24,M=s.lineOffsetX*I,k=s.lineOffsetY*I;let B;if(s.numGlyphs>1){const G=s.glyphStartIndex+s.numGlyphs,Z=s.lineStartIndex,q=s.lineStartIndex+s.lineLength,Y=ha(I,_,M,k,p,s,T,t);if(!Y)return{notEnoughRoom:!0};const te=Ys(Y.first.point.x,Y.first.point.y,t,n),H=Ys(Y.last.point.x,Y.last.point.y,t,n);if(m&&!p){const ee=Qa(s.writingMode,te,H,w);if(ee)return ee}B=[Y.first];for(let ee=s.glyphStartIndex+1;ee<G-1;ee++){const re=yr(I*_.getoffsetX(ee),M,k,p,s.segment,Z,q,t,T);if(!re)return{notEnoughRoom:!0};B.push(re)}B.push(Y.last)}else{if(m&&!p){const Z=bt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,q=s.lineStartIndex+s.segment+1,Y=new c.P(t.lineVertexArray.getx(q),t.lineVertexArray.gety(q)),te=bt(Y.x,Y.y,t),H=te.signedDistanceFromCamera>0?te.point:es(t.tileAnchorPoint,Y,Z,1,t),ee=Ys(Z.x,Z.y,t,n),re=Ys(H.x,H.y,t,n),J=Qa(s.writingMode,ee,re,w);if(J)return J}const G=yr(I*_.getoffsetX(s.glyphStartIndex),M,k,p,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,t,T);if(!G||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};B=[G]}for(const G of B)c.aG(x,G.point,G.angle);return{}}function es(d,t,n,s,l){const p=d.add(d.sub(t)._unit()),m=bt(p.x,p.y,l).point,_=n.sub(m);return n.add(_._mult(s/_.mag()))}function Ri(d,t,n){const s=t.projectionCache;if(s.projections[d])return s.projections[d];const l=new c.P(t.lineVertexArray.getx(d),t.lineVertexArray.gety(d)),p=bt(l.x,l.y,t);if(p.signedDistanceFromCamera>0)return s.projections[d]=p.point,s.anyProjectionOccluded=s.anyProjectionOccluded||p.isOccluded,p.point;const m=d-n.direction;return es(n.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(m),t.lineVertexArray.gety(m)),l,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function bt(d,t,n){const s=d+n.translation[0],l=t+n.translation[1];let p;return n.pitchWithMap?(p=ot(s,l,n.pitchedLabelPlaneMatrix,n.getElevation),p.isOccluded=!1):(p=n.transform.projectTileCoordinates(s,l,n.unwrappedTileID,n.getElevation),p.point.x=(.5*p.point.x+.5)*n.width,p.point.y=(.5*-p.point.y+.5)*n.height),p}function Ys(d,t,n,s){if(n.pitchWithMap){const l=[d,t,0,1];return c.aH(l,l,s),n.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],n.unwrappedTileID,n.getElevation).point}return{x:d/n.width*2-1,y:1-t/n.height*2}}function pa(d,t,n){return n.transform.projectTileCoordinates(d,t,n.unwrappedTileID,n.getElevation)}function ts(d,t,n){return d._unit()._perp()._mult(t*n)}function Ln(d,t,n,s,l,p,m,_,x){if(_.projectionCache.offsets[d])return _.projectionCache.offsets[d];const w=n.add(t);if(d+x.direction<s||d+x.direction>=l)return _.projectionCache.offsets[d]=w,w;const T=Ri(d+x.direction,_,x),I=ts(T.sub(n),m,x.direction),M=n.add(I),k=T.add(I);return _.projectionCache.offsets[d]=c.aI(p,w,M,k)||w,_.projectionCache.offsets[d]}function yr(d,t,n,s,l,p,m,_,x){const w=s?d-t:d+t;let T=w>0?1:-1,I=0;s&&(T*=-1,I=Math.PI),T<0&&(I+=Math.PI);let M,k=T>0?p+l:p+l+1;_.projectionCache.cachedAnchorPoint?M=_.projectionCache.cachedAnchorPoint:(M=bt(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=M);let B,G,Z=M,q=M,Y=0,te=0;const H=Math.abs(w),ee=[];let re;for(;Y+te<=H;){if(k+=T,k<p||k>=m)return null;Y+=te,q=Z,G=B;const _e={absOffsetX:H,direction:T,distanceFromAnchor:Y,previousVertex:q};if(Z=Ri(k,_,_e),n===0)ee.push(q),re=Z.sub(q);else{let de;const me=Z.sub(q);de=me.mag()===0?ts(Ri(k+T,_,_e).sub(Z),n,T):ts(me,n,T),G||(G=q.add(de)),B=Ln(k,de,Z,p,m,G,n,_,_e),ee.push(G),re=B.sub(G)}te=re.mag()}const J=re._mult((H-Y)/te)._add(G||q),oe=I+Math.atan2(Z.y-q.y,Z.x-q.x);return ee.push(J),{point:J,angle:x?oe:0,path:ee}}const xc=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Fn(d,t){for(let n=0;n<d;n++){const s=t.length;t.resize(s+4),t.float32.set(xc,3*s)}}function Ks(d,t,n){const s=t[0],l=t[1];return d[0]=n[0]*s+n[4]*l+n[12],d[1]=n[1]*s+n[5]*l+n[13],d[3]=n[3]*s+n[7]*l+n[15],d}const Zt=100;class vc{constructor(t,n=new rt(t.width+200,t.height+200,25),s=new rt(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Zt,this.screenBottomBoundary=t.height+Zt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,l,p,m,_,x,w,T,I,M){const k=this.projectAndGetPerspectiveRatio(t.anchorPointX+x[0],t.anchorPointY+x[1],p,T,M),B=s*k.perspectiveRatio;let G;if(m||_)G=this._projectCollisionBox(t,B,l,p,m,_,x,k,T,I,M);else{const re=k.x+(I?I.x*B:0),J=k.y+(I?I.y*B:0);G={allPointsOccluded:!1,box:[re+t.x1*B,J+t.y1*B,re+t.x2*B,J+t.y2*B]}}const[Z,q,Y,te]=G.box,H=m?G.allPointsOccluded:k.isOccluded;let ee=H;return ee||(ee=k.perspectiveRatio<this.perspectiveRatioCutoff),ee||(ee=!this.isInsideGrid(Z,q,Y,te)),ee||n!=="always"&&this.grid.hitTest(Z,q,Y,te,n,w)?{box:[Z,q,Y,te],placeable:!1,offscreen:!1,occluded:H}:{box:[Z,q,Y,te],placeable:!0,offscreen:this.isOffscreen(Z,q,Y,te),occluded:H}}placeCollisionCircles(t,n,s,l,p,m,_,x,w,T,I,M,k,B){const G=[],Z=new c.P(n.anchorX,n.anchorY),q=this.getPerspectiveRatio(Z.x,Z.y,m,B),Y=(w?p*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,m)/q:p*q)/c.aM,te={getElevation:B,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:w,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:Z,unwrappedTileID:m,width:this.transform.width,height:this.transform.height,translation:k},H=ha(Y,l,n.lineOffsetX*Y,n.lineOffsetY*Y,!1,n,!1,te);let ee=!1,re=!1,J=!0;if(H){const oe=.5*I*q+M,_e=new c.P(-100,-100),de=new c.P(this.screenRightBoundary,this.screenBottomBoundary),me=new Re,ge=H.first,Ae=H.last;let ke=[];for(let tt=ge.path.length-1;tt>=1;tt--)ke.push(ge.path[tt]);for(let tt=1;tt<Ae.path.length;tt++)ke.push(Ae.path[tt]);const Me=2.5*oe;if(w){const tt=this.projectPathToScreenSpace(ke,te);ke=tt.some((xt=>xt.signedDistanceFromCamera<=0))?[]:tt.map((xt=>xt.point))}let Le=[];if(ke.length>0){const tt=ke[0].clone(),xt=ke[0].clone();for(let Dt=1;Dt<ke.length;Dt++)tt.x=Math.min(tt.x,ke[Dt].x),tt.y=Math.min(tt.y,ke[Dt].y),xt.x=Math.max(xt.x,ke[Dt].x),xt.y=Math.max(xt.y,ke[Dt].y);Le=tt.x>=_e.x&&xt.x<=de.x&&tt.y>=_e.y&&xt.y<=de.y?[ke]:xt.x<_e.x||tt.x>de.x||xt.y<_e.y||tt.y>de.y?[]:c.aJ([ke],_e.x,_e.y,de.x,de.y)}for(const tt of Le){me.reset(tt,.25*oe);let xt=0;xt=me.length<=.5*oe?1:Math.ceil(me.paddedLength/Me)+1;for(let Dt=0;Dt<xt;Dt++){const It=Dt/Math.max(xt-1,1),Ot=me.lerp(It),Et=Ot.x+Zt,Ht=Ot.y+Zt;G.push(Et,Ht,oe,0);const jt=Et-oe,pi=Ht-oe,ai=Et+oe,ti=Ht+oe;if(J=J&&this.isOffscreen(jt,pi,ai,ti),re=re||this.isInsideGrid(jt,pi,ai,ti),t!=="always"&&this.grid.hitTestCircle(Et,Ht,oe,t,T)&&(ee=!0,!x))return{circles:[],offscreen:!1,collisionDetected:ee}}}}return{circles:!x&&ee||!re||q<this.perspectiveRatioCutoff?[]:G,offscreen:J,collisionDetected:ee}}projectPathToScreenSpace(t,n){const s=(function(l,p){const m=c.N();return c.aB(m,p.pitchedLabelPlaneMatrix),l.map((_=>{const x=ot(_.x,_.y,m,p.getElevation),w=p.transform.projectTileCoordinates(x.point.x,x.point.y,p.unwrappedTileID,p.getElevation);return w.point.x=(.5*w.point.x+.5)*p.width,w.point.y=(.5*-w.point.y+.5)*p.height,w}))})(t,n);return(function(l){let p=0,m=0,_=0,x=0;for(let w=0;w<l.length;w++)l[w].isOccluded?(_=w+1,x=0):(x++,x>m&&(m=x,p=_));return l.slice(p,p+m)})(s)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],s=new c.aa;for(const I of t){const M=new c.P(I.x+Zt,I.y+Zt);s.extend(M),n.push(M)}const{minX:l,minY:p,maxX:m,maxY:_}=s,x=this.grid.query(l,p,m,_).concat(this.ignoredGrid.query(l,p,m,_)),w={},T={};for(const I of x){const M=I.key;if(w[M.bucketInstanceId]===void 0&&(w[M.bucketInstanceId]={}),w[M.bucketInstanceId][M.featureIndex])continue;const k=[new c.P(I.x1,I.y1),new c.P(I.x2,I.y1),new c.P(I.x2,I.y2),new c.P(I.x1,I.y2)];c.aK(n,k)&&(w[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,n,s,l,p,m){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:p,collisionGroupID:m,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,l,p,m){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:p,collisionGroupID:m,overlapMode:n};for(let w=0;w<t.length;w+=4)_.insertCircle(x,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,n,s,l,p){if(p){let m;l?(m=[t,n,l(t,n),1],c.aH(m,m,p)):(m=[t,n,0,1],Ks(m,m,p));const _=m[3];return{x:(m[0]/_+1)/2*this.transform.width+Zt,y:(-m[1]/_+1)/2*this.transform.height+Zt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const m=this.transform.projectTileCoordinates(t,n,s,l);return{x:(m.point.x+1)/2*this.transform.width+Zt,y:(1-m.point.y)/2*this.transform.height+Zt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5,isOccluded:m.isOccluded,signedDistanceFromCamera:m.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,s,l){const p=this.transform.projectTileCoordinates(t,n,s,l);return .5+this.transform.cameraToCenterDistance/p.signedDistanceFromCamera*.5}isOffscreen(t,n,s,l){return s<Zt||t>=this.screenRightBoundary||l<Zt||n>this.screenBottomBoundary}isInsideGrid(t,n,s,l){return s>=0&&t<this.gridRightBoundary&&l>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.ar([]);return c.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,s,l,p,m,_,x,w,T,I){let M=1,k=0,B=0,G=1;const Z=t.anchorPointX+_[0],q=t.anchorPointY+_[1];if(m&&!p){const ke=this.projectAndGetPerspectiveRatio(Z+1,q,l,w,I),Me=ke.x-x.x,Le=Math.atan((ke.y-x.y)/Me)+(Me<0?Math.PI:0),tt=Math.sin(Le),xt=Math.cos(Le);M=xt,k=tt,B=-tt,G=xt}else if(!m&&p){const ke=Ur(this.transform);M=ke.vecEast[0],k=ke.vecEast[1],B=ke.vecSouth[0],G=ke.vecSouth[1]}let Y=x.x,te=x.y,H=n;p&&(Y=Z,te=q,H=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),H*=this.transform.getPitchedTextCorrection(Z,q,l),T||(H*=c.an(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),T&&(Y+=M*T.x*H+B*T.y*H,te+=k*T.x*H+G*T.y*H);const ee=t.x1*H,re=t.x2*H,J=(ee+re)/2,oe=t.y1*H,_e=t.y2*H,de=(oe+_e)/2,me=[{offsetX:ee,offsetY:oe},{offsetX:J,offsetY:oe},{offsetX:re,offsetY:oe},{offsetX:re,offsetY:de},{offsetX:re,offsetY:_e},{offsetX:J,offsetY:_e},{offsetX:ee,offsetY:_e},{offsetX:ee,offsetY:de}];let ge=[];for(const{offsetX:ke,offsetY:Me}of me)ge.push(new c.P(Y+M*ke+B*Me,te+k*ke+G*Me));let Ae=!1;if(p){const ke=ge.map((Me=>this.projectAndGetPerspectiveRatio(Me.x,Me.y,l,w,I)));Ae=ke.some((Me=>!Me.isOccluded)),ge=ke.map((Me=>new c.P(Me.x,Me.y)))}else Ae=!0;return{box:c.aL(ge),allPointsOccluded:!Ae}}}class bc{constructor(t,n,s,l){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class is{constructor(t,n,s,l,p){this.text=new bc(t?t.text:null,n,s,p),this.icon=new bc(t?t.icon:null,n,l,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class wc{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class Tc{constructor(t,n,s,l,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=p}}class Sc{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function Js(d,t,n,s,l){const{horizontalAlign:p,verticalAlign:m}=c.aS(d);return new c.P(-(p-.5)*t+s[0]*l,-(m-.5)*n+s[1]*l)}class il{constructor(t,n,s,l,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new vc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Sc(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(s,l)=>n.getElevation(t,s,l):null}getBucketParts(t,n,s,l){const p=s.getBucket(n),m=s.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,x=p.layers[0].layout,w=p.layers[0].paint,T=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),I=s.tileSize/c.a5,M=s.tileID.toUnwrapped(),k=x.get("text-rotation-alignment")==="map",B=c.aN(s,1,this.transform.zoom),G=c.aO(this.collisionIndex.transform,s,w.get("text-translate"),w.get("text-translate-anchor")),Z=c.aO(this.collisionIndex.transform,s,w.get("icon-translate"),w.get("icon-translate-anchor")),q=er(k,this.transform,B);this.retainedQueryData[p.bucketInstanceId]=new Tc(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,s.tileID);const Y={bucket:p,layout:x,translationText:G,translationIcon:Z,unwrappedTileID:M,pitchedLabelPlaneMatrix:q,scale:T,textPixelRatio:I,holdingForFade:s.holdingForSymbolFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.ay(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(l)for(const te of p.sortKeyRanges){const{sortKey:H,symbolInstanceStart:ee,symbolInstanceEnd:re}=te;t.push({sortKey:H,symbolInstanceStart:ee,symbolInstanceEnd:re,parameters:Y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(t,n,s,l,p,m,_,x,w,T,I,M,k,B,G,Z,q,Y,te,H){const ee=c.aP[t.textAnchor],re=[t.textOffset0,t.textOffset1],J=Js(ee,s,l,re,p),oe=this.collisionIndex.placeCollisionBox(n,M,x,w,T,_,m,Z,I.predicate,te,J,H);if((!Y||this.collisionIndex.placeCollisionBox(Y,M,x,w,T,_,m,q,I.predicate,te,J,H).placeable)&&oe.placeable){let _e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID].text&&(_e=this.prevPlacement.variableOffsets[k.crossTileID].anchor),k.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[k.crossTileID]={textOffset:re,width:s,height:l,anchor:ee,textBoxScale:p,prevAnchor:_e},this.markUsedJustification(B,ee,k,G),B.allowVerticalPlacement&&(this.markUsedOrientation(B,G,k),this.placedOrientations[k.crossTileID]=G),{shift:J,placedGlyphBoxes:oe}}}placeLayerBucketPart(t,n,s){const{bucket:l,layout:p,translationText:m,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:w,textPixelRatio:T,holdingForFade:I,collisionBoxArray:M,partiallyEvaluatedTextSize:k,collisionGroup:B}=t.parameters,G=p.get("text-optional"),Z=p.get("icon-optional"),q=c.aQ(p,"text-overlap","text-allow-overlap"),Y=q==="always",te=c.aQ(p,"icon-overlap","icon-allow-overlap"),H=te==="always",ee=p.get("text-rotation-alignment")==="map",re=p.get("text-pitch-alignment")==="map",J=p.get("icon-text-fit")!=="none",oe=p.get("symbol-z-order")==="viewport-y",_e=Y&&(H||!l.hasIconData()||Z),de=H&&(Y||!l.hasTextData()||G);!l.collisionArrays&&M&&l.deserializeCollisionBoxes(M);const me=this.retainedQueryData[l.bucketInstanceId].tileID,ge=this._getTerrainElevationFunc(me),Ae=this.transform.getFastPathSimpleProjectionMatrix(me),ke=(Me,Le,tt)=>{var xt,Dt;if(n[Me.crossTileID])return;if(I)return void(this.placements[Me.crossTileID]=new wc(!1,!1,!1));let It=!1,Ot=!1,Et=!0,Ht=null,jt={box:null,placeable:!1,offscreen:null,occluded:!1},pi={placeable:!1},ai=null,ti=null,xi=null,_n=0,$r=0,Rr=0;Le.textFeatureIndex?_n=Le.textFeatureIndex:Me.useRuntimeCollisionCircles&&(_n=Me.featureIndex),Le.verticalTextFeatureIndex&&($r=Le.verticalTextFeatureIndex);const Zi=Le.textBox;if(Zi){const dr=zt=>{let Ct=c.az.horizontal;if(l.allowVerticalPlacement&&!zt&&this.prevPlacement){const ui=this.prevPlacement.placedOrientations[Me.crossTileID];ui&&(this.placedOrientations[Me.crossTileID]=ui,Ct=ui,this.markUsedOrientation(l,Ct,Me))}return Ct},Lr=(zt,Ct)=>{if(l.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&Le.verticalTextBox){for(const ui of l.writingModes)if(ui===c.az.vertical?(jt=Ct(),pi=jt):jt=zt(),jt&&jt.placeable)break}else jt=zt()},Sr=Me.textAnchorOffsetStartIndex,Pr=Me.textAnchorOffsetEndIndex;if(Pr===Sr){const zt=(Ct,ui)=>{const hi=this.collisionIndex.placeCollisionBox(Ct,q,T,me,x,re,ee,m,B.predicate,ge,void 0,Ae);return hi&&hi.placeable&&(this.markUsedOrientation(l,ui,Me),this.placedOrientations[Me.crossTileID]=ui),hi};Lr((()=>zt(Zi,c.az.horizontal)),(()=>{const Ct=Le.verticalTextBox;return l.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&Ct?zt(Ct,c.az.vertical):{box:null,offscreen:null}})),dr(jt&&jt.placeable)}else{let zt=c.aP[(Dt=(xt=this.prevPlacement)===null||xt===void 0?void 0:xt.variableOffsets[Me.crossTileID])===null||Dt===void 0?void 0:Dt.anchor];const Ct=(hi,xu,vu)=>{const ea=hi.x2-hi.x1,Mh=hi.y2-hi.y1,bu=Me.textBoxScale,Yl=J&&te==="never"?xu:null;let yn=null,xn=q==="never"?1:2,vn="never";zt&&xn++;for(let Kl=0;Kl<xn;Kl++){for(let Jl=Sr;Jl<Pr;Jl++){const Fo=l.textAnchorOffsets.get(Jl);if(zt&&Fo.textAnchor!==zt)continue;const Bo=this.attemptAnchorPlacement(Fo,hi,ea,Mh,bu,ee,re,T,me,x,B,vn,Me,l,vu,m,_,Yl,ge);if(Bo&&(yn=Bo.placedGlyphBoxes,yn&&yn.placeable))return It=!0,Ht=Bo.shift,yn}zt?zt=null:vn=q}return s&&!yn&&(yn={box:this.collisionIndex.placeCollisionBox(Zi,"always",T,me,x,re,ee,m,B.predicate,ge,void 0,Ae).box,offscreen:!1,placeable:!1,occluded:!1}),yn};Lr((()=>Ct(Zi,Le.iconBox,c.az.horizontal)),(()=>{const hi=Le.verticalTextBox;return l.allowVerticalPlacement&&(!jt||!jt.placeable)&&Me.numVerticalGlyphVertices>0&&hi?Ct(hi,Le.verticalIconBox,c.az.vertical):{box:null,occluded:!0,offscreen:null}})),jt&&(It=jt.placeable,Et=jt.offscreen);const ui=dr(jt&&jt.placeable);if(!It&&this.prevPlacement){const hi=this.prevPlacement.variableOffsets[Me.crossTileID];hi&&(this.variableOffsets[Me.crossTileID]=hi,this.markUsedJustification(l,hi.anchor,Me,ui))}}}if(ai=jt,It=ai&&ai.placeable,Et=ai&&ai.offscreen,Me.useRuntimeCollisionCircles&&Me.centerJustifiedTextSymbolIndex>=0){const dr=l.text.placedSymbolArray.get(Me.centerJustifiedTextSymbolIndex),Lr=c.aA(l.textSizeData,k,dr),Sr=p.get("text-padding");ti=this.collisionIndex.placeCollisionCircles(q,dr,l.lineVertexArray,l.glyphOffsetArray,Lr,x,w,s,re,B.predicate,Me.collisionCircleDiameter,Sr,m,ge),ti.circles.length&&ti.collisionDetected&&!s&&c.w("Collisions detected, but collision boxes are not shown"),It=Y||ti.circles.length>0&&!ti.collisionDetected,Et=Et&&ti.offscreen}if(Le.iconFeatureIndex&&(Rr=Le.iconFeatureIndex),Le.iconBox){const dr=Lr=>this.collisionIndex.placeCollisionBox(Lr,te,T,me,x,re,ee,_,B.predicate,ge,J&&Ht?Ht:void 0,Ae);pi&&pi.placeable&&Le.verticalIconBox?(xi=dr(Le.verticalIconBox),Ot=xi.placeable):(xi=dr(Le.iconBox),Ot=xi.placeable),Et=Et&&xi.offscreen}const Jn=G||Me.numHorizontalGlyphVertices===0&&Me.numVerticalGlyphVertices===0,Fs=Z||Me.numIconVertices===0;Jn||Fs?Fs?Jn||(Ot=Ot&&It):It=Ot&&It:Ot=It=Ot&&It;const Qn=Ot&&xi.placeable;if(It&&ai.placeable&&this.collisionIndex.insertCollisionBox(ai.box,q,p.get("text-ignore-placement"),l.bucketInstanceId,pi&&pi.placeable&&$r?$r:_n,B.ID),Qn&&this.collisionIndex.insertCollisionBox(xi.box,te,p.get("icon-ignore-placement"),l.bucketInstanceId,Rr,B.ID),ti&&It&&this.collisionIndex.insertCollisionCircles(ti.circles,q,p.get("text-ignore-placement"),l.bucketInstanceId,_n,B.ID),s&&this.storeCollisionData(l.bucketInstanceId,tt,Le,ai,xi,ti),Me.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Me.crossTileID]=new wc((It||_e)&&!(ai!=null&&ai.occluded),(Ot||de)&&!(xi!=null&&xi.occluded),Et||l.justReloaded),n[Me.crossTileID]=!0};if(oe){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Me=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Le=Me.length-1;Le>=0;--Le){const tt=Me[Le];ke(l.symbolInstances.get(tt),l.collisionArrays[tt],tt)}}else for(let Me=t.symbolInstanceStart;Me<t.symbolInstanceEnd;Me++)ke(l.symbolInstances.get(Me),l.collisionArrays[Me],Me);l.justReloaded=!1}storeCollisionData(t,n,s,l,p,m){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(t)?_=this.collisionBoxArrays.get(t):(_=new Map,this.collisionBoxArrays.set(t,_)),_.has(n)?x=_.get(n):(x={text:null,icon:null},_.set(n,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=p.box)}if(m){let _=this.collisionCircleArrays[t];_===void 0&&(_=this.collisionCircleArrays[t]=[]);for(let x=0;x<m.circles.length;x+=4)_.push(m.circles[x+0]-Zt),_.push(m.circles[x+1]-Zt),_.push(m.circles[x+2]),_.push(m.collisionDetected?1:0)}}markUsedJustification(t,n,s,l){let p;p=l===c.az.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[c.aR(n)];const m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of m)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const l=n===c.az.horizontal||n===c.az.horizontalOnly?n:0,p=n===c.az.vertical?n:0,m=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of m)t.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const l=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const x in this.placements){const w=this.placements[x],T=p[x];T?(this.opacities[x]=new is(T,l,w.text,w.icon),s=s||w.text!==T.text.placed||w.icon!==T.icon.placed):(this.opacities[x]=new is(null,l,w.text,w.icon,w.skipFade),s=s||w.text||w.icon)}for(const x in p){const w=p[x];if(!this.opacities[x]){const T=new is(w,l,!1,!1);T.isHidden()||(this.opacities[x]=T,s=s||w.text.placed||w.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const l of n){const p=l.getBucket(t);p&&l.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(t,n,s,l){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const p=t.layers[0],m=p.layout,_=new is(null,0,!1,!1,!0),x=m.get("text-allow-overlap"),w=m.get("icon-allow-overlap"),T=p._unevaluatedLayout.hasValue("text-variable-anchor")||p._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=m.get("text-rotation-alignment")==="map",M=m.get("text-pitch-alignment")==="map",k=m.get("icon-text-fit")!=="none",B=new is(null,0,x&&(w||!t.hasIconData()||m.get("icon-optional")),w&&(x||!t.hasTextData()||m.get("text-optional")),!0);!t.collisionArrays&&l&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(l);const G=(q,Y,te)=>{for(let H=0;H<Y/4;H++)q.opacityVertexArray.emplaceBack(te);q.hasVisibleVertices=q.hasVisibleVertices||te!==ns},Z=this.collisionBoxArrays.get(t.bucketInstanceId);for(let q=0;q<t.symbolInstances.length;q++){const Y=t.symbolInstances.get(q),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:H,crossTileID:ee}=Y;let re=this.opacities[ee];s[ee]?re=_:re||(re=B,this.opacities[ee]=re),s[ee]=!0;const J=Y.numIconVertices>0,oe=this.placedOrientations[Y.crossTileID],_e=oe===c.az.vertical,de=oe===c.az.horizontal||oe===c.az.horizontalOnly;if(te>0||H>0){const ge=sl(re.text);G(t.text,te,_e?ns:ge),G(t.text,H,de?ns:ge);const Ae=re.text.isHidden();[Y.rightJustifiedTextSymbolIndex,Y.centerJustifiedTextSymbolIndex,Y.leftJustifiedTextSymbolIndex].forEach((Le=>{Le>=0&&(t.text.placedSymbolArray.get(Le).hidden=Ae||_e?1:0)})),Y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(Y.verticalPlacedTextSymbolIndex).hidden=Ae||de?1:0);const ke=this.variableOffsets[Y.crossTileID];ke&&this.markUsedJustification(t,ke.anchor,Y,oe);const Me=this.placedOrientations[Y.crossTileID];Me&&(this.markUsedJustification(t,"left",Y,Me),this.markUsedOrientation(t,Me,Y))}if(J){const ge=sl(re.icon),Ae=!(k&&Y.verticalPlacedIconSymbolIndex&&_e);Y.placedIconSymbolIndex>=0&&(G(t.icon,Y.numIconVertices,Ae?ge:ns),t.icon.placedSymbolArray.get(Y.placedIconSymbolIndex).hidden=re.icon.isHidden()),Y.verticalPlacedIconSymbolIndex>=0&&(G(t.icon,Y.numVerticalIconVertices,Ae?ns:ge),t.icon.placedSymbolArray.get(Y.verticalPlacedIconSymbolIndex).hidden=re.icon.isHidden())}const me=Z&&Z.has(q)?Z.get(q):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ge=t.collisionArrays[q];if(ge){let Ae=new c.P(0,0);if(ge.textBox||ge.verticalTextBox){let ke=!0;if(T){const Me=this.variableOffsets[ee];Me?(Ae=Js(Me.anchor,Me.width,Me.height,Me.textOffset,Me.textBoxScale),I&&Ae._rotate(M?-this.transform.bearingInRadians:this.transform.bearingInRadians)):ke=!1}if(ge.textBox||ge.verticalTextBox){let Me;ge.textBox&&(Me=_e),ge.verticalTextBox&&(Me=de),rl(t.textCollisionBox.collisionVertexArray,re.text.placed,!ke||Me,me.text,Ae.x,Ae.y)}}if(ge.iconBox||ge.verticalIconBox){const ke=!!(!de&&ge.verticalIconBox);let Me;ge.iconBox&&(Me=ke),ge.verticalIconBox&&(Me=!ke),rl(t.iconCollisionBox.collisionVertexArray,re.icon.placed,Me,me.icon,k?Ae.x:0,k?Ae.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function rl(d,t,n,s,l,p){s&&s.length!==0||(s=[0,0,0,0]);const m=s[0]-Zt,_=s[1]-Zt,x=s[2]-Zt,w=s[3]-Zt;d.emplaceBack(t?1:0,n?1:0,l||0,p||0,m,_),d.emplaceBack(t?1:0,n?1:0,l||0,p||0,x,_),d.emplaceBack(t?1:0,n?1:0,l||0,p||0,x,w),d.emplaceBack(t?1:0,n?1:0,l||0,p||0,m,w)}const nl=Math.pow(2,25),al=Math.pow(2,24),th=Math.pow(2,17),rs=Math.pow(2,16),Qs=Math.pow(2,9),Pc=Math.pow(2,8),fa=Math.pow(2,1);function sl(d){if(d.opacity===0&&!d.placed)return 0;if(d.opacity===1&&d.placed)return 4294967295;const t=d.placed?1:0,n=Math.floor(127*d.opacity);return n*nl+t*al+n*th+t*rs+n*Qs+t*Pc+n*fa+t}const ns=0;class ln{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,l,p){const m=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(m,l,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,m.sort(((_,x)=>_.sortKey-x.sortKey)));this._currentPartIndex<m.length;)if(n.placeLayerBucketPart(m[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,p())return!0;return!1}}class ma{constructor(t,n,s,l,p,m,_,x){this.placement=new il(t,n,m,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const l=st(),p=()=>!this._forceFullPlacement&&st()-l>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=_)&&(!m.maxzoom||m.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new ln(m)),this._inProgressLayer.continuePlacement(s[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ut=512/c.a5/2;class ol{constructor(t,n,s){this.tileID=t,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let p=0;p<n.length;p++){const m=n.get(p),_=m.key,x=l.get(_);x?x.push(m):l.set(_,[m])}for(const[p,m]of l){const _={positions:m.map((x=>({x:Math.floor(x.anchorX*ut),y:Math.floor(x.anchorY*ut)}))),crossTileIDs:m.map((x=>x.crossTileID))};if(_.positions.length>128){const x=new c.aT(_.positions.length,16,Uint16Array);for(const{x:w,y:T}of _.positions)x.add(w,T);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[p]=_}}getScaledCoordinates(t,n){const{x:s,y:l,z:p}=this.tileID.canonical,{x:m,y:_,z:x}=n.canonical,w=ut/Math.pow(2,x-p),T=(_*c.a5+t.anchorY)*w,I=l*c.a5*ut;return{x:Math.floor((m*c.a5+t.anchorX)*w-s*c.a5*ut),y:Math.floor(T-I)}}findMatches(t,n,s){const l=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let p=0;p<t.length;p++){const m=t.get(p);if(m.crossTileID)continue;const _=this._symbolsByKey[m.key];if(!_)continue;const x=this.getScaledCoordinates(m,n);if(_.index){const w=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const T of w){const I=_.crossTileIDs[T];if(!s[I]){s[I]=!0,m.crossTileID=I;break}}}else if(_.positions)for(let w=0;w<_.positions.length;w++){const T=_.positions[w],I=_.crossTileIDs[w];if(Math.abs(T.x-x.x)<=l&&Math.abs(T.y-x.y)<=l&&!s[I]){s[I]=!0,m.crossTileID=I;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class ih{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ll{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const l=this.indexes[s],p={};for(const m in l){const _=l[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const l=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const _ in m){const x=m[_];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,l)}else{const _=m[t.scaledTo(Number(p)).key];_&&_.findMatches(n.symbolInstances,t,l)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=s.generate(),l[m.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new ol(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s of n.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[t][l]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const l=this.indexes[s];for(const p in l)t[l[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[p]),delete l[p],n=!0)}return n}}class qi{constructor(){this.layerIndexes={},this.crossTileIDs=new ih,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let l=this.layerIndexes[t.id];l===void 0&&(l=this.layerIndexes[t.id]=new ll);let p=!1;const m={};l.handleWrapJump(s);for(const _ of n){const x=_.getBucket(t);x&&t.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(p=!0),m[x.bucketInstanceId]=!0)}return l.removeStaleBuckets(m)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach((s=>{n[s]=!0}));for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var Mi="void main() {fragColor=vec4(1.0);}";const Nt={prelude:Ke(`#ifdef GL_ES
6precision mediump float;
7#else
8#if !defined(lowp)
9#define lowp
10#endif
11#if !defined(mediump)
12#define mediump
13#endif
14#if !defined(highp)
15#define highp
16#endif
17#endif
18out highp vec4 fragColor;`,`#ifdef GL_ES
19precision highp float;
20#else
21#if !defined(lowp)
22#define lowp
23#endif
24#if !defined(mediump)
25#define mediump
26#endif
27#if !defined(highp)
28#define highp
29#endif
30#endif
31vec2 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
32);}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);
32return (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
33);}
34#ifdef TERRAIN3D
35uniform 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;
36#endif
37const 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) {
38#ifdef TERRAIN3D
39highp 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));
40#else
41return 1.0;
42#endif
43}float calculate_visibility(vec4 pos) {
44#ifdef TERRAIN3D
45vec3 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;
46#else
47return 1.0;
48#endif
49}float ele(vec2 pos) {
50#ifdef TERRAIN3D
51vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
52#else
53return 0.0;
54#endif
55}float get_elevation(vec2 pos) {
56#ifdef TERRAIN3D
57#ifdef GLOBE
58if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
59#endif
60vec2 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;
61#else
62return 0.0;
63#endif
64}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Ke("","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:Ke("",`#define GLOBE_RADIUS 6371008.8
65uniform 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
66);}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); 
67if (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
68);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:Ke(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
69#ifdef OVERDRAW_INSPECTOR
70fragColor=vec4(1.0);
71#endif
72}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Ke(`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;
72uniform 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;
73#ifdef OVERDRAW_INSPECTOR
74fragColor=vec4(1.0);
75#endif
76}`,"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:Ke(`in vec3 v_data;in float v_visibility;
77#pragma mapbox: define highp vec4 color
78#pragma mapbox: define mediump float radius
79#pragma mapbox: define lowp float blur
80#pragma mapbox: define lowp float opacity
81#pragma mapbox: define highp vec4 stroke_color
82#pragma mapbox: define mediump float stroke_width
83#pragma mapbox: define lowp float stroke_opacity
84void main() {
85#pragma mapbox: initialize highp vec4 color
86#pragma mapbox: initialize mediump float radius
87#pragma mapbox: initialize lowp float blur
88#pragma mapbox: initialize lowp float opacity
89#pragma mapbox: initialize highp vec4 stroke_color
90#pragma mapbox: initialize mediump float stroke_width
91#pragma mapbox: initialize lowp float stroke_opacity
92vec2 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;}
93#ifdef OVERDRAW_INSPECTOR
94fragColor=vec4(1.0);
95#endif
96}`,`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;
97#pragma mapbox: define highp vec4 color
98#pragma mapbox: define mediump float radius
99#pragma mapbox: define lowp float blur
100#pragma mapbox: define lowp float opacity
101#pragma mapbox: define highp vec4 stroke_color
102#pragma mapbox: define mediump float stroke_width
103#pragma mapbox: define lowp float stroke_opacity
104void main(void) {
105#pragma mapbox: initialize highp vec4 color
106#pragma mapbox: initialize mediump float radius
107#pragma mapbox: initialize lowp float blur
108#pragma mapbox: initialize lowp float opacity
109#pragma mapbox: initialize highp vec4 stroke_color
110#pragma mapbox: initialize mediump float stroke_width
111#pragma mapbox: initialize lowp float stroke_opacity
112vec2 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) {
113#ifdef GLOBE
114vec3 center_vector=projectToSphere(circle_center);
115#endif
116float 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 {
117#ifdef GLOBE
118vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
119#else
120vec4 projected_center=projectTileWithElevation(circle_center,ele);
121#endif
122corner_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);}
123#ifdef GLOBE
124vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
125#else
126gl_Position=projectTileWithElevation(corner_position,ele);
127#endif
128} 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:Ke(Mi,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Ke(`uniform highp float u_intensity;in vec2 v_extrude;
129#pragma mapbox: define highp float weight
130#define GAUSS_COEF 0.3989422804014327
131void main() {
132#pragma mapbox: initialize highp float weight
133float 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);
134#ifdef OVERDRAW_INSPECTOR
135fragColor=vec4(1.0);
136#endif
137}`,`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;
138#pragma mapbox: define highp float weight
139#pragma mapbox: define mediump float radius
140const highp float ZERO=1.0/255.0/16.0;
141#define GAUSS_COEF 0.3989422804014327
142void main(void) {
143#pragma mapbox: initialize highp float weight
144#pragma mapbox: initialize mediump float radius
145vec2 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);
146#ifdef GLOBE
147vec2 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);
148#else
149gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
150#endif
151}`),heatmapTexture:Ke(`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;
152#ifdef OVERDRAW_INSPECTOR
153fragColor=vec4(0.0);
154#endif
155}`,"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:Ke("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:Ke("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:Ke(`#ifdef GL_ES
156precision highp float;
157#endif
158uniform 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
159{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));
160#ifdef OVERDRAW_INSPECTOR
161fragColor=vec4(1.0);
162#endif
163}`,"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:Ke("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:Ke(Mi,`in vec2 a_pos;void main() {
164#ifdef GLOBE
165gl_Position=projectTileFor3D(a_pos,0.0);
166#else
167gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
168#endif
169}`),fill:Ke(`#pragma mapbox: define highp vec4 color
170#pragma mapbox: define lowp float opacity
171void main() {
172#pragma mapbox: initialize highp vec4 color
173#pragma mapbox: initialize lowp float opacity
174fragColor=color*opacity;
175#ifdef OVERDRAW_INSPECTOR
176fragColor=vec4(1.0);
177#endif
178}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
179#pragma mapbox: define highp vec4 color
180#pragma mapbox: define lowp float opacity
181void main() {
182#pragma mapbox: initialize highp vec4 color
183#pragma mapbox: initialize lowp float opacity
184gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Ke(`in vec2 v_pos;
185#ifdef GLOBE
186in float v_depth;
187#endif
188#pragma mapbox: define highp vec4 outline_color
189#pragma mapbox: define lowp float opacity
190void main() {
191#pragma mapbox: initialize highp vec4 outline_color
192#pragma mapbox: initialize lowp float opacity
193float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
194#ifdef GLOBE
195if (v_depth > 1.0) {discard;}
196#endif
197#ifdef OVERDRAW_INSPECTOR
198fragColor=vec4(1.0);
199#endif
200}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
201#ifdef GLOBE
202out float v_depth;
203#endif
204#pragma mapbox: define highp vec4 outline_color
205#pragma mapbox: define lowp float opacity
206void main() {
207#pragma mapbox: initialize highp vec4 outline_color
208#pragma mapbox: initialize lowp float opacity
209gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
210#ifdef GLOBE
211v_depth=gl_Position.z/gl_Position.w;
212#endif
213}`),fillOutlinePattern:Ke(`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;
214#ifdef GLOBE
215in float v_depth;
216#endif
217#pragma mapbox: define lowp float opacity
218#pragma mapbox: define lowp vec4 pattern_from
219#pragma mapbox: define lowp vec4 pattern_to
220void main() {
221#pragma mapbox: initialize lowp float opacity
222#pragma mapbox: initialize mediump vec4 pattern_from
223#pragma mapbox: initialize mediump vec4 pattern_to
224vec2 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;
225#ifdef GLOBE
226if (v_depth > 1.0) {discard;}
227#endif
228#ifdef OVERDRAW_INSPECTOR
229fragColor=vec4(1.0);
230#endif
231}`,`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;
232#ifdef GLOBE
233out float v_depth;
234#endif
235#pragma mapbox: define lowp float opacity
236#pragma mapbox: define lowp vec4 pattern_from
237#pragma mapbox: define lowp vec4 pattern_to
238#pragma mapbox: define lowp float pixel_ratio_from
239#pragma mapbox: define lowp float pixel_ratio_to
240void main() {
241#pragma mapbox: initialize lowp float opacity
242#pragma mapbox: initialize mediump vec4 pattern_from
243#pragma mapbox: initialize mediump vec4 pattern_to
244#pragma mapbox: initialize lowp float pixel_ratio_from
245#pragma mapbox: initialize lowp float pixel_ratio_to
246vec2 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;
247#ifdef GLOBE
248v_depth=gl_Position.z/gl_Position.w;
249#endif
250}`),fillPattern:Ke(`#ifdef GL_ES
251precision highp float;
252#endif
253uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
254#pragma mapbox: define lowp float opacity
255#pragma mapbox: define lowp vec4 pattern_from
256#pragma mapbox: define lowp vec4 pattern_to
257void main() {
258#pragma mapbox: initialize lowp float opacity
259#pragma mapbox: initialize mediump vec4 pattern_from
260#pragma mapbox: initialize mediump vec4 pattern_to
261vec2 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;
262#ifdef OVERDRAW_INSPECTOR
263fragColor=vec4(1.0);
264#endif
265}`,`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;
266#pragma mapbox: define lowp float opacity
267#pragma mapbox: define lowp vec4 pattern_from
268#pragma mapbox: define lowp vec4 pattern_to
269#pragma mapbox: define lowp float pixel_ratio_from
270#pragma mapbox: define lowp float pixel_ratio_to
271void main() {
272#pragma mapbox: initialize lowp float opacity
273#pragma mapbox: initialize mediump vec4 pattern_from
274#pragma mapbox: initialize mediump vec4 pattern_to
275#pragma mapbox: initialize lowp float pixel_ratio_from
276#pragma mapbox: initialize lowp float pixel_ratio_to
277vec2 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_siz
277e_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:Ke(`in vec4 v_color;void main() {fragColor=v_color;
278#ifdef OVERDRAW_INSPECTOR
279fragColor=vec4(1.0);
280#endif
281}`,`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;
282#ifdef TERRAIN3D
283in vec2 a_centroid;
284#endif
285out vec4 v_color;
286#pragma mapbox: define highp float base
287#pragma mapbox: define highp float height
288#pragma mapbox: define highp vec4 color
289void main() {
290#pragma mapbox: initialize highp float base
291#pragma mapbox: initialize highp float height
292#pragma mapbox: initialize highp vec4 color
293vec3 normal=a_normal_ed.xyz;
294#ifdef TERRAIN3D
295float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
296#else
297float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
298#endif
299base=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;
300#ifdef GLOBE
301vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
302#else
303gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
304#endif
305float 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);
306#ifdef GLOBE
307mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
308#endif
309directional=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:Ke(`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;
310#pragma mapbox: define lowp float base
311#pragma mapbox: define lowp float height
312#pragma mapbox: define lowp vec4 pattern_from
313#pragma mapbox: define lowp vec4 pattern_to
314#pragma mapbox: define lowp float pixel_ratio_from
315#pragma mapbox: define lowp float pixel_ratio_to
316void main() {
317#pragma mapbox: initialize lowp float base
318#pragma mapbox: initialize lowp float height
319#pragma mapbox: initialize mediump vec4 pattern_from
320#pragma mapbox: initialize mediump vec4 pattern_to
321#pragma mapbox: initialize lowp float pixel_ratio_from
322#pragma mapbox: initialize lowp float pixel_ratio_to
323vec2 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;
324#ifdef OVERDRAW_INSPECTOR
325fragColor=vec4(1.0);
326#endif
327}`,`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;
328#ifdef TERRAIN3D
329in vec2 a_centroid;
330#endif
331#ifdef GLOBE
332out vec3 v_sphere_pos;
333#endif
334out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
335#pragma mapbox: define lowp float base
336#pragma mapbox: define lowp float height
337#pragma mapbox: define lowp vec4 pattern_from
338#pragma mapbox: define lowp vec4 pattern_to
339#pragma mapbox: define lowp float pixel_ratio_from
340#pragma mapbox: define lowp float pixel_ratio_to
341void main() {
342#pragma mapbox: initialize lowp float base
343#pragma mapbox: initialize lowp float height
344#pragma mapbox: initialize mediump vec4 pattern_from
345#pragma mapbox: initialize mediump vec4 pattern_to
346#pragma mapbox: initialize lowp float pixel_ratio_from
347#pragma mapbox: initialize lowp float pixel_ratio_to
348vec2 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;
349#ifdef TERRAIN3D
350float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
351#else
352float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
353#endif
354base=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;
355#ifdef GLOBE
356vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
357#else
358gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
359#endif
360vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
361? a_pos
362: 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:Ke(`#ifdef GL_ES
363precision highp float;
364#endif
365uniform 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/p
365ow(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);
366#ifdef OVERDRAW_INSPECTOR
367fragColor=vec4(1.0);
368#endif
369}`,"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:Ke(`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];
370#define PI 3.141592653589793
371#define STANDARD 0
372#define COMBINED 1
373#define IGOR 2
374#define MULTIDIRECTIONAL 3
375#define BASIC 4
376float 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
377{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
378{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);}
379#ifdef OVERDRAW_INSPECTOR
380fragColor=vec4(1.0);
381#endif
382}`,"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:Ke(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
383#ifdef GLOBE
384in float v_depth;
385#endif
386#pragma mapbox: define highp vec4 color
387#pragma mapbox: define lowp float blur
388#pragma mapbox: define lowp float opacity
389void main() {
390#pragma mapbox: initialize highp vec4 color
391#pragma mapbox: initialize lowp float blur
392#pragma mapbox: initialize lowp float opacity
393float 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);
394#ifdef GLOBE
395if (v_depth > 1.0) {discard;}
396#endif
397#ifdef OVERDRAW_INSPECTOR
398fragColor=vec4(1.0);
399#endif
400}`,`
401#define scale 0.015873016
402in 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;
403#ifdef GLOBE
404out float v_depth;
405#endif
406#pragma mapbox: define highp vec4 color
407#pragma mapbox: define lowp float blur
408#pragma mapbox: define lowp float opacity
409#pragma mapbox: define mediump float gapwidth
410#pragma mapbox: define lowp float offset
411#pragma mapbox: define mediump float width
412void main() {
413#pragma mapbox: initialize highp vec4 color
414#pragma mapbox: initialize lowp float blur
415#pragma mapbox: initialize lowp float opacity
416#pragma mapbox: initialize mediump float gapwidth
417#pragma mapbox: initialize lowp float offset
418#pragma mapbox: initialize mediump float width
419float 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);
419float 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;
420#ifdef GLOBE
421v_depth=gl_Position.z/gl_Position.w;
422#endif
423#ifdef TERRAIN3D
424v_gamma_scale=1.0;
425#else
426float 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;
427#endif
428v_width2=vec2(outset,inset);}`),lineGradient:Ke(`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;
429#ifdef GLOBE
430in float v_depth;
431#endif
432#pragma mapbox: define lowp float blur
433#pragma mapbox: define lowp float opacity
434void main() {
435#pragma mapbox: initialize lowp float blur
436#pragma mapbox: initialize lowp float opacity
437float 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);
438#ifdef GLOBE
439if (v_depth > 1.0) {discard;}
440#endif
441#ifdef OVERDRAW_INSPECTOR
442fragColor=vec4(1.0);
443#endif
444}`,`
445#define scale 0.015873016
446in 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;
447#ifdef GLOBE
448out float v_depth;
449#endif
450#pragma mapbox: define lowp float blur
451#pragma mapbox: define lowp float opacity
452#pragma mapbox: define mediump float gapwidth
453#pragma mapbox: define lowp float offset
454#pragma mapbox: define mediump float width
455void main() {
456#pragma mapbox: initialize lowp float blur
457#pragma mapbox: initialize lowp float opacity
458#pragma mapbox: initialize mediump float gapwidth
459#pragma mapbox: initialize lowp float offset
460#pragma mapbox: initialize mediump float width
461float 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;
462#ifdef GLOBE
463v_depth=gl_Position.z/gl_Position.w;
464#endif
465#ifdef TERRAIN3D
466v_gamma_scale=1.0;
467#else
468float 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;
469#endif
470v_width2=vec2(outset,inset);}`),linePattern:Ke(`#ifdef GL_ES
471precision highp float;
472#endif
473uniform 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;
474#ifdef GLOBE
475in float v_depth;
476#endif
477#pragma mapbox: define lowp vec4 pattern_from
478#pragma mapbox: define lowp vec4 pattern_to
479#pragma mapbox: define lowp float pixel_ratio_from
480#pragma mapbox: define lowp float pixel_ratio_to
481#pragma mapbox: define lowp float blur
482#pragma mapbox: define lowp float opacity
483void main() {
484#pragma mapbox: initialize mediump vec4 pattern_from
485#pragma mapbox: initialize mediump vec4 pattern_to
486#pragma mapbox: initialize lowp float pixel_ratio_from
487#pragma mapbox: initialize lowp float pixel_ratio_to
488#pragma mapbox: initialize lowp float blur
489#pragma mapbox: initialize lowp float opacity
490vec2 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;
491#ifdef GLOBE
492if (v_depth > 1.0) {discard;}
493#endif
494#ifdef OVERDRAW_INSPECTOR
495fragColor=vec4(1.0);
496#endif
497}`,`
498#define scale 0.015873016
499#define LINE_DISTANCE_SCALE 2.0
500in 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;
501#ifdef GLOBE
502out float v_depth;
503#endif
504#pragma mapbox: define lowp float blur
505#pragma mapbox: define lowp float opacity
506#pragma mapbox: define lowp float offset
507#pragma mapbox: define mediump float gapwidth
508#pragma mapbox: define mediump float width
509#pragma mapbox: define lowp float floorwidth
510#pragma mapbox: define lowp vec4 pattern_from
511#pragma mapbox: define lowp vec4 pattern_to
512#pragma mapbox: define lowp float pixel_ratio_from
513#pragma mapbox: define lowp float pixel_ratio_to
514void main() {
515#pragma mapbox: initialize lowp float blur
516#pragma mapbox: initialize lowp float opacity
517#pragma mapbox: initialize lowp float offset
518#pragma mapbox: initialize mediump float gapwidth
519#pragma mapbox: initialize mediump float width
520#pragma mapbox: initialize lowp float floorwidth
521#pragma mapbox: initialize mediump vec4 pattern_from
522#pragma mapbox: initialize mediump vec4 pattern_to
523#pragma mapbox: initialize lowp float pixel_ratio_from
524#pragma mapbox: initialize lowp float pixel_ratio_to
525float 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);
525float 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;
526#ifdef GLOBE
527v_depth=gl_Position.z/gl_Position.w;
528#endif
529#ifdef TERRAIN3D
530v_gamma_scale=1.0;
531#else
532float 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;
533#endif
534v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ke(`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;
535#ifdef GLOBE
536in float v_depth;
537#endif
538#pragma mapbox: define highp vec4 color
539#pragma mapbox: define lowp float blur
540#pragma mapbox: define lowp float opacity
541#pragma mapbox: define mediump float width
542#pragma mapbox: define lowp float floorwidth
543#pragma mapbox: define mediump vec4 dasharray_from
544#pragma mapbox: define mediump vec4 dasharray_to
545void main() {
546#pragma mapbox: initialize highp vec4 color
547#pragma mapbox: initialize lowp float blur
548#pragma mapbox: initialize lowp float opacity
549#pragma mapbox: initialize mediump float width
550#pragma mapbox: initialize lowp float floorwidth
551#pragma mapbox: initialize mediump vec4 dasharray_from
552#pragma mapbox: initialize mediump vec4 dasharray_to
553float 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);
553float 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);
554#ifdef GLOBE
555if (v_depth > 1.0) {discard;}
556#endif
557#ifdef OVERDRAW_INSPECTOR
558fragColor=vec4(1.0);
559#endif
560}`,`
561#define scale 0.015873016
562#define LINE_DISTANCE_SCALE 2.0
563in 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;
564#ifdef GLOBE
565out float v_depth;
566#endif
567#pragma mapbox: define highp vec4 color
568#pragma mapbox: define lowp float blur
569#pragma mapbox: define lowp float opacity
570#pragma mapbox: define mediump float gapwidth
571#pragma mapbox: define lowp float offset
572#pragma mapbox: define mediump float width
573#pragma mapbox: define lowp float floorwidth
574#pragma mapbox: define mediump vec4 dasharray_from
575#pragma mapbox: define mediump vec4 dasharray_to
576void main() {
577#pragma mapbox: initialize highp vec4 color
578#pragma mapbox: initialize lowp float blur
579#pragma mapbox: initialize lowp float opacity
580#pragma mapbox: initialize mediump float gapwidth
581#pragma mapbox: initialize lowp float offset
582#pragma mapbox: initialize mediump float width
583#pragma mapbox: initialize lowp float floorwidth
584#pragma mapbox: initialize mediump vec4 dasharray_from
585#pragma mapbox: initialize mediump vec4 dasharray_to
586float 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;
587#ifdef GLOBE
588v_depth=gl_Position.z/gl_Position.w;
589#endif
590#ifdef TERRAIN3D
591v_gamma_scale=1.0;
592#else
593float 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;
594#endif
595float 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:Ke(`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;
596#ifdef GLOBE
597in float v_depth;
598#endif
599#pragma mapbox: define lowp float blur
600#pragma mapbox: define lowp float opacity
601#pragma mapbox: define mediump float width
602#pragma mapbox: define lowp float floorwidth
603#pragma mapbox: define mediump vec4 dasharray_from
604#pragma mapbox: define mediump vec4 dasharray_to
605void main() {
606#pragma mapbox: initialize lowp float blur
607#pragma mapbox: initialize lowp float opacity
608#pragma mapbox: initialize mediump float width
609#pragma mapbox: initialize lowp float floorwidth
610#pragma mapbox: initialize mediump vec4 dasharray_from
611#pragma mapbox: initialize mediump vec4 dasharray_to
612float 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);
612float 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);
613#ifdef GLOBE
614if (v_depth > 1.0) {discard;}
615#endif
616#ifdef OVERDRAW_INSPECTOR
617fragColor=vec4(1.0);
618#endif
619}`,`
620#define scale 0.015873016
621#define LINE_DISTANCE_SCALE 2.0
622in 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;
623#ifdef GLOBE
624out float v_depth;
625#endif
626#pragma mapbox: define lowp float blur
627#pragma mapbox: define lowp float opacity
628#pragma mapbox: define mediump float gapwidth
629#pragma mapbox: define lowp float offset
630#pragma mapbox: define mediump float width
631#pragma mapbox: define lowp float floorwidth
632#pragma mapbox: define mediump vec4 dasharray_from
633#pragma mapbox: define mediump vec4 dasharray_to
634void main() {
635#pragma mapbox: initialize lowp float blur
636#pragma mapbox: initialize lowp float opacity
637#pragma mapbox: initialize mediump float gapwidth
638#pragma mapbox: initialize lowp float offset
639#pragma mapbox: initialize mediump float width
640#pragma mapbox: initialize lowp float floorwidth
641#pragma mapbox: initialize mediump vec4 dasharray_from
642#pragma mapbox: initialize mediump vec4 dasharray_to
643float 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;
644#ifdef GLOBE
645v_depth=gl_Position.z/gl_Position.w;
646#endif
647#ifdef TERRAIN3D
648v_gamma_scale=1.0;
649#else
650float 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;
651#endif
652float 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:Ke(`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);
653#ifdef OVERDRAW_INSPECTOR
654fragColor=vec4(1.0);
655#endif
656}`,`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;
657#ifdef GLOBE
658if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
659#endif
660v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Ke(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
661#pragma mapbox: define lowp float opacity
662void main() {
663#pragma mapbox: initialize lowp float opacity
664lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
665#ifdef OVERDRAW_INSPECTOR
666fragColor=vec4(1.0);
667#endif
668}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
669#pragma mapbox: define lowp float opacity
670void main() {
671#pragma mapbox: initialize lowp float opacity
672vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
673camera_to_anchor_distance/u_camera_to_center_distance :
674u_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;
675#ifdef GLOBE
676if(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);}
677#endif
678vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ke(`#define SDF_PX 8.0
679uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
680#pragma mapbox: define highp vec4 fill_color
681#pragma mapbox: define highp vec4 halo_color
682#pragma mapbox: define lowp float opacity
683#pragma mapbox: define lowp float halo_width
684#pragma mapbox: define lowp float halo_blur
685void main() {
686#pragma mapbox: initialize highp vec4 fill_color
687#pragma mapbox: initialize highp vec4 halo_color
688#pragma mapbox: initialize lowp float opacity
689#pragma mapbox: initialize lowp float halo_width
690#pragma mapbox: initialize lowp float halo_blur
691float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
692#ifdef OVERDRAW_INSPECTOR
693fragColor=vec4(1.0);
694#endif
695}`,`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;
696#pragma mapbox: define highp vec4 fill_color
697#pragma mapbox: define highp vec4 halo_color
698#pragma mapbox: define lowp float opacity
699#pragma mapbox: define lowp float halo_width
700#pragma mapbox: define lowp float halo_blur
701void main() {
702#pragma mapbox: initialize highp vec4 fill_color
703#pragma mapbox: initialize highp vec4 halo_color
704#pragma mapbox: initialize lowp float opacity
705#pragma mapbox: initialize lowp float halo_width
706#pragma mapbox: initialize lowp float halo_blur
707vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
708camera_to_anchor_distance/u_camera_to_center_distance :
709u_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;
710#ifdef GLOBE
711if(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);}
712#endif
713vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ke(`#define SDF_PX 8.0
714#define SDF 1.0
715#define ICON 0.0
716uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
717#pragma mapbox: define highp vec4 fill_color
718#pragma mapbox: define highp vec4 halo_color
719#pragma mapbox: define lowp float opacity
720#pragma mapbox: define lowp float halo_width
721#pragma mapbox: define lowp float halo_blur
722void main() {
723#pragma mapbox: initialize highp vec4 fill_color
724#pragma mapbox: initialize highp vec4 halo_color
725#pragma mapbox: initialize lowp float opacity
726#pragma mapbox: initialize lowp float halo_width
727#pragma mapbox: initialize lowp float halo_blur
728float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
728fragColor=texture(u_texture_icon,tex_icon)*alpha;
729#ifdef OVERDRAW_INSPECTOR
730fragColor=vec4(1.0);
731#endif
732return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
733#ifdef OVERDRAW_INSPECTOR
734fragColor=vec4(1.0);
735#endif
736}`,`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;
737#pragma mapbox: define highp vec4 fill_color
738#pragma mapbox: define highp vec4 halo_color
739#pragma mapbox: define lowp float opacity
740#pragma mapbox: define lowp float halo_width
741#pragma mapbox: define lowp float halo_blur
742void main() {
743#pragma mapbox: initialize highp vec4 fill_color
744#pragma mapbox: initialize highp vec4 halo_color
745#pragma mapbox: initialize lowp float opacity
746#pragma mapbox: initialize lowp float halo_width
747#pragma mapbox: initialize lowp float halo_blur
748vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
749camera_to_anchor_distance/u_camera_to_center_distance :
750u_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;
751#ifdef GLOBE
752if(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);}
753#endif
754vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ke("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
754float 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,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Ke("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:Ke("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:Ke("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:Ke(`#ifdef GL_ES
755precision highp float;
756#endif
757in 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
758);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:Ke("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);}")};
vendor: 10,982 bytes, lines 758-807
758function Ke(d,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/in ([\w]+) ([\w]+)/g),l=d.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(l):l,_={};return{fragmentSource:d=d.replace(n,((x,w,T,I,M)=>(_[M]=!0,w==="define"?`
759#ifndef HAS_UNIFORM_u_${M}
760in ${T} ${I} ${M};
761#else
762uniform ${T} ${I} u_${M};
763#endif
764`:`
765#ifdef HAS_UNIFORM_u_${M}
766    ${T} ${I} ${M} = u_${M};
767#endif
768`))),vertexSource:t=t.replace(n,((x,w,T,I,M)=>{const k=I==="float"?"vec2":"vec4",B=M.match(/color/)?"color":k;return _[M]?w==="define"?`
769#ifndef HAS_UNIFORM_u_${M}
770uniform lowp float u_${M}_t;
771in ${T} ${k} a_${M};
772out ${T} ${I} ${M};
773#else
774uniform ${T} ${I} u_${M};
775#endif
776`:B==="vec4"?`
777#ifndef HAS_UNIFORM_u_${M}
778    ${M} = a_${M};
779#else
780    ${T} ${I} ${M} = u_${M};
781#endif
782`:`
783#ifndef HAS_UNIFORM_u_${M}
784    ${M} = unpack_mix_${B}(a_${M}, u_${M}_t);
785#else
786    ${T} ${I} ${M} = u_${M};
787#endif
788`:w==="define"?`
789#ifndef HAS_UNIFORM_u_${M}
790uniform lowp float u_${M}_t;
791in ${T} ${k} a_${M};
792#else
793uniform ${T} ${I} u_${M};
794#endif
795`:B==="vec4"?`
796#ifndef HAS_UNIFORM_u_${M}
797    ${T} ${I} ${M} = a_${M};
798#else
799    ${T} ${I} ${M} = u_${M};
800#endif
801`:`
802#ifndef HAS_UNIFORM_u_${M}
803    ${T} ${I} ${M} = unpack_mix_${B}(a_${M}, u_${M}_t);
804#else
805    ${T} ${I} ${M} = u_${M};
806#endif
807`})),staticAttributes:s,staticUniforms:m}}class Pt{constructor(t,n,s){this.vertexBuffer=t,this.indexBuffer=n,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var cn=c.aU([{name:"a_pos",type:"Int16",components:2}]);const Li="#define PROJECTION_MERCATOR",tr="mercator";class Fi{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return tr}get shaderDefine(){return Li}get shaderPreludeCode(){return Nt.projectionMercator}get vertexShaderPreludeCode(){return Nt.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,s,l,p){if(this._cachedMesh)return this._cachedMesh;const m=new c.aW;m.emplaceBack(0,0),m.emplaceBack(c.a5,0),m.emplaceBack(0,c.a5),m.emplaceBack(c.a5,c.a5);const _=t.createVertexBuffer(m,cn.members),x=c.aX.simpleSegment(0,0,4,2),w=new c.aY;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3);const T=t.createIndexBuffer(w);return this._cachedMesh=new Pt(_,T,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class ga{constructor(t=0,n=0,s=0,l=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=l}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=c.G.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.G.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=c.G.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=c.G.number(t.right,n.right,s)),this}getCenter(t,n){const s=c.an((this.left+t-this.right)/2,0,t),l=c.an((this.top+n-this.bottom)/2,0,n);return new c.P(s,l)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ga(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function un(d,t){if(!d.renderWorldCopies||d.lngRange)return;const n=t.lng-d.center.lng;t.lng+=n>180?-360:n<-180?360:0}function Jt(d){return Math.max(0,Math.floor(d))}class Bn{constructor(t,n){var s;this.applyConstrain=(l,p)=>this._constrainOverride!==null?this._constrainOverride(l,p):this._callbacks.defaultConstrain(l,p),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=(n==null?void 0:n.renderWorldCopies)===void 0||!!(n!=null&&n.renderWorldCopies),this._minZoom=(n==null?void 0:n.minZoom)||0,this._maxZoom=(n==null?void 0:n.maxZoom)||22,this._minPitch=(n==null?void 0:n.minPitch)==null?0:n==null?void 0:n.minPitch,this._maxPitch=(n==null?void 0:n.maxPitch)==null?60:n==null?void 0:n.maxPitch,this._constrainOverride=(s=n==null?void 0:n.constrainOverride)!==null&&s!==void 0?s:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Jt(this._zoom),this._scale=c.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new ga,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,s){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Jt(this._zoom),this._scale=c.aq(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new ga(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!s&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}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(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,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 c.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=c.W(t,-180,180)*Math.PI/180;var s,l,p,m,_,x,w,T,I;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=Ne(),s=this._rotationMatrix,p=-this._bearingInRadians,m=(l=this._rotationMatrix)[0],_=l[1],x=l[2],w=l[3],T=Math.sin(p),I=Math.cos(p),s[0]=m*I+x*T,s[1]=_*I+w*T,s[2]=m*-T+x*I,s[3]=_*-T+w*I)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=c.an(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return c.aZ(this._fovInRadians)}setFov(t){t=c.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=c.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=c.aq(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,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(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this.constrainInternal(),this._calcMatrices()}resize(t,n,s=!0){this._width=t,this._height=n,s&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Ft([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-c.ao,c.ao])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:s,minY:l,maxX:p,maxY:m}=c.aa.fromPoints(n).extend(t);return[new c.P(s,l),new c.P(p,l),new c.P(p,m),new c.P(s,m),new c.P(s,l)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:s}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(s),this._unmodified=t,this._constraining=!1}
807_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=c.ar(new Float64Array(16));c.Q(t,t,[this._width/2,-this._height/2,1]),c.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=c.ar(new Float64Array(16)),c.Q(t,t,[1,-1,1]),c.O(t,t,[-1,-1,0]),c.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,s,l){const p=s!==void 0?s:this.bearing,m=l=l!==void 0?l:this.pitch,{distanceToCenter:_,clampedElevation:x}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,m),{x:w,y:T}=Ge(m,p),I=c.a9.fromLngLat(t,n);let M,k,B=c.a_(1,I.y),G=0;do{if(G+=1,G>10)break;k=_/B,M=new c.a9(I.x+w*k,I.y+T*k),B=1/M.meterInMercatorCoordinateUnits()}while(Math.abs(_-k*B)>1e-12);return{center:M.toLngLat(),elevation:x,zoom:c.at(this.height/2/Math.tan(this.fovInRadians/2)/k/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,s=c.as(1,this.center.lat)*this.worldSize,l=c.a9.fromLngLat(this.center,this.elevation),p=l.x/n,m=l.y/n,_=l.z/n,x=this.pitch,w=this.bearing,{x:T,y:I,z:M}=Ge(x,w),k=this.cameraToCenterDistance,B=p+k*-T,G=m+k*-I,Z=_+k*M,{distanceToCenter:q,clampedElevation:Y}=this._distanceToCenterFromAltElevationPitch(Z/s,t,x),te=q*s,H=new c.a9((B+T*te)*n,(G+I*te)*n,0).toLngLat(),ee=c.as(1,H.lat),re=c.at(this.height/2/Math.tan(this.fovInRadians/2)/q/ee/this.tileSize);this._elevation=Y,this._center=H,this.setZoom(re)}_distanceToCenterFromAltElevationPitch(t,n,s){const l=-Math.cos(c.ap(s)),p=t-n;let m,_=n;return l*p>=0||Math.abs(l)<.1?(m=1e4,_=t+m*l):m=-p/l,{distanceToCenter:m,clampedElevation:_}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=c.as(1,this.center.lat)*this.worldSize;return ie(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/c.a5,1/n/c.a5]}}class kr{constructor(t,n){this.min=t,this.max=n,this.center=c.a$([],c.b0([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=c.b1(this.min),l=c.b1(this.max);for(let p=0;p<n.length;p++)s[p]=n[p]?this.min[p]:this.center[p],l[p]=n[p]?this.center[p]:this.max[p];return l[2]=this.max[2],new kr(s,l)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let n=!0;for(let s=0;s<t.planes.length;s++){const l=this.intersectsPlane(t.planes[s]);if(l===0)return 0;l===1&&(n=!1)}return n?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let n=t[3],s=t[3];for(let l=0;l<3;l++)t[l]>0?(n+=t[l]*this.min[l],s+=t[l]*this.max[l]):(s+=t[l]*this.min[l],n+=t[l]*this.max[l]);return n>=0?2:s<0?0:1}}class eo{distanceToTile2d(t,n,s,l){const p=l.distanceX([t,n]),m=l.distanceY([t,n]);return Math.hypot(p,m)}getWrap(t,n,s){return s}getTileBoundingVolume(t,n,s,l){var p,m;let _=0,x=0;if(l!=null&&l.terrain){const T=new c.a2(t.z,n,t.z,t.x,t.y),I=l.terrain.getMinMaxElevation(T);_=(p=I.minElevation)!==null&&p!==void 0?p:Math.min(0,s),x=(m=I.maxElevation)!==null&&m!==void 0?m:Math.max(0,s)}const w=1<<t.z;return new kr([n+t.x/w,t.y/w,_],[n+(t.x+1)/w,(t.y+1)/w,x])}allowVariableZoom(t,n){const s=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,l=c.an(78.5-s/2,0,60);return!!n.terrain||t.pitch>l}allowWorldCopies(){return!0}prepareNextFrame(){}}class $i{constructor(t,n,s){this.points=t,this.planes=n,this.aabb=s}static fromInvProjectionMatrix(t,n=1,s=0,l,p){const m=p?[[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]],_=Math.pow(2,s),x=[[-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((M=>(function(k,B,G,Z){const q=c.aH([],k,B),Y=1/q[3]/G*Z;return c.b6(q,q,[Y,Y,1/q[3],Y])})(M,t,n,_)));
vendor: 106,364 bytes, lines 807-809
807l&&(function(M,k,B,G){const Z=G?4:0,q=G?0:4;let Y=0;const te=[],H=[];for(let J=0;J<4;J++){const oe=c.b2([],M[J+q],M[J+Z]),_e=c.b7(oe);c.a$(oe,oe,1/_e),te.push(_e),H.push(oe)}for(let J=0;J<4;J++){const oe=c.b8(M[J+Z],H[J],B);Y=oe!==null&&oe>=0?Math.max(Y,oe):Math.max(Y,te[J])}const ee=(function(J,oe){const _e=c.b2([],J[oe[0]],J[oe[1]]),de=c.b2([],J[oe[2]],J[oe[1]]),me=[0,0,0,0];return c.b3(me,c.b4([],_e,de)),me[3]=-c.b5(me,J[oe[0]]),me})(M,k),re=(function(J,oe){const _e=c.b9(J),de=c.ba([],J,1/_e),me=c.b2([],oe,c.a$([],de,c.b5(oe,de))),ge=c.b9(me);if(ge>0){const Ae=Math.sqrt(1-de[3]*de[3]),ke=c.a$([],de,-de[3]),Me=c.b0([],ke,c.a$([],me,Ae/ge));return c.bb(oe,Me)}return null})(B,ee);if(re!==null){const J=re/c.b5(H[0],ee);Y=Math.min(Y,J)}for(let J=0;J<4;J++){const oe=Math.min(Y,te[J]);M[J+q]=[M[J+Z][0]+H[J][0]*oe,M[J+Z][1]+H[J][1]*oe,M[J+Z][2]+H[J][2]*oe,1]}})(x,m[0],l,p);const w=m.map((M=>{const k=c.b2([],x[M[0]],x[M[1]]),B=c.b2([],x[M[2]],x[M[1]]),G=c.b3([],c.b4([],k,B)),Z=-c.b5(G,x[M[1]]);return G.concat(Z)})),T=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],I=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const M of x)for(let k=0;k<3;k++)T[k]=Math.min(T[k],M[k]),I[k]=Math.max(I[k],M[k]);return new $i(x,w,new kr(T,I))}}class On{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,s){return this._helper.interpolatePadding(t,n,s)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,s=!0){this._helper.resize(t,n,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,s)=>{s=c.an(+s,this.minZoom,this.maxZoom);const l={center:new c.V(n.lng,n.lat),zoom:s};let p=this._helper._lngRange;if(!this._helper._renderWorldCopies&&p===null){const H=179.9999999999;p=[-H,H]}const m=this.tileSize*c.aq(l.zoom);let _=0,x=m,w=0,T=m,I=0,M=0;const{x:k,y:B}=this.size;if(this._helper._latRange){const H=this._helper._latRange;_=c.X(H[1])*m,x=c.X(H[0])*m,x-_<B&&(I=B/(x-_))}p&&(w=c.W(c.Y(p[0])*m,0,m),T=c.W(c.Y(p[1])*m,0,m),T<w&&(T+=m),T-w<k&&(M=k/(T-w)));const{x:G,y:Z}=se(m,n);let q,Y;const te=Math.max(M||0,I||0);if(te){const H=new c.P(M?(T+w)/2:G,I?(x+_)/2:Z);return l.center=ue(m,H).wrap(),l.zoom+=c.at(te),l}if(this._helper._latRange){const H=B/2;Z-H<_&&(Y=_+H),Z+H>x&&(Y=x-H)}if(p){const H=(w+T)/2;let ee=G;this._helper._renderWorldCopies&&(ee=c.W(G,H-m/2,H+m/2));const re=k/2;ee-re<w&&(q=w+re),ee+re>T&&(q=T-re)}if(q!==void 0||Y!==void 0){const H=new c.P(q??G,Y??Z);l.center=ue(m,H).wrap()}return l},this.applyConstrain=(n,s)=>this._helper.applyConstrain(n,s),this._helper=new Bn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,s)=>this.defaultConstrain(n,s)},t),this._coveringTilesDetailsProvider=new eo}clone(){const t=new On;return t.apply(this,!1),t}apply(t,n,s){this._helper.apply(t,n,s)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const n=[new c.bc(0,t)];if(this._helper._renderWorldCopies){const s=this.screenPointToMercatorCoordinate(new c.P(0,0)),l=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),p=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),m=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),_=Math.floor(Math.min(s.x,l.x,p.x,m.x)),x=Math.floor(Math.max(s.x,l.x,p.x,m.x)),w=1;for(let T=_-w;T<=x+w;T++)T!==0&&n.push(new c.bc(T,t))}return n}getCameraFrustum(){return $i.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),s=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(s)}setLocationAtPoint(t,n){const s=c.as(this.elevation,this.center.lat),l=this.screenPointToMercatorCoordinateAtZ(n,s),p=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,s),m=c.a9.fromLngLat(t),_=new c.a9(m.x-(l.x-p.x),m.y-(l.y-p.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(c.a9.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(c.a9.fromLngLat(t))}screenPointToLocation(t,n){var s;return(s=this.screenPointToMercatorCoordinate(t,n))===null||s===void 0?void 0:s.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const s=n.pointCoordinate(t);if(s!=null)return s}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const s=n||0,l=[t.x,t.y,0,1],p=[t.x,t.y,1,1];c.aH(l,l,this._pixelMatrixInverse),c.aH(p,p,this._pixelMatrixInverse);const m=l[3],_=p[3],x=l[1]/m,w=p[1]/_,T=l[2]/m,I=p[2]/_,M=T===I?0:(s-T)/(I-T);return new c.a9(c.G.number(l[0]/m,p[0]/_,M)/this.worldSize,c.G.number(x,w,M)/this.worldSize,s)}coordinatePoint(t,n=0,s=this._pixelMatrix){const l=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.aH(l,l,s),new c.P(l[0]/l[3],l[1]/l[3])}getBounds(){const t=Math.max(0,this._helper._height/2-Pe(this));return new Ft().extend(this.screenPointToLocation(new c.P(0,t))).extend(this.screenPointToLocation(new c.P(this._helper._width,t))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-Pe(this)}calculatePosMatrix(t,n=!1,s){var l;const p=(l=t.key)!==null&&l!==void 0?l:c.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),m=n?this._alignedPosMatrixCache:this._posMatrixCache;if(m.has(p)){const w=m.get(p);return s?w.f32:w.f64}const _=ve(t,this.worldSize);c.S(_,n?this._alignedProjMatrix:this._viewProjMatrix,_);const x={f64:_,f32:new Float32Array(_)};return m.set(p,x),s?x.f32:x.f64}calculateFogMatrix(t){const n=t.key,s=this._fogMatrixCacheF32;if(s.has(n))return s.get(n);const l=ve(t,this.worldSize);return c.S(l,this._fogMatrix,l),s.set(n,new Float32Array(l)),s.get(n)}calculateCenterFromCameraLngLatAlt(t,n,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,s,l)}_calculateNearFarZIfNeeded(t,n,s){if(!this._helper.autoCalculateNearFarZ)return;const l=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),p=t-l*this._helper._pixelPerMeter/Math.cos(n),m=l<0?p:t,_=Math.PI/2+this.pitchInRadians,x=c.ap(this.fov)*(Math.abs(Math.cos(c.ap(this.roll)))*this.height+Math.abs(Math.sin(c.ap(this.roll)))*this.width)/this.height*(.5+s.y/this.height),w=Math.sin(x)*m/Math.sin(c.an(Math.PI-_-x,.01,Math.PI-.01)),T=Pe(this),I=Math.atan(T/this._helper.cameraToCenterDistance),M=c.ap(.75),k=I>M?2*I*(.5+s.y/(2*T)):M,B=Math.sin(k)*m/Math.sin(c.an(Math.PI-_-k,.01,Math.PI-.01)),G=Math.min(w,B);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*G+m),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=se(this.worldSize,this.center),s=n.x,l=n.y;this._helper._pixelPerMeter=c.as(1,this.center.lat)*this.worldSize;const p=c.ap(Math.min(this.pitch,fe)),m=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(p));let _;this._calculateNearFarZIfNeeded(m,p,t),_=new Float64Array(16),c.be(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.aB(this._invProjMatrix,_),_[8]=2*-t.x/this._helper._width,_[9]=2*t.y/this._helper._height,this._projectionMatrix=c.bf(_),c.Q(_,_,[1,-1,1]),c.O(_,_,[0,0,-this._helper.cameraToCenterDistance]),c.bg(_,_,-this.rollInRadians),c.bh(_,_,this.pitchInRadians),c.bg(_,_,-this.bearingInRadians),c.O(_,_,[-s,-l,0]),this._mercatorMatrix=c.Q([],_,[this.worldSize,this.worldSize,this.worldSize]),c.Q(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),c.O(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=c.aB([],_);const x=[0,0,-1,1];c.aH(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),c.be(this._fogMatrix,this.fovInRadians,this.width/this.height,m,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,c.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.O(this._fogMatrix,this._fogMatrix,[-s,-l,0]),c.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const w=this._helper._width%2/2,T=this._helper._height%2/2,I=Math.cos(this.bearingInRadians),M=Math.sin(-this.bearingInRadians),k=s-Math.round(s)+I*w+M*T,B=l-Math.round(l)+I*T+M*w,G=new Float64Array(_);if(c.O(G,G,[k>.5?k-1:k,B>.5?B-1:B,0]),this._alignedProjMatrix=G,_=c.aB(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.aH(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=c.as(1,this.center.lat)*this.worldSize;return ie(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const s=c.a9.fromLngLat(t),l=[s.x*this.worldSize,s.y*this.worldSize,n,1];return c.aH(l,l,this._viewProjMatrix),l[2]/l[3]}getProjectionData(t){const{overscaledTileID:n,aligned:s,applyTerrainMatrix:l}=t,p=this._helper.getMercatorTileCoordinates(n),m=n?this.calculatePosMatrix(n,s,!0):null;let _;return _=n&&n.terrainRttPosMatrix32f&&l?n.terrainRttPosMatrix32f:m||c.bi(),{mainMatrix:_,tileMercatorCoords:p,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,s){return 1}transformLightDirection(t){return c.b1(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,s,l){const p=this.calculatePosMatrix(s);let m;l?(m=[t,n,l(t,n),1],c.aH(m,m,p)):(m=[t,n,0,1],Ks(m,m,p));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const s=c.a9.fromLngLat(t,n),l=s.meterInMercatorCoordinateUnits(),p=c.bj();return c.O(p,p,[s.x,s.y,s.z]),c.bg(p,p,Math.PI),c.bh(p,p,Math.PI/2),c.Q(p,p,[-l,l,l]),p}getProjectionDataForCustomLayer(t=!0){const n=new c.a2(0,0,0,0,0),s=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),l=ve(n,this.worldSize);c.S(l,this._viewProjMatrix,l),s.tileMercatorCoords=[0,0,1,1];const p=[c.a5,c.a5,this.worldSize/this._helper.pixelsPerMeter],m=c.bk();return c.Q(m,l,p),s.fallbackMatrix=m,s.mainMatrix=m,s}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Gr(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Mc(d){if(d.useSlerp)if(d.k<1){const t=c.bl(d.startEulerAngles.roll,d.startEulerAngles.pitch,d.startEulerAngles.bearing),n=c.bl(d.endEulerAngles.roll,d.endEulerAngles.pitch,d.endEulerAngles.bearing),s=new Float64Array(4);c.bm(s,t,n,d.k);const l=c.bn(s);d.tr.setRoll(l.roll),d.tr.setPitch(l.pitch),d.tr.setBearing(l.bearing)}else d.tr.setRoll(d.endEulerAngles.roll),d.tr.setPitch(d.endEulerAngles.pitch),d.tr.setBearing(d.endEulerAngles.bearing);else d.tr.setRoll(c.G.number(d.startEulerAngles.roll,d.endEulerAngles.roll,d.k)),d.tr.setPitch(c.G.number(d.startEulerAngles.pitch,d.endEulerAngles.pitch,d.k)),d.tr.setBearing(c.G.number(d.startEulerAngles.bearing,d.endEulerAngles.bearing,d.k))}function cl(d,t,n,s,l){const p=l.padding,m=se(l.worldSize,n.getNorthWest()),_=se(l.worldSize,n.getNorthEast()),x=se(l.worldSize,n.getSouthEast()),w=se(l.worldSize,n.getSouthWest()),T=c.ap(-s),I=m.rotate(T),M=_.rotate(T),k=x.rotate(T),B=w.rotate(T),G=new c.P(Math.max(I.x,M.x,B.x,k.x),Math.max(I.y,M.y,B.y,k.y)),Z=new c.P(Math.min(I.x,M.x,B.x,k.x),Math.min(I.y,M.y,B.y,k.y)),q=G.sub(Z),Y=(l.width-(p.left+p.right+t.left+t.right))/q.x,te=(l.height-(p.top+p.bottom+t.top+t.bottom))/q.y;if(te<0||Y<0)return void Gr();const H=Math.min(c.at(l.scale*Math.min(Y,te)),d.maxZoom),ee=c.P.convert(d.offset),re=new c.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(c.ap(s)),J=ee.add(re).mult(l.scale/c.aq(H));return{center:ue(l.worldSize,m.add(x).div(2).sub(J)),zoom:H,bearing:s}}class jn{get useGlobeControls(){return!1}handlePanInertia(t,n){const s=t.mag(),l=Math.abs(Pe(n));return{easingOffset:t.mult(Math.min(.75*l/s,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,s){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(s,t.around)}cameraForBoxAndBearing(t,n,s,l,p){return cl(t,n,s,l,p)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(c.V.convert(n.center))}handleEaseTo(t,n){const s=t.zoom,l=t.padding,p={roll:t.roll,pitch:t.pitch,bearing:t.bearing},m={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},_=n.zoom!==void 0,x=!t.isPaddingEqual(n.padding);let w=!1;const T=_?+n.zoom:t.zoom;let I=t.centerPoint.add(n.offsetAsPoint);const M=t.screenPointToLocation(I),{center:k,zoom:B}=t.applyConstrain(c.V.convert(n.center||M),T??s);un(t,k);const G=se(t.worldSize,M),Z=se(t.worldSize,k).sub(G),q=c.aq(B-s);return w=B!==s,{easeFunc:Y=>{if(w&&t.setZoom(c.G.number(s,B,Y)),c.bo(p,m)||Mc({startEulerAngles:p,endEulerAngles:m,tr:t,k:Y,useSlerp:p.roll!=m.roll}),x&&(t.interpolatePadding(l,n.padding,Y),I=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const te=c.aq(t.zoom-s),H=B>s?Math.min(2,q):Math.max(.5,q),ee=Math.pow(H,1-Y),re=ue(t.worldSize,G.add(Z.mult(Y*ee)).mult(te));t.setLocationAtPoint(t.renderWorldCopies?re.wrap():re,I)}},isZooming:w,elevationCenter:k}}handleFlyTo(t,n){const s=n.zoom!==void 0,l=t.zoom,p=t.applyConstrain(c.V.convert(n.center||n.locationAtOffset),s?+n.zoom:l),m=p.center,_=p.zoom;un(t,m);const x=se(t.worldSize,n.locationAtOffset),w=se(t.worldSize,m).sub(x),T=w.mag(),I=c.aq(_-l);let M;if(n.minZoom!==void 0){const k=Math.min(+n.minZoom,l,_),B=t.applyConstrain(m,k).zoom;M=c.aq(B-l)}return{easeFunc:(k,B,G,Z)=>{t.setZoom(k===1?_:l+c.at(B));const q=k===1?m:ue(t.worldSize,x.add(w.mult(G)).mult(B));t.setLocationAtPoint(t.renderWorldCopies?q.wrap():q,Z)},scaleOfZoom:I,targetCenter:m,scaleOfMinZoom:M,pixelPathLength:T}}}class Mt{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Mt.Replace=[1,0],Mt.disabled=new Mt(Mt.Replace,c.bp.transparent,[!1,!1,!1,!1]),Mt.unblended=new Mt(Mt.Replace,c.bp.transparent,[!0,!0,!0,!0]),Mt.alphaBlended=new Mt([1,771],c.bp.transparent,[!0,!0,!0,!0]);const _a=2305;class dt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}dt.disabled=new dt(!1,1029,_a),dt.backCCW=new dt(!0,1029,_a),dt.frontCCW=new dt(!0,1028,_a);class lt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}lt.ReadOnly=!1,lt.ReadWrite=!0,lt.disabled=new lt(519,lt.ReadOnly,[0,1]);const ya=7680;class pt{constructor(t,n,s,l,p,m){this.test=t,this.ref=n,this.mask=s,this.fail=l,this.depthFail=p,this.pass=m}}pt.disabled=new pt({func:519,mask:0},0,0,ya,ya,ya);const as=new WeakMap;function lr(d){var t;if(as.has(d))return as.get(d);{const n=(t=d.getParameter(d.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return as.set(d,n),n}}class xa{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,s=n.gl;this._texFormat=s.RGBA,this._texType=s.UNSIGNED_BYTE;const l=new c.aW;l.emplaceBack(-1,-1),l.emplaceBack(2,-1),l.emplaceBack(-1,2);const p=new c.aY;p.emplaceBack(0,1,2),this._fullscreenTriangle=new Pt(n.createVertexBuffer(l,cn.members),n.createIndexBuffer(p),c.aX.simpleSegment(0,0,l.length,p.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(s.TEXTURE1);const m=s.createTexture();s.bindTexture(s.TEXTURE_2D,m),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texImage2D(s.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(m),lr(s)&&(this._pbo=s.createBuffer(),s.bindBuffer(s.PIXEL_PACK_BUFFER,this._pbo),s.bufferData(s.PIXEL_PACK_BUFFER,4,s.STREAM_READ),s.bindBuffer(s.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const s=this._updateCount;return this._readbackQueue?s>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():s>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const s=this._cachedRenderContext.context,l=s.gl;if(this._bindFramebuffer(),s.viewport.set([0,0,this._texWidth,this._texHeight]),s.clear({color:c.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(s,l.TRIANGLES,lt.disabled,pt.disabled,Mt.unblended,dt.disabled,((p,m)=>({u_input:p,u_output_expected:m}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&lr(l)){l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.readBuffer(l.COLOR_ATTACHMENT0),l.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null);const p=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:p}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&lr(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return c.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=xa._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const hn=c.a5/128;function Ic(d,t){const n=d.granularity!==void 0?Math.max(d.granularity,1):1,s=n+(d.generateBorders?2:0),l=n+(d.extendToNorthPole||d.generateBorders?1:0)+(d.extendToSouthPole||d.generateBorders?1:0),p=s+1,m=l+1,_=d.generateBorders?-1:0,x=d.generateBorders||d.extendToNorthPole?-1:0,w=n+(d.generateBorders?1:0),T=n+(d.generateBorders||d.extendToSouthPole?1:0),I=p*m,M=s*l*6,k=p*m>65536;if(k&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const B=k||t==="32bit",G=new Int16Array(2*I);let Z=0;for(let te=x;te<=T;te++)for(let H=_;H<=w;H++){let ee=H/n*c.a5;H===-1&&(ee=-hn),H===n+1&&(ee=c.a5+hn);let re=te/n*c.a5;te===-1&&(re=d.extendToNorthPole?c.br:-hn),te===n+1&&(re=d.extendToSouthPole?c.bs:c.a5+hn),G[Z++]=ee,G[Z++]=re}const q=B?new Uint32Array(M):new Uint16Array(M);let Y=0;for(let te=0;te<l;te++)for(let H=0;H<s;H++){const ee=H+1+te*p,re=H+(te+1)*p,J=H+1+(te+1)*p;q[Y++]=H+te*p,q[Y++]=re,q[Y++]=ee,q[Y++]=ee,q[Y++]=re,q[Y++]=J}return{vertices:G.buffer.slice(0),indices:q.buffer.slice(0),uses32bitIndices:B}}const ss=new c.aV({fill:new c.bt(128,2),line:new c.bt(512,0),tile:new c.bt(128,32),stencil:new c.bt(128,1),circle:3});class ul{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 Nt.projectionGlobe}get vertexShaderPreludeCode(){return Nt.projectionMercator.vertexSource}get subdivisionGranularity(){return ss}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new xa(t));const n=c.X(this._errorQueryLatitudeDegrees),s=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,l=this._errorMeasurement.updateErrorLoop(n,s),p=st();l!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=l,this._errorMeasurementLastChangeTime=p);const m=Math.min(Math.max((p-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=c.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,c.bv(m))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,s,l,p){const m=(p==="stencil"?ss.stencil:ss.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:m,generateBorders:s,extendToNorthPole:n.y===0&&l,extendToSouthPole:n.y===(1<<n.z)-1&&l})}_getMesh(t,n){const s=this._getMeshKey(n);if(s in this._tileMeshCache)return this._tileMeshCache[s];const l=(function(p,m){const _=Ic(m,"16bit"),x=c.aW.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),w=c.aY.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new Pt(p.createVertexBuffer(x,cn.members),p.createIndexBuffer(w),c.aX.simpleSegment(0,0,x.length,w.length))})(t,n);return this._tileMeshCache[s]=l,l}recalculate(t){}hasTransition(){const t=st();let n=!1;return n=n||(t-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const rh=new c.t({type:new c.D(c.u.projection.type)});class Ec extends c.E{constructor(t){super(),this._transitionable=new c.x(rh,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0)),this._mercatorProjection=new Fi,this._verticalPerspectiveProjection=new ul}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof c.bw){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.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(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,s,l,p){return this.currentProjection.getMeshFromTileID(t,n,s,l,p)}setProjection(t){this._transitionable.setValue("type",(t==null?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Bi(d){const t=Vn(d.worldSize,d.center.lat);return 2*Math.PI*t}function Dr(d,t,n,s,l){const p=1/(1<<l),m=t/c.a5*p+s*p,_=c.bz((d/c.a5*p+n*p)*Math.PI*2+Math.PI,2*Math.PI),x=2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI,w=Math.cos(x),T=new Float64Array(3);return T[0]=Math.sin(_)*w,T[1]=Math.sin(x),T[2]=Math.cos(_)*w,T}function Bt(d){return(function(t,n){const s=Math.cos(n),l=new Float64Array(3);return l[0]=Math.sin(t)*s,l[1]=Math.sin(n),l[2]=Math.cos(t)*s,l})(d.lng*Math.PI/180,d.lat*Math.PI/180)}function Vn(d,t){return d/(2*Math.PI)/Math.cos(t*Math.PI/180)}function hl(d){const t=Math.asin(d[1])/Math.PI*180,n=Math.sqrt(d[0]*d[0]+d[2]*d[2]);if(n>1e-6){const s=d[0]/n,l=Math.acos(d[2]/n),p=(s>0?l:-l)/Math.PI*180;return new c.V(c.W(p,-180,180),t)}return new c.V(0,t)}function os(d){return Math.cos(d*Math.PI/180)}function Wt(d,t){const n=os(d),s=os(t);return c.at(s/n)}function Cc(d,t){const n=d.rotate(t.bearingInRadians),s=t.zoom+Wt(t.center.lat,0),l=c.bu(1/os(t.center.lat),1/os(Math.min(Math.abs(t.center.lat),60)),c.bx(s,7,3,0,1)),p=360/Bi({worldSize:t.worldSize,center:{lat:t.center.lat}});return new c.V(t.center.lng-n.x*p*l,c.an(t.center.lat+n.y*p,-c.ao,c.ao))}function dl(d){const t=.5*d,n=Math.sin(t),s=Math.cos(t);return Math.log(n+s)-Math.log(s-n)}function Ac(d,t,n,s){const l=d.lat+n*s;if(Math.abs(n)>1){const p=(Math.sign(d.lat+n)!==Math.sign(d.lat)?-Math.abs(d.lat):Math.abs(d.lat))*Math.PI/180,m=Math.abs(d.lat+n)*Math.PI/180,_=dl(p+s*(m-p)),x=dl(p),w=dl(m);return new c.V(d.lng+t*((_-x)/(w-x)),l)}return new c.V(d.lng+t*s,l)}class nh{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,s,l){const p=`${t.z}_${t.x}_${t.y}_${l!=null&&l.terrain?"t":""}`,m=this._cache.get(p);if(m)return m;const _=this._cachePrevious.get(p);if(_)return this._cache.set(p,_),_;const x=this._boundingVolumeFactory(t,n,s,l);return this._cache.set(p,x),this._hadAnyChanges=!0,x}}class va{constructor(t,n,s,l){this.min=s,this.max=l,this.points=t,this.planes=n}static fromAabb(t,n){const s=[];for(let l=0;l<8;l++)s.push([1&~l?t[0]:n[0],(l>>1&1)==1?n[1]:t[1],(l>>2&1)==1?n[2]:t[2]]);return new va(s,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,s){const l=c.bB([],s[0],s[1],s[2]),p=c.bC([],[n[0],0,0],l),m=c.bC([],[0,n[1],0],l),_=c.bC([],[0,0,n[2]],l),x=[...t],w=[...t];for(let I=0;I<8;I++)for(let M=0;M<3;M++){const k=t[M]+p[M]*(1&~I?-1:1)+m[M]*((I>>1&1)==1?1:-1)+_[M]*((I>>2&1)==1?1:-1);x[M]=Math.min(x[M],k),w[M]=Math.max(w[M],k)}const T=[];for(let I=0;I<8;I++){const M=[...t];c.b0(M,M,c.a$([],p,1&~I?-1:1)),c.b0(M,M,c.a$([],m,(I>>1&1)==1?1:-1)),c.b0(M,M,c.a$([],_,(I>>2&1)==1?1:-1)),T.push(M)}return new va(T,[[...p,-c.b5(p,T[0])],[...m,-c.b5(m,T[0])],[..._,-c.b5(_,T[0])],[-p[0],-p[1],-p[2],-c.b5(p,T[7])],[-m[0],-m[1],-m[2],-c.b5(m,T[7])],[-_[0],-_[1],-_[2],-c.b5(_,T[7])]],x,w)}intersectsFrustum(t){let n=!0;const s=this.points.length,l=this.planes.length,p=t.planes.length,m=t.points.length;for(let _=0;_<p;_++){const x=t.planes[_];let w=0;for(let T=0;T<s;T++){const I=this.points[T];x[0]*I[0]+x[1]*I[1]+x[2]*I[2]+x[3]>=0&&w++}if(w===0)return 0;w<s&&(n=!1)}if(n)return 2;for(let _=0;_<l;_++){const x=this.planes[_];let w=0;for(let T=0;T<m;T++){const I=t.points[T];x[0]*I[0]+x[1]*I[1]+x[2]*I[2]+x[3]>=0&&w++}if(w===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let s=0;for(let l=0;l<n;l++){const p=this.points[l];t[0]*p[0]+t[1]*p[1]+t[2]*p[2]+t[3]>=0&&s++}return s===n?2:s===0?0:1}}function to(d,t,n){const s=d-t;return s<0?-s:Math.max(0,s-n)}function ba(d,t,n,s,l){const p=d-n;let m;return m=p<0?Math.min(-p,1+p-l):p>1?Math.min(Math.max(p-l,0),1-p):0,Math.max(m,to(t,s,l))}class pl{constructor(){this._boundingVolumeCache=new nh(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,s,l){const p=1<<s.z,m=1/p,_=s.x/p,x=s.y/p;let w=2;return w=Math.min(w,ba(t,n,_,x,m)),w=Math.min(w,ba(t,n,_+.5,-x-m,m)),w=Math.min(w,ba(t,n,_+.5,2-x-m,m)),w}getWrap(t,n,s){const l=1<<n.z,p=1/l,m=n.x/l,_=to(t.x,m,p),x=to(t.x,m-1,p),w=to(t.x,m+1,p),T=Math.min(_,x,w);return T===w?1:T===x?-1:0}allowVariableZoom(t,n){return et(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,s,l){return this._boundingVolumeCache.getTileBoundingVolume(t,n,s,l)}_computeTileBoundingVolume(t,n,s,l){var p,m;let _=0,x=0;if(l!=null&&l.terrain){const w=new c.a2(t.z,n,t.z,t.x,t.y),T=l.terrain.getMinMaxElevation(w);_=(p=T.minElevation)!==null&&p!==void 0?p:Math.min(0,s),x=(m=T.maxElevation)!==null&&m!==void 0?m:Math.max(0,s)}if(_/=c.bE,x/=c.bE,_+=1,x+=1,t.z<=0)return va.fromAabb([-x,-x,-x],[x,x,x]);if(t.z===1)return va.fromAabb([t.x===0?-x:0,t.y===0?0:-x,-x],[t.x===0?0:x,t.y===0?x:0,x]);{const w=[Dr(0,0,t.x,t.y,t.z),Dr(c.a5,0,t.x,t.y,t.z),Dr(c.a5,c.a5,t.x,t.y,t.z),Dr(0,c.a5,t.x,t.y,t.z)],T=[];for(const me of w)T.push(c.a$([],me,x));if(x!==_)for(const me of w)T.push(c.a$([],me,_));t.y===0&&T.push([0,1,0]),t.y===(1<<t.z)-1&&T.push([0,-1,0]);const I=[1,1,1],M=[-1,-1,-1];for(const me of T)for(let ge=0;ge<3;ge++)I[ge]=Math.min(I[ge],me[ge]),M[ge]=Math.max(M[ge],me[ge]);const k=Dr(c.a5/2,c.a5/2,t.x,t.y,t.z),B=c.b4([],[0,1,0],k);c.b3(B,B);const G=c.b4([],k,B);c.b3(G,G);const Z=c.b4([],w[2],w[1]);c.b3(Z,Z);const q=c.b4([],w[0],w[3]);c.b3(q,q),T.push(c.a$([],k,x)),t.y>=(1<<t.z)/2&&T.push(c.a$([],Dr(c.a5/2,0,t.x,t.y,t.z),x)),t.y<(1<<t.z)/2&&T.push(c.a$([],Dr(c.a5/2,c.a5,t.x,t.y,t.z),x));const Y=ls(k,T),te=ls(G,T),H=[-k[0],-k[1],-k[2],Y.max],ee=[k[0],k[1],k[2],-Y.min],re=[-G[0],-G[1],-G[2],te.max],J=[G[0],G[1],G[2],-te.min],oe=[...Z,0],_e=[...q,0],de=[];return t.y===0?de.push(c.bD(_e,oe,H),c.bD(_e,oe,ee)):de.push(c.bD(re,oe,H),c.bD(re,oe,ee),c.bD(re,_e,H),c.bD(re,_e,ee)),t.y===(1<<t.z)-1?de.push(c.bD(_e,oe,H),c.bD(_e,oe,ee)):de.push(c.bD(J,oe,H),c.bD(J,oe,ee),c.bD(J,_e,H),c.bD(J,_e,ee)),new va(de,[H,ee,re,J,oe,_e],I,M)}}}function ls(d,t){let n=1/0,s=-1/0;for(const l of t){const p=c.b5(d,l);n=Math.min(n,p),s=Math.max(s,p)}return{min:n,max:s}}class wa{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,s){return this._helper.interpolatePadding(t,n,s)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=c.bF(),this._projectionMatrix=c.bj(),this._globeViewProjMatrix32f=c.bi(),this._globeViewProjMatrixNoCorrection=c.bj(),this._globeViewProjMatrixNoCorrectionInverted=c.bj(),this._globeProjMatrixInverted=c.bj(),this._cameraPosition=c.bA(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,s)=>{const l=c.an(n.lat,-c.ao,c.ao),p=c.an(+s,this.minZoom+Wt(0,l),this.maxZoom);return{center:new c.V(n.lng,l),zoom:p}},this.applyConstrain=(n,s)=>this._helper.applyConstrain(n,s),this._helper=new Bn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,s)=>this.defaultConstrain(n,s)},t),this._coveringTilesDetailsProvider=new pl}clone(){const t=new wa;return t.apply(this,!1),t}apply(t,n,s){this._globeLatitudeErrorCorrectionRadians=s||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=c.bA();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:n,applyGlobeMatrix:s}=t,l=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:l,clippingPlane:this._cachedClippingPlane,projectionTransition:s?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,s=this.cameraToCenterDistance/t,l=Math.sin(n)*s,p=Math.cos(n)*s+1,m=1/Math.sqrt(l*l+p*p)*1;let _=-l,x=p;const w=Math.sqrt(_*_+x*x);_/=w,x/=w;const T=[0,_,x];c.bG(T,T,[0,0,0],-this.bearingInRadians),c.bH(T,T,[0,0,0],-1*this.center.lat*Math.PI/180),c.bI(T,T,[0,0,0],this.center.lng*Math.PI/180);const I=1/c.b7(T);return c.a$(T,T,I),[...T,-m*I]}isLocationOccluded(t){return!this.isSurfacePointVisible(Bt(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,s=this._helper._center.lat*Math.PI/180,l=Math.cos(s),p=[Math.sin(n)*l,Math.sin(s),Math.cos(n)*l],m=[p[2],0,-p[0]],_=[0,0,0];c.b4(_,m,p),c.b3(m,m),c.b3(_,_);const x=[0,0,0];return c.b3(x,[m[0]*t[0]+_[0]*t[1]+p[0]*t[2],m[1]*t[0]+_[1]*t[1]+p[1]*t[2],m[2]*t[0]+_[2]*t[1]+p[2]*t[2]]),x}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,n,s){const l=(function(_,x,w){const T=1/(1<<w.z);return new c.a9(_/c.a5*T+w.x*T,x/c.a5*T+w.y*T)})(t,n,s.canonical),p=(m=l.y,[c.bz(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-m*Math.PI*2))-.5*Math.PI]);var m;return this.getCircleRadiusCorrection()/Math.cos(p[1])}projectTileCoordinates(t,n,s,l){const p=s.canonical,m=Dr(t,n,p.x,p.y,p.z),_=1+(l?l(t,n):0)/c.bE,x=[m[0]*_,m[1]*_,m[2]*_,1];c.aH(x,x,this._globeViewProjMatrixNoCorrection);const w=this._cachedClippingPlane,T=w[0]*m[0]+w[1]*m[1]+w[2]*m[2]+w[3]<0;return{point:new c.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:T}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=Vn(this.worldSize,this.center.lat),n=c.bk(),s=c.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),c.be(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const l=this.centerOffset;n[8]=2*-l.x/this._helper._width,n[9]=2*l.y/this._helper._height,this._projectionMatrix=c.bf(n),this._globeProjMatrixInverted=c.bk(),c.aB(this._globeProjMatrixInverted,n),c.O(n,n,[0,0,-this.cameraToCenterDistance]),c.bg(n,n,this.rollInRadians),c.bh(n,n,-this.pitchInRadians),c.bg(n,n,this.bearingInRadians),c.O(n,n,[0,0,-t]);const p=c.bA();p[0]=t,p[1]=t,p[2]=t,c.bh(s,n,this.center.lat*Math.PI/180),c.bJ(s,s,-this.center.lng*Math.PI/180),c.Q(s,s,p),this._globeViewProjMatrixNoCorrection=s,c.bh(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),c.bJ(n,n,-this.center.lng*Math.PI/180),c.Q(n,n,p),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=c.bk(),c.aB(this._globeViewProjMatrixNoCorrectionInverted,s);const m=c.bA();this._cameraPosition=c.bA(),this._cameraPosition[2]=this.cameraToCenterDistance/t,c.bG(this._cameraPosition,this._cameraPosition,m,-this.rollInRadians),c.bH(this._cameraPosition,this._cameraPosition,m,this.pitchInRadians),c.bG(this._cameraPosition,this._cameraPosition,m,-this.bearingInRadians),c.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),c.bH(this._cameraPosition,this._cameraPosition,m,-this.center.lat*Math.PI/180),c.bI(this._cameraPosition,this._cameraPosition,m,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const _=c.bf(this._globeViewProjMatrixNoCorrectionInverted);c.Q(_,_,[1,1,-1]),this._cachedFrustum=$i.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){c.w("calculateFogMatrix is not supported on globe projection.");const n=c.bk();return c.ar(n),n}getVisibleUnwrappedCoordinates(t){return[new c.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&c.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(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const s=Bt(t);c.a$(s,s,1+n/c.bE);const l=c.bF();return c.aH(l,[s[0],s[1],s[2],1],this._globeViewProjMatrixNoCorrection),l[2]/l[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,s=[new c.P(0,0),new c.P(t,0),new c.P(this.width,0),new c.P(this.width,n),new c.P(this.width,this.height),new c.P(t,this.height),new c.P(0,this.height),new c.P(0,n)],l=[];for(const I of s)l.push(this.unprojectScreenPoint(I));let p=0,m=0,_=0,x=0;const w=this.center;for(const I of l){const M=c.bK(w.lng,I.lng),k=c.bK(w.lat,I.lat);M<m&&(m=M),M>p&&(p=M),k<x&&(x=k),k>_&&(_=k)}const T=[w.lng+m,w.lat+x,w.lng+p,w.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(T[3]=90,T[0]=-180,T[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(T[1]=-90,T[0]=-180,T[2]=180),new Ft(T)}calculateCenterFromCameraLngLatAlt(t,n,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,s,l)}setLocationAtPoint(t,n){const s=Bt(this.unprojectScreenPoint(n)),l=Bt(t),p=c.bA();c.bL(p);const m=c.bA();c.bI(m,s,p,-this.center.lng*Math.PI/180),c.bH(m,m,p,this.center.lat*Math.PI/180);const _=l[0]*l[0]+l[2]*l[2],x=m[0]*m[0];if(_<x)return;const w=Math.sqrt(_-x),T=-w,I=c.bM(l[0],l[2],m[0],w),M=c.bM(l[0],l[2],m[0],T),k=c.bA();c.bI(k,l,p,-I);const B=c.bM(k[1],k[2],m[1],m[2]),G=c.bA();c.bI(G,l,p,-M);const Z=c.bM(G[1],G[2],m[1],m[2]),q=.5*Math.PI,Y=B>=-q&&B<=q,te=Z>=-q&&Z<=q;let H,ee;if(Y&&te){const _e=this.center.lng*Math.PI/180,de=this.center.lat*Math.PI/180;c.bN(I,_e)+c.bN(B,de)<c.bN(M,_e)+c.bN(Z,de)?(H=I,ee=B):(H=M,ee=Z)}else if(Y)H=I,ee=B;else{if(!te)return;H=M,ee=Z}const re=H/Math.PI*180,J=ee/Math.PI*180,oe=this.center.lat;this.setCenter(new c.V(re,c.an(J,-90,90))),this.setZoom(this.zoom+Wt(oe,this.center.lat))}locationToScreenPoint(t,n){const s=Bt(t);if(n){const l=n.getElevationForLngLatZoom(t,this._helper._tileZoom);c.a$(s,s,1+l/c.bE)}return this._projectSurfacePointToScreen(s)}_projectSurfacePointToScreen(t){const n=c.bF();return c.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new c.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const s=n.pointCoordinate(t);if(s)return s}return c.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var s;return(s=this.screenPointToMercatorCoordinate(t,n))===null||s===void 0?void 0:s.toLngLat()}isPointOnMapSurface(t,n){const s=this._cameraPosition,l=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(s,l)}getRayDirectionFromPixel(t){const n=c.bF();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,c.aH(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const s=c.bA();s[0]=n[0]-this._cameraPosition[0],s[1]=n[1]-this._cameraPosition[1],s[2]=n[2]-this._cameraPosition[2];const l=c.bA();return c.b3(l,s),l}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=c.bF();return c.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const s=c.b5(t,n),l=c.bA(),p=c.bA();c.a$(p,n,s),c.b2(l,t,p);const m=1-c.b5(l,l);if(m<0)return null;const _=c.b5(t,t)-1,x=-s+(s<0?1:-1)*Math.sqrt(m),w=_/x,T=x;return{tMin:Math.min(w,T),tMax:Math.max(w,T)}}unprojectScreenPoint(t){const n=this._cameraPosition,s=this.getRayDirectionFromPixel(t),l=this.rayPlanetIntersection(n,s);if(l){const T=c.bA();c.b0(T,n,[s[0]*l.tMin,s[1]*l.tMin,s[2]*l.tMin]);const I=c.bA();return c.b3(I,T),hl(I)}const p=this._cachedClippingPlane,m=p[0]*s[0]+p[1]*s[1]+p[2]*s[2],_=-c.bb(p,n)/m,x=c.bA();if(_>0)c.b0(x,n,[s[0]*_,s[1]*_,s[2]*_]);else{const T=c.bA();c.b0(T,n,[2*s[0],2*s[1],2*s[2]]);const I=c.bb(this._cachedClippingPlane,T);c.b2(x,T,[this._cachedClippingPlane[0]*I,this._cachedClippingPlane[1]*I,this._cachedClippingPlane[2]*I])}const w=(function(T){const I=c.bA();return I[0]=T[0]*-T[3],I[1]=T[1]*-T[3],I[2]=T[2]*-T[3],{center:I,radius:Math.sqrt(1-T[3]*T[3])}})(p);return hl((function(T,I,M){const k=c.bA();c.b2(k,M,T);const B=c.bA();return c.by(B,T,k,I/c.b9(k)),B})(w.center,w.radius,x))}getMatrixForModel(t,n){const s=c.V.convert(t),l=1/c.bE,p=c.bj();return c.bJ(p,p,s.lng/180*Math.PI),c.bh(p,p,-s.lat/180*Math.PI),c.O(p,p,[0,0,1+n/c.bE]),c.bh(p,p,.5*Math.PI),c.Q(p,p,[l,l,l]),p}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new c.a2(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class Ta{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,s){return this._helper.interpolatePadding(t,n,s)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,s=!0){this._helper.resize(t,n,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get 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(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,s)=>this.currentTransform.defaultConstrain(n,s),this.applyConstrain=(n,s)=>this._helper.applyConstrain(n,s),this._helper=new Bn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,s)=>this.defaultConstrain(n,s)},t),this._globeness=1,this._mercatorTransform=new On,this._verticalPerspectiveTransform=new wa}clone(){const t=new Ta;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),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(t){const n=this._mercatorTransform.getProjectionData(t),s=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?s.mainMatrix:n.mainMatrix,clippingPlane:s.clippingPlane,tileMercatorCoords:s.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return c.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,s){const l=this._mercatorTransform.getPitchedTextCorrection(t,n,s),p=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,s);return c.bu(l,p,this._globeness)}projectTileCoordinates(t,n,s,l){return this.currentTransform.projectTileCoordinates(t,n,s,l)}_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(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,s,l)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const s=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return s.fallbackMatrix=n.mainMatrix,s}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class oi{get useGlobeControls(){return!0}handlePanInertia(t,n){const s=Cc(t,n);return Math.abs(s.lng-n.center.lng)>180&&(s.lng=n.center.lng+179.5*Math.sign(s.lng-n.center.lng)),{easingCenter:s,easingOffset:new c.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const s=t.around,l=n.screenPointToLocation(s);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const p=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const m=n.zoom-p;if(m===0)return;const _=c.bK(n.center.lng,l.lng),x=_/(Math.abs(_/180)+1),w=c.bK(n.center.lat,l.lat),T=n.getRayDirectionFromPixel(s),I=n.cameraPosition,M=-1*c.b5(I,T),k=c.bA();c.b0(k,I,[T[0]*M,T[1]*M,T[2]*M]);const B=c.b7(k)-1,G=Math.exp(.5*-Math.max(B-.3,0)),Z=Vn(n.worldSize,n.center.lat)/Math.min(n.width,n.height),q=c.bx(Z,.9,.5,1,.25),Y=(1-c.aq(-m))*Math.min(G,q),te=n.center.lat,H=n.zoom,ee=new c.V(n.center.lng+x*Y,c.an(n.center.lat+w*Y,-c.ao,c.ao));n.setLocationAtPoint(l,s);const re=n.center,J=c.bx(Math.abs(_),45,85,0,1),oe=c.bx(Z,.75,.35,0,1),_e=Math.pow(Math.max(J,oe),.25),de=c.bK(re.lng,ee.lng),me=c.bK(re.lat,ee.lat);n.setCenter(new c.V(re.lng+de*_e,re.lat+me*_e).wrap()),n.setZoom(H+Wt(te,n.center.lat))}handleMapControlsPan(t,n,s){if(!t.panDelta)return;const l=n.center.lat,p=n.zoom;n.setCenter(Cc(t.panDelta,n).wrap()),n.setZoom(p+Wt(l,n.center.lat))}cameraForBoxAndBearing(t,n,s,l,p){const m=cl(t,n,s,l,p),_=n.left/p.width*2-1,x=(p.width-n.right)/p.width*2-1,w=n.top/p.height*-2+1,T=(p.height-n.bottom)/p.height*-2+1,I=c.bK(s.getWest(),s.getEast())<0,M=I?s.getEast():s.getWest(),k=I?s.getWest():s.getEast(),B=Math.max(s.getNorth(),s.getSouth()),G=Math.min(s.getNorth(),s.getSouth()),Z=M+.5*c.bK(M,k),q=B+.5*c.bK(B,G),Y=p.clone();Y.setCenter(m.center),Y.setBearing(m.bearing),Y.setPitch(0),Y.setRoll(0),Y.setZoom(m.zoom);const te=Y.modelViewProjectionMatrix,H=[Bt(s.getNorthWest()),Bt(s.getNorthEast()),Bt(s.getSouthWest()),Bt(s.getSouthEast()),Bt(new c.V(k,q)),Bt(new c.V(M,q)),Bt(new c.V(Z,B)),Bt(new c.V(Z,G))],ee=Bt(m.center);let re=Number.POSITIVE_INFINITY;for(const J of H)_<0&&(re=oi.getLesserNonNegativeNonNull(re,oi.solveVectorScale(J,ee,te,"x",_))),x>0&&(re=oi.getLesserNonNegativeNonNull(re,oi.solveVectorScale(J,ee,te,"x",x))),w>0&&(re=oi.getLesserNonNegativeNonNull(re,oi.solveVectorScale(J,ee,te,"y",w))),T<0&&(re=oi.getLesserNonNegativeNonNull(re,oi.solveVectorScale(J,ee,te,"y",T)));if(Number.isFinite(re)&&re!==0)return m.zoom=Y.zoom+c.at(re),m;Gr()}handleJumpToCenterZoom(t,n){const s=t.center.lat,l=t.applyConstrain(n.center?c.V.convert(n.center):t.center,t.zoom).center;t.setCenter(l.wrap());const p=n.zoom!==void 0?+n.zoom:t.zoom+Wt(s,l.lat);t.zoom!==p&&t.setZoom(p)}handleEaseTo(t,n){const s=t.zoom,l=t.center,p=t.padding,m={roll:t.roll,pitch:t.pitch,bearing:t.bearing},_={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},x=n.zoom!==void 0,w=!t.isPaddingEqual(n.padding);let T=!1;const I=n.center?c.V.convert(n.center):l,M=t.applyConstrain(I,s).center;un(t,M);const k=t.clone();k.setCenter(M),k.setZoom(x?+n.zoom:s+Wt(l.lat,I.lat)),k.setBearing(n.bearing);const B=new c.P(c.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),c.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));k.setLocationAtPoint(M,B);const G=(n.offset&&n.offsetAsPoint.mag())>0?k.center:M,Z=x?+n.zoom:s+Wt(l.lat,G.lat),q=s+Wt(l.lat,0),Y=Z+Wt(G.lat,0),te=c.bK(l.lng,G.lng),H=c.bK(l.lat,G.lat),ee=c.aq(Y-q);return T=Z!==s,{easeFunc:re=>{if(c.bo(m,_)||Mc({startEulerAngles:m,endEulerAngles:_,tr:t,k:re,useSlerp:m.roll!=_.roll}),w&&t.interpolatePadding(p,n.padding,re),n.around)c.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const J=Y>q?Math.min(2,ee):Math.max(.5,ee),oe=Math.pow(J,1-re),_e=Ac(l,te,H,re*oe);t.setCenter(_e.wrap())}if(T){const J=c.G.number(q,Y,re)+Wt(0,t.center.lat);t.setZoom(J)}},isZooming:T,elevationCenter:G}}handleFlyTo(t,n){const s=n.zoom!==void 0,l=t.center,p=t.zoom,m=t.padding,_=!t.isPaddingEqual(n.padding),x=t.applyConstrain(c.V.convert(n.center||n.locationAtOffset),p).center,w=s?+n.zoom:t.zoom+Wt(t.center.lat,x.lat),T=t.clone();T.setCenter(x),T.setZoom(w),T.setBearing(n.bearing);const I=new c.P(c.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),c.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));T.setLocationAtPoint(x,I);const M=T.center;un(t,M);const k=(function(H,ee,re){const J=Bt(ee),oe=Bt(re),_e=c.b5(J,oe),de=Math.acos(_e),me=Bi(H);return de/(2*Math.PI)*me})(t,l,M),B=p+Wt(l.lat,0),G=w+Wt(M.lat,0),Z=c.aq(G-B);let q;if(typeof n.minZoom=="number"){const H=+n.minZoom+Wt(M.lat,0),ee=Math.min(H,B,G)+Wt(0,M.lat),re=t.applyConstrain(M,ee).zoom+Wt(M.lat,0);q=c.aq(re-B)}const Y=c.bK(l.lng,M.lng),te=c.bK(l.lat,M.lat);return{easeFunc:(H,ee,re,J)=>{const oe=Ac(l,Y,te,re);_&&t.interpolatePadding(m,n.padding,H);const _e=H===1?M:oe;t.setCenter(_e.wrap());const de=B+c.at(ee);t.setZoom(H===1?w:de+Wt(0,_e.lat))},scaleOfZoom:Z,targetCenter:M,scaleOfMinZoom:q,pixelPathLength:k}}static solveVectorScale(t,n,s,l,p){const m=l==="x"?[s[0],s[4],s[8],s[12]]:[s[1],s[5],s[9],s[13]],_=[s[3],s[7],s[11],s[15]],x=t[0]*m[0]+t[1]*m[1]+t[2]*m[2],w=t[0]*_[0]+t[1]*_[1]+t[2]*_[2],T=n[0]*m[0]+n[1]*m[1]+n[2]*m[2],I=n[0]*_[0]+n[1]*_[1]+n[2]*_[2];return T+p*w===x+p*I||_[3]*(x-T)+m[3]*(I-w)+x*I==T*w?null:(T+m[3]-p*I-p*_[3])/(T-x-p*I+p*w)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class zc{constructor(t){this._globe=t,this._mercatorCameraHelper=new jn,this._verticalPerspectiveCameraHelper=new oi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,s){this.currentHelper.handleMapControlsPan(t,n,s)}cameraForBoxAndBearing(t,n,s,l,p){return this.currentHelper.cameraForBoxAndBearing(t,n,s,l,p)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Sa=(d,t)=>c.B(d,t&&t.filter((n=>n.identifier!=="source.canvas"))),cs=c.bO();class Nn extends c.E{constructor(t,n={}){var s,l;super(),this._rtlPluginLoaded=()=>{for(const m in this.tileManagers){const _=this.tileManagers[m].getSource().type;_!=="vector"&&_!=="geojson"||this.tileManagers[m].reload()}},this.map=t,this.dispatcher=new Cn(oa(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((m,_)=>this.getGlyphs(m,_))),this.dispatcher.registerMessageHandler("GI",((m,_)=>this.getImages(m,_))),this.dispatcher.registerMessageHandler("GDA",((m,_)=>this.getDashes(m,_))),this.imageManager=new rn,this.imageManager.setEventedParent(this);const p=((s=t._container)===null||s===void 0?void 0:s.lang)||typeof document<"u"&&((l=document.documentElement)===null||l===void 0?void 0:l.lang)||void 0;this.glyphManager=new jr(t._requestManager,n.localIdeographFontFamily,p),this.lineAtlas=new sa(256,512),this.crossTileSymbolIndex=new qi,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",c.bP()),D().on(Dn,this._rtlPluginLoaded),this.on("data",(m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const _=this.tileManagers[m.sourceId];if(!_)return;const x=_.getSource();if(x&&x.vectorLayerIds)for(const w in this._layers){const T=this._layers[w];T.source===x.id&&this._validateLayer(T)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new c.bQ,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(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var s,l,p;this._checkLoaded();const m=n===null?(p=(l=(s=this.stylesheet.state)===null||s===void 0?void 0:s[t])===null||l===void 0?void 0:l.default)!==null&&p!==void 0?p:null:n;if(c.bR(m,this._globalState[t]))return this;this._globalState[t]=m,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const s in t)!c.bR(this._globalState[s],t[s].default)&&(n.push(s),this._globalState[s]=t[s].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,s={};for(const l of t){s[l]=this._globalState[l];for(const p in this._layers){const m=this._layers[p],_=m.getLayoutAffectingGlobalStateRefs(),x=m.getPaintAffectingGlobalStateRefs(),w=m.getVisibilityAffectingGlobalStateRefs();if(_.has(l)&&n.add(m.source),x.has(l))for(const{name:T,value:I}of x.get(l))this._updatePaintProperty(m,T,I);w!=null&&w.has(l)&&(m.recalculateVisibility(),this._updateLayer(m))}}this.dispatcher.broadcast("UGS",s);for(const l in this.tileManagers)n.has(l)&&(this._reloadSource(l),this._changed=!0)}loadURL(t,n={},s){this.fire(new c.l("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const l=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const p=this._loadStyleRequest;c.j(l,this._loadStyleRequest).then((m=>{this._loadStyleRequest=null,this._load(m.data,n,s)})).catch((m=>{this._loadStyleRequest=null,m&&!p.signal.aborted&&this.fire(new c.k(m))}))}loadJSON(t,n={},s){this.fire(new c.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,_t.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,s)})).catch((()=>{}))}loadEmpty(){this.fire(new c.l("dataloading",{dataType:"style"})),this._load(cs,{validate:!1})}_load(t,n,s){var l,p;let m=n.transformStyle?n.transformStyle(s,t):t;if(!n.validate||!Sa(this,c.C(m))){m=Object.assign({},m),this._loaded=!0,this.stylesheet=m;for(const _ in m.sources)this.addSource(_,m.sources[_],{validate:!1});m.sprite?this._loadSprite(m.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(m.glyphs),this._createLayers(),this.light=new En(this.stylesheet.light),this._setProjectionInternal(((l=this.stylesheet.projection)===null||l===void 0?void 0:l.type)||"mercator"),this.sky=new Ha(this.stylesheet.sky),this.map.setTerrain((p=this.stylesheet.terrain)!==null&&p!==void 0?p:null),this.fire(new c.l("data",{dataType:"style"})),this.fire(new c.l("style.load"))}}_createLayers(){var t,n,s;const l=c.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",l),this._order=l.map((p=>p.id)),this._layers={},this._serializedLayers=null;for(const p of l){const m=c.bT(p,this._globalState);if(m.setEventedParent(this,{layer:{id:p.id}}),this._layers[p.id]=m,c.bU(m)&&this.tileManagers[m.source]){const _=(s=(n=p.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&s!==void 0?s:m.paint.get("raster-fade-duration");this.tileManagers[m.source].setRasterFadeDuration(_)}}}_loadSprite(t,n=!1,s=void 0){this.imageManager.setLoaded(!1);const l=new AbortController;let p;this._spriteRequest=l,(function(m,_,x,w){return c._(this,void 0,void 0,(function*(){const T=Er(m),I=x>1?"@2x":"",M={},k={};for(const{id:B,url:G}of T){const Z=_.transformRequest(tn(G,I,".json"),"SpriteJSON");M[B]=c.j(Z,w);const q=_.transformRequest(tn(G,I,".png"),"SpriteImage");k[B]=Ki.getImage(q,w)}return yield Promise.all([...Object.values(M),...Object.values(k)]),(function(B,G){return c._(this,void 0,void 0,(function*(){const Z={};for(const q in B){Z[q]={};const Y=_t.getImageCanvasContext((yield G[q]).data),te=(yield B[q]).data;for(const H in te){const{width:ee,height:re,x:J,y:oe,sdf:_e,pixelRatio:de,stretchX:me,stretchY:ge,content:Ae,textFitWidth:ke,textFitHeight:Me}=te[H];Z[q][H]={data:null,pixelRatio:de,sdf:_e,stretchX:me,stretchY:ge,content:Ae,textFitWidth:ke,textFitHeight:Me,spriteData:{width:ee,height:re,x:J,y:oe,context:Y}}}}return Z}))})(M,k)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((m=>{if(this._spriteRequest=null,m)for(const _ in m){this._spritesImagesIds[_]=[];const x=this._spritesImagesIds[_]?this._spritesImagesIds[_].filter((w=>!(w in m))):[];for(const w of x)this.imageManager.removeImage(w),this._changedImages[w]=!0;for(const w in m[_]){const T=_==="default"?w:`${_}:${w}`;this._spritesImagesIds[_].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,m[_][w],!1):this.imageManager.addImage(T,m[_][w]),n&&(this._changedImages[T]=!0)}}})).catch((m=>{this._spriteRequest=null,p=m,l.signal.aborted||this.fire(new c.k(p))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"})),s&&s(p)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const l=n.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(s)===-1)&&this.fire(new c.k(new Error(`Source layer "${s}" does not exist on source "${l.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const s=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?c.bV(s):s);const l=[];for(const p of t)if(s[p]){const m=n?c.bV(s[p]):s[p];l.push(m)}return l}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const s of n){const l=this._layers[s];l.type!=="custom"&&(t[s]=l.serialize())}return t}hasTransitions(){var t,n,s;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((s=this.projection)===null||s===void 0)&&s.hasTransition())return!0;for(const l in this.tileManagers)if(this.tileManagers[l].hasTransition())return!0;for(const l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const l=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(l.length||p.length)&&this._updateWorkerLayers(l,p);for(const m in this._updatedSources){const _=this._updatedSources[m];if(_==="reload")this._reloadSource(m);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const s={};for(const l in this.tileManagers){const p=this.tileManagers[l];s[l]=p.used,p.used=!1}for(const l of this._order){const p=this._layers[l];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.tileManagers[p.source].used=!0)}for(const l in s){const p=this.tileManagers[l];!!s[l]!=!!p.used&&p.fire(new c.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new c.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var s;this._checkLoaded();const l=this.serialize();if(t=n.transformStyle?n.transformStyle(l,t):t,((s=n.validate)===null||s===void 0||s)&&Sa(this,c.C(t)))return!1;(t=c.bV(t)).layers=c.bS(t.layers);const p=c.bW(l,t),m=this._getOperationsToPerform(p);if(m.unimplemented.length>0)throw new Error(`Unimplemented: ${m.unimplemented.join(", ")}.`);if(m.operations.length===0)return!1;for(const _ of m.operations)_();return this.stylesheet=t,this._serializedLayers=null,this.fire(new c.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],s=[];for(const l of t)switch(l.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,l.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,l.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,l.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,l.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,l.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,l.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,l.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,l.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,l.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,l.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,l.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,l.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,l.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,l.args)));break;case"setProjection":this.setProjection.apply(this,l.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,l.args)));break;case"setTransition":n.push((()=>{}));break;default:s.push(l.command)}return{operations:n,unimplemented:s}}addImage(t,n){if(this.getImage(t))return this.fire(new c.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.C.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const l=this.tileManagers[t]=new Di(t,n,this.dispatcher);l.style=this,l.setEventedParent(this,(()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:t}))),l.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new c.k(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new c.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.tileManagers[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const l=t.id;if(this.getLayer(l))return void this.fire(new c.k(new Error(`Layer "${l}" already exists on this map.`)));let p;if(t.type==="custom"){if(Sa(this,c.bX(t)))return;p=c.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(l,t.source),t=c.bV(t),t=c.e(t,{source:l})),this._validate(c.C.layer,`layers.${l}`,t,{arrayIndex:-1},s))return;p=c.bT(t,this._globalState),this._validateLayer(p),p.setEventedParent(this,{layer:{id:l}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new c.k(new Error(`Cannot add layer "${l}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,l),this._layerOrderChanged=!0,this._layers[l]=p,this._removedLayers[l]&&p.source&&p.type!=="custom"){const _=this._removedLayers[l];delete this._removedLayers[l],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.tileManagers[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const l=n?this._order.indexOf(n):this._order.length;n&&l===-1?this.fire(new c.k(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(l,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.k(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const l=this.getLayer(t);l?l.minzoom===n&&l.maxzoom===s||(n!=null&&(l.minzoom=n),s!=null&&(l.maxzoom=s),this._updateLayer(l)):this.fire(new c.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const l=this.getLayer(t);if(l){if(!c.bR(l.filter,n))return n==null?(l.setFilter(void 0),void this._updateLayer(l)):void(this._validate(c.C.filter,`layers.${l.id}.filter`,n,null,s)||(l.setFilter(c.bV(n)),this._updateLayer(l)))}else this.fire(new c.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.bV(this.getLayer(t).filter)}setLayoutProperty(t,n,s,l={}){this._checkLoaded();const p=this.getLayer(t);p?c.bR(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,l),this._updateLayer(p)):this.fire(new c.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new c.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,l={}){this._checkLoaded();const p=this.getLayer(t);p?c.bR(p.getPaintProperty(n),s)||this._updatePaintProperty(p,n,s,l):this.fire(new c.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,s,l={}){t.setPaintProperty(n,s,l)&&this._updateLayer(t),c.bU(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(s),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,l=t.sourceLayer,p=this.tileManagers[s];if(p===void 0)return void this.fire(new c.k(new Error(`The source '${s}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&l?this.fire(new c.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||l?(t.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),p.setFeatureState(l,t.id,n)):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,l=this.tileManagers[s];if(l===void 0)return void this.fire(new c.k(new Error(`The source '${s}' does not exist in the map's style.`)));const p=l.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.k(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(m,t.id,n):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,l=this.tileManagers[n];if(l!==void 0)return l.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),l.getFeatureState(s,t.id)):void this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.bY(this.tileManagers,(p=>p.serialize())),n=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,l=this.stylesheet;return c.bZ({version:l.version,name:l.name,metadata:l.metadata,light:l.light,sky:l.sky,center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,sprite:l.sprite,glyphs:l.glyphs,transition:l.transition,projection:l.projection,sources:t,layers:n,terrain:s},(p=>p!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",s={},l=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_)){s[_]=m;for(const x of t){const w=x[_];if(w)for(const T of w)l.push(T)}}}l.sort(((m,_)=>_.intersectionZ-m.intersectionZ));const p=[];for(let m=this._order.length-1;m>=0;m--){const _=this._order[m];if(n(_))for(let x=l.length-1;x>=0;x--){const w=l[x].feature;if(s[w.layer.id]<m)break;p.push(w),l.pop()}else for(const x of t){const w=x[_];if(w)for(const T of w)p.push(T.feature)}}return p}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(c.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const l={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new c.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const w of n.layers){const T=this._layers[w];if(!T)return this.fire(new c.k(new Error(`The layer '${w}' does not exist in the map's style and cannot be queried for features.`))),[];l[T.source]=!0}}const p=[];n.availableImages=this._availableImages;const m=this._serializedAllLayers(),_=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,x=Object.assign(Object.assign({},n),{layers:_,globalState:this._globalState});for(const w in this.tileManagers)n.layers&&!l[w]||p.push(Ws(this.tileManagers[w],this._layers,m,t,x,s,this.map.terrain?(T,I,M)=>this.map.terrain.getElevation(T,I,M):void 0));return this.placement&&p.push((function(w,T,I,M,k,B,G){const Z={},q=B.queryRenderedSymbols(M),Y=[];for(const te of Object.keys(q).map(Number))Y.push(G[te]);Y.sort(Si);for(const te of Y){const H=te.featureIndex.lookupSymbolFeatures(q[te.bucketInstanceId],T,te.bucketIndex,te.sourceLayerIndex,{filterSpec:k.filter,globalState:k.globalState},k.layers,k.availableImages,w);for(const ee in H){const re=Z[ee]=Z[ee]||[],J=H[ee];J.sort(((oe,_e)=>{const de=te.featureSortOrder;if(de){const me=de.indexOf(oe.featureIndex);return de.indexOf(_e.featureIndex)-me}return _e.featureIndex-oe.featureIndex}));for(const oe of J)re.push(oe)}}return(function(te,H,ee){for(const re in te)for(const J of te[re])Ji(J,ee[H[re].source]);return te})(Z,w,I)})(this._layers,m,this.tileManagers,t,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n!=null&&n.filter&&this._validate(c.C.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.tileManagers[t];return s?(function(l,p){const m=l.getRenderableIds().map((w=>l.getTileByID(w))),_=[],x={};for(let w=0;w<m.length;w++){const T=m[w],I=T.tileID.canonical.key;x[I]||(x[I]=!0,T.querySourceFeatures(_,p))}return _})(s,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let l=!1;for(const m in t)if(!c.bR(t[m],s[m])){l=!0;break}if(!l)return;const p={now:st(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.stylesheet.projection=t,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const s=this.getSky();let l=!1;if(!t&&!s)return;if(t&&!s)l=!0;else if(!t&&s)l=!0;else for(const m in t)if(!c.bR(t[m],s[m])){l=!0;break}if(!l)return;const p={now:st(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(p)}_setProjectionInternal(t){const n=(function(s,l){const p={constrainOverride:l};if(Array.isArray(s)){const m=new Ec({type:s});return{projection:m,transform:new Ta(p),cameraHelper:new zc(m)}}switch(s){case"mercator":return{projection:new Fi,transform:new On(p),cameraHelper:new jn};case"globe":{const m=new Ec({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:m,transform:new Ta(p),cameraHelper:new zc(m)}}case"vertical-perspective":return{projection:new ul,transform:new wa(p),cameraHelper:new oi};default:return c.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new Fi,transform:new On(p),cameraHelper:new jn}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const s in this.tileManagers)this.tileManagers[s].reload()}_validate(t,n,s,l,p={}){return(!p||p.validate!==!1)&&Sa(this,t.call(c.C,c.e({key:n,style:this.serialize(),value:s,styleSpec:c.u},l)))}_remove(t=!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),D().off(Dn,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const s=this.tileManagers[n];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,s,l,p=!1){let m=!1,_=!1;const x={};for(const w of this._order){const T=this._layers[w];if(T.type!=="symbol")continue;if(!x[T.source]){const M=this.tileManagers[T.source];x[T.source]=M.getRenderableIds(!0).map((k=>M.getTileByID(k))).sort(((k,B)=>B.tileID.overscaledZ-k.tileID.overscaledZ||(k.tileID.isLessThan(B.tileID)?-1:1)))}const I=this.crossTileSymbolIndex.addLayer(T,x[T.source],t.center.lng);m=m||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(st(),t.zoom))&&(this.pauseablePlacement=new ma(t,this.map.terrain,this._order,p,n,s,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,x),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(st()),_=!0),m&&this.pauseablePlacement.placement.setStale()),_||m)for(const w of this._order){const T=this._layers[w];T.type==="symbol"&&this.placement.updateLayerOpacities(T,x[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(st())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return c._(this,void 0,void 0,(function*(){const s=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const l=this.tileManagers[n.source];return l&&l.setDependencies(n.tileID.key,n.type,n.icons),s}))}getGlyphs(t,n){return c._(this,void 0,void 0,(function*(){const s=yield this.glyphManager.getGlyphs(n.stacks),l=this.tileManagers[n.source];return l&&l.setDependencies(n.tileID.key,n.type,[""]),s}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.C.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return c._(this,void 0,void 0,(function*(){const s={};for(const[l,p]of Object.entries(n.dashes))s[l]=this.lineAtlas.getDash(p.dasharray,p.round);return s}))}addSprite(t,n,s={},l){this._checkLoaded();const p=[{id:t,url:n}],m=[...Er(this.stylesheet.sprite),...p];this._validate(c.C.sprite,"sprite",m,null,s)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,l))}removeSprite(t){this._checkLoaded();const n=Er(this.stylesheet.sprite);if(n.find((s=>s.id===t))){if(this._spritesImagesIds[t])for(const s of this._spritesImagesIds[t])this.imageManager.removeImage(s),this._changedImages[s]=!0;n.splice(n.findIndex((s=>s.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}else this.fire(new c.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Er(this.stylesheet.sprite)}setSprite(t,n={},s){this._checkLoaded(),t&&this._validate(c.C.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,s):(this._unloadSprite(),s&&s(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(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.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 ah=c.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class io{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,l,p,m,_,x,w){this.context=t;let T=this.boundPaintVertexBuffers.length!==l.length;for(let I=0;!T&&I<l.length;I++)this.boundPaintVertexBuffers[I]!==l[I]&&(T=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==s||T||this.boundIndexBuffer!==p||this.boundVertexOffset!==m||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==w?this.freshBind(n,s,l,p,m,_,x,w):(t.bindVertexArray.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),x&&x.bind(),w&&w.bind())}freshBind(t,n,s,l,p,m,_,x){const w=t.numAttributes,T=this.context,I=T.gl;this.vao&&this.destroy(),this.vao=T.createVertexArray(),T.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=l,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=m,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,n.enableAttributes(I,t);for(const M of s)M.enableAttributes(I,t);m&&m.enableAttributes(I,t),_&&_.enableAttributes(I,t),x&&x.enableAttributes(I,t),n.bind(),n.setVertexAttribPointers(I,t,p);for(const M of s)M.bind(),M.setVertexAttribPointers(I,t,p);m&&(m.bind(),m.setVertexAttribPointers(I,t,p)),l&&l.bind(),_&&(_.bind(),_.setVertexAttribPointers(I,t,p)),x&&(x.bind(),x.setVertexAttribPointers(I,t,p)),T.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const sh=(d,t,n,s,l)=>({u_texture:0,u_ele_delta:d,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):c.bp.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:l?0:n?n.calculateFogBlendOpacity(s):0,u_horizon_color:n?n.properties.get("horizon-color"):c.bp.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:l?1:0}),Pa={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 ro(d){const t=[];for(let n=0;n<d.length;n++){if(d[n]===null)continue;const s=d[n].split(" ");t.push(s.pop())}return t}class kc{constructor(t,n,s,l,p,m,_,x,w=[]){const T=t.gl;this.program=T.createProgram();const I=ro(n.staticAttributes),M=s?s.getBinderAttributes():[],k=I.concat(M),B=Nt.prelude.staticUniforms?ro(Nt.prelude.staticUniforms):[],G=_.staticUniforms?ro(_.staticUniforms):[],Z=n.staticUniforms?ro(n.staticUniforms):[],q=s?s.getBinderUniforms():[],Y=B.concat(G).concat(Z).concat(q),te=[];for(const de of Y)te.indexOf(de)<0&&te.push(de);const H=s?s.defines():[];lr(T)&&H.unshift("#version 300 es"),p&&H.push("#define OVERDRAW_INSPECTOR;"),m&&H.push("#define TERRAIN3D;"),x&&H.push(x),w&&H.push(...w);let ee=H.concat(Nt.prelude.fragmentSource,_.fragmentSource,n.fragmentSource).join(`
808`),re=H.concat(Nt.prelude.vertexSource,_.vertexSource,n.vertexSource).join(`
809`);lr(T)||(ee=(function(de){return de.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(ee),re=(function(de){return de.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(re));const J=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(J,ee),T.compileShader(J),!T.getShaderParameter(J,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(J)}`);T.attachShader(this.program,J);const oe=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(oe,re),T.compileShader(oe),!T.getShaderParameter(oe,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(oe)}`);T.attachShader(this.program,oe),this.attributes={};const _e={};this.numAttributes=k.length;for(let de=0;de<this.numAttributes;de++)k[de]&&(T.bindAttribLocation(this.program,de,k[de]),this.attributes[k[de]]=de);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(oe),T.deleteShader(J);for(let de=0;de<te.length;de++){const me=te[de];if(me&&!_e[me]){const ge=T.getUniformLocation(this.program,me);ge&&(_e[me]=ge)}}this.fixedUniforms=l(t,_e),this.terrainUniforms=((de,me)=>({u_depth:new c.b_(de,me.u_depth),u_terrain:new c.b_(de,me.u_terrain),u_terrain_dim:new c.bq(de,me.u_terrain_dim),u_terrain_matrix:new c.c0(de,me.u_terrain_matrix),u_terrain_unpack:new c.c1(de,me.u_terrain_unpack),u_terrain_exaggeration:new c.bq(de,me.u_terrain_exaggeration)}))(t,_e),this.projectionUniforms=((de,me)=>({u_projection_matrix:new c.c0(de,me.u_projection_matrix),u_projection_tile_mercator_coords:new c.c1(de,me.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.c1(de,me.u_projection_clipping_plane),u_projection_transition:new c.bq(de,me.u_projection_transition),u_projection_fallback_matrix:new c.c0(de,me.u_projection_fallback_matrix)}))(t,_e),this.binderUniforms=s?s.getUniforms(t,_e):[]}draw(t,n,s,l,p,m,_,x,w,T,I,M,k,B,G,Z,q,Y,te){const H=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(l),t.setColorMode(p),t.setCullFace(m),x){t.activeTexture.set(H.TEXTURE2),H.bindTexture(H.TEXTURE_2D,x.depthTexture),t.activeTexture.set(H.TEXTURE3),H.bindTexture(H.TEXTURE_2D,x.texture);for(const re in this.terrainUniforms)this.terrainUniforms[re].set(x[re])}if(w)for(const re in w)this.projectionUniforms[Pa[re]].set(w[re]);if(_)for(const re in this.fixedUniforms)this.fixedUniforms[re].set(_[re]);Z&&Z.setUniforms(t,this.binderUniforms,B,{zoom:G});let ee=0;switch(n){case H.LINES:ee=2;break;case H.TRIANGLES:ee=3;break;case H.LINE_STRIP:ee=1}for(const re of k.get()){const J=re.vaos||(re.vaos={});(J[T]||(J[T]=new io)).bind(t,this,I,Z?Z.getPaintVertexBuffers():[],M,re.vertexOffset,q,Y,te),H.drawElements(n,re.primitiveLength*ee,H.UNSIGNED_SHORT,re.primitiveOffset*ee*2)}}}function Dc(d,t,n){const s=1/c.aN(n,1,t.transform.tileZoom),l=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/l,m=p*(n.tileID.canonical.x+n.tileID.wrap*l),_=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,d.fromScale,d.toScale],u_fade:d.t,u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}const fl=(d,t,n,s)=>{const l=d.style.light,p=l.properties.get("position"),m=[p.x,p.y,p.z],_=c.c4();l.properties.get("anchor")==="viewport"&&c.c5(_,d.transform.bearingInRadians),c.c6(m,m,_);const x=d.transform.transformLightDirection(m),w=l.properties.get("color");return{u_lightpos:m,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:s}},ml=(d,t,n,s,l,p,m)=>c.e(fl(d,t,n,s),Dc(p,d,m),{u_height_factor:-Math.pow(2,l.overscaledZ)/m.tileSize/8}),gl=(d,t,n,s)=>c.e(Dc(t,d,n),{u_fill_translate:s}),Rc=(d,t)=>({u_world:d,u_fill_translate:t}),Lc=(d,t,n,s,l)=>c.e(gl(d,t,n,l),{u_world:s}),Fc=(d,t,n,s,l)=>{const p=d.transform;let m,_,x=0;if(n.paint.get("circle-pitch-alignment")==="map"){const w=c.aN(t,1,p.zoom);m=!0,_=[w,w],x=w/(c.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*l}else m=!1,_=p.pixelsToGLUnits;return{u_camera_to_center_distance:p.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+m,u_device_pixel_ratio:d.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Un=d=>({u_pixel_extrude_scale:[1/d.width,1/d.height]}),Bc=d=>({u_viewport_size:[d.width,d.height]}),_l=(d,t=1)=>({u_color:d,u_overlay:0,u_overlay_scale:t}),Ma=(d,t,n,s)=>{const l=c.aN(d,1,t)/(c.a5*Math.pow(2,d.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:c.aN(d,1,t),u_intensity:n,u_globe_extrude_scale:l}},Oc=(d,t,n,s)=>{const l=c.N();c.c7(l,0,d.width,d.height,0,0,1);const p=d.context.gl;return{u_matrix:l,u_world:[p.drawingBufferWidth,p.drawingBufferHeight],u_image:n,u_color_ramp:s,u_opacity:t.paint.get("heatmap-opacity")}},no=(d,t,n)=>{const s=n.paint.get("hillshade-accent-color");let l;switch(n.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const p=n.getIlluminationProperties();for(let m=0;m<p.directionRadians.length;m++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(p.directionRadians[m]+=d.transform.bearingInRadians);return{u_image:0,u_latrange:lh(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:p.altitudeRadians,u_azimuths:p.directionRadians,u_accent:s,u_method:l,u_highlights:p.highlightColor,u_shadows:p.shadowColor}},oh=(d,t)=>{const n=t.stride,s=c.N();return c.c7(s,0,c.a5,-c.a5,0,0,1),c.O(s,s,[0,-c.a5,0]),{u_matrix:s,u_image:1,u_dimension:[n,n],u_zoom:d.overscaledZ,u_unpack:t.getUnpackVector()}};function lh(d,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new c.a9(0,s/n).toLngLat().lat,new c.a9(0,(s+1)/n).toLngLat().lat]}const jc=(d,t,n=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:n,u_opacity:d.paint.get("color-relief-opacity")}),us=(d,t,n,s)=>{const l=d.transform;return{u_translation:so(d,t,n),u_ratio:s/c.aN(t,1,l.zoom),u_device_pixel_ratio:d.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Vc=(d,t,n,s,l)=>c.e(us(d,t,n,s),{u_image:0,u_image_height:l}),yl=(d,t,n,s,l)=>{const p=d.transform,m=xr(t,p);return{u_translation:so(d,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:s/c.aN(t,1,p.zoom),u_device_pixel_ratio:d.pixelRatio,u_image:0,u_scale:[m,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Nc=(d,t,n,s,l)=>{const p=xr(t,d.transform);return c.e(us(d,t,n,s),{u_tileratio:p,u_crossfade_from:l.fromScale,u_crossfade_to:l.toScale,u_image:0,u_mix:l.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})},ao=(d,t,n,s,l,p)=>{const m=xr(t,d.transform);return c.e(us(d,t,n,s),{u_image:0,u_image_height:p,u_tileratio:m,u_crossfade_from:l.fromScale,u_crossfade_to:l.toScale,u_image_dash:1,u_mix:l.t,u_lineatlas_width:d.lineAtlas.width,u_lineatlas_height:d.lineAtlas.height})};function xr(d,t){return 1/c.aN(d,1,t.tileZoom)}function so(d,t,n){return c.aO(d.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const xl=(d,t,n,s,l)=>{return{u_tl_parent:d,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(m=s.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=s.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:vl(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var p,m};function vl(d){d*=Math.PI/180;const t=Math.sin(d),n=Math.cos(d);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const bl=(d,t,n,s,l,p,m,_,x,w,T,I,M)=>{const k=m.transform;return{u_is_size_zoom_constant:+(d==="constant"||d==="source"),u_is_size_feature_constant:+(d==="constant"||d==="c
809amera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:k.width/k.height,u_fade_change:m.options.fadeDuration?m.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+T,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:p,u_texsize:I,u_texture:0,u_translation:w,u_pitched_scale:M}},oo=(d,t,n,s,l,p,m,_,x,w,T,I,M,k)=>{const B=m.transform;return c.e(bl(d,t,n,s,l,p,m,_,x,w,T,I,k),{u_gamma_scale:s?Math.cos(B.pitch*Math.PI/180)*B.cameraToCenterDistance:1,u_device_pixel_ratio:m.pixelRatio,u_is_halo:1})},Gn=(d,t,n,s,l,p,m,_,x,w,T,I,M)=>c.e(oo(d,t,n,s,l,p,m,_,x,w,!0,T,0,M),{u_texsize_icon:I,u_texture_icon:1}),wl=(d,t)=>({u_opacity:d,u_color:t}),ch=(d,t,n,s,l)=>c.e((function(p,m,_,x){const w=_.imageManager.getPattern(p.from.toString()),T=_.imageManager.getPattern(p.to.toString()),{width:I,height:M}=_.imageManager.getPixelSize(),k=Math.pow(2,x.tileID.overscaledZ),B=x.tileSize*Math.pow(2,_.transform.tileZoom)/k,G=B*(x.tileID.canonical.x+x.tileID.wrap*k),Z=B*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:w.tl,u_pattern_br_a:w.br,u_pattern_tl_b:T.tl,u_pattern_br_b:T.br,u_texsize:[I,M],u_mix:m.t,u_pattern_size_a:w.displaySize,u_pattern_size_b:T.displaySize,u_scale_a:m.fromScale,u_scale_b:m.toScale,u_tile_units_to_pixels:1/c.aN(x,1,_.transform.tileZoom),u_pixel_coord_upper:[G>>16,Z>>16],u_pixel_coord_lower:[65535&G,65535&Z]}})(n,l,t,s),{u_opacity:d}),Uc=(d,t)=>{},uh={fillExtrusion:(d,t)=>({u_lightpos:new c.c2(d,t.u_lightpos),u_lightpos_globe:new c.c2(d,t.u_lightpos_globe),u_lightintensity:new c.bq(d,t.u_lightintensity),u_lightcolor:new c.c2(d,t.u_lightcolor),u_vertical_gradient:new c.bq(d,t.u_vertical_gradient),u_opacity:new c.bq(d,t.u_opacity),u_fill_translate:new c.c3(d,t.u_fill_translate)}),fillExtrusionPattern:(d,t)=>({u_lightpos:new c.c2(d,t.u_lightpos),u_lightpos_globe:new c.c2(d,t.u_lightpos_globe),u_lightintensity:new c.bq(d,t.u_lightintensity),u_lightcolor:new c.c2(d,t.u_lightcolor),u_vertical_gradient:new c.bq(d,t.u_vertical_gradient),u_height_factor:new c.bq(d,t.u_height_factor),u_opacity:new c.bq(d,t.u_opacity),u_fill_translate:new c.c3(d,t.u_fill_translate),u_image:new c.b_(d,t.u_image),u_texsize:new c.c3(d,t.u_texsize),u_pixel_coord_upper:new c.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c3(d,t.u_pixel_coord_lower),u_scale:new c.c2(d,t.u_scale),u_fade:new c.bq(d,t.u_fade)}),fill:(d,t)=>({u_fill_translate:new c.c3(d,t.u_fill_translate)}),fillPattern:(d,t)=>({u_image:new c.b_(d,t.u_image),u_texsize:new c.c3(d,t.u_texsize),u_pixel_coord_upper:new c.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c3(d,t.u_pixel_coord_lower),u_scale:new c.c2(d,t.u_scale),u_fade:new c.bq(d,t.u_fade),u_fill_translate:new c.c3(d,t.u_fill_translate)}),fillOutline:(d,t)=>({u_world:new c.c3(d,t.u_world),u_fill_translate:new c.c3(d,t.u_fill_translate)}),fillOutlinePattern:(d,t)=>({u_world:new c.c3(d,t.u_world),u_image:new c.b_(d,t.u_image),u_texsize:new c.c3(d,t.u_texsize),u_pixel_coord_upper:new c.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c3(d,t.u_pixel_coord_lower),u_scale:new c.c2(d,t.u_scale),u_fade:new c.bq(d,t.u_fade),u_fill_translate:new c.c3(d,t.u_fill_translate)}),circle:(d,t)=>({u_camera_to_center_distance:new c.bq(d,t.u_camera_to_center_distance),u_scale_with_map:new c.b_(d,t.u_scale_with_map),u_pitch_with_map:new c.b_(d,t.u_pitch_with_map),u_extrude_scale:new c.c3(d,t.u_extrude_scale),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_globe_extrude_scale:new c.bq(d,t.u_globe_extrude_scale),u_translate:new c.c3(d,t.u_translate)}),collisionBox:(d,t)=>({u_pixel_extrude_scale:new c.c3(d,t.u_pixel_extrude_scale)}),collisionCircle:(d,t)=>({u_viewport_size:new c.c3(d,t.u_viewport_size)}),debug:(d,t)=>({u_color:new c.b$(d,t.u_color),u_overlay:new c.b_(d,t.u_overlay),u_overlay_scale:new c.bq(d,t.u_overlay_scale)}),depth:Uc,clippingMask:Uc,heatmap:(d,t)=>({u_extrude_scale:new c.bq(d,t.u_extrude_scale),u_intensity:new c.bq(d,t.u_intensity),u_globe_extrude_scale:new c.bq(d,t.u_globe_extrude_scale)}),heatmapTexture:(d,t)=>({u_matrix:new c.c0(d,t.u_matrix),u_world:new c.c3(d,t.u_world),u_image:new c.b_(d,t.u_image),u_color_ramp:new c.b_(d,t.u_color_ramp),u_opacity:new c.bq(d,t.u_opacity)}),hillshade:(d,t)=>({u_image:new c.b_(d,t.u_image),u_latrange:new c.c3(d,t.u_latrange),u_exaggeration:new c.bq(d,t.u_exaggeration),u_altitudes:new c.c9(d,t.u_altitudes),u_azimuths:new c.c9(d,t.u_azimuths),u_accent:new c.b$(d,t.u_accent),u_method:new c.b_(d,t.u_method),u_shadows:new c.c8(d,t.u_shadows),u_highlights:new c.c8(d,t.u_highlights)}),hillshadePrepare:(d,t)=>({u_matrix:new c.c0(d,t.u_matrix),u_image:new c.b_(d,t.u_image),u_dimension:new c.c3(d,t.u_dimension),u_zoom:new c.bq(d,t.u_zoom),u_unpack:new c.c1(d,t.u_unpack)}),colorRelief:(d,t)=>({u_image:new c.b_(d,t.u_image),u_unpack:new c.c1(d,t.u_unpack),u_dimension:new c.c3(d,t.u_dimension),u_elevation_stops:new c.b_(d,t.u_elevation_stops),u_color_stops:new c.b_(d,t.u_color_stops),u_color_ramp_size:new c.b_(d,t.u_color_ramp_size),u_opacity:new c.bq(d,t.u_opacity)}),line:(d,t)=>({u_translation:new c.c3(d,t.u_translation),u_ratio:new c.bq(d,t.u_ratio),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new c.c3(d,t.u_units_to_pixels)}),lineGradient:(d,t)=>({u_translation:new c.c3(d,t.u_translation),u_ratio:new c.bq(d,t.u_ratio),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new c.c3(d,t.u_units_to_pixels),u_image:new c.b_(d,t.u_image),u_image_height:new c.bq(d,t.u_image_height)}),linePattern:(d,t)=>({u_translation:new c.c3(d,t.u_translation),u_texsize:new c.c3(d,t.u_texsize),u_ratio:new c.bq(d,t.u_ratio),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_image:new c.b_(d,t.u_image),u_units_to_pixels:new c.c3(d,t.u_units_to_pixels),u_scale:new c.c2(d,t.u_scale),u_fade:new c.bq(d,t.u_fade)}),lineSDF:(d,t)=>({u_translation:new c.c3(d,t.u_translation),u_ratio:new c.bq(d,t.u_ratio),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new c.c3(d,t.u_units_to_pixels),u_image:new c.b_(d,t.u_image),u_mix:new c.bq(d,t.u_mix),u_tileratio:new c.bq(d,t.u_tileratio),u_crossfade_from:new c.bq(d,t.u_crossfade_from),u_crossfade_to:new c.bq(d,t.u_crossfade_to),u_lineatlas_width:new c.bq(d,t.u_lineatlas_width),u_lineatlas_height:new c.bq(d,t.u_lineatlas_height)}),lineGradientSDF:(d,t)=>({u_translation:new c.c3(d,t.u_translation),u_ratio:new c.bq(d,t.u_ratio),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_units_to_pixels:new c.c3(d,t.u_units_to_pixels),u_image:new c.b_(d,t.u_image),u_image_height:new c.bq(d,t.u_image_height),u_tileratio:new c.bq(d,t.u_tileratio),u_crossfade_from:new c.bq(d,t.u_crossfade_from),u_crossfade_to:new c.bq(d,t.u_crossfade_to),u_image_dash:new c.b_(d,t.u_image_dash),u_mix:new c.bq(d,t.u_mix),u_lineatlas_width:new c.bq(d,t.u_lineatlas_width),u_lineatlas_height:new c.bq(d,t.u_lineatlas_height)}),raster:(d,t)=>({u_tl_parent:new c.c3(d,t.u_tl_parent),u_scale_parent:new c.bq(d,t.u_scale_parent),u_buffer_scale:new c.bq(d,t.u_buffer_scale),u_fade_t:new c.bq(d,t.u_fade_t),u_opacity:new c.bq(d,t.u_opacity),u_image0:new c.b_(d,t.u_image0),u_image1:new c.b_(d,t.u_image1),u_brightness_low:new c.bq(d,t.u_brightness_low),u_brightness_high:new c.bq(d,t.u_brightness_high),u_saturation_factor:new c.bq(d,t.u_saturation_factor),u_contrast_factor:new c.bq(d,t.u_contrast_factor),u_spin_weights:new c.c2(d,t.u_spin_weights),u_coords_top:new c.c1(d,t.u_coords_top),u_coords_bottom:new c.c1(d,t.u_coords_bottom)}),symbolIcon:(d,t)=>({u_is_size_zoom_constant:new c.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.b_(d,t.u_is_size_feature_constant),u_size_t:new c.bq(d,t.u_size_t),u_size:new c.bq(d,t.u_size),u_camera_to_center_distance:new c.bq(d,t.u_camera_to_center_distance),u_pitch:new c.bq(d,t.u_pitch),u_rotate_symbol:new c.b_(d,t.u_rotate_symbol),u_aspect_ratio:new c.bq(d,t.u_aspect_ratio),u_fade_change:new c.bq(d,t.u_fade_change),u_label_plane_matrix:new c.c0(d,t.u_label_plane_matrix
vendor: 166,018 bytes, lines 809-811
809),u_coord_matrix:new c.c0(d,t.u_coord_matrix),u_is_text:new c.b_(d,t.u_is_text),u_pitch_with_map:new c.b_(d,t.u_pitch_with_map),u_is_along_line:new c.b_(d,t.u_is_along_line),u_is_variable_anchor:new c.b_(d,t.u_is_variable_anchor),u_texsize:new c.c3(d,t.u_texsize),u_texture:new c.b_(d,t.u_texture),u_translation:new c.c3(d,t.u_translation),u_pitched_scale:new c.bq(d,t.u_pitched_scale)}),symbolSDF:(d,t)=>({u_is_size_zoom_constant:new c.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.b_(d,t.u_is_size_feature_constant),u_size_t:new c.bq(d,t.u_size_t),u_size:new c.bq(d,t.u_size),u_camera_to_center_distance:new c.bq(d,t.u_camera_to_center_distance),u_pitch:new c.bq(d,t.u_pitch),u_rotate_symbol:new c.b_(d,t.u_rotate_symbol),u_aspect_ratio:new c.bq(d,t.u_aspect_ratio),u_fade_change:new c.bq(d,t.u_fade_change),u_label_plane_matrix:new c.c0(d,t.u_label_plane_matrix),u_coord_matrix:new c.c0(d,t.u_coord_matrix),u_is_text:new c.b_(d,t.u_is_text),u_pitch_with_map:new c.b_(d,t.u_pitch_with_map),u_is_along_line:new c.b_(d,t.u_is_along_line),u_is_variable_anchor:new c.b_(d,t.u_is_variable_anchor),u_texsize:new c.c3(d,t.u_texsize),u_texture:new c.b_(d,t.u_texture),u_gamma_scale:new c.bq(d,t.u_gamma_scale),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_is_halo:new c.b_(d,t.u_is_halo),u_translation:new c.c3(d,t.u_translation),u_pitched_scale:new c.bq(d,t.u_pitched_scale)}),symbolTextAndIcon:(d,t)=>({u_is_size_zoom_constant:new c.b_(d,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.b_(d,t.u_is_size_feature_constant),u_size_t:new c.bq(d,t.u_size_t),u_size:new c.bq(d,t.u_size),u_camera_to_center_distance:new c.bq(d,t.u_camera_to_center_distance),u_pitch:new c.bq(d,t.u_pitch),u_rotate_symbol:new c.b_(d,t.u_rotate_symbol),u_aspect_ratio:new c.bq(d,t.u_aspect_ratio),u_fade_change:new c.bq(d,t.u_fade_change),u_label_plane_matrix:new c.c0(d,t.u_label_plane_matrix),u_coord_matrix:new c.c0(d,t.u_coord_matrix),u_is_text:new c.b_(d,t.u_is_text),u_pitch_with_map:new c.b_(d,t.u_pitch_with_map),u_is_along_line:new c.b_(d,t.u_is_along_line),u_is_variable_anchor:new c.b_(d,t.u_is_variable_anchor),u_texsize:new c.c3(d,t.u_texsize),u_texsize_icon:new c.c3(d,t.u_texsize_icon),u_texture:new c.b_(d,t.u_texture),u_texture_icon:new c.b_(d,t.u_texture_icon),u_gamma_scale:new c.bq(d,t.u_gamma_scale),u_device_pixel_ratio:new c.bq(d,t.u_device_pixel_ratio),u_is_halo:new c.b_(d,t.u_is_halo),u_translation:new c.c3(d,t.u_translation),u_pitched_scale:new c.bq(d,t.u_pitched_scale)}),background:(d,t)=>({u_opacity:new c.bq(d,t.u_opacity),u_color:new c.b$(d,t.u_color)}),backgroundPattern:(d,t)=>({u_opacity:new c.bq(d,t.u_opacity),u_image:new c.b_(d,t.u_image),u_pattern_tl_a:new c.c3(d,t.u_pattern_tl_a),u_pattern_br_a:new c.c3(d,t.u_pattern_br_a),u_pattern_tl_b:new c.c3(d,t.u_pattern_tl_b),u_pattern_br_b:new c.c3(d,t.u_pattern_br_b),u_texsize:new c.c3(d,t.u_texsize),u_mix:new c.bq(d,t.u_mix),u_pattern_size_a:new c.c3(d,t.u_pattern_size_a),u_pattern_size_b:new c.c3(d,t.u_pattern_size_b),u_scale_a:new c.bq(d,t.u_scale_a),u_scale_b:new c.bq(d,t.u_scale_b),u_pixel_coord_upper:new c.c3(d,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c3(d,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.bq(d,t.u_tile_units_to_pixels)}),terrain:(d,t)=>({u_texture:new c.b_(d,t.u_texture),u_ele_delta:new c.bq(d,t.u_ele_delta),u_fog_matrix:new c.c0(d,t.u_fog_matrix),u_fog_color:new c.b$(d,t.u_fog_color),u_fog_ground_blend:new c.bq(d,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.bq(d,t.u_fog_ground_blend_opacity),u_horizon_color:new c.b$(d,t.u_horizon_color),u_horizon_fog_blend:new c.bq(d,t.u_horizon_fog_blend),u_is_globe_mode:new c.bq(d,t.u_is_globe_mode)}),terrainDepth:(d,t)=>({u_ele_delta:new c.bq(d,t.u_ele_delta)}),terrainCoords:(d,t)=>({u_texture:new c.b_(d,t.u_texture),u_terrain_coords_id:new c.bq(d,t.u_terrain_coords_id),u_ele_delta:new c.bq(d,t.u_ele_delta)}),projectionErrorMeasurement:(d,t)=>({u_input:new c.bq(d,t.u_input),u_output_expected:new c.bq(d,t.u_output_expected)}),atmosphere:(d,t)=>({u_sun_pos:new c.c2(d,t.u_sun_pos),u_atmosphere_blend:new c.bq(d,t.u_atmosphere_blend),u_globe_position:new c.c2(d,t.u_globe_position),u_globe_radius:new c.bq(d,t.u_globe_radius),u_inv_proj_matrix:new c.c0(d,t.u_inv_proj_matrix)}),sky:(d,t)=>({u_sky_color:new c.b$(d,t.u_sky_color),u_horizon_color:new c.b$(d,t.u_horizon_color),u_horizon:new c.c3(d,t.u_horizon),u_horizon_normal:new c.c3(d,t.u_horizon_normal),u_sky_horizon_blend:new c.bq(d,t.u_sky_horizon_blend),u_sky_blend:new c.bq(d,t.u_sky_blend)})};class hh{constructor(t,n,s){this.context=t;const l=t.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Gc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class dh{constructor(t,n,s,l){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=l,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const l=n.attributes[this.attributes[s].name];l!==void 0&&t.enableVertexAttribArray(l)}}setVertexAttribPointers(t,n,s){for(let l=0;l<this.attributes.length;l++){const p=this.attributes[l],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Gc[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class mt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class lo extends mt{getDefault(){return c.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class co extends mt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class uo extends mt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Tl extends mt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class qn extends mt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class hs extends mt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Ia extends mt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class cr extends mt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class qc extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class $c extends mt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Sl extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class $n extends mt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ho extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class po extends mt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ds extends mt{getDefault(){return c.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class fo extends mt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Zc extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Ea extends mt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ca extends mt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Wc extends mt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Pl extends mt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ht extends mt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class mo extends mt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class ph extends mt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Hc extends mt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ps extends mt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class fh extends mt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class mh extends mt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const s=this.gl;lr(s)?s.bindVertexArray(t):(n=s.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Xc extends mt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class gh extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ml extends mt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Aa extends mt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class fs extends Aa{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class go extends Aa{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Il extends Aa{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const El="Framebuffer is not complete";class _o{constructor(t,n,s,l,p){this.context=t,this.width=n,this.height=s;const m=t.gl,_=this.framebuffer=m.createFramebuffer();if(this.colorAttachment=new fs(t,_),l)this.depthAttachment=p?new Il(t,_):new go(t,_);else if(p)throw new Error("Stencil cannot be set without depth");if(m.checkFramebufferStatus(m.FRAMEBUFFER)!==m.FRAMEBUFFER_COMPLETE)throw new Error(El)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class yo{constructor(t){var n,s;if(this.gl=t,this.clearColor=new lo(this),this.clearDepth=new co(this),this.clearStencil=new uo(this),this.colorMask=new Tl(this),this.depthMask=new qn(this),this.stencilMask=new hs(this),this.stencilFunc=new Ia(this),this.stencilOp=new cr(this),this.stencilTest=new qc(this),this.depthRange=new $c(this),this.depthTest=new Sl(this),this.depthFunc=new $n(this),this.blend=new ho(this),this.blendFunc=new po(this),this.blendColor=new ds(this),this.blendEquation=new fo(this),this.cullFace=new Zc(this),this.cullFaceSide=new Ea(this),this.frontFace=new Ca(this),this.program=new Wc(this),this.activeTexture=new Pl(this),this.viewport=new ht(this),this.bindFramebuffer=new mo(this),this.bindRenderbuffer=new ph(this),this.bindTexture=new Hc(this),this.bindVertexBuffer=new ps(this),this.bindElementBuffer=new fh(this),this.bindVertexArray=new mh(this),this.pixelStoreUnpack=new Xc(this),this.pixelStoreUnpackPremultiplyAlpha=new gh(this),this.pixelStoreUnpackFlipY=new Ml(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),lr(t)){this.HALF_FLOAT=t.HALF_FLOAT;const l=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=t.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const l=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.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(t,n){return new hh(this,t,n)}createVertexBuffer(t,n,s){return new dh(this,t,n,s)}createRenderbuffer(t,n,s){const l=this.gl,p=l.createRenderbuffer();return this.bindRenderbuffer.set(p),l.renderbufferStorage(l.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s,l){return new _o(this,t,n,s,l)}clear({color:t,depth:n,stencil:s}){const l=this.gl;let p=0;t&&(p|=l.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(p|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s!==void 0&&(p|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(p)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){c.bR(t.blendFunction,Mt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return lr(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return lr(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let dn;function Zn(d,t,n,s,l){const p=d.context,m=d.transform,_=p.gl,x=d.useProgram("collisionBox"),w=[];let T=0,I=0;for(let q=0;q<s.length;q++){const Y=s[q],te=t.getTile(Y).getBucket(n);if(!te)continue;const H=l?te.textCollisionBox:te.iconCollisionBox,ee=te.collisionCircleArray;ee.length>0&&(w.push({circleArray:ee,circleOffset:I,coord:Y}),T+=ee.length/4,I=T),H&&x.draw(p,_.LINES,lt.disabled,pt.disabled,d.colorModeForRenderPass(),dt.disabled,Un(d.transform),d.style.map.terrain&&d.style.map.terrain.getTerrainData(Y),m.getProjectionData({overscaledTileID:Y,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,null,d.transform.zoom,null,null,H.collisionVertexBuffer)}if(!l||!w.length)return;const M=d.useProgram("collisionCircle"),k=new c.ca;k.resize(4*T),k._trim();let B=0;for(const q of w)for(let Y=0;Y<q.circleArray.length/4;Y++){const te=4*Y,H=q.circleArray[te+0],ee=q.circleArray[te+1],re=q.circleArray[te+2],J=q.circleArray[te+3];k.emplace(B++,H,ee,re,J,0),k.emplace(B++,H,ee,re,J,1),k.emplace(B++,H,ee,re,J,2),k.emplace(B++,H,ee,re,J,3)}(!dn||dn.length<2*T)&&(dn=(function(q){const Y=2*q,te=new c.cc;te.resize(Y),te._trim();for(let H=0;H<Y;H++){const ee=6*H;te.uint16[ee+0]=4*H+0,te.uint16[ee+1]=4*H+1,te.uint16[ee+2]=4*H+2,te.uint16[ee+3]=4*H+2,te.uint16[ee+4]=4*H+3,te.uint16[ee+5]=4*H+0}return te})(T));const G=p.createIndexBuffer(dn,!0),Z=p.createVertexBuffer(k,c.cb.members,!0);for(const q of w){const Y=Bc(d.transform);M.draw(p,_.TRIANGLES,lt.disabled,pt.disabled,d.colorModeForRenderPass(),dt.disabled,Y,d.style.map.terrain&&d.style.map.terrain.getTerrainData(q.coord),null,n.id,Z,G,c.aX.simpleSegment(0,2*q.circleOffset,q.circleArray.length,q.circleArray.length/2),null,d.transform.zoom,null,null,null)}Z.destroy(),G.destroy()}const Cl=c.ar(new Float32Array(16));function _h(d,t,n,s,l,p){const{horizontalAlign:m,verticalAlign:_}=c.aS(d);return new c.P((-(m-.5)*t/l+s[0])*p,(-(_-.5)*n/l+s[1])*p)}function ms(d,t,n,s,l,p){const m=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let _=s.mult(p);n||(_=_.rotate(-l));const x=m.add(_);return ot(x.x,x.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const _=bt(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(d),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return d.add(s.rotate(x))}return d.add(s)}function yh(d,t,n,s,l,p,m,_,x,w,T,I){const M=d.text.placedSymbolArray,k=d.text.dynamicLayoutVertexArray,B=d.icon.dynamicLayoutVertexArray,G={};k.clear();for(let Z=0;Z<M.length;Z++){const q=M.get(Z),Y=q.hidden||!q.crossTileID||d.allowVerticalPlacement&&!q.placedOrientation?null:s[q.crossTileID];if(Y){const te=new c.P(q.anchorX,q.anchorY),H={getElevation:I,width:l.width,height:l.height,pitchedLabelPlaneMatrix:p,pitchWithMap:n,transform:l,tileAnchorPoint:te,translation:w,unwrappedTileID:T},ee=n?pa(te.x,te.y,H):bt(te.x,te.y,H),re=Ka(l.cameraToCenterDistance,ee.signedDistanceFromCamera);let J=c.aA(d.textSizeData,_,q)*re/c.aM;n&&(J*=d.tilePixelRatio/m);const{width:oe,height:_e,anchor:de,textOffset:me,textBoxScale:ge}=Y,Ae=_h(de,oe,_e,me,ge,J),ke=l.getPitchedTextCorrection(te.x+w[0],te.y+w[1],T),Me=ms(ee.point,H,t,Ae,-l.bearingInRadians,ke),Le=d.allowVerticalPlacement&&q.placedOrientation===c.az.vertical?Math.PI/2:0;for(let tt=0;tt<q.numGlyphs;tt++)c.aG(k,Me,Le);x&&q.associatedIconIndex>=0&&(G[q.associatedIconIndex]={shiftedAnchor:Me,angle:Le})}else Fn(q.numGlyphs,k)}if(x){B.clear();const Z=d.icon.placedSymbolArray;for(let q=0;q<Z.length;q++){const Y=Z.get(q);if(Y.hidden)Fn(Y.numGlyphs,B);else{const te=G[q];if(te)for(let H=0;H<Y.numGlyphs;H++)c.aG(B,te.shiftedAnchor,te.angle);else Fn(Y.numGlyphs,B)}}d.icon.dynamicLayoutVertexBuffer.updateData(B)}d.text.dynamicLayoutVertexBuffer.updateData(k)}function Yc(d,t,n){return n.iconsInText&&t?"symbolTextAndIcon":d?"symbolSDF":"symbolIcon"}function gs(d,t,n,s,l,p,m,_,x,w,T,I,M){const k=d.context,B=k.gl,G=d.transform,Z=_==="map",q=x==="map",Y=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",te=Z&&!q&&!Y,H=!n.layout.get("symbol-sort-key").isConstant();let ee=!1;const re=d.getDepthModeForSublayer(0,lt.ReadOnly),J=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),oe=[],_e=G.getCircleRadiusCorrection();for(const de of s){const me=t.getTile(de),ge=me.getBucket(n);if(!ge)continue;const Ae=l?ge.text:ge.icon;if(!Ae||!Ae.segments.get().length||!Ae.hasVisibleVertices)continue;const ke=Ae.programConfigurations.get(n.id),Me=l||ge.sdfIcons,Le=l?ge.textSizeData:ge.iconSizeData,tt=q||G.pitch!==0,xt=d.useProgram(Yc(Me,l,ge),ke),Dt=c.ay(Le,G.zoom),It=d.style.map.terrain&&d.style.map.terrain.getTerrainData(de);let Ot,Et,Ht,jt,pi=[0,0],ai=null;if(l)Et=me.glyphAtlasTexture,Ht=B.LINEAR,Ot=me.glyphAtlasTexture.size,ge.iconsInText&&(pi=me.imageAtlasTexture.size,ai=me.imageAtlasTexture,jt=tt||d.options.rotating||d.options.zooming||Le.kind==="composite"||Le.kind==="camera"?B.LINEAR:B.NEAREST);else{const zt=n.layout.get("icon-size").constantOr(0)!==1||ge.iconsNeedLinear;Et=me.imageAtlasTexture,Ht=Me||d.options.rotating||d.options.zooming||zt||tt?B.LINEAR:B.NEAREST,Ot=me.imageAtlasTexture.size}const ti=c.aN(me,1,d.transform.zoom),xi=er(Z,d.transform,ti),_n=c.N();c.aB(_n,xi);const $r=Hs(q,Z,d.transform,ti),Rr=c.aO(G,me,p,m),Zi=G.getProjectionData({overscaledTileID:de,applyGlobeMatrix:!M,applyTerrainMatrix:!0}),Jn=J&&ge.hasTextData(),Fs=n.layout.get("icon-text-fit")!=="none"&&Jn&&ge.hasIconData();if(Y){const zt=d.style.map.terrain?(ui,hi)=>d.style.map.terrain.getElevation(de,ui,hi):null,Ct=n.layout.get("text-rotation-alignment")==="map";Xs(ge,d,l,xi,_n,q,w,Ct,de.toUnwrapped(),G.width,G.height,Rr,zt)}const Qn=l&&J||Fs,dr=Y||Qn?Cl:q?xi:d.transform.clipSpaceToPixelsMatrix,Lr=Me&&n.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Sr;Sr=Me?ge.iconsInText?Gn(Le.kind,Dt,te,q,Y,Qn,d,dr,$r,Rr,Ot,pi,_e):oo(Le.kind,Dt,te,q,Y,Qn,d,dr,$r,Rr,l,Ot,0,_e):bl(Le.kind,Dt,te,q,Y,Qn,d,dr,$r,Rr,l,Ot,_e);const Pr={program:xt,buffers:Ae,uniformValues:Sr,projectionData:Zi,atlasTexture:Et,atlasTextureIcon:ai,atlasInterpolation:Ht,atlasInterpolationIcon:jt,isSDF:Me,hasHalo:Lr};if(H&&ge.canOverlap){ee=!0;const zt=Ae.segments.get();for(const Ct of zt)oe.push({segments:new c.aX([Ct]),sortKey:Ct.sortKey,state:Pr,terrainData:It})}else oe.push({segments:Ae.segments,sortKey:0,state:Pr,terrainData:It})}ee&&oe.sort(((de,me)=>de.sortKey-me.sortKey));for(const de of oe){const me=de.state;if(k.activeTexture.set(B.TEXTURE0),me.atlasTexture.bind(me.atlasInterpolation,B.CLAMP_TO_EDGE),me.atlasTextureIcon&&(k.activeTexture.set(B.TEXTURE1),me.atlasTextureIcon&&me.atlasTextureIcon.bind(me.atlasInterpolationIcon,B.CLAMP_TO_EDGE)),me.isSDF){const ge=me.uniformValues;me.hasHalo&&(ge.u_is_halo=1,xo(me.buffers,de.segments,n,d,me.program,re,T,I,ge,me.projectionData,de.terrainData)),ge.u_is_halo=0}xo(me.buffers,de.segments,n,d,me.program,re,T,I,me.uniformValues,me.projectionData,de.terrainData)}}function xo(d,t,n,s,l,p,m,_,x,w,T){const I=s.context;l.draw(I,I.gl.TRIANGLES,p,m,_,dt.backCCW,x,T,w,n.id,d.layoutVertexBuffer,d.indexBuffer,t,n.paint,s.transform.zoom,d.programConfigurations.get(n.id),d.dynamicLayoutVertexBuffer,d.opacityVertexBuffer)}function Kc(d,t,n,s,l){const p=d.context,m=p.gl,_=pt.disabled,x=new Mt([m.ONE,m.ONE],c.bp.transparent,[!0,!0,!0,!0]),w=t.getBucket(n);if(!w)return;const T=s.key;let I=n.heatmapFbos.get(T);I||(I=_s(p,t.tileSize,t.tileSize),n.heatmapFbos.set(T,I)),p.bindFramebuffer.set(I.framebuffer),p.viewport.set([0,0,t.tileSize,t.tileSize]),p.clear({color:c.bp.transparent});const M=w.programConfigurations.get(n.id),k=d.useProgram("heatmap",M,!l),B=d.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),G=d.style.map.terrain.getTerrainData(s);k.draw(p,m.TRIANGLES,lt.disabled,_,x,dt.disabled,Ma(t,d.transform.zoom,n.paint.get("heatmap-intensity"),1),G,B,n.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,n.paint,d.transform.zoom,M)}function Jc(d,t,n,s,l){const p=d.context,m=p.gl,_=d.transform;p.setColorMode(d.colorModeForRenderPass());const x=vo(p,t),w=n.key,T=t.heatmapFbos.get(w);if(!T)return;p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,T.colorAttachment.get()),p.activeTexture.set(m.TEXTURE1),x.bind(m.LINEAR,m.CLAMP_TO_EDGE);const I=_.getProjectionData({overscaledTileID:n,applyTerrainMatrix:l,applyGlobeMatrix:!s});d.useProgram("heatmapTexture").draw(p,m.TRIANGLES,lt.disabled,pt.disabled,d.colorModeForRenderPass(),dt.disabled,Oc(d,t,0,1),null,I,t.id,d.rasterBoundsBuffer,d.quadTriangleIndexBuffer,d.rasterBoundsSegments,t.paint,_.zoom),T.destroy(),t.heatmapFbos.delete(w)}function _s(d,t,n){var s,l;const p=d.gl,m=p.createTexture();p.bindTexture(p.TEXTURE_2D,m),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.LINEAR);const _=(s=d.HALF_FLOAT)!==null&&s!==void 0?s:p.UNSIGNED_BYTE,x=(l=d.RGBA16F)!==null&&l!==void 0?l:p.RGBA;p.texImage2D(p.TEXTURE_2D,0,x,t,n,0,p.RGBA,_,null);const w=d.createFramebuffer(t,n,!1,!1);return w.colorAttachment.set(m),w}function vo(d,t){return t.colorRampTexture||(t.colorRampTexture=new c.T(d,t.colorRamp,d.gl.RGBA)),t.colorRampTexture}function Qc(d,t,n,s,l,p,m,_){let x=256;if(l.stepInterpolant){const w=t.getSource().maxzoom,T=m.canonical.z===w?Math.ceil(1<<d.transform.maxZoom-m.canonical.z):1;x=c.an(c.ce(p.maxLineLength/c.a5*1024*T),256,n.maxTextureSize)}return _.gradient=c.cf({expression:l.gradientExpression(),evaluationKey:"lineProgress",resolution:x,image:_.gradient||void 0,clips:p.lineClipsArray}),_.texture?_.texture.update(_.gradient):_.texture=new c.T(n,_.gradient,s.RGBA),_.version=l.gradientVersion,_.texture}function eu(d,t,n,s,l){d.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),s.updatePaintBuffers(l)}function Qt(d,t,n,s,l,p){(l||d.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),d.lineAtlas.bind(t)),s.updatePaintBuffers(p)}function Wn(d,t,n,s,l,p,m){const _=p.gradients[l.id];let x=_.texture;l.gradientVersion!==_.version&&(x=Qc(d,t,n,s,l,p,m,_)),n.activeTexture.set(s.TEXTURE0),x.bind(l.stepInterpolant?s.NEAREST:s.LINEAR,s.CLAMP_TO_EDGE)}function ir(d,t,n,s,l,p,m,_,x){const w=p.gradients[l.id];let T=w.texture;l.gradientVersion!==w.version&&(T=Qc(d,t,n,s,l,p,m,w)),n.activeTexture.set(s.TEXTURE0),T.bind(l.stepInterpolant?s.NEAREST:s.LINEAR,s.CLAMP_TO_EDGE),n.activeTexture.set(s.TEXTURE1),d.lineAtlas.bind(n),_.updatePaintBuffers(x)}function bo(d,t,n,s,l){if(!n||!s||!s.imageAtlas)return;const p=s.imageAtlas.patternPositions;let m=p[n.to.toString()],_=p[n.from.toString()];if(!m&&_&&(m=_),!_&&m&&(_=m),!m||!_){const x=l.getPaintProperty(t);m=p[x],_=p[x]}m&&_&&d.setConstantPatternPositions(m,_)}function ys(d,t,n,s,l,p,m,_){const x=d.context.gl,w="fill-pattern",T=n.paint.get(w),I=T&&T.constantOr(1),M=n.getCrossfadeParameters();let k,B,G,Z,q;const Y=d.transform,te=n.paint.get("fill-translate"),H=n.paint.get("fill-translate-anchor");m?(B=I&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",k=x.LINES):(B=I?"fillPattern":"fill",k=x.TRIANGLES);const ee=T.constantOr(null);for(const re of s){const J=t.getTile(re);if(I&&!J.patternsLoaded())continue;const oe=J.getBucket(n);if(!oe)continue;const _e=oe.programConfigurations.get(n.id),de=d.useProgram(B,_e),me=d.style.map.terrain&&d.style.map.terrain.getTerrainData(re);I&&(d.context.activeTexture.set(x.TEXTURE0),J.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),_e.updatePaintBuffers(M)),bo(_e,w,ee,J,n);const ge=Y.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Ae=c.aO(Y,J,te,H);if(m){Z=oe.indexBuffer2,q=oe.segments2;const Me=[x.drawingBufferWidth,x.drawingBufferHeight];G=B==="fillOutlinePattern"&&I?Lc(d,M,J,Me,Ae):Rc(Me,Ae)}else Z=oe.indexBuffer,q=oe.segments,G=I?gl(d,M,J,Ae):{u_fill_translate:Ae};const ke=d.stencilModeForClipping(re);de.draw(d.context,k,l,ke,p,dt.backCCW,G,me,ge,n.id,oe.layoutVertexBuffer,Z,q,n.paint,d.transform.zoom,_e)}}function wo(d,t,n,s,l,p,m,_){const x=d.context,w=x.gl,T="fill-extrusion-pattern",I=n.paint.get(T),M=I.constantOr(1),k=n.getCrossfadeParameters(),B=n.paint.get("fill-extrusion-opacity"),G=I.constantOr(null),Z=d.transform;for(const q of s){const Y=t.getTile(q),te=Y.getBucket(n);if(!te)continue;const H=d.style.map.terrain&&d.style.map.terrain.getTerrainData(q),ee=te.programConfigurations.get(n.id),re=d.useProgram(M?"fillExtrusionPattern":"fillExtrusion",ee);M&&(d.context.activeTexture.set(w.TEXTURE0),Y.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ee.updatePaintBuffers(k));const J=Z.getProjectionData({overscaledTileID:q,applyGlobeMatrix:!_,applyTerrainMatrix:!0});bo(ee,T,G,Y,n);const oe=c.aO(Z,Y,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),_e=n.paint.get("fill-extrusion-vertical-gradient"),de=M?ml(d,_e,B,oe,q,k,Y):fl(d,_e,B,oe);re.draw(x,x.gl.TRIANGLES,l,p,m,dt.backCCW,de,H,J,n.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,n.paint,d.transform.zoom,ee,d.style.map.terrain&&te.centroidVertexBuffer)}}function pn(d,t,n,s,l,p,m,_,x){var w;const T=d.style.projection,I=d.context,M=d.transform,k=I.gl,B=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],G=d.useProgram("hillshade",null,!1,B),Z=!d.options.moving;for(const q of s){const Y=t.getTile(q),te=Y.fbo;if(!te)continue;const H=T.getMeshFromTileID(I,q.canonical,_,!0,"raster"),ee=(w=d.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(q);I.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,te.colorAttachment.get());const re=M.getProjectionData({overscaledTileID:q,aligned:Z,applyGlobeMatrix:!x,applyTerrainMatrix:!0});G.draw(I,k.TRIANGLES,p,l[q.overscaledZ],m,dt.backCCW,no(d,Y,n),ee,re,n.id,H.vertexBuffer,H.indexBuffer,H.segments)}}function xs(d,t,n,s,l,p,m,_,x){var w;const T=d.style.projection,I=d.context,M=d.transform,k=I.gl,B=d.useProgram("colorRelief"),G=!d.options.moving;let Z=!0,q=0;for(const Y of s){const te=t.getTile(Y),H=te.dem;if(Z){const de=k.getParameter(k.MAX_TEXTURE_SIZE),{elevationTexture:me,colorTexture:ge}=n.getColorRampTextures(I,de,H.getUnpackVector());I.activeTexture.set(k.TEXTURE1),me.bind(k.NEAREST,k.CLAMP_TO_EDGE),I.activeTexture.set(k.TEXTURE4),ge.bind(k.LINEAR,k.CLAMP_TO_EDGE),Z=!1,q=me.size[0]}if(!H||!H.data)continue;const ee=H.stride,re=H.getPixels();if(I.activeTexture.set(k.TEXTURE0),I.pixelStoreUnpackPremultiplyAlpha.set(!1),te.demTexture=te.demTexture||d.getTileTexture(ee),te.demTexture){const de=te.demTexture;de.update(re,{premultiply:!1}),de.bind(k.LINEAR,k.CLAMP_TO_EDGE)}else te.demTexture=new c.T(I,re,k.RGBA,{premultiply:!1}),te.demTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE);const J=T.getMeshFromTileID(I,Y.canonical,_,!0,"raster"),oe=(w=d.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(Y),_e=M.getProjectionData({overscaledTileID:Y,aligned:G,applyGlobeMatrix:!x,applyTerrainMatrix:!0});B.draw(I,k.TRIANGLES,p,l[Y.overscaledZ],m,dt.backCCW,jc(n,te.dem,q),oe,_e,n.id,J.vertexBuffer,J.indexBuffer,J.segments)}}const Hn=[new c.P(0,0),new c.P(c.a5,0),new c.P(c.a5,c.a5),new c.P(0,c.a5)];function za(d,t,n,s,l,p,m,_,x=!1,w=!1){const T=s[s.length-1].overscaledZ,I=d.context,M=I.gl,k=d.useProgram("raster"),B=d.transform,G=d.style.projection,Z=d.colorModeForRenderPass(),q=!d.options.moving,Y=n.paint.get("raster-opacity"),te=n.paint.get("raster-resampling"),H=n.paint.get("raster-fade-duration"),ee=!!d.style.map.terrain;for(const re of s){const J=d.getDepthModeForSublayer(re.overscaledZ-T,Y===1?lt.ReadWrite:lt.ReadOnly,M.LESS),oe=t.getTile(re),_e=te==="nearest"?M.NEAREST:M.LINEAR;I.activeTexture.set(M.TEXTURE0),oe.texture.bind(_e,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),I.activeTexture.set(M.TEXTURE1);const{parentTile:de,parentScaleBy:me,parentTopLeft:ge,fadeValues:Ae}=tu(oe,t,H,ee);oe.fadeOpacity=Ae.tileOpacity,de?(de.fadeOpacity=Ae.parentTileOpacity,de.texture.bind(_e,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST)):oe.texture.bind(_e,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),oe.texture.useMipmap&&I.extTextureFilterAnisotropic&&d.transform.pitch>20&&M.texParameterf(M.TEXTURE_2D,I.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,I.extTextureFilterAnisotropicMax);const ke=d.style.map.terrain&&d.style.map.terrain.getTerrainData(re),Me=B.getProjectionData({overscaledTileID:re,aligned:q,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),Le=xl(ge,me,Ae.fadeMix,n,_),tt=G.getMeshFromTileID(I,re.canonical,p,m,"raster");k.draw(I,M.TRIANGLES,J,l?l[re.overscaledZ]:pt.disabled,Z,x?dt.frontCCW:dt.backCCW,Le,ke,Me,n.id,tt.vertexBuffer,tt.indexBuffer,tt.segments)}}function tu(d,t,n,s){const l={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||s)return l;if(d.fadingParentID){const p=t.getLoadedTile(d.fadingParentID);if(!p)return l;const m=Math.pow(2,p.tileID.overscaledZ-d.tileID.overscaledZ),_=[d.tileID.canonical.x*m%1,d.tileID.canonical.y*m%1],x=(function(w,T,I){const M=st(),k=(M-T.timeAdded)/I,B=w.fadingDirection===K.Incoming,G=c.an((M-w.timeAdded)/I,0,1),Z=c.an(1-k,0,1),q=B?G:Z;return{tileOpacity:q,parentTileOpacity:B?Z:G,fadeMix:{opacity:1,mix:1-q}}})(d,p,n);return{parentTile:p,parentScaleBy:m,parentTopLeft:_,fadeValues:x}}if(d.selfFading){const p=(function(m,_){const x=(st()-m.timeAdded)/_,w=c.an(x,0,1);return{tileOpacity:w,fadeMix:{opacity:w,mix:0}}})(d,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:p}}return l}const iu=new c.bp(1,0,0,1),ru=new c.bp(0,1,0,1),nu=new c.bp(0,0,1,1),au=new c.bp(1,0,1,1),fn=new c.bp(0,1,1,1);function Al(d,t,n,s){vs(d,0,t+n/2,d.transform.width,n,s)}function zl(d,t,n,s){vs(d,t-n/2,0,n,d.transform.height,s)}function vs(d,t,n,s,l,p){const m=d.context,_=m.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*d.pixelRatio,n*d.pixelRatio,s*d.pixelRatio,l*d.pixelRatio),m.clear({color:p}),_.disable(_.SCISSOR_TEST)}function su(d,t,n){const s=d.context,l=s.gl,p=d.useProgram("debug"),m=lt.disabled,_=pt.disabled,x=d.colorModeForRenderPass(),w="$debug",T=d.style.map.terrain&&d.style.map.terrain.getTerrainData(n);s.activeTexture.set(l.TEXTURE0);const I=t.getTileByID(n.key).latestRawTileData,M=Math.floor((I&&I.byteLength||0)/1024),k=t.getTile(n).tileSize,B=512/Math.min(k,512)*(n.overscaledZ/d.transform.zoom)*.5;let G=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(G+=` => ${n.overscaledZ}`),(function(q,Y){q.initDebugOverlayCanvas();const te=q.debugOverlayCanvas,H=q.context.gl,ee=q.debugOverlayCanvas.getContext("2d");ee.clearRect(0,0,te.width,te.height),ee.shadowColor="white",ee.shadowBlur=2,ee.lineWidth=1.5,ee.strokeStyle="white",ee.textBaseline="top",ee.font="bold 36px Open Sans, sans-serif",ee.fillText(Y,5,5),ee.strokeText(Y,5,5),q.debugOverlayTexture.update(te),q.debugOverlayTexture.bind(H.LINEAR,H.CLAMP_TO_EDGE)})(d,`${G} ${M}kB`);const Z=d.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(s,l.TRIANGLES,m,_,Mt.alphaBlended,dt.disabled,_l(c.bp.transparent,B),null,Z,w,d.debugBuffer,d.quadTriangleIndexBuffer,d.debugSegments),p.draw(s,l.LINE_STRIP,m,_,x,dt.disabled,_l(c.bp.red),T,Z,w,d.debugBuffer,d.tileBorderIndexBuffer,d.debugSegments)}function kl(d,t,n,s){const{isRenderingGlobe:l}=s,p=d.context,m=p.gl,_=d.transform,x=d.colorModeForRenderPass(),w=d.getDepthModeFor3D(),T=d.useProgram("terrain");p.bindFramebuffer.set(null),p.viewport.set([0,0,d.width,d.height]);for(const I of n){const M=t.getTerrainMesh(I.tileID),k=d.renderToTexture.getTexture(I),B=t.getTerrainData(I.tileID);p.activeTexture.set(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,k.texture);const G=t.getMeshFrameDelta(_.zoom),Z=_.calculateFogMatrix(I.tileID.toUnwrapped()),q=sh(G,Z,d.style.sky,_.pitch,l),Y=_.getProjectionData({overscaledTileID:I.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});T.draw(p,m.TRIANGLES,w,pt.disabled,x,dt.backCCW,q,B,Y,"terrain",M.vertexBuffer,M.indexBuffer,M.segments)}}function Dl(d,t){if(!t.mesh){const n=new c.aW;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const s=new c.aY;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),t.mesh=new Pt(d.createVertexBuffer(n,cn.members),d.createIndexBuffer(s),c.aX.simpleSegment(0,0,n.length,s.length))}return t.mesh}class ou{constructor(t,n){this.context=new yo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Di.maxOverzooming+Di.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new qi}resize(t,n,s){if(this.width=Math.floor(t*s),this.height=Math.floor(n*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const t=this.context,n=new c.aW;n.emplaceBack(0,0),n.emplaceBack(c.a5,0),n.emplaceBack(0,c.a5),n.emplaceBack(c.a5,c.a5),this.tileExtentBuffer=t.createVertexBuffer(n,cn.members),this.tileExtentSegments=c.aX.simpleSegment(0,0,4,2);const s=new c.aW;s.emplaceBack(0,0),s.emplaceBack(c.a5,0),s.emplaceBack(0,c.a5),s.emplaceBack(c.a5,c.a5),this.debugBuffer=t.createVertexBuffer(s,cn.members),this.debugSegments=c.aX.simpleSegment(0,0,4,5);const l=new c.ch;l.emplaceBack(0,0,0,0),l.emplaceBack(c.a5,0,c.a5,0),l.emplaceBack(0,c.a5,0,c.a5),l.emplaceBack(c.a5,c.a5,c.a5,c.a5),this.rasterBoundsBuffer=t.createVertexBuffer(l,ah.members),this.rasterBoundsSegments=c.aX.simpleSegment(0,0,4,2);const p=new c.aW;p.emplaceBack(0,0),p.emplaceBack(c.a5,0),p.emplaceBack(0,c.a5),p.emplaceBack(c.a5,c.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(p,cn.members),this.rasterBoundsSegmentsPosOnly=c.aX.simpleSegment(0,0,4,5);const m=new c.aW;m.emplaceBack(0,0),m.emplaceBack(1,0),m.emplaceBack(0,1),m.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(m,cn.members),this.viewportSegments=c.aX.simpleSegment(0,0,4,2);const _=new c.ci;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(_);const x=new c.aY;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(x);const w=this.context.gl;this.stencilClearMode=new pt({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.tileExtentMesh=new Pt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=c.N();c.c7(s,0,this.width,this.height,0,0,1),c.Q(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,lt.disabled,this.stencilClearMode,Mt.disabled,dt.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,s){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const l=this.context;l.setColorMode(Mt.disabled),l.setDepthMode(lt.disabled);const p={};for(const m of n)p[m.key]=this.nextStencilID++;this._renderTileMasks(p,n,s,!0),this._renderTileMasks(p,n,s,!1),this._tileClippingMaskIDs=p}_renderTileMasks(t,n,s,l){const p=this.context,m=p.gl,_=this.style.projection,x=this.transform,w=this.useProgram("clippingMask");for(const T of n){const I=t[T.key],M=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T),k=_.getMeshFromTileID(this.context,T.canonical,l,!0,"stencil"),B=x.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!s,applyTerrainMatrix:!0});w.draw(p,m.TRIANGLES,lt.disabled,new pt({func:m.ALWAYS,mask:0},I,255,m.KEEP,m.KEEP,m.REPLACE),Mt.disabled,s?dt.disabled:dt.backCCW,null,M,B,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}_renderTilesDepthBuffer(){const t=this.context,n=t.gl,s=this.style.projection,l=this.transform,p=this.useProgram("depth"),m=this.getDepthModeFor3D(),_=yt(l,{tileSize:l.tileSize});for(const x of _){const w=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),T=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),I=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});p.draw(t,n.TRIANGLES,m,pt.disabled,Mt.disabled,dt.backCCW,null,w,I,"$clipping",T.vertexBuffer,T.indexBuffer,T.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new pt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new pt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,s=t.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),l=s[s.length-1].overscaledZ,p=s[0].overscaledZ-l+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let _=0;_<p;_++)m[_+l]=new pt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,s]}return[{[l]:pt.disabled},s]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,s=t.sort(((m,_)=>_.overscaledZ-m.overscaledZ)),l=s[s.length-1].overscaledZ,p=s[0].overscaledZ-l+1;if(this.clearStencil(),p>1){const m={},_={};for(let x=0;x<p;x++)m[x+l]=new pt({func:n.GREATER,mask:255},p+1+x,255,n.KEEP,n.KEEP,n.REPLACE),_[x+l]=new pt({func:n.GREATER,mask:255},1+x,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*p+1,[m,_,s]}return this.nextStencilID=3,[{[l]:new pt({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[l]:new pt({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Mt([t.CONSTANT_COLOR,t.ONE],new c.bp(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Mt.unblended:Mt.alphaBlended}getDepthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return lt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new lt(s||this.context.gl.LEQUAL,n,[l,l])}getDepthModeFor3D(){return new lt(this.context.gl.LEQUAL,lt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var s,l;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(st()),this.imageManager.beginFrame();const p=this.style._order,m=this.style.tileManagers,_={},x={},w={},T={isRenderingToTexture:!1,isRenderingGlobe:((s=t.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const M in m){const k=m[M];k.used&&k.prepare(this.context),_[M]=k.getVisibleCoordinates(!1),x[M]=_[M].slice().reverse(),w[M]=k.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let M=0;M<p.length;M++)if(this.style._layers[p[M]].is3D()){this.opaquePassCutoff=M;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const M of p){const k=this.style._layers[M];if(!k.hasOffscreenPass()||k.isHidden(this.transform.zoom))continue;const B=x[k.source];(k.type==="custom"||B.length)&&this.renderLayer(this,m[k.source],k,B,T)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:M=>this.useProgram(M)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.bp.black:c.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(M,k){const B=M.context,G=B.gl,Z=((re,J,oe)=>{const _e=Math.cos(J.rollInRadians),de=Math.sin(J.rollInRadians),me=Pe(J),ge=J.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:re.properties.get("sky-color"),u_horizon_color:re.properties.get("horizon-color"),u_horizon:[(J.width/2-me*de)*oe,(J.height/2+me*_e)*oe],u_horizon_normal:[-de,_e],u_sky_horizon_blend:re.properties.get("sky-horizon-blend")*J.height/2*oe,u_sky_blend:ge}})(k,M.style.map.transform,M.pixelRatio),q=new lt(G.LEQUAL,lt.ReadWrite,[0,1]),Y=pt.disabled,te=M.colorModeForRenderPass(),H=M.useProgram("sky"),ee=Dl(B,k);H.draw(B,G.TRIANGLES,q,Y,te,dt.disabled,Z,null,void 0,"sky",ee.vertexBuffer,ee.indexBuffer,ee.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=p.length-1;this.currentLayer>=0;this.currentLayer--){const M=this.style._layers[p[this.currentLayer]],k=m[M.source],B=_[M.source];this._renderTileClippingMasks(M,B,!1),this.renderLayer(this,k,M,B,T)}this.renderPass="translucent";let I=!1;for(this.currentLayer=0;this.currentLayer<p.length;this.currentLayer++){const M=this.style._layers[p[this.currentLayer]],k=m[M.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(M,T))continue;this.opaquePassEnabledForLayer()||I||(I=!0,T.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const B=(M.type==="symbol"?w:x)[M.source];this._renderTileClippingMasks(M,_[M.source],!!this.renderToTexture),this.renderLayer(this,k,M,B,T)}if(T.isRenderingGlobe&&(function(M,k,B){const G=M.context,Z=G.gl,q=M.useProgram("atmosphere"),Y=new lt(Z.LEQUAL,lt.ReadOnly,[0,1]),te=M.transform,H=(function(ge,Ae){const ke=ge.properties.get("position"),Me=[-ke.x,-ke.y,-ke.z],Le=c.ar(new Float64Array(16));return ge.properties.get("anchor")==="map"&&(c.bg(Le,Le,Ae.rollInRadians),c.bh(Le,Le,-Ae.pitchInRadians),c.bg(Le,Le,Ae.bearingInRadians),c.bh(Le,Le,Ae.center.lat*Math.PI/180),c.bJ(Le,Le,-Ae.center.lng*Math.PI/180)),c.cg(Me,Me,Le),Me})(B,M.transform),ee=te.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),re=k.properties.get("atmosphere-blend")*ee.projectionTransition;if(re===0)return;const J=Vn(te.worldSize,te.center.lat),oe=te.inverseProjectionMatrix,_e=new Float64Array(4);_e[3]=1,c.aH(_e,_e,te.modelViewProjectionMatrix),_e[0]/=_e[3],_e[1]/=_e[3],_e[2]/=_e[3],_e[3]=1,c.aH(_e,_e,oe),_e[0]/=_e[3],_e[1]/=_e[3],_e[2]/=_e[3],_e[3]=1;const de=((ge,Ae,ke,Me,Le)=>({u_sun_pos:ge,u_atmosphere_blend:Ae,u_globe_position:ke,u_globe_radius:Me,u_inv_proj_matrix:Le}))(H,re,[_e[0],_e[1],_e[2]],J,oe),me=Dl(G,k);q.draw(G,Z.TRIANGLES,Y,pt.disabled,Mt.alphaBlended,dt.disabled,de,null,null,"atmosphere",me.vertexBuffer,me.indexBuffer,me.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const M=(function(k,B){let G=null;const Z=Object.values(k._layers).flatMap((H=>H.source&&!H.isHidden(B)?[k.tileManagers[H.source]]:[])),q=Z.filter((H=>H.getSource().type==="vector")),Y=Z.filter((H=>H.getSource().type!=="vector")),te=H=>{(!G||G.getSource().maxzoom<H.getSource().maxzoom)&&(G=H)};return q.forEach((H=>te(H))),G||Y.forEach((H=>te(H))),G})(this.style,this.transform.zoom);M&&(function(k,B,G){for(let Z=0;Z<G.length;Z++)su(k,B,G[Z])})(this,M,M.getVisibleCoordinates())}this.options.showPadding&&(function(M){const k=M.transform.padding;Al(M,M.transform.height-(k.top||0),3,iu),Al(M,k.bottom||0,3,ru),zl(M,k.left||0,3,nu),zl(M,M.transform.width-(k.right||0),3,au);const B=M.transform.centerPoint;(function(G,Z,q,Y){vs(G,Z-1,q-10,2,20,Y),vs(G,Z-10,q-1,20,2,Y)})(M,B.x,M.transform.height-B.y,fn)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=t?!c.cj(n,s):!c.ck(n,s)),l||(l=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(c.cl(n,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(p,m){const _=p.context,x=_.gl,w=p.transform,T=Mt.unblended,I=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),M=m.tileManager.getRenderableTiles(),k=p.useProgram("terrainDepth");_.bindFramebuffer.set(m.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:c.bp.transparent,depth:1});for(const B of M){const G=m.getTerrainMesh(B.tileID),Z=m.getTerrainData(B.tileID),q=w.getProjectionData({overscaledTileID:B.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),Y={u_ele_delta:m.getMeshFrameDelta(w.zoom)};k.draw(_,x.TRIANGLES,I,pt.disabled,T,dt.backCCW,Y,Z,q,"terrain",G.vertexBuffer,G.indexBuffer,G.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain),(function(p,m){const _=p.context,x=_.gl,w=p.transform,T=Mt.unblended,I=new lt(x.LEQUAL,lt.ReadWrite,[0,1]),M=m.getCoordsTexture(),k=m.tileManager.getRenderableTiles(),B=p.useProgram("terrainCoords");_.bindFramebuffer.set(m.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,p.width/devicePixelRatio,p.height/devicePixelRatio]),_.clear({color:c.bp.transparent,depth:1}),m.coordsIndex=[];for(const G of k){const Z=m.getTerrainMesh(G.tileID),q=m.getTerrainData(G.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,M.texture);const Y={u_terrain_coords_id:(255-m.coordsIndex.length)/255,u_texture:0,u_ele_delta:m.getMeshFrameDelta(w.zoom)},te=w.getProjectionData({overscaledTileID:G.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});B.draw(_,x.TRIANGLES,I,pt.disabled,T,dt.backCCW,Y,q,te,"terrain",Z.vertexBuffer,Z.indexBuffer,Z.segments),m.coordsIndex.push(G.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,p.width,p.height])})(this,this.style.map.terrain))}renderLayer(t,n,s,l,p){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,c.cm(s)?(function(m,_,x,w,T,I){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:M}=I,k=pt.disabled,B=m.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(G,Z,q,Y,te,H,ee,re,J){const oe=Z.transform,_e=Z.style.map.terrain,de=te==="map",me=H==="map";for(const ge of G){const Ae=Y.getTile(ge),ke=Ae.getBucket(q);if(!ke||!ke.text||!ke.text.segments.get().length)continue;const Me=c.ay(ke.textSizeData,oe.zoom),Le=c.aN(Ae,1,Z.transform.zoom),tt=er(de,Z.transform,Le),xt=q.layout.get("icon-text-fit")!=="none"&&ke.hasIconData();if(Me){const Dt=Math.pow(2,oe.zoom-Ae.tileID.overscaledZ),It=_e?(Ot,Et)=>_e.getElevation(ge,Ot,Et):null;yh(ke,de,me,J,oe,tt,Dt,Me,xt,c.aO(oe,Ae,ee,re),ge.toUnwrapped(),It)}}})(w,m,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),T),x.paint.get("icon-opacity").constantOr(1)!==0&&gs(m,_,x,w,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),k,B,M),x.paint.get("text-opacity").constantOr(1)!==0&&gs(m,_,x,w,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),k,B,M),_.map.showCollisionBoxes&&(Zn(m,_,x,w,!0),Zn(m,_,x,w,!1))})(t,n,s,l,this.style.placement.variableOffsets,p):c.cn(s)?(function(m,_,x,w,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:I}=T,M=x.paint.get("circle-opacity"),k=x.paint.get("circle-stroke-width"),B=x.paint.get("circle-stroke-opacity"),G=!x.layout.get("circle-sort-key").isConstant();if(M.constantOr(1)===0&&(k.constantOr(1)===0||B.constantOr(1)===0))return;const Z=m.context,q=Z.gl,Y=m.transform,te=m.getDepthModeForSublayer(0,lt.ReadOnly),H=pt.disabled,ee=m.colorModeForRenderPass(),re=[],J=Y.getCircleRadiusCorrection();for(let oe=0;oe<w.length;oe++){const _e=w[oe],de=_.getTile(_e),me=de.getBucket(x);if(!me)continue;const ge=x.paint.get("circle-translate"),Ae=x.paint.get("circle-translate-anchor"),ke=c.aO(Y,de,ge,Ae),Me=me.programConfigurations.get(x.id),Le=m.useProgram("circle",Me),tt=me.layoutVertexBuffer,xt=me.indexBuffer,Dt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(_e),It={programConfiguration:Me,program:Le,layoutVertexBuffer:tt,indexBuffer:xt,uniformValues:Fc(m,de,x,ke,J),terrainData:Dt,projectionData:Y.getProjectionData({overscaledTileID:_e,applyGlobeMatrix:!I,applyTerrainMatrix:!0})};if(G){const Ot=me.segments.get();for(const Et of Ot)re.push({segments:new c.aX([Et]),sortKey:Et.sortKey,state:It})}else re.push({segments:me.segments,sortKey:0,state:It})}G&&re.sort(((oe,_e)=>oe.sortKey-_e.sortKey));for(const oe of re){const{programConfiguration:_e,program:de,layoutVertexBuffer:me,indexBuffer:ge,uniformValues:Ae,terrainData:ke,projectionData:Me}=oe.state;de.draw(Z,q.TRIANGLES,te,H,ee,dt.backCCW,Ae,ke,Me,x.id,me,ge,oe.segments,x.paint,m.transform.zoom,_e)}})(t,n,s,l,p):c.co(s)?(function(m,_,x,w,T){if(x.paint.get("heatmap-opacity")===0)return;const I=m.context,{isRenderingToTexture:M,isRenderingGlobe:k}=T;if(m.style.map.terrain){for(const B of w){const G=_.getTile(B);_.hasRenderableParent(B)||(m.renderPass==="offscreen"?Kc(m,G,x,B,k):m.renderPass==="translucent"&&Jc(m,x,B,M,k))}I.viewport.set([0,0,m.width,m.height])}else m.renderPass==="offscreen"?(function(B,G,Z,q){const Y=B.context,te=Y.gl,H=B.transform,ee=pt.disabled,re=new Mt([te.ONE,te.ONE],c.bp.transparent,[!0,!0,!0,!0]);(function(J,oe,_e){const de=J.gl;J.activeTexture.set(de.TEXTURE1),J.viewport.set([0,0,oe.width/4,oe.height/4]);let me=_e.heatmapFbos.get(c.cd);me?(de.bindTexture(de.TEXTURE_2D,me.colorAttachment.get()),J.bindFramebuffer.set(me.framebuffer)):(me=_s(J,oe.width/4,oe.height/4),_e.heatmapFbos.set(c.cd,me))})(Y,B,Z),Y.clear({color:c.bp.transparent});for(let J=0;J<q.length;J++){const oe=q[J];if(G.hasRenderableParent(oe))continue;const _e=G.getTile(oe),de=_e.getBucket(Z);if(!de)continue;const me=de.programConfigurations.get(Z.id),ge=B.useProgram("heatmap",me),Ae=H.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),ke=H.getCircleRadiusCorrection();ge.draw(Y,te.TRIANGLES,lt.disabled,ee,re,dt.backCCW,Ma(_e,H.zoom,Z.paint.get("heatmap-intensity"),ke),null,Ae,Z.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,Z.paint,H.zoom,me)}Y.viewport.set([0,0,B.width,B.height])})(m,_,x,w):m.renderPass==="translucent"&&(function(B,G){const Z=B.context,q=Z.gl;Z.setColorMode(B.colorModeForRenderPass());const Y=G.heatmapFbos.get(c.cd);Y&&(Z.activeTexture.set(q.TEXTURE0),q.bindTexture(q.TEXTURE_2D,Y.colorAttachment.get()),Z.activeTexture.set(q.TEXTURE1),vo(Z,G).bind(q.LINEAR,q.CLAMP_TO_EDGE),B.useProgram("heatmapTexture").draw(Z,q.TRIANGLES,lt.disabled,pt.disabled,B.colorModeForRenderPass(),dt.disabled,Oc(B,G,0,1),null,null,G.id,B.viewportBuffer,B.quadTriangleIndexBuffer,B.viewportSegments,G.paint,B.transform.zoom))})(m,x)})(t,n,s,l,p):c.cp(s)?(function(m,_,x,w,T){if(m.renderPass!=="translucent")return;const{isRenderingToTexture:I}=T,M=x.paint.get("line-opacity"),k=x.paint.get("line-width");if(M.constantOr(1)===0||k.constantOr(1)===0)return;const B=m.getDepthModeForSublayer(0,lt.ReadOnly),G=m.colorModeForRenderPass(),Z=x.paint.get("line-dasharray"),q=Z.constantOr(1),Y=x.paint.get("line-pattern"),te=Y.constantOr(1),H=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters();let re;re=te?"linePattern":q&&H?"lineGradientSDF":q?"lineSDF":H?"lineGradient":"line";const J=m.context,oe=J.gl,_e=m.transform;let de=!0;for(const me of w){const ge=_.getTile(me);if(te&&!ge.patternsLoaded())continue;const Ae=ge.getBucket(x);if(!Ae)continue;const ke=Ae.programConfigurations.get(x.id),Me=m.context.program.get(),Le=m.useProgram(re,ke),tt=de||Le.program!==Me,xt=m.style.map.terrain&&m.style.map.terrain.getTerrainData(me),Dt=Y.constantOr(null),It=Z&&Z.constantOr(null);if(Dt&&ge.imageAtlas){const pi=ge.imageAtlas,ai=pi.patternPositions[Dt.to.toString()],ti=pi.patternPositions[Dt.from.toString()];ai&&ti&&ke.setConstantPatternPositions(ai,ti)}else if(It){const pi=x.layout.get("line-cap")==="round",ai=m.lineAtlas.getDash(It.to,pi),ti=m.lineAtlas.getDash(It.from,pi);ke.setConstantDashPositions(ai,ti)}const Ot=_e.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!I,applyTerrainMatrix:!0}),Et=_e.getPixelScale();let Ht;te?(Ht=yl(m,ge,x,Et,ee),eu(J,oe,ge,ke,ee)):q&&H?(Ht=ao(m,ge,x,Et,ee,Ae.lineClipsArray.length),ir(m,_,J,oe,x,Ae,me,ke,ee)):q?(Ht=Nc(m,ge,x,Et,ee),Qt(m,J,oe,ke,tt,ee)):H?(Ht=Vc(m,ge,x,Et,Ae.lineClipsArray.length),Wn(m,_,J,oe,x,Ae,me)):Ht=us(m,ge,x,Et);const jt=m.stencilModeForClipping(me);Le.draw(J,oe.TRIANGLES,B,jt,G,dt.disabled,Ht,xt,Ot,x.id,Ae.layoutVertexBuffer,Ae.indexBuffer,Ae.segments,x.paint,m.transform.zoom,ke,Ae.layoutVertexBuffer2),de=!1}})(t,n,s,l,p):c.cq(s)?(function(m,_,x,w,T){const I=x.paint.get("fill-color"),M=x.paint.get("fill-opacity");if(M.constantOr(1)===0)return;const{isRenderingToTexture:k}=T,B=m.colorModeForRenderPass(),G=x.paint.get("fill-pattern"),Z=m.opaquePassEnabledForLayer()&&!G.constantOr(1)&&I.constantOr(c.bp.transparent).a===1&&M.constantOr(0)===1?"opaque":"translucent";if(m.renderPass===Z){const q=m.getDepthModeForSublayer(1,m.renderPass==="opaque"?lt.ReadWrite:lt.ReadOnly);ys(m,_,x,w,q,B,!1,k)}if(m.renderPass==="translucent"&&x.paint.get("fill-antialias")){const q=m.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,lt.ReadOnly);ys(m,_,x,w,q,B,!0,k)}})(t,n,s,l,p):c.cr(s)?(function(m,_,x,w,T){const I=x.paint.get("fill-extrusion-opacity");if(I===0)return;const{isRenderingToTexture:M}=T;if(m.renderPass==="translucent"){const k=new lt(m.context.gl.LEQUAL,lt.ReadWrite,m.depthRangeFor3D);if(I!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))wo(m,_,x,w,k,pt.disabled,Mt.disabled,M),wo(m,_,x,w,k,m.stencilModeFor3D(),m.colorModeForRenderPass(),M);else{const B=m.colorModeForRenderPass();wo(m,_,x,w,k,pt.disabled,B,M)}}})(t,n,s,l,p):c.cs(s)?(function(m,_,x,w,T){if(m.renderPass!=="offscreen"&&m.renderPass!=="translucent")return;const{isRenderingToTexture:I}=T,M=m.context,k=m.style.projection.useSubdivision,B=m.getDepthModeForSublayer(0,lt.ReadOnly),G=m.colorModeForRenderPass();if(m.renderPass==="offscreen")(function(Z,q,Y,te,H,ee,re){const J=Z.context,oe=J.gl;for(const _e of Y){const de=q.getTile(_e),me=de.dem;if(!me||!me.data||!de.needsHillshadePrepare)continue;const ge=me.dim,Ae=me.stride,ke=me.getPixels();if(J.activeTexture.set(oe.TEXTURE1),J.pixelStoreUnpackPremultiplyAlpha.set(!1),de.demTexture=de.demTexture||Z.getTileTexture(Ae),de.demTexture){const Le=de.demTexture;Le.update(ke,{premultiply:!1}),Le.bind(oe.NEAREST,oe.CLAMP_TO_EDGE)}else de.demTexture=new c.T(J,ke,oe.RGBA,{premultiply:!1}),de.demTexture.bind(oe.NEAREST,oe.CLAMP_TO_EDGE);J.activeTexture.set(oe.TEXTURE0);let Me=de.fbo;if(!Me){const Le=new c.T(J,{width:ge,height:ge,data:null},oe.RGBA);Le.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),Me=de.fbo=J.createFramebuffer(ge,ge,!0,!1),Me.colorAttachment.set(Le.texture)}J.bindFramebuffer.set(Me.framebuffer),J.viewport.set([0,0,ge,ge]),Z.useProgram("hillshadePrepare").draw(J,oe.TRIANGLES,H,ee,re,dt.disabled,oh(de.tileID,me),null,null,te.id,Z.rasterBoundsBuffer,Z.quadTriangleIndexBuffer,Z.rasterBoundsSegments),de.needsHillshadePrepare=!1}})(m,_,w,x,B,pt.disabled,G),M.viewport.set([0,0,m.width,m.height]);else if(m.renderPass==="translucent")if(k){const[Z,q,Y]=m.stencilConfigForOverlapTwoPass(w);pn(m,_,x,Y,Z,B,G,!1,I),pn(m,_,x,Y,q,B,G,!0,I)}else{const[Z,q]=m.getStencilConfigForOverlapAndUpdateStencilID(w);pn(m,_,x,q,Z,B,G,!1,I)}})(t,n,s,l,p):c.ct(s)?(function(m,_,x,w,T){if(m.renderPass!=="translucent"||!w.length)return;const{isRenderingToTexture:I}=T,M=m.style.projection.useSubdivision,k=m.getDepthModeForSublayer(0,lt.ReadOnly),B=m.colorModeForRenderPass();if(M){const[G,Z,q]=m.stencilConfigForOverlapTwoPass(w);xs(m,_,x,q,G,k,B,!1,I),xs(m,_,x,q,Z,k,B,!0,I)}else{const[G,Z]=m.getStencilConfigForOverlapAndUpdateStencilID(w);xs(m,_,x,Z,G,k,B,!1,I)}})(t,n,s,l,p):c.bU(s)?(function(m,_,x,w,T){if(m.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!w.length)return;const{isRenderingToTexture:I}=T,M=_.getSource(),k=m.style.projection.useSubdivision;if(M instanceof Qi)za(m,_,x,w,null,!1,!1,M.tileCoords,M.flippedWindingOrder,I);else if(k){const[B,G,Z]=m.stencilConfigForOverlapTwoPass(w);za(m,_,x,Z,B,!1,!0,Hn,!1,I),za(m,_,x,Z,G,!0,!0,Hn,!1,I)}else{const[B,G]=m.getStencilConfigForOverlapAndUpdateStencilID(w);za(m,_,x,G,B,!1,!0,Hn,!1,I)}})(t,n,s,l,p):c.cu(s)?(function(m,_,x,w,T){const I=x.paint.get("background-color"),M=x.paint.get("background-opacity");if(M===0)return;const{isRenderingToTexture:k}=T,B=m.context,G=B.gl,Z=m.style.projection,q=m.transform,Y=q.tileSize,te=x.paint.get("background-pattern");if(m.isPatternMissing(te))return;const H=!te&&I.a===1&&M===1&&m.opaquePassEnabledForLayer()?"opaque":"translucent";if(m.renderPass!==H)return;const ee=pt.disabled,re=m.getDepthModeForSublayer(0,H==="opaque"?lt.ReadWrite:lt.ReadOnly),J=m.colorModeForRenderPass(),oe=m.useProgram(te?"backgroundPattern":"background"),_e=w||yt(q,{tileSize:Y,terrain:m.style.map.terrain});te&&(B.activeTexture.set(G.TEXTURE0),m.imageManager.bind(m.context));const de=x.getCrossfadeParameters();for(const me of _e){const ge=q.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),Ae=te?ch(M,m,te,{tileID:me,tileSize:Y},de):wl(M,I),ke=m.style.map.terrain&&m.style.map.terrain.getTerrainData(me),Me=Z.getMeshFromTileID(B,me.canonical,!1,!0,"raster");oe.draw(B,G.TRIANGLES,re,ee,J,dt.backCCW,Ae,ke,ge,x.id,Me.vertexBuffer,Me.indexBuffer,Me.segments)}})(t,0,s,l,p):c.cv(s)&&(function(m,_,x,w){const{isRenderingGlobe:T}=w,I=m.context,M=x.implementation,k=m.style.projection,B=m.transform,G=B.getProjectionDataForCustomLayer(T),Z={farZ:B.farZ,nearZ:B.nearZ,fov:B.fov*Math.PI/180,modelViewProjectionMatrix:B.modelViewProjectionMatrix,projectionMatrix:B.projectionMatrix,shaderData:{variantName:k.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
810uniform mat4 u_projection_matrix;
811${k.shaderPreludeCode.vertexSource}`,define:k.shaderDefine},defaultProjectionData:G},q=M.renderingMode?M.renderingMode:"2d";if(m.renderPass==="offscreen"){const Y=M.prerender;Y&&(m.setCustomLayerDefaults(),I.setColorMode(m.colorModeForRenderPass()),Y.call(M,I.gl,Z),I.setDirty(),m.setBaseState())}else if(m.renderPass==="translucent"){m.setCustomLayerDefaults(),I.setColorMode(m.colorModeForRenderPass()),I.setStencilMode(pt.disabled);const Y=q==="3d"?m.getDepthModeFor3D():m.getDepthModeForSublayer(0,lt.ReadOnly);I.setDepthMode(Y),M.render(I.gl,Z),I.setDirty(),m.setBaseState(),I.bindFramebuffer.set(null)}})(t,0,s,p))}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n,s=!1,l=[]){this.cache=this.cache||{};const p=!!this.style.map.terrain,m=this.style.projection,_=s?Nt.projectionMercator:m.shaderPreludeCode,x=s?Li:m.shaderDefine,w=t+(n?n.cacheKey:"")+`/${s?tr:m.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(p?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[w]||(this.cache[w]=new kc(this.context,Nt[t],n,uh[t],this._showOverdrawInspector,p,_,x,l)),this.cache[w]}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(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new c.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const s in this._tileTextures){const l=this._tileTextures[s];if(l)for(const p of l)p.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&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const s in this.cache){const l=this.cache[s];l&&l.program&&this.context.gl.deleteProgram(l.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Rl(d,t){let n,s=!1,l=null,p=null;const m=()=>{l=null,s&&(d.apply(p,n),l=setTimeout(m,t),s=!1)};return(..._)=>(s=!0,p=this,n=_,l||m(),l)}class Ll{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let s;return n.split("&").map((l=>l.split("="))).forEach((l=>{l[0]===this._hashName&&(s=l)})),(s&&s[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:s,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const s=n.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let p=window.location.hash.replace(l,"");p.startsWith("#&")?p=p.slice(0,1)+p.slice(2):p==="#"&&(p="");let m=window.location.href.replace(/(#.+)?$/,p);m=m.replace("&&","&"),window.history.replaceState(window.history.state,null,m)},this._updateHash=Rl(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),m=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,x=this._map.getBearing(),w=this._map.getPitch();let T="";if(T+=t?`/${m}/${_}/${s}`:`${s}/${_}/${m}`,(x||w)&&(T+="/"+Math.round(10*x)/10),w&&(T+=`/${Math.round(w)}`),this._hashName){const I=this._hashName;let M=!1;const k=window.location.hash.slice(1).split("&").map((B=>{const G=B.split("=")[0];return G===I?(M=!0,`${G}=${T}`):B})).filter((B=>B));return M||k.push(`${I}=${T}`),`#${k.join("&")}`}return`#${T}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new c.V(+t[2],+t[1])}catch{return!1}const n=+t[0],s=+(t[3]||0),l=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const mn={linearity:.3,easing:c.cw(0,0,.3,1)},lu=c.e({deceleration:2500,maxSpeed:1400},mn),ur=c.e({deceleration:20,maxSpeed:1400},mn),vr=c.e({deceleration:1e3,maxSpeed:360},mn),cu=c.e({deceleration:1e3,maxSpeed:90},mn),br=c.e({deceleration:1e3,maxSpeed:360},mn);class xh{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:st(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=st();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,n.roll+=p.rollDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(n.pan.mag()){const p=ws(n.pan.mag(),s,c.e({},lu,t||{})),m=n.pan.mult(p.amount/n.pan.mag()),_=this._map.cameraHelper.handlePanInertia(m,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,bs(l,p)}if(n.zoom){const p=ws(n.zoom,s,ur),m=c.cx(this._map.transform.zoom+p.amount,this._map.getZoomSnap(),p.amount);l.zoom=m,bs(l,p)}if(n.bearing){const p=ws(n.bearing,s,vr);l.bearing=this._map.transform.bearing+c.an(p.amount,-179,179),bs(l,p)}if(n.pitch){const p=ws(n.pitch,s,cu);l.pitch=this._map.transform.pitch+p.amount,bs(l,p)}if(n.roll){const p=ws(n.roll,s,br);l.roll=this._map.transform.roll+c.an(p.amount,-179,179),bs(l,p)}if(l.zoom||l.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;l.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),c.e(l,{noMoveStart:!0})}}function bs(d,t){(!d.duration||d.duration<t.duration)&&(d.duration=t.duration,d.easing=t.easing)}function ws(d,t,n){const{maxSpeed:s,linearity:l,deceleration:p}=n,m=c.an(d*l/(t/1e3),-s,s),_=Math.abs(m)/(p*l);return{easing:n.easing,duration:1e3*_,amount:m*(_/2)}}class di extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(t,s);const p=xe.mousePos(n.getCanvas(),s),m=n.unproject(p);super(t,c.e({point:p,lngLat:m,originalEvent:s},l)),this._defaultPrevented=!1,this.target=n}}class Ts extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){const l=t==="touchend"?s.changedTouches:s.touches,p=xe.touchPos(n.getCanvasContainer(),l),m=p.map((x=>n.unproject(x))),_=p.reduce(((x,w,T,I)=>x.add(w.div(I.length))),new c.P(0,0));super(t,{points:p,point:_,lngLats:m,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class uu extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}}class vh{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new uu(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new di(t.type,this._map,t))}mouseup(t){this._map.fire(new di(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new di(t.type,this._map,t))}dblclick(t){return this._firePreventable(new di(t.type,this._map,t))}mouseover(t){this._map.fire(new di(t.type,this._map,t))}mouseout(t){this._map.fire(new di(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ts(t.type,this._map,t))}touchmove(t){this._map.fire(new Ts(t.type,this._map,t))}touchend(t){this._map.fire(new Ts(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ts(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class bh{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new di(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new di("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new di(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ka{constructor(t){this._map=t}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(t){return this.transform.screenPointToLocation(c.P.convert(t),this._map.terrain)}}class Da{constructor(t,n){this._map=t,this._tr=new ka(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(xe.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=xe.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const p=Math.min(l.x,s.x),m=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);xe.setTransform(this._box,`translate(${p}px,${_}px)`),this._box.style.width=m-p+"px",this._box.style.height=x-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,l=n;if(this.reset(),xe.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new c.l("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(xe.remove(this._box),this._box=null),xe.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.l(t,{originalEvent:n}))}}function wr(d,t){if(d.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${d.length}, points ${t.length}`);const n={};for(let s=0;s<d.length;s++)n[d[s].identifier]=t[s];return n}class Be{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=(function(l){const p=new c.P(0,0);for(const m of l)p._add(m);return p.div(l.length)})(n),this.touches=wr(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const l=wr(s,n);for(const p in this.touches){const m=l[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class To{constructor(t){this.singleTap=new Be(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const l=this.singleTap.touchend(t,n,s);if(l){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(l)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class Fl{constructor(t){this._tr=new ka(t),this._zoomIn=new To({numTouches:1,numTaps:2}),this._zoomOut=new To({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const l=this._zoomIn.touchend(t,n,s),p=this._zoomOut.touchend(t,n,s),m=this._tr;return l?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:c.cx(m.zoom+1,_.getZoomSnap()),around:m.unproject(l)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:c.cx(m.zoom-1,_.getZoomSnap()),around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ra{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const l=Array.isArray(n)?n[0]:n;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&xe.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ss=0,Ps=2,Bl={[Ss]:1,[Ps]:2};class Ms{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=xe.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,s){const l=Bl[s];return n.buttons===void 0||(n.buttons&l)!==l})(t,this._eventButton)}isValidEndEvent(t){return xe.mouseButton(t)===this._eventButton}}class Ol{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class hu{constructor(t=new Ms({checkCorrectEvent:()=>!0}),n=new Ol){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,s){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?s(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const La=d=>{d.mousedown=d.dragStart,d.mousemoveWindow=d.dragMove,d.mouseup=d.dragEnd,d.contextmenu=t=>{t.preventDefault()}};class wh{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._active){if(!this._shouldBePrevented(s.length))return t.preventDefault(),this._calculateTransform(t,n,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const l=wr(s,n),p=new c.P(0,0),m=new c.P(0,0);let _=0;for(const w in l){const T=l[w],I=this._touches[w];I&&(p._add(T),m._add(T.sub(I)),_++,l[w]=T)}if(this._touches=l,this._shouldBePrevented(_)||!m.mag())return;const x=m.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class So{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[l,p]=this._firstTwoTouches,m=Po(s,n,l),_=Po(s,n,p);if(!m||!_)return;const x=this._aroundCenter?null:m.add(_).div(2);return this._move([m,_],x,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[l,p]=this._firstTwoTouches,m=Po(s,n,l),_=Po(s,n,p);m&&_||(this._active&&xe.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Po(d,t,n){for(let s=0;s<d.length;s++)if(d[s].identifier===n)return t[s]}function du(d,t){return Math.log(d/t)/Math.LN2}class jl extends So{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(du(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:du(this._distance,s),pinchAround:n}}}function pu(d,t){return 180*d.angleWith(t)/Math.PI}class Vl extends So{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,s){const l=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:pu(this._vector,l),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=pu(t,this._startVector);return Math.abs(s)<n}}function Nl(d){return Math.abs(d.y)>Math.abs(d.x)}class fu extends So{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,Nl(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(l.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const l=t.mag()>=2,p=n.mag()>=2;if(!l&&!p)return;if(!l||!p)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Nl(t)&&Nl(n)&&m}}const gn={panStep:100,bearingStep:15,pitchStep:10};class Tt{constructor(t){this._tr=new ka(t);const n=gn;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,l=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?l=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?l=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Th,zoom:n?c.cx(x.zoom+n*(t.shiftKey?2:1),_.getZoomSnap()):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:x.center},{originalEvent:t})}}}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 Th(d){return d*(2-d)}const Is=4.000244140625,Mo=1/450;class Io{constructor(t,n){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=t,this._tr=new ka(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Mo}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=st(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Is==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(l*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=xe.mousePos(this._map.getCanvas(),t),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(c.V.convert(s.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Is?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const w=typeof this._targetZoom!="number"?t.scale:c.aq(this._targetZoom),T=t.applyConstrain(t.getCameraLngLat(),c.at(w*x)).zoom,I=this._map.getZoomSnap();if(this._type==="wheel"&&I>0){const M=c.cx(t.zoom,I);this._targetZoom=c.cx(T,I,T-M)}else this._targetZoom=T;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let p,m=!1;if(this._type==="wheel"&&s&&l){const _=st()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),w=l(x);p=c.G.number(s,n,w),x<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=p,{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.cz;if(this._prevEase){const s=this._prevEase,l=(st()-s.start)/s.duration,p=s.easing(l+.01)-s.easing(l),m=.27/Math.sqrt(p*p+1e-4)*.01,_=Math.sqrt(.0729-m*m);n=c.cw(m,_,.25,1)}return this._prevEase={start:st(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ul{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 mu{constructor(t){this._tr=new ka(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:c.cx(this._tr.zoom+(t.shiftKey?-1:1),s.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gu{constructor(){this._tap=new To({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,s){if(!this._swipePoint)if(this._tapTime){const l=n[0],p=t.timeStamp-this._tapTime<500,m=this._tapPoint.dist(l)<30;p&&m?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(t,n,s)}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=n[0],p=l.y-this._swipePoint.y;return this._swipePoint=l,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(t,n,s);l&&(this._tapTime=t.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _u{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},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 Tr{constructor(t,n,s,l){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=s,this._mouseRoll=l}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 Es{constructor(t,n,s,l){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class qe{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=xe.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=n,this._container.appendChild(l);const p=document.createElement("div");p.className="maplibregl-mobile-message",p.textContent=s,this._container.appendChild(p),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(xe.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.l("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const He=d=>d.zoom||d.drag||d.roll||d.pitch||d.rotate;class Cs extends c.l{}function Eo(d){return d.panDelta&&d.panDelta.mag()||d.zoomDelta||d.bearingDelta||d.pitchDelta||d.rollDelta}class Co{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,p)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const m=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},w={};for(const{handlerName:M,handler:k,allowed:B}of this._handlers){if(!k.isEnabled())continue;let G;if(this._blockedByActive(w,B,M))k.reset();else if(k[p||l.type]){if(c.cA(l,p||l.type)){const Z=xe.mousePos(this._map.getCanvas(),l);G=k[p||l.type](l,Z)}else if(c.cB(l,p||l.type)){const Z=this._getMapTouches(l.touches),q=xe.touchPos(this._map.getCanvas(),Z);G=k[p||l.type](l,q,Z)}else c.cC(p||l.type)||(G=k[p||l.type](l));this.mergeHandlerResult(_,x,G,M,m),G&&G.needsRenderFrame&&this._triggerRenderFrame()}(G||k.isActive())&&(w[M]=k)}const T={};for(const M in this._previousActiveHandlers)w[M]||(T[M]=m);this._previousActiveHandlers=w,(Object.keys(T).length||Eo(_))&&(this._changes.push([_,x,T]),this._triggerRenderFrame()),(Object.keys(w).length||Eo(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=_;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new xh(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[l,p,m]of this._listeners)xe.addEventListener(l,p,l===this._ownerDocument?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,s]of this._listeners)xe.removeEventListener(t,n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new vh(n,t));const l=n.boxZoom=new Da(n,t);this._add("boxZoom",l),t.interactive&&t.boxZoom&&l.enable();const p=n.cooperativeGestures=new qe(n,t.cooperativeGestures);this._add("cooperativeGestures",p),t.cooperativeGestures&&p.enable();const m=new Fl(n),_=new mu(n);n.doubleClickZoom=new Ul(_,m),this._add("tapZoom",m),this._add("clickZoom",_),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const x=new gu;this._add("tapDragZoom",x);const w=n.touchPitch=new fu(n);this._add("touchPitch",w),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const T=()=>n.project(n.getCenter()),I=(function({enable:H,clickTolerance:ee,aroundCenter:re=!0,minPixelCenterThreshold:J=100,rotateDegreesPerPixelMoved:oe=.8},_e){const de=new Ms({checkCorrectEvent:me=>xe.mouseButton(me)===0&&me.ctrlKey||xe.mouseButton(me)===2&&!me.ctrlKey});return new Ra({clickTolerance:ee,move:(me,ge)=>{const Ae=_e();if(re&&Math.abs(Ae.y-me.y)>J)return{bearingDelta:c.cy(new c.P(me.x,ge.y),ge,Ae)};let ke=(ge.x-me.x)*oe;return re&&ge.y<Ae.y&&(ke=-ke),{bearingDelta:ke}},moveStateManager:de,enable:H,assignEvents:La})})(t,T),M=(function({enable:H,clickTolerance:ee,pitchDegreesPerPixelMoved:re=-.5}){const J=new Ms({checkCorrectEvent:oe=>xe.mouseButton(oe)===0&&oe.ctrlKey||xe.mouseButton(oe)===2});return new Ra({clickTolerance:ee,move:(oe,_e)=>({pitchDelta:(_e.y-oe.y)*re}),moveStateManager:J,enable:H,assignEvents:La})})(t),k=(function({enable:H,clickTolerance:ee,rollDegreesPerPixelMoved:re=.3},J){const oe=new Ms({checkCorrectEvent:_e=>xe.mouseButton(_e)===2&&_e.ctrlKey});return new Ra({clickTolerance:ee,move:(_e,de)=>{const me=J();let ge=(de.x-_e.x)*re;return de.y<me.y&&(ge=-ge),{rollDelta:ge}},moveStateManager:oe,enable:H,assignEvents:La})})(t,T);n.dragRotate=new Tr(t,I,M,k),this._add("mouseRotate",I,["mousePitch"]),this._add("mousePitch",M,["mouseRotate","mouseRoll"]),this._add("mouseRoll",k,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const B=(function({enable:H,clickTolerance:ee}){const re=new Ms({checkCorrectEvent:J=>xe.mouseButton(J)===0&&!J.ctrlKey});return new Ra({clickTolerance:ee,move:(J,oe)=>({around:oe,panDelta:oe.sub(J)}),activateOnStart:!0,moveStateManager:re,enable:H,assignEvents:La})})(t),G=new wh(t,n);n.dragPan=new _u(s,B,G),this._add("mousePan",B),this._add("touchPan",G,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const Z=new Vl,q=new jl;n.touchZoomRotate=new Es(s,q,Z,x),this._add("touchRotate",Z,["touchPan","touchZoom"]),this._add("touchZoom",q,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new bh(n));const Y=n.scrollZoom=new Io(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",Y,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const te=n.keyboard=new Tt(n);this._add("keyboard",te),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!He(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,s){for(const l in t)if(l!==s&&(!n||n.indexOf(l)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}mergeHandlerResult(t,n,s,l,p){if(!s)return;c.e(t,s);const m={handlerName:l,originalEvent:s.originalEvent||p};s.zoomDelta!==void 0&&(n.zoom=m),s.panDelta!==void 0&&(n.drag=m),s.rollDelta!==void 0&&(n.roll=m),s.pitchDelta!==void 0&&(n.pitch=m),s.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},s={};for(const[l,p,m]of this._changes)l.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(l.panDelta)),l.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(t.rollDelta=(t.rollDelta||0)+l.rollDelta),l.around!==void 0&&(t.around=l.around),l.pinchAround!==void 0&&(t.pinchAround=l.pinchAround),l.noInertia&&(t.noInertia=l.noInertia),c.e(n,p),c.e(s,m);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const l=this._map,p=l._getTransformForUpdate(),m=l.terrain;if(!(Eo(t)||m&&this._terrainMovement))return this._fireEvents(n,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:w,pitchDelta:T,rollDelta:I,around:M,pinchAround:k}=t;k!==void 0&&(M=k),M=M||l.transform.centerPoint,m&&!p.isPointOnMapSurface(M)&&(M=p.centerPoint);const B={panDelta:_,zoomDelta:x,rollDelta:I,pitchDelta:T,bearingDelta:w,around:M};this._map.cameraHelper.useGlobeControls&&!p.isPointOnMapSurface(M)&&(M=p.centerPoint);const G=M.distSqr(p.centerPoint)<.01?p.center:p.screenPointToLocation(_?M.sub(_):M);this._handleMapControls({terrain:m,tr:p,deltasForHelper:B,preZoomAroundLoc:G,combinedEventsInProgress:n,panDelta:_}),l._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:s,preZoomAroundLoc:l,combinedEventsInProgress:p,panDelta:m}){const _=this._map.cameraHelper;if(_.handleMapControlsRollPitchBearingZoom(s,n),t)return _.useGlobeControls?(this._terrainMovement||!p.drag&&!p.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void _.handleMapControlsPan(s,n,l)):this._terrainMovement||!p.drag&&!p.zoom?void(p.drag&&this._terrainMovement&&m?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(m))):_.handleMapControlsPan(s,n,l)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void _.handleMapControlsPan(s,n,l));_.handleMapControlsPan(s,n,l)}_fireEvents(t,n,s){const l=He(this._eventsInProgress),p=He(t),m={};for(const I in t){const{originalEvent:M}=t[I];this._eventsInProgress[I]||(m[`${I}start`]=M),this._eventsInProgress[I]=t[I]}!l&&p&&this._fireEvent("movestart",p.originalEvent);for(const I in m)this._fireEvent(I,m[I]);p&&this._fireEvent("move",p.originalEvent);for(const I in t){const{originalEvent:M}=t[I];this._fireEvent(I,M)}const _={};let x;for(const I in this._eventsInProgress){const{handlerName:M,originalEvent:k}=this._eventsInProgress[I];this._handlersById[M].isActive()||(delete this._eventsInProgress[I],x=n[M]||k,_[`${I}end`]=x)}for(const I in _)this._fireEvent(I,_[I]);const w=He(this._eventsInProgress),T=(l||p)&&!w;if(T&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const I=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&I.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(I)}if(s&&T){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=k=>k!==0&&-this._bearingSnap<k&&k<this._bearingSnap;!I||!I.essential&&_t.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()):(M(I.bearing||this._map.getBearing())&&(I.bearing=0),I.freezeElevation=!0,this._map.easeTo(I,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.l(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Cs("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Oi extends c.E{constructor(t,n,s){super(),this._renderFrameCallback=()=>{const l=Math.min((st()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=s.bearingSnap,this._zoomSnap=s.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new c.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,s){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),s)}panTo(t,n,s){return this.easeTo(c.e({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(c.e({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(c.cx(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(c.cx(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)).fire(new c.l("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(c.e({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Ft.convert(t).adjustAntiMeridian();const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,l){const p={top:0,bottom:0,right:0,left:0};if(typeof(l=c.e({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const w=l.padding;l.padding={top:w,bottom:w,right:w,left:w}}const m=c.e(p,l.padding);l.padding=m;const _=this.transform,x=new Ft(t,n);return this.cameraHelper.cameraForBoxAndBearing(l,m,x,s,_)}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,l,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(c.P.convert(t)),this.transform.screenPointToLocation(c.P.convert(n)),s,l),l,p)}_fitInternal(t,n,s){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this._getTransformForUpdate();let l=!1,p=!1,m=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,t);const x=s.zoom!==_;return"elevation"in t&&s.elevation!==+t.elevation&&s.setElevation(+t.elevation),"bearing"in t&&s.bearing!==+t.bearing&&(l=!0,s.setBearing(+t.bearing)),"pitch"in t&&s.pitch!==+t.pitch&&(p=!0,s.setPitch(+t.pitch)),"roll"in t&&s.roll!==+t.roll&&(m=!0,s.setRoll(+t.roll)),t.padding==null||s.isPaddingEqual(t.padding)||s.setPadding(t.padding),this._applyUpdatedTransform(s),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)),x&&this.fire(new c.l("zoomstart",n)).fire(new c.l("zoom",n)).fire(new c.l("zoomend",n)),l&&this.fire(new c.l("rotatestart",n)).fire(new c.l("rotate",n)).fire(new c.l("rotateend",n)),p&&this.fire(new c.l("pitchstart",n)).fire(new c.l("pitch",n)).fire(new c.l("pitchend",n)),m&&this.fire(new c.l("rollstart",n)).fire(new c.l("roll",n)).fire(new c.l("rollend",n)),this.fire(new c.l("moveend",n))}calculateCameraOptionsFromTo(t,n,s,l=0){const p=c.a9.fromLngLat(t,n),m=c.a9.fromLngLat(s,l),_=m.x-p.x,x=m.y-p.y,w=m.z-p.z,T=Math.hypot(_,x,w);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,x),M=c.at(this.transform.cameraToCenterDistance/T/this.transform.tileSize),k=180*Math.atan2(_,-x)/Math.PI;let B=180*Math.acos(I/T)/Math.PI;return B=w<0?90-B:90+B,{center:m.toLngLat(),elevation:l,zoom:M,pitch:B,bearing:k}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,s,l,p){const m=this.transform.calculateCenterFromCameraLngLatAlt(t,n,s,l);return{center:m.center,elevation:m.elevation,zoom:m.zoom,bearing:s,pitch:l,roll:p}}easeTo(t,n){this._stop(!1,t.easeId),((t=c.e({offset:[0,0],duration:500,easing:c.cz},t)).animate===!1||!t.essential&&_t.prefersReducedMotion)&&(t.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),p=s.pitch,m=s.roll,_="bearing"in t?this._normalizeBearing(t.bearing,l):l,x="pitch"in t?+t.pitch:p,w="roll"in t?this._normalizeBearing(t.roll,m):m,T="padding"in t?t.padding:s.padding,I=c.P.convert(t.offset);let M,k;t.around&&(M=c.V.convert(t.around),k=s.locationToScreenPoint(M));const B={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},G=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:w,padding:T,around:M,aroundPoint:k,offsetAsPoint:I,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==p,this._rolling=this._rolling||w!==m,this._padding=!s.isPaddingEqual(T),this._zooming=this._zooming||G.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,B),this.terrain&&this._prepareElevation(G.elevationCenter),this._ease((Z=>{G.easeFunc(Z),this.terrain&&!t.freezeElevation&&this._updateElevation(Z),this._applyUpdatedTransform(s),this._fireMoveEvents(n)}),(Z=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,Z)}),t),this}_prepareEase(t,n,s={}){this._moving=!0,n||s.moving||this.fire(new c.l("movestart",t)),this._zooming&&!s.zooming&&this.fire(new c.l("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new c.l("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new c.l("pitchstart",t)),this._rolling&&!s.rolling&&this.fire(new c.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(s-(n-(s*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(c.G.number(this._elevationStart,this._elevationTarget,t))}_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(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),s=t.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(s<l){const p=this.calculateCameraOptionsFromTo(n,l,t.center,t.elevation);return{pitch:p.pitch,zoom:p.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((l=>this._elevateCameraIfInsideTerrain(l))),this.transformCameraUpdate&&n.push((l=>this.transformCameraUpdate(l))),!n.length)return;const s=t.clone();for(const l of n){const p=s.clone(),{center:m,zoom:_,roll:x,pitch:w,bearing:T,elevation:I}=l(p);m&&p.setCenter(m),I!==void 0&&p.setElevation(I),_!==void 0&&p.setZoom(_),x!==void 0&&p.setRoll(x),w!==void 0&&p.setPitch(w),T!==void 0&&p.setBearing(T),s.apply(p,!1)}this.transform.apply(s,!1)}_fireMoveEvents(t){this.fire(new c.l("move",t)),this._zooming&&this.fire(new c.l("zoom",t)),this._rotating&&this.fire(new c.l("rotate",t)),this._pitching&&this.fire(new c.l("pitch",t)),this._rolling&&this.fire(new c.l("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const s=this._zooming,l=this._rotating,p=this._pitching,m=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new c.l("zoomend",t)),l&&this.fire(new c.l("rotateend",t)),p&&this.fire(new c.l("pitchend",t)),m&&this.fire(new c.l("rollend",t)),this.fire(new c.l("moveend",t))}flyTo(t,n){if(!t.essential&&_t.prefersReducedMotion){const ge=c.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(ge,n)}this.stop(),t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.cz},t);const s=this._getTransformForUpdate(),l=s.bearing,p=s.pitch,m=s.roll,_=s.padding,x="bearing"in t?this._normalizeBearing(t.bearing,l):l,w="pitch"in t?+t.pitch:p,T="roll"in t?this._normalizeBearing(t.roll,m):m,I="padding"in t?t.padding:s.padding,M=c.P.convert(t.offset);let k=s.centerPoint.add(M);const B=s.screenPointToLocation(k),G=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:w,roll:T,padding:I,locationAtOffset:B,offsetAsPoint:M,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let Z=t.curve;const q=Math.max(s.width,s.height),Y=q/G.scaleOfZoom,te=G.pixelPathLength;typeof G.scaleOfMinZoom=="number"&&(Z=Math.sqrt(q/G.scaleOfMinZoom/te*2));const H=Z*Z;function ee(ge){const Ae=(Y*Y-q*q+(ge?-1:1)*H*H*te*te)/(2*(ge?Y:q)*H*te);return Math.log(Math.sqrt(Ae*Ae+1)-Ae)}function re(ge){return(Math.exp(ge)-Math.exp(-ge))/2}function J(ge){return(Math.exp(ge)+Math.exp(-ge))/2}const oe=ee(!1);let _e=function(ge){return J(oe)/J(oe+Z*ge)},de=function(ge){return q*((J(oe)*(re(Ae=oe+Z*ge)/J(Ae))-re(oe))/H)/te;var Ae},me=(ee(!0)-oe)/Z;if(Math.abs(te)<2e-6||!isFinite(me)){if(Math.abs(q-Y)<1e-6)return this.easeTo(t,n);const ge=Y<q?-1:1;me=Math.abs(Math.log(Y/q))/Z,de=()=>0,_e=Ae=>Math.exp(ge*Z*Ae)}return t.duration="duration"in t?+t.duration:1e3*me/("screenSpeed"in t?+t.screenSpeed/Z:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=w!==p,this._rolling=T!==m,this._padding=!s.isPaddingEqual(I),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(G.targetCenter),this._ease((ge=>{const Ae=ge*me,ke=1/_e(Ae),Me=de(Ae);this._rotating&&s.setBearing(c.G.number(l,x,ge)),this._pitching&&s.setPitch(c.G.number(p,w,ge)),this._rolling&&s.setRoll(c.G.number(m,T,ge)),this._padding&&(s.interpolatePadding(_,I,ge),k=s.centerPoint.add(M)),G.easeFunc(ge,ke,Me,k),this.terrain&&!t.freezeElevation&&this._updateElevation(ge),this._applyUpdatedTransform(s),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,n)}return t||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=st(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.W(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(c.V.convert(t),this.transform):null}}const hr={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Gl{constructor(t=hr){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=xe.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=xe.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=xe.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(){xe.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((l=>typeof l!="string"?"":l))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const n=this._map.style.tileManagers;for(const l in n){const p=n[l];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter((l=>String(l).trim())),t.sort(((l,p)=>l.length-p.length)),t=t.filter(((l,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(l)>=0)return!1;return!0}));const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=xe.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class yu{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const s=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=xe.create("div","maplibregl-ctrl");const n=xe.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){xe.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Sh{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const l of s)if(l.id===t)return void(l.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Ph=c.aU([{name:"a_pos3d",type:"Int16",components:3}]);class As extends c.E{constructor(t){super(),this._lastTilesetChange=st(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const s={};for(const l of yt(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),c.c7(l.terrainRttPosMatrix32f,0,c.a5,c.a5,0,0,1),this._tiles[l.key]=new ae(l,this.tileSize),this._lastTilesetChange=st());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(t){for(const n in this._tiles){const s=this._tiles[n];(!t||s.tileID.equals(t)||s.tileID.isChildOf(t)||t.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,p=t.clone(),m=c.bk();if(l.canonical.equals(t.canonical))c.c7(m,0,c.a5,c.a5,0,0,1);else if(l.canonical.isChildOf(t.canonical)){const _=l.canonical.z-t.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),w=l.canonical.y-(l.canonical.y>>_<<_),T=c.a5>>_;c.c7(m,0,T,T,0,0,1),c.O(m,m,[-x*T,-w*T,0])}else{if(!t.canonical.isChildOf(l.canonical))continue;{const _=t.canonical.z-l.canonical.z,x=t.canonical.x-(t.canonical.x>>_<<_),w=t.canonical.y-(t.canonical.y>>_<<_),T=c.a5>>_;c.c7(m,0,c.a5,c.a5,0,0,1),c.O(m,m,[x*T,w*T,0]),c.Q(m,m,[1/2**_,1/2**_,0])}}p.terrainRttPosMatrix32f=new Float32Array(m),n[s]=p}return n}_getTerrainCoordsForTileRanges(t,n){const s={};for(const l of this._renderableTilesKeys){const p=this._tiles[l].tileID;if(!this._isWithinTileRanges(p,n))continue;const m=t.clone(),_=c.bk();if(p.canonical.z===t.canonical.z){const x=t.canonical.x-p.canonical.x+t.wrap*(1<<t.canonical.z),w=t.canonical.y-p.canonical.y;c.c7(_,0,c.a5,c.a5,0,0,1),c.O(_,_,[x*c.a5,w*c.a5,0])}else if(p.canonical.z>t.canonical.z){const x=p.canonical.z-t.canonical.z,w=p.canonical.x-(p.canonical.x>>x<<x)+t.wrap*(1<<p.canonical.z),T=p.canonical.y-(p.canonical.y>>x<<x),I=t.canonical.x-(p.canonical.x>>x),M=t.canonical.y-(p.canonical.y>>x),k=c.a5>>x;c.c7(_,0,k,k,0,0,1),c.O(_,_,[-w*k+I*c.a5,-T*k+M*c.a5,0])}else{const x=t.canonical.z-p.canonical.z,w=t.canonical.x-(t.canonical.x>>x<<x)+t.wrap*(1<<t.canonical.z),T=t.canonical.y-(t.canonical.y>>x<<x),I=(t.canonical.x>>x)-p.canonical.x,M=(t.canonical.y>>x)-p.canonical.y,k=c.a5<<x;c.c7(_,0,k,k,0,0,1),c.O(_,_,[w*c.a5+I*k,T*c.a5+M*k,0])}m.terrainRttPosMatrix32f=new Float32Array(_),s[l]=m}return s}getSourceTile(t,n){const s=this.tileManager._source;let l=t.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(l).key);let p=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(p!=null&&p.dem)&&n)for(;l>=s.minzoom&&!(p!=null&&p.dem);)p=this.findTileInCaches(t.scaledTo(l--).key);return p}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const s=n[t.canonical.z];return!!s&&(t.wrap>s.minWrap||t.wrap<s.maxWrap||t.canonical.x>=s.minTileXWrapped&&t.canonical.x<=s.maxTileXWrapped&&t.canonical.y>=s.minTileY&&t.canonical.y<=s.maxTileY)}}class Ut{constructor(t,n,s){this._meshCache={},this.painter=t,this.tileManager=new As(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,s,l=c.a5){var p;const m=t.normalizeCoordinates(n,s,l);if(!m)return 0;const _=this.getTerrainData(m.tileID),x=(p=_.tile)===null||p===void 0?void 0:p.dem;if(!x)return 0;const w=c.cD([],[m.x/l*c.a5,m.y/l*c.a5],_.u_terrain_matrix),T=[w[0]*x.dim,w[1]*x.dim],I=Math.floor(T[0]),M=Math.floor(T[1]),k=T[0]-I,B=T[1]-M;return x.get(I,M)*(1-k)*(1-B)+x.get(I+1,M)*k*(1-B)+x.get(I,M+1)*(1-k)*B+x.get(I+1,M+1)*k*B}getElevationForLngLatZoom(t,n){if(!c.cE(n,t.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:p}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(s,l%c.a5,p%c.a5,c.a5)}getElevationForLngLat(t,n){const s=yt(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let l=0;for(const p of s)p.canonical.z>l&&(l=Math.min(p.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,l)}getElevation(t,n,s,l=c.a5){return this.getDEMElevation(t,n,s,l)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const l=this.painter.context,p=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new c.T(l,p,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new c.T(l,new c.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ar([])}const n=this.tileManager.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const l=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new c.T(l,n.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),n.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n.toString()+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const l=this.tileManager.getSource().maxzoom;let p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=l?p=t.canonical.z-l:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),x=c.cF(new Float64Array(16),[1/(c.a5<<p),1/(c.a5<<p),0]);c.O(x,x,[m*c.a5,_*c.a5,0]),this._demMatrixCache[t.key]={matrix:x,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,s=n.width/devicePixelRatio,l=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new c.T(n.context,{width:s,height:l,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new c.T(n.context,{width:s,height:l,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let p=0,m=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,m+=4)n[m+0]=255&_,n[m+1]=255&p,n[m+2]=_>>8<<4|p>>8,n[m+3]=0;const s=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),l=new c.T(t,s,t.gl.RGBA,{premultiply:!1});return l.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),s=this.painter.context,l=s.gl,p=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),m=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(p,_-m-1,1,1,l.RGBA,l.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null);const x=n[0]+(n[2]>>4<<8),w=n[1]+((15&n[2])<<8),T=this.coordsIndex[255-n[3]],I=T&&this.tileManager.getTileByID(T);if(!I)return null;const M=this._coordsTextureSize,k=(1<<I.tileID.canonical.z)*M;return new c.a9((I.tileID.canonical.x*M+x)/k+I.tileID.wrap,(I.tileID.canonical.y*M+w)/k,this.getElevation(I.tileID,x,w,M))}depthAtPoint(t){const n=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,n),s.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const s=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,l=s&&t.canonical.y===0,p=s&&t.canonical.y===(1<<t.canonical.z)-1,m=`m_${l?"n":""}_${p?"s":""}`;if(this._meshCache[m])return this._meshCache[m];const _=this.painter.context,x=new c.cG,w=new c.aY,T=this.meshSize,I=c.a5/T,M=T*T;for(let J=0;J<=T;J++)for(let oe=0;oe<=T;oe++)x.emplaceBack(oe*I,J*I,0);for(let J=0;J<M;J+=T+1)for(let oe=0;oe<T;oe++)w.emplaceBack(oe+J,T+oe+J+1,T+oe+J+2),w.emplaceBack(oe+J,T+oe+J+2,oe+J+1);const k=x.length,B=k+(T+1),G=(T+1)*T,Z=l?c.br:0,q=l?0:1,Y=p?c.bs:c.a5,te=p?0:1;for(let J=0;J<=T;J++)x.emplaceBack(J*I,Z,q);for(let J=0;J<=T;J++)x.emplaceBack(J*I,Y,te);for(let J=0;J<T;J++)w.emplaceBack(G+J,B+J,B+J+1),w.emplaceBack(G+J,B+J+1,G+J+1),w.emplaceBack(0+J,k+J+1,k+J),w.emplaceBack(0+J,0+J+1,k+J+1);const H=x.length,ee=H+2*(T+1);for(const J of[0,1])for(let oe=0;oe<=T;oe++)for(const _e of[0,1])x.emplaceBack(J*c.a5,oe*I,_e);for(let J=0;J<2*T;J+=2)w.emplaceBack(H+J,H+J+1,H+J+3),w.emplaceBack(H+J,H+J+3,H+J+2),w.emplaceBack(ee+J,ee+J+3,ee+J+1),w.emplaceBack(ee+J,ee+J+2,ee+J+3);const re=new Pt(_.createVertexBuffer(x,Ph.members),_.createIndexBuffer(w),c.aX.simpleSegment(0,0,x.length,w.length));return this._meshCache[m]=re,re}getMeshFrameDelta(t){return 2*Math.PI*c.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var s;if(!c.cE(n,t.wrap()))return 0;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=n.dem.min*this.exaggeration,s.maxElevation=n.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(t,n){const s=c.a9.fromLngLat(t.wrap()),l=(1<<n)*c.a5,p=s.x*l,m=s.y*l,_=Math.floor(p/c.a5),x=Math.floor(m/c.a5);return{tileID:new c.a2(n,0,n,_,x),mercatorX:p,mercatorY:m}}}class ei{constructor(t,n,s){this._context=t,this._size=n,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new c.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.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),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(s.texture),{id:t,fbo:n,texture:s,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const Xn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class zs{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new ei(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){var s,l;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((p=>!t._layers[p].isHidden(n))),this._coordsAscending={};for(const p in t.tileManagers){this._coordsAscending[p]={};const m=t.tileManagers[p].getVisibleCoordinates(),_=t.tileManagers[p].getSource(),x=_ instanceof Qi?_.terrainTileRanges:null;for(const w of m){const T=this.terrain.tileManager.getTerrainCoords(w,x);for(const I in T)this._coordsAscending[p][I]||(this._coordsAscending[p][I]=[]),this._coordsAscending[p][I].push(T[I])}}this._rttFingerprints={};for(const p of t._order){const m=t._layers[p],_=m.source;if(Xn[m.type]&&!this._rttFingerprints[_]){this._rttFingerprints[_]={};const x=(l=(s=t.tileManagers[_])===null||s===void 0?void 0:s.getState().revision)!==null&&l!==void 0?l:0;for(const w in this._coordsAscending[_])this._rttFingerprints[_][w]=`${this._coordsAscending[_][w].map((T=>T.key)).sort().join()}#${x}`}}for(const p of this._renderableTiles)for(const m in this._rttFingerprints){const _=this._rttFingerprints[m][p.tileID.key];_&&_!==p.rttFingerprint[m]&&(p.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),l=t.type,p=this.painter,m=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Xn[l]&&(this._prevType&&Xn[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(t.id),!m))return!0;if(Xn[this._prevType]||Xn[l]&&m){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const w of this._renderableTiles){if(this.pool.isFull()&&(kl(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(w),w.rtt[_]){const I=this.pool.getObjectForId(w.rtt[_].id);if(I.stamp===w.rtt[_].stamp){this.pool.useObject(I);continue}}const T=this.pool.getOrCreateFreeObject();this.pool.useObject(T),this.pool.stampObject(T),w.rtt[_]={id:T.id,stamp:T.stamp},p.context.bindFramebuffer.set(T.fbo.framebuffer),p.context.clear({color:c.bp.transparent,stencil:0}),p.currentStencilSource=void 0;for(let I=0;I<x.length;I++){const M=p.style._layers[x[I]],k=M.source?this._coordsAscending[M.source][w.tileID.key]:[w.tileID];p.context.viewport.set([0,0,T.fbo.width,T.fbo.height]),p._renderTileClippingMasks(M,k,!0),p.renderLayer(p,p.style.tileManagers[M.source],M,k,s),M.source&&(w.rttFingerprint[M.source]=this._rttFingerprints[M.source][w.tileID.key])}}return kl(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),Xn[l]}return!1}}const Ao={"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"},ql=be,zo={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:hr,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:c.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},$l={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class ks{constructor(t,n,s=!1){this.mousedown=p=>{this.startMove(p,xe.mousePos(this.element,p)),xe.addEventListener(window,"mousemove",this.mousemove),xe.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=p=>{this.move(p,xe.mousePos(this.element,p))},this.mouseup=p=>{this._rotatePitchHandler.dragEnd(p),this.offTemp()},this.touchstart=p=>{p.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=xe.touchPos(this.element,p.targetTouches)[0],this.startMove(p,this._startPos),xe.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),xe.addEventListener(window,"touchend",this.touchend))},this.touchmove=p=>{p.targetTouches.length!==1?this.reset():(this._lastPos=xe.touchPos(this.element,p.targetTouches)[0],this.move(p,this._lastPos))},this.touchend=p=>{p.targetTouches.length===0&&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=n;const l=new hu;this._rotatePitchHandler=new Ra({clickTolerance:3,move:(p,m)=>{const _=n.getBoundingClientRect(),x=new c.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:c.cy(new c.P(p.x,m.y),m,x),pitchDelta:s?-.5*(m.y-p.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=t,xe.addEventListener(n,"mousedown",this.mousedown),xe.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),xe.addEventListener(n,"touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),xe.disableDrag()}move(t,n){const s=this.map,{bearingDelta:l,pitchDelta:p}=this._rotatePitchHandler.dragMove(t,n)||{};l&&s.setBearing(s.getBearing()+l),p&&s.setPitch(s.getPitch()+p)}off(){const t=this.element;xe.removeEventListener(t,"mousedown",this.mousedown),xe.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),xe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),xe.removeEventListener(window,"touchend",this.touchend),xe.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){xe.enableDrag(),xe.removeEventListener(window,"mousemove",this.mousemove),xe.removeEventListener(window,"mouseup",this.mouseup),xe.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),xe.removeEventListener(window,"touchend",this.touchend)}}let qr;function ko(d,t,n,s=!1){if(s||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return d==null?void 0:d.wrap();const l=new c.V(d.lng,d.lat);if(d=new c.V(d.lng,d.lat),t){const p=new c.V(d.lng-360,d.lat),m=new c.V(d.lng+360,d.lat),_=n.locationToScreenPoint(d).distSqr(t);n.locationToScreenPoint(p).distSqr(t)<_?d=p:n.locationToScreenPoint(m).distSqr(t)<_&&(d=m)}for(;Math.abs(d.lng-n.center.lng)>180;){const p=n.locationToScreenPoint(d);if(p.x>=0&&p.y>=0&&p.x<=n.width&&p.y<=n.height)break;d.lng>n.center.lng?d.lng-=360:d.lng+=360}return d.lng!==l.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(d))?d:l}const Ds={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 Do(d,t,n){const s=d.classList;for(const l in Ds)s.remove(`maplibregl-${n}-anchor-${l}`);s.add(`maplibregl-${n}-anchor-${t}`)}class Rs extends c.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new c.l("click",{originalEvent:n}))},this._onKeyPress=n=>{const s=n.code,l=n.charCode||n.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=n=>{const s=n.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=ko(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 l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),xe.setTransform(this._element,`${Ds[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${l}`),_t.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.l("dragstart"))),this.fire(new c.l("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),this._state==="active"&&this.fire(new c.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=xe.create("div");const n=xe.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${s}px`),n.setAttributeNS(null,"width",`${l}px`),n.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const p=xe.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"stroke","none"),p.setAttributeNS(null,"stroke-width","1"),p.setAttributeNS(null,"fill","none"),p.setAttributeNS(null,"fill-rule","evenodd");const m=xe.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"fill-rule","nonzero");const _=xe.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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(const q of x){const Y=xe.createNS("http://www.w3.org/2000/svg","ellipse");Y.setAttributeNS(null,"opacity","0.04"),Y.setAttributeNS(null,"cx","10.5"),Y.setAttributeNS(null,"cy","5.80029008"),Y.setAttributeNS(null,"rx",q.rx),Y.setAttributeNS(null,"ry",q.ry),_.appendChild(Y)}const w=xe.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const T=xe.createNS("http://www.w3.org/2000/svg","path");T.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"),w.appendChild(T);const I=xe.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"opacity","0.25"),I.setAttributeNS(null,"fill","#000000");const M=xe.createNS("http://www.w3.org/2000/svg","path");M.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"),I.appendChild(M);const k=xe.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"transform","translate(6.0, 7.0)"),k.setAttributeNS(null,"fill","#FFFFFF");const B=xe.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(8.0, 8.0)");const G=xe.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");const Z=xe.createNS("http://www.w3.org/2000/svg","circle");Z.setAttributeNS(null,"fill","#FFFFFF"),Z.setAttributeNS(null,"cx","5.5"),Z.setAttributeNS(null,"cy","5.5"),Z.setAttributeNS(null,"r","5.4999962"),B.appendChild(G),B.appendChild(Z),m.appendChild(_),m.appendChild(w),m.appendChild(I),m.appendChild(k),m.appendChild(B),n.appendChild(m),n.setAttributeNS(null,"height",s*this._scale+"px"),n.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),Do(this._element,this._anchor,"marker"),this._element.addEventListener("click",this._onClick),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),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),xe.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const l=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,s;const l=(n=this._map)===null||n===void 0?void 0:n.terrain,p=this._map.transform.isLocationOccluded(this._lngLat);if(!l||p){const k=p?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==k&&(this._element.style.opacity=k))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const m=this._map,_=m.terrain.depthAtPoint(this._pos),x=m.terrain.getElevationForLngLat(this._lngLat,m.transform);if(m.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const w=-this._offset.y/m.transform.pixelsPerMeter,T=Math.sin(m.getPitch()*Math.PI/180)*w,I=m.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),M=m.transform.lngLatToCameraDepth(this._lngLat,x+T)-I>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&M&&this._popup.remove(),this._element.style.opacity=M?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Zl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Fa=0,Yn=!1;const Wl={maxWidth:100,unit:"metric"};function Ls(d,t,n){const s=n&&n.maxWidth||100,l=d._container.clientHeight/2,p=d._container.clientWidth/2,m=d.unproject([p-s/2,l]),_=d.unproject([p+s/2,l]),x=Math.round(d.project(_).x-d.project(m).x),w=Math.min(s,x,d._container.clientWidth),T=m.distanceTo(_);if(n&&n.unit==="imperial"){const I=3.2808*T;I>5280?Kn(t,w,I/5280,d._getUIString("ScaleControl.Miles")):Kn(t,w,I,d._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Kn(t,w,T/1852,d._getUIString("ScaleControl.NauticalMiles")):T>=1e3?Kn(t,w,T/1e3,d._getUIString("ScaleControl.Kilometers")):Kn(t,w,T,d._getUIString("ScaleControl.Meters"))}function Kn(d,t,n,s){const l=(function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/m;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:(function(x){const w=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*w)/w})(_),m*_})(n);d.style.width=t*(l/n)+"px",d.innerHTML=`${l}&nbsp;${s}`}const Hl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Ro=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lo(d){if(d){if(typeof d=="number"){const t=Math.round(Math.abs(d)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,d),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-d),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(d,0),right:new c.P(-d,0)}}if(d instanceof c.P||Array.isArray(d)){const t=c.P.convert(d);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.P.convert(d.center||[0,0]),top:c.P.convert(d.top||[0,0]),"top-left":c.P.convert(d["top-left"]||[0,0]),"top-right":c.P.convert(d["top-right"]||[0,0]),bottom:c.P.convert(d.bottom||[0,0]),"bottom-left":c.P.convert(d["bottom-left"]||[0,0]),"bottom-right":c.P.convert(d["bottom-right"]||[0,0]),left:c.P.convert(d.left||[0,0]),right:c.P.convert(d.right||[0,0])}}return Lo(new c.P(0,0))}const Xl=be;C.AJAXError=c.cJ,C.EXTENT=c.a5,C.Event=c.l,C.Evented=c.E,C.LngLat=c.V,C.MercatorCoordinate=c.a9,C.Point=c.P,C.addProtocol=c.cK,C.config=c.c,C.removeProtocol=c.cL,C.AttributionControl=Gl,C.BoxZoomHandler=Da,C.CanvasSource=on,C.CooperativeGesturesHandler=qe,C.DoubleClickZoomHandler=Ul,C.DragPanHandler=_u,C.DragRotateHandler=Tr,C.EdgeInsets=ga,C.FullscreenControl=class extends c.E{constructor(d={}){var t;super(),this._onFullscreenChange=()=>{var n;let s=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=s==null?void 0:s.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)s=s.shadowRoot.fullscreenElement;s===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=d.pseudo)!==null&&t!==void 0&&t,d&&d.container&&(d.container instanceof HTMLElement?this._container=d.container:c.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(d){return this._map=d,this._container||(this._container=this._map.getContainer()),this._controlContainer=xe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){xe.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const d=this._fullscreenButton=xe.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);xe.create("span","maplibregl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const d=this._getTitle();this._fullscreenButton.setAttribute("aria-label",d),this._fullscreenButton.title=d}_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 c.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.l("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()}},C.GeoJSONSource=kn,C.GeolocateControl=class extends c.E{constructor(d){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
811RROR":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&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.V(t.coords.longitude,t.coords.latitude),s=t.coords.accuracy,l=this._map.getBearing(),p=c.e({bearing:l},this.options.fitBoundsOptions),m=Ft.fromLngLat(n,s);this._map.fitBounds(m,p,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===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._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Yn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=xe.create("button","maplibregl-ctrl-geolocate",this._container),xe.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=xe.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Rs({element:this._dotElement}),this._circleElement=xe.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Rs({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",(n=>{const s=(n==null?void 0:n[0])instanceof ResizeObserverEntry;n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s||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 c.l("trackuserlocationend")),this.fire(new c.l("userlocationlostfocus")))}))}},this.options=c.e({},Zl,d)}onAdd(d){return this._map=d,this._container=xe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return c._(this,arguments,void 0,(function*(t=!1){if(qr!==void 0&&!t)return qr;if(window.navigator.permissions===void 0)return qr=!!window.navigator.geolocation,qr;try{qr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{qr=!!window.navigator.geolocation}return qr}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),xe.remove(this._container),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,Fa=0,Yn=!1}
vendor: 5,578 bytes, line 811
811_isOutOfMapMaxBounds(d){const t=this._map.getMaxBounds(),n=d.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.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(){const d=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&d))return;const t=this._map.project(d),n=this._map.unproject([t.x+100,t.y]),s=d.distanceTo(n)/100,l=2*this._accuracy/s;this._circleElement.style.width=`${l.toFixed(2)}px`,this._circleElement.style.height=`${l.toFixed(2)}px`}trigger(){if(!this._setup)return c.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 c.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fa--,Yn=!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 c.l("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 c.l("trackuserlocationstart")),this.fire(new c.l("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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let d;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fa++,Fa>1?(d={maximumAge:6e5,timeout:0},Yn=!0):(d=this.options.positionOptions,Yn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,d)}}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)}},C.GlobeControl=class{constructor(){this._toggleProjection=()=>{var d;const t=(d=this._map.getProjection())===null||d===void 0?void 0:d.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var d;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((d=this._map.getProjection())===null||d===void 0?void 0:d.type)==="globe"?(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(d){return this._map=d,this._container=xe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=xe.create("button","maplibregl-ctrl-globe",this._container),xe.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(){xe.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},C.Hash=Ll,C.ImageSource=Qi,C.KeyboardHandler=Tt,C.LngLatBounds=Ft,C.LogoControl
811=yu,C.Map=class extends Oi{get _ownerWindow(){var d,t;return((t=(d=this._container)===null||d===void 0?void 0:d.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(d){var t,n;c.cH.mark(c.cI.create);const s=Object.assign(Object.assign(Object.assign({},zo),d),{canvasContextAttributes:Object.assign(Object.assign({},zo.canvasContextAttributes),d.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new On,p=new jn;s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),s.transformConstrain!==null&&l.setConstrainOverride(s.transformConstrain),super(l,p,{bearingSnap:s.bearingSnap,zoomSnap:s.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Sh,this._controls=[],this._mapId=c.af(),this._lostContextStyle={style:null,images:null},this._contextLost=_=>{if(_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const x of Object.values(this.style._layers))if(x.type==="custom"&&console.warn(`Custom layer with id '${x.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),x._listeners)for(const[w]of Object.entries(x._listeners))console.warn(`Custom layer with id '${x.id}' had event listeners for event '${w}' 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 c.l("webglcontextlost",{originalEvent:_}))}else this.fire(new c.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new c.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._zoomSnap=s.zoomSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Ao),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this._zoomLevelsToOverscale=s.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=s.transformCameraUpdate,this.transformConstrain=s.transformConstrain,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,s.reduceMotion!==void 0&&(_t.prefersReducedMotion=s.reduceMotion),this._imageQueueHandle=Ki.addThrottleControl((()=>this.isMoving())),this._requestManager=new Za(s.transformRequest),this._container=this._resolveContainer(s.container),s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Co(this,s),this._hash=s.hash&&new Ll(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,c.e({},s.fitBoundsOptions,{duration:0}))));const m=typeof s.style=="string"||((n=(t=s.style)===null||t===void 0?void 0:t.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,m),this._localIdeographFontFamily=s.localIdeographFontFamily,this._val
811idateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Gl(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new yu,s.logoPosition),this.on("style.load",(()=>{if(m||this._resizeTransform(),this.transform.unmodified){const _=c.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}})),this.on("data",(_=>{this._update(_.dataType==="style"),this.fire(new c.l(`${_.dataType}data`,_))})),this.on("dataloading",(_=>{this.fire(new c.l(`${_.dataType}dataloading`,_))})),this.on("dataabort",(_=>{this.fire(new c.l("sourcedataabort",_))}))}_getMapId(){return this._mapId}setGlobalStateProperty(d,t){return this.style.setGlobalStateProperty(d,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(d,t){if(t===void 0&&(t=d.getDefaultPosition?d.getDefaultPosition():"top-right"),!d||!d.onAdd)return this.fire(new c.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=d.onAdd(this);this._controls.push(d);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(d){if(!d||!d.onRemove)return this.fire(new c.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(d);return t>-1&&this._controls.splice(t,1),d.onRemove(this),this}hasControl(d){return this._controls.indexOf(d)>-1}coveringTiles(d){return yt(this.transform,d)}calculateCameraOptionsFromTo(d,t,n,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(d,t,n,s)}resize(d,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new c.l("movestart",d)).fire(new c.l("move",d))),this.fire(new c.l("resize",d)),n&&this.fire(new c.l("moveend",d)),this}_resizeInternal(d=!0){const[t,n]=this._containerDimensions(),s=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,s),this.painter.resize(t,n,s),this.painter.overLimit()){const l=this.painter.context.gl;this._maxCanvasSize=[l.drawingBufferWidth,l.drawingBufferHeight];const p=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,p),this.painter.resize(t,n,p)}this._resizeTransform(d)}_resizeTransform(d=!0){var t;const[n,s]=this._containerDimensions();this.transform.resize(n,s,d),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,s,d)}_getClampedPixelRatio(d,t){const{0:n,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),p=d*l,m=t*l;return Math.min(p>n?n/p:1,m>s?s/m:1)*l}getPixelRatio(){var d;return(d=this._overridePixelRatio)!==null&&d!==void 0?d:devicePixelRatio}setPixelRatio(d){this._overridePixelRatio=d,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(d){return this.transform.setMaxBounds(Ft.convert(d)),this._update()}setMinZoom(d){if((d=d??-2)>=-2&&d<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new c.l("zoomstart")).fire(new c.l("zoom")).fire(new c.l("zoomend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(d){if((d=d??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new c.l("zoomstart")).fire(new c.l("zoom")).fire(new c.l("zoomend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(d){if((d=d??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(d>=0&&d<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new c.l("pitchstart")).fire(new c.l("pitch")).fire(new c.l("pitchend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(d){if((d=d??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(d>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();
vendor: 33,139 bytes, line 811
811return n.setMaxPitch(d),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new c.l("pitchstart")).fire(new c.l("pitch")).fire(new c.l("pitchend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(d){return this.transform.setRenderWorldCopies(d),this._update()}setTransformConstrain(d){return this.transform.setConstrainOverride(d),this._update()}project(d){return this.transform.locationToScreenPoint(c.V.convert(d),this.style&&this.terrain)}unproject(d){return this.transform.screenPointToLocation(c.P.convert(d),this.terrain)}isMoving(){var d;return this._moving||((d=this.handlers)===null||d===void 0?void 0:d.isMoving())}isZooming(){var d;return this._zooming||((d=this.handlers)===null||d===void 0?void 0:d.isZooming())}isRotating(){var d;return this._rotating||((d=this.handlers)===null||d===void 0?void 0:d.isRotating())}_createDelegatedListener(d,t,n){if(d==="mouseenter"||d==="mouseover"){let s=!1;return{layers:t,listener:n,delegates:{mousemove:p=>{const m=t.filter((x=>this.getLayer(x))),_=m.length!==0?this.queryRenderedFeatures(p.point,{layers:m}):[];_.length?s||(s=!0,n.call(this,new di(d,this,p.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(d==="mouseleave"||d==="mouseout"){let s=!1;return{layers:t,listener:n,delegates:{mousemove:m=>{const _=t.filter((x=>this.getLayer(x)));(_.length!==0?this.queryRenderedFeatures(m.point,{layers:_}):[]).length?s=!0:s&&(s=!1,n.call(this,new di(d,this,m.originalEvent)))},mouseout:m=>{s&&(s=!1,n.call(this,new di(d,this,m.originalEvent)))}}}}{const s=l=>{const p=t.filter((_=>this.getLayer(_))),m=p.length!==0?this.queryRenderedFeatures(l.point,{layers:p}):[];m.length&&(l.features=m,n.call(this,l),delete l.features)};return{layers:t,listener:n,delegates:{[d]:s}}}}_saveDelegatedListener(d,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[d]=this._delegatedListeners[d]||[],this._delegatedListeners[d].push(t)}_removeDelegatedListener(d,t,n){if(!this._delegatedListeners||!this._delegatedListeners[d])return;const s=this._delegatedListeners[d];for(let l=0;l<s.length;l++){const p=s[l];if(p.listener===n&&p.layers.length===t.length&&p.layers.every((m=>t.includes(m)))){for(const m in p.delegates)this.off(m,p.delegates[m]);return void s.splice(l,1)}}}on(d,t,n){if(n===void 0)return super.on(d,t);const s=typeof t=="string"?[t]:t,l=this._createDelegatedListener(d,s,n);this._saveDelegatedListener(d,l);for(const p in l.delegates)this.on(p,l.delegates[p]);return{unsubscribe:()=>{this._removeDelegatedListener(d,s,n)}}}once(d,t,n){if(n===void 0)return super.once(d,t);const s=typeof t=="string"?[t]:t,l=this._createDelegatedListener(d,s,n);for(const p in l.delegates){const m=l.delegates[p];l.delegates[p]=(..._)=>{this._removeDelegatedListener(d,s,n),m(..._)}}this._saveDelegatedListener(d,l);for(const p in l.delegates)this.once(p,l.delegates[p]);return this}off(d,t,n){return n===void 0?super.off(d,t):(this._removeDelegatedListener(d,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(d,t){if(!this.style)return[];let n;const s=d instanceof c.P||Array.isArray(d),l=s?d:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(s?{}:d)||{},l instanceof c.P||typeof l[0]=="number")n=[c.P.convert(l)];else{const p=c.P.convert(l[0]),m=c.P.convert(l[1]);n=[p,new c.P(m.x,p.y),m,new c.P(p.x,m.y),p]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(d,t){return this.style.querySourceFeatures(d,t)}setStyle(d,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&d?(this._diffStyle(d,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(d,t))}setTransformRequest(d){return this._requestManager.setTransformRequest(d),this}_getUIString(d){const t=this._locale[d];if(t==null)throw new Error(`Missing UI string '${d}'`);return t}_updateStyle(d,t){var n,s;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(d,t)));const l=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!d)),d?(this.style=new Nn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof d=="string"?this.style.loadURL(d,t,l):this.style.loadJSON(d,t,l),this):((s=(n=this.style)===null||n===void 0?void 0:n.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Nn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(d,t){if(typeof d=="string"){const n=this._requestManager.transformRequest(d,"Style");c.j(n,new AbortController).then((s=>{this._updateDiff(s.data,t)})).catch((s=>{s&&this.fire(new c.k(s))}))}else typeof d=="object"&&this._updateDiff(d,t)}_updateDiff(d,t){try{this.style.setState(d,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}.  Rebuilding the style from scratch.`),this._updateStyle(d,t)}}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(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(d,t){return this._lazyInitEmptyStyle(),this.style.addSource(d,t),this._update(!0)}isSourceLoaded(d){const t=this.style&&this.style.tileManagers[d];if(t!==void 0)return t.loaded();this.fire(new c.k(new Error(`There is no tile manager with ID '${d}'`)))}setTerrain(d){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),d){const t=this.style.tileManagers[d.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${d.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const s=this.style._layers[n];s.type==="hillshade"&&s.source===d.source&&c.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."),s.type==="color-relief"&&s.source===d.source&&c.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 Ut(this.painter,t,d),this.painter.renderToTexture=new zs(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=n=>{var s;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==d.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))),((s=n.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),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 c.l("terrain",{terrain:d})),this}getTerrain(){var d,t;return(t=(d=this.terrain)===null||d===void 0?void 0:d.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const d=this.style&&this.style.tileManagers;for(const t of Object.values(d))if(!t.areTilesLoaded())return!1;return!0}removeSource(d){return this.style.removeSource(d),this._update(!0)}getSource(d){return this.style.getSource(d)}setSourceTileLodParams(d,t,n){if(n){const s=this.getSource(n);if(!s)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);s.calculateTileZoom=Ye(Math.max(1,d),Math.max(1,t))}else for(const s in this.style.tileManagers)this.style.tileManagers[s].getSource().calculateTileZoom=Ye(Math.max(1,d),Math.max(1,t));return this._update(!0),this}refreshTiles(d,t){const n=this.style.tileManagers[d];if(!n)throw new Error(`There is no tile manager with ID "${d}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((s=>new c.ac(s.z,s.x,s.y))))}addImage(d,t,n={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:w}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.k(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`")));{const{width:T,height:I,data:M}=t,k=t;return this.style.addImage(d,{data:new c.R({width:T,height:I},new Uint8Array(M)),pixelRatio:s,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:w,sdf:l,version:0,userImage:k}),k.onAdd&&k.onAdd(this,d),this}}{const{width:T,height:I,data:M}=_t.getImageData(t);this.style.addImage(d,{data:new c.R({width:T,height:I},M),pixelRatio:s,stretchX:p,stretchY:m,content:_,textFitWidth:x,textFitHeight:w,sdf:l,version:0})}}updateImage(d,t){const n=this.style.getImage(d);if(!n)return this.fire(new c.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||c.b(t)?_t.getImageData(t):t,{width:l,height:p,data:m}=s;if(l===void 0||p===void 0)return this.fire(new c.k(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(l!==n.data.width||p!==n.data.height)return this.fire(new c.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(m,_),this.style.updateImage(d,n),this}getImage(d){return this.style.getImage(d)}hasImage(d){return d?!!this.style.getImage(d):(this.fire(new c.k(new Error("Missing required image id"))),!1)}removeImage(d){this.style.removeImage(d)}loadImage(d){return Ki.getImage(this._requestManager.transformRequest(d,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(d,t){return this._lazyInitEmptyStyle(),this.style.addLayer(d,t),this._update(!0)}moveLayer(d,t){return this.style.moveLayer(d,t),this._update(!0)}removeLayer(d){return this.style.removeLayer(d),this._update(!0)}getLayer(d){return this.style.getLayer(d)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(d,t,n){return this.style.setLayerZoomRange(d,t,n),this._update(!0)}setFilter(d,t,n={}){return this.style.setFilter(d,t,n),this._update(!0)}getFilter(d){return this.style.getFilter(d)}setPaintProperty(d,t,n,s={}){return this.style.setPaintProperty(d,t,n,s),this._update(!0)}getPaintProperty(d,t){return this.style.getPaintProperty(d,t)}setLayoutProperty(d,t,n,s={}){return this.style.setLayoutProperty(d,t,n,s),this._update(!0)}getLayoutProperty(d,t){return this.style.getLayoutProperty(d,t)}setGlyphs(d,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(d,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(d,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(d,t,n,(s=>{s||this._update(!0)})),this}removeSprite(d){return this._lazyInitEmptyStyle(),this.style.removeSprite(d),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(d,t,(n=>{n||this._update(!0)})),this}setLight(d,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(d,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(d,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(d,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(d,t){return this.style.setFeatureState(d,t),this._update()}removeFeatureState(d,t){return this.style.removeFeatureState(d,t),this._update()}getFeatureState(d){return this.style.getFeatureState(d)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let d=0,t=0;return this._container&&(d=this._container.clientWidth||400,t=this._container.clientHeight||300),[d,t]}_setupResizeObserver(){var d;let t=!1;const n=Rl((l=>{this._trackResize&&!this._removed&&(this.resize(l),this.redraw())}),50),s=(d=this._ownerWindow.ResizeObserver)!==null&&d!==void 0?d:ResizeObserver;this._resizeObserver=new s((l=>{t?n(l):t=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(d){if(typeof d=="string"){const t=document.getElementById(d);if(!t)throw new Error(`Container '${d}' not found.`);return t}if(d instanceof HTMLElement||d&&typeof d=="object"&&d.nodeType===1)return d;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const d=this._container;d.classList.add("maplibregl-map");const t=this._canvasContainer=xe.create("div","maplibregl-canvas-container",d);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=xe.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");const n=this._containerDimensions(),s=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],s);const l=this._controlContainer=xe.create("div","maplibregl-control-container",d),p=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((m=>{p[m]=xe.create("div",`maplibregl-ctrl-${m} `,l)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(d,t,n){this._canvas.width=Math.floor(n*d),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${d}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const d=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(s=>{t={requestedAttributes:d},s&&(t.statusMessage=s.statusMessage,t.type=s.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,d):this._canvas.getContext("webgl2",d)||this._canvas.getContext("webgl",d),!n){const s="Failed to initialize WebGL";throw t?(t.message=s,new Error(JSON.stringify(t))):new Error(s)}this.painter=new ou(n,this.transform),sr.testSupport(n)}migrateProjection(d,t){super.migrateProjection(d,t),this.painter.transform=d,this.fire(new c.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(d){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||d,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(d){return this._update(),this._renderTaskQueue.add(d)}_cancelRenderFrame(d){this._renderTaskQueue.remove(d)}_render(d){var t,n,s,l,p;const m=this._idleTriggered?this._fadeDuration:0,_=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(d),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const I=this.transform.zoom,M=st();this.style.zoomHistory.update(I,M);const k=new c.H(I,{now:M,fadeDuration:m,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),B=k.crossFadingFactor();B===1&&B===this._crossFadingFactor||(x=!0,this._crossFadingFactor=B),this.style.update(k)}const w=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(p=this.style.projection)===null||p===void 0?void 0:p.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||w)&&(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=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,w),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,showPadding:this.showPadding}),this.fire(new c.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.cH.mark(c.cI.load),this.fire(new c.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const T=this._sourcesDirty||this._styleDirty||this._placementDirty;return T||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.l("idle")),!this._loaded||this._fullyLoaded||T||(this._fullyLoaded=!0,c.cH.mark(c.cI.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var d;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Ki.removeThrottleControl(this._imageQueueHandle),(d=this._resizeObserver)===null||d===void 0||d.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),xe.remove(this._canvasContainer),xe.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),c.cH.remove(),this._removed=!0,this.fire(new c.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,_t.frame(this._frameRequest,(d=>{c.cH.recordStartOfFrameAt(d),this._frameRequest=null;try{this._render(d)}catch(t){if(!c.Z(t)&&!(function(n){return n.message===El})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(d){this._showTileBoundaries!==d&&(this._showTileBoundaries=d,this._update())}get showPadding(){return!!this._showPadding}set showPadding(d){this._showPadding!==d&&(this._showPadding=d,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(d){this._showCollisionBoxes!==d&&(this._showCollisionBoxes=d,d?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(d){this._showOverdrawInspector!==d&&(this._showOverdrawInspector=d,this._update())}get repaint(){return!!this._repaint}set repaint(d){this._repaint!==d&&(this._repaint=d,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(d){this._vertices=d,this._update()}get version(){return ql}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(d){return this._lazyInitEmptyStyle(),this.style.setProjection(d),this._update(!0)}},C.MapMouseEvent=di,C.MapTouchEvent=Ts,C.MapWheelEvent=uu,C.Marker=Rs,C.NavigationControl=class{constructor(d){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),s=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.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=(t,n)=>{const s=this._map._getUIString(`NavigationControl.${n}`);t.title=s,t.setAttribute("aria-label",s)},this.options=c.e({},$l,d),this._container=xe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),xe.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),xe.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=xe.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(d){return this._map=d,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 ks(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){xe.remove(this._container),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(d,t){const n=xe.create("button",d,this._container);return n.type="button",n.addEventListener("click",t),n}},C.Popup=class extends c.E{constructor(d){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&xe.remove(this._content),this._container&&(xe.remove(this._container),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("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=xe.create("div","maplibregl-popup",this._map.getContainer()),this._tip=xe.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const m of this.options.className.split(" "))this._container.classList.add(m);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ko(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const n=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 s=this.options.anchor;const l=Lo(this.options.offset);if(!s){const m=this._container.offsetWidth,_=this._container.offsetHeight,x=(function(T){var I,M,k,B;return T?{top:(I=T.top)!==null&&I!==void 0?I:0,right:(M=T.right)!==null&&M!==void 0?M:0,bottom:(k=T.bottom)!==null&&k!==void 0?k:0,left:(B=T.left)!==null&&B!==void 0?B:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let w;w=n.y+l.bottom.y<_+x.top?["top"]:n.y>this._map.transform.height-_-x.bottom?["bottom"]:[],n.x<m/2+x.left?w.push("left"):n.x>this._map.transform.width-m/2-x.right&&w.push("right"),s=w.length===0?"bottom":w.join("-")}let p=n.add(l[s]);this.options.subpixelPositioning||(p=p.round()),xe.setTransform(this._container,`${Ds[s]} translate(${p.x}px,${p.y}px)`),Do(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Hl),d)}addTo(d){return this._map&&this.remove(),this._map=d,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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),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 c.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=c.V.convert(d),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),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._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(d){return this.setDOMContent(document.createTextNode(d))}setHTML(d){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=d;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){var d;return(d=this._container)===null||d===void 0?void 0:d.style.maxWidth}setMaxWidth(d){return this.options.maxWidth=d,this._update(),this}setDOMContent(d){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=xe.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(d),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(d){return this._container&&this._container.classList.add(d),this}removeClassName(d){return this._container&&this._container.classList.remove(d),this}setOffset(d){return this.options.offset=d,this._update(),this}toggleClassName(d){if(this._container)return this._container.classList.toggle(d)}setSubpixelPositioning(d){this.options.subpixelPositioning=d}setPadding(d){this.options.padding=d,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=xe.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;const d=this._container.querySelector(Ro);d&&d.focus()}},C.RasterDEMTileSource=sn,C.RasterTileSource=zn,C.ScaleControl=class{constructor(d){this._onMove=()=>{Ls(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Ls(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Wl),d)}getDefaultPosition(){return"bottom-left"}onAdd(d){return this._map=d,this._container=xe.create("div","maplibregl-ctrl maplibregl-ctrl-scale",d.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){xe.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},C.ScrollZoomHandler=Io,C.Style=Nn,C.TerrainControl=class{constructor(d){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=d}onAdd(d){return this._map=d,this._container=xe.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=xe.create("button","maplibregl-ctrl-terrain",this._container),xe.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(){xe.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},C.TwoFingersTouchPitchHandler=fu,C.TwoFingersTouchRotateHandler=Vl,C.TwoFingersTouchZoomHandler=jl,C.TwoFingersTouchZoomRotateHandler=Es,C.VectorTileSource=la,C.VideoSource=Xa,C.addSourceType=(d,t)=>c._(void 0,void 0,void 0,(function*(){if(Ya(d))throw new Error(`A source type called "${d}" already exists.`);((n,s)=>{ua[n]=s})(d,t)})),C.clearPrewarmedResources=function(){const d=wi;d&&(d.isPreloaded()&&d.numActive()===1?(d.release(an),wi=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()"))},C.createTileMesh=Ic,C.getMaxParallelImageRequests=function(){return c.c.MAX_PARALLEL_IMAGE_REQUESTS},C.getRTLTextPluginStatus=function(){return D().getRTLTextPluginStatus()},C.getVersion=function(){return Xl},C.getWorkerCount=function(){return Vr.workerCount},C.getWorkerUrl=function(){return c.c.WORKER_URL},C.importScriptInWorkers=function(d){return An().broadcast("IS",d)},C.isTimeFrozen=function(){return ki.isFrozen()},C.now=st,C.prewarm=function(){oa().acquire(an)},C.restoreNow=function(){ki.restoreNow()}
811,C.setMaxParallelImageRequests=function(d){c.c.MAX_PARALLEL_IMAGE_REQUESTS=d},C.setNow=function(d){ki.setNow(d)},C.setRTLTextPlugin=function(d,t){return D().setRTLTextPlugin(d,t)},C.setWorkerCount=function(d){Vr.workerCount=d},C.setWorkerUrl=function(d){c.c.WORKER_URL=d}}));var Fe=N;return Fe}))})(Yu)),Yu.exports}var tl=$_(),Z_=Object.defineProperty,Pn=(R,F)=>Z_(R,"name",{value:F,configurable:!0});function gr(R,F){let N="script";return R==="name"?N="script":R==="name2"?N="script2":R==="name3"&&(N="script3"),[["coalesce",["get",`pgf:${R}`],["get",R]],{"text-font":["case",["==",["get",N],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[F||"Noto Sans Regular"]]]}]}Pn(gr,"get_name_block");function Tn(R,F,N){let X="name";return N==="name"?X="":N==="name2"?X="2":N==="name3"&&(X="3"),F==="Latin"?["has",`script${X}`]:R==="ja"?["all",["!=",["get",`script${X}`],"Han"],["!=",["get",`script${X}`],"Hiragana"],["!=",["get",`script${X}`],"Katakana"],["!=",["get",`script${X}`],"Mixed-Japanese"]]:["!=",["get",`script${X}`],F]}Pn(Tn,"is_not_in_target_script");function Qr(R){return R==="Devanagari"?{"text-font":["literal",["Noto Sans Devanagari Regular v1"]]}:{}}Pn(Qr,"get_font_formatting");function Rd(R){let F=W_.find(N=>N.lang===R);return F===void 0?"Latin":F.script}Pn(Rd,"get_default_script");function tm(R,F){let N=F||Rd(R),X;return N==="Devanagari"?X="pgf:":X="",["format",["coalesce",["get",`${X}name:${R}`],["get","name:en"]],Qr(N)]}Pn(tm,"get_country_name");function Jr(R,F,N){let X=F||Rd(R),pe;return X==="Devanagari"?pe="pgf:":pe="",["case",["all",["any",["has","name"],["has","pgf:name"]],["!",["any",["has","name2"],["has","pgf:name2"]]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",Tn(R,X,"name"),["case",["any",["is-supported-script",["get","name"]],["has","pgf:name"]],["format",["coalesce",["get",`${pe}name:${R}`],["get","name:en"]],Qr(X),`
812`,{},["case",["all",["!",["has",`${pe}name:${R}`]],["has","name:en"],["!",["has","script"]]],"",["coalesce",["get","pgf:name"],["get","name"]]],{"text-font":["case",["==",["get","script"],"Devanagari"],["literal",["Noto Sans Devanagari Regular v1"]],["literal",[N||"Noto Sans Regular"]]]}],["get","name:en"]],["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name"],["get","name"]],Qr(X)]],["all",["any",["has","name"],["has","pgf:name"]],["any",["has","name2"],["has","pgf:name2"]],["!",["any",["has","name3"],["has","pgf:name3"]]]],["case",["all",Tn(R,X,"name"),Tn(R,X,"name2")],["format",["get",`${pe}name:${R}`],Qr(X),`
813`,{},...gr("name",N),`
814`,{},...gr("name2",N)],["case",Tn(R,X,"name2"),["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name"],["get","name"]],Qr(X),`
815`,{},...gr("name2",N)],["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name2"],["get","name2"]],Qr(X),`
816`,{},...gr("name",N)]]],["case",["all",Tn(R,X,"name"),Tn(R,X,"name2"),Tn(R,X,"name3")],["format",["get",`${pe}name:${R}`],Qr(X),`
817`,{},...gr("name",N),`
818`,{},...gr("name2",N),`
819`,{},...gr("name3",N)],["case",["!",Tn(R,X,"name")],["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name"],["get","name"]],Qr(X),`
820`,{},...gr("name2",N),`
821`,{},...gr("name3",N)],["!",Tn(R,X,"name2")],["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name2"],["get","name2"]],Qr(X),`
822`,{},...gr("name",N),`
823`,{},...gr("name3",N)],["format",["coalesce",["get",`${pe}name:${R}`],["get","pgf:name3"],["get","name3"]],Qr(X),`
824`,{},...gr("name",N),`
825`,{},...gr("name2",N)]]]]}Pn(Jr,"get_multiline_name");var W_=[{lang:"ar",full_name:"Arabic",script:"Arabic"},{lang:"cs",full_name:"Czech",script:"Latin"},{lang:"bg",full_name:"Bulgarian",script:"Cyrillic"},{lang:"da",full_name:"Danish",script:"Latin"},{lang:"de",full_name:"German",script:"Latin"},{lang:"el",full_name:"Greek",script:"Greek"},{lang:"en",full_name:"English",script:"Latin"},{lang:"es",full_name:"Spanish",script:"Latin"},{lang:"et",full_name:"Estonian",script:"Latin"},{lang:"fa",full_name:"Persian",script:"Arabic"},{lang:"fi",full_name:"Finnish",script:"Latin"},{lang:"fr",full_name:"French",script:"Latin"},{lang:"ga",full_name:"Irish",script:"Latin"},{lang:"he",full_name:"Hebrew",script:"Hebrew"},{lang:"hi",full_name:"Hindi",script:"Devanagari"},{lang:"hr",full_name:"Croatian",script:"Latin"},{lang:"hu",full_name:"Hungarian",script:"Latin"},{lang:"id",full_name:"Indonesian",script:"Latin"}
825,{lang:"it",full_name:"Italian",script:"Latin"},{lang:"ja",full_name:"Japanese",script:""},{lang:"ko",full_name:"Korean",script:"Hangul"},{lang:"lt",full_name:"Lithuanian",script:"Latin"},{lang:"lv",full_name:"Latvian",script:"Latin"},{lang:"ne",full_name:"Nepali",script:"Devanagari"},{lang:"nl",full_name:"Dutch",script:"Latin"},{lang:"no",full_name:"Norwegian",script:"Latin"},{lang:"mr",full_name:"Marathi",script:"Devanagari"},{lang:"mt",full_name:"Maltese",script:"Latin"},{lang:"pl",full_name:"Polish",script:"Latin"},{lang:"pt",full_name:"Portuguese",script:"Latin"},{lang:"ro",full_name:"Romanian",script:"Latin"},{lang:"ru",full_name:"Russian",script:"Cyrillic"},{lang:"sk",full_name:"Slovak",script:"Latin"},{lang:"sl",full_name:"Slovenian",script:"Latin"},{lang:"sv",full_name:"Swedish",script:"Latin"},{lang:"tr",full_name:"Turkish",script:"Latin"},{lang:"uk",full_name:"Ukrainian",script:"Cyrillic"},{lang:"ur",full_name:"Urdu",script:"Arabic"},{lang:"vi",full_name:"Vietnamese",script:"Latin"},{lang:"zh-Hans",full_name:"Chinese (Simplified)",script:"Han"},{lang:"zh-Hant",full_name:"Chinese (Traditional)",script:"Han"}];function im(R,F){return[{id:"background",type:"background",paint:{"background-color":F.background}},{id:"earth",type:"fill",filter:["==","$type","Polygon"],source:R,"source-layer":"earth",paint:{"fill-color":F.earth}},...F.landcover?[{id:"landcover",type:"fill",source:R,"source-layer":"landcover",paint:{"fill-color":["match",["get","kind"],"grassland",F.landcover.grassland,"barren",F.landcover.barren,"urban_area",F.landcover.urban_area,"farmland",F.landcover.farmland,"glacier",F.landcover.glacier,"scrub",F.landcover.scrub,F.landcover.forest],"fill-opacity":["interpolate",["linear"],["zoom"],5,1,7,0]}}]:[],{id:"landuse_park",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course","wood","nature_reserve","forest","scrub","grassland","grass","military","naval_base","airfield"],paint:{"fill-opacity":["interpolate",["linear"],["zoom"],6,0,11,1],"fill-color":["case",["in",["get","kind"],["literal",["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"]]],F.park_b,["in",["get","kind"],["literal",["wood","nature_reserve","forest"]]],F.wood_b,["in",["get","kind"],["literal",["scrub","grassland","grass"]]],F.scrub_b,["in",["get","kind"],["literal",["glacier"]]],F.glacier,["in",["get","kind"],["literal",["sand"]]],F.sand,["in",["get","kind"],["literal",["military","naval_base","airfield"]]],F.zoo,F.earth]}},{id:"landuse_urban_green",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","allotments","village_green","playground"],paint:{"fill-color":F.park_b,"fill-opacity":.7}},{id:"landuse_hospital",type:"fill",source:R,"source-layer":"landuse",filter:["==","kind","hospital"],paint:{"fill-color":F.hospital}},{id:"landuse_industrial",type:"fill",source:R,"source-layer":"landuse",filter:["==","kind","industrial"],paint:{"fill-color":F.industrial}},{id:"landuse_school",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","school","university","college"],paint:{"fill-color":F.school}},{id:"landuse_beach",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","beach"],paint:{"fill-color":F.beach}},{id:"landuse_zoo",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","zoo"],paint:{"fill-color":F.zoo}},{id:"landuse_aerodrome",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","aerodrome"],paint:{"fill-color":F.aerodrome}},{id:"roads_runway",type:"line",source:R,"source-layer":"roads",filter:["==","kind_detail","runway"],paint:{"line-color":F.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],10,0,12,4,18,30]}},{id:"roads_taxiway",type:"line",source:R,"source-layer":"roads",minzoom:13,filter:["==","kind_detail","taxiway"],paint:{"line-color":F.runway,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,15,6]}},{id:"landuse_runway",type:"fill",source:R,"source-layer":"landuse",filter:["any",["in","kind","runway","taxiway"]],paint:{"fill-color":F.runway}},{id:"water",type:"fill",filter:["==","$type","Polygon"],source:R,"source-layer":"water",paint:{"fill-color":F.water}},{id:"water_stream",type:"line",source:R,"source-layer":"water",minzoom:14,filter:["in","kind","stream"],paint:{"line-color":F.water,"line-width":.5}},{id:"water_river",type:"line",source:R,"source-layer":"water",minzoom:9,filter:["in","kind","river"],paint:{"line-color":F.water,"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1,18,12]}}
825,{id:"landuse_pedestrian",type:"fill",source:R,"source-layer":"landuse",filter:["in","kind","pedestrian","dam"],paint:{"fill-color":F.pedestrian}},{id:"landuse_pier",type:"fill",source:R,"source-layer":"landuse",filter:["==","kind","pier"],paint:{"fill-color":F.pier}},{id:"roads_tunnels_other_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":F.tunnel_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":F.tunnel_minor_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_link_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":F.tunnel_link_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_tunnels_major_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.tunnel_major_casing,"line-dasharray":[3,2],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_tunnels_highway_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.tunnel_highway_casing,"line-dasharray":[6,.5],"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_tunnels_other",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["in","kind","other","path"]],paint:{"line-color":F.tunnel_other,"line-dasharray":[4.5,.5],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_tunnels_minor",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","minor_road"]],paint:{"line-color":F.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_tunnels_link",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["has","is_link"]],paint:{"line-color":F.tunnel_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_tunnels_major",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==","kind","major_road"]],paint:{"line-color":F.tunnel_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_tunnels_highway",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_tunnel"],["==",["get","kind"],"highway"],["!",["has","is_link"]]],paint:{"line-color":F.tunnel_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"buildings",type:"fill",source:R,"source-layer":"buildings",filter:["in","kind","building","building_part"],paint:{"fill-color":F.buildings,"fill-opacity":.5}},{id:"roads_pier",type:"line",source:R,"source-layer":"roads",filter:["==","kind_detail","pier"],paint:{"line-color":F.pier,"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,.5,20,16]}},{id:"roads_minor_service_casing",type:"line",source:R,"source-layer":"roads",minzoom:13,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":F.minor_service_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}},{id:"roads_minor_casing",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":F.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1]}},{id:"roads_link_casing",type:"line",source:R,"source-layer":"roads",minzoom:13,filter:["has","is_link"],paint:{"line-color":F.minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1.5]}},{id:"roads_major_casing_late",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.major_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_highway_casing_late",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.highway_casing_late,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_other",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["in","kind","other","path"],["!=","kind_detail","pier"]],paint:{"line-color":F.other,"line-dasharray":[3,1],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_link",type:"line",source:R,"source-layer":"roads",filter:["has","is_link"],paint:{"line-color":F.link,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_minor_service",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["==","kind_detail","service"]],paint:{"line-color":F.minor_service,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,18,8]}},{id:"roads_minor",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","minor_road"],["!=","kind_detail","service"]],paint:{"line-color":["interpolate",["exponential",1.6],["zoom"],11,F.minor_a,16,F.minor_b],"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_major_casing_early",type:"line",source:R,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.major_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,
82518,13],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1]}},{id:"roads_major",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_highway_casing_early",type:"line",source:R,"source-layer":"roads",maxzoom:12,filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.highway_casing_early,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1]}},{id:"roads_highway",type:"line",source:R,"source-layer":"roads",filter:["all",["!has","is_tunnel"],["!has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}},{id:"roads_rail",type:"line",source:R,"source-layer":"roads",filter:["==","kind","rail"],paint:{"line-dasharray":[.3,.75],"line-opacity":.5,"line-color":F.railway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,.15,18,9]}},{id:"boundaries_country",type:"line",source:R,"source-layer":"boundaries",filter:["<=","kind_detail",2],paint:{"line-color":F.boundaries,"line-width":.7,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"boundaries",type:"line",source:R,"source-layer":"boundaries",filter:[">","kind_detail",2],paint:{"line-color":F.boundaries,"line-width":.4,"line-dasharray":["step",["zoom"],["literal",[2,0]],4,["literal",[2,1]]]}},{id:"roads_bridges_other_casing",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":F.bridges_other_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_link_casing",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":F.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],12,0,12.5,1.5]}},{id:"roads_bridges_minor_casing",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":F.bridges_minor_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11],"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,.8]}},{id:"roads_bridges_major_casing",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.bridges_major_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,.5,18,10],"line-width":["interpolate",["exponential",1.6],["zoom"],9,0,9.5,1.5]}},{id:"roads_bridges_other",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["in","kind","other","path"]],paint:{"line-color":F.bridges_other,"line-dasharray":[2,1],"line-width":["interpolate",["exponential",1.6],["zoom"],14,0,20,7]}},{id:"roads_bridges_minor",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","minor_road"]],paint:{"line-color":F.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],11,0,12.5,.5,15,2,18,11]}},{id:"roads_bridges_link",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["has","is_link"]],paint:{"line-color":F.bridges_minor,"line-width":["interpolate",["exponential",1.6],["zoom"],13,0,13.5,1,18,11]}},{id:"roads_bridges_major",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","major_road"]],paint:{"line-color":F.bridges_major,"line-width":["interpolate",["exponential",1.6],["zoom"],6,0,12,1.6,15,3,18,13]}},{id:"roads_bridges_highway_casing",type:"line",source:R,"source-layer":"roads",minzoom:12,filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.bridges_highway_casing,"line-gap-width":["interpolate",["exponential",1.6],["zoom"],3,0,3.5,.5,18,15],"line-width":["interpolate",["exponential",1.6],["zoom"],7,0,7.5,1,20,15]}},{id:"roads_bridges_highway",type:"line",source:R,"source-layer":"roads",filter:["all",["has","is_bridge"],["==","kind","highway"],["!has","is_link"]],paint:{"line-color":F.bridges_highway,"line-width":["interpolate",["exponential",1.6],["zoom"],3,0,6,1.1,12,1.6,15,5,18,15]}}]}Pn(im,"nolabels_layers");function rm(R,F,N,X){return[{id:"address_label",type:"symbol",source:R,"source-layer":"buildings",minzoom:18,filter:["==","kind","address"],layout:{"symbol-placement":"point","text-font":[F.italic||"Noto Sans Italic"],"text-field":["get","addr_housenumber"],"text-size":12},paint:{"text-color":F.address_label,"text-halo-color":F.address_label_halo,"text-halo-width":1}},{id:"water_waterway_label",type:"symbol",source:R,"source-layer":"water",minzoom:13,filter:["in","kind","river","stream"],layout:{"symbol-placement":"line","text-font":[F.italic||"Noto Sans Italic"],"text-field":Jr(N,X,F.regular),"text-size":12,"text-letter-spacing":.2},paint:{"text-color":F.ocean_label,"text-halo-color":F.water,"text-halo-width":1}},{id:"roads_oneway",type:"symbol",source:R,"source-layer":"roads",minzoom:16,filter:["==",["get","oneway"],"yes"],layout:{"symbol-placement":"line","icon-image":"arrow","icon-rotate":90,"symbol-spacing":100}},{id:"roads_labels_minor",type:"symbol",source:R,"source-layer":"roads",minzoom:15,filter:["in","kind","minor_road","other","path"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[F.regular||"Noto Sans Regular"],"text-field":Jr(N,X,F.regular),"text-size":12},paint:{"text-color":F.roads_label_minor,"text-halo-color":F.roads_label_minor_halo,"text-halo-width":1}},{id:"water_label_ocean",type:"symbol",source:R,"source-layer":"water",filter:["in","kind","sea","ocean","bay","strait","fjord"],layout:{"text-font":[F.italic||"Noto Sans Italic"],"text-field":Jr(N,X,F.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,10,12],"text-letter-spacing":.1,"text-max-width":9,"text-transform":"uppercase"},paint:{"text-color":F.ocean_label,"text-halo-width":1,"text-halo-color":F.water}},{id:"earth_label_islands",type:"symbol",source:R,"source-layer":"earth",filter:["in","kind","island"],layout:{"text-font":[F.italic||"Noto Sans Italic"],"text-field":Jr(N,X,F.regular),"text-size":10,"text-letter-spacing":.1,"text-max-width":8},paint:{"text-color":F.subplace_label,"text-halo-color":F.subplace_label_halo,"text-halo-width":1}},{id:"water_label_lakes",type:"symbol",source:R,"source-layer":"water",filter:["in","kind","lake","water"],layout:{"text-font":[F.italic||"Noto Sans Italic"],"text-field":Jr(N,X,F.regular),"text-size":["interpolate",["linear"],["zoom"],3,10,6,12,10,12],"text-letter-spacing":.1,"text-max-width":9},paint:{"text-color":F.ocean_label,"text-halo-color":F.water,"text-halo-width":1}},{id:"roads_shields",type:"symbol",source:R,"source-layer":"roads",filter:["all",["in",["get","kind"],["literal",["highway","major_road"]]],["has","shield_text"],["<=",["length",["get","shield_text"]],5]],layout:{"icon-image":["match",["get","network"],"US:I",["concat","US:I-",["length",["get","shield_text"]],"char"],"NL:S-road",["concat","NL:S-road-",["length",["get","shield_text"]],"char"],["concat","generic_shield-",["length",["get","shield_text"]],"char"]],"text-field":["get","shield_text"],"text-font":[F.bold||"Noto Sans Medium"],"text-size":8,"icon-size":.8,"symbol-placement":"line","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport"},paint:{"text-color":F.roads_label_major}},{id:"roads_labels_major",type:"symbol",source:R,"source-layer":"roads",minzoom:11,filter:["in","kind","highway","major_road"],layout:{"symbol-sort-key":["get","min_zoom"],"symbol-placement":"line","text-font":[F.regular||"Noto Sans Regular"],"text-field":Jr(N,X,F.regular),"text-size":12},paint:{"text-color":F.roads_label_major,"text-halo-color":F.roads_label_major_halo,"text-halo-width":1}},...F.pois?[{id:"pois",type:"symbol",source:R,"source-layer":"pois",filter:["all",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench","aerodrome","station","bus_stop","ferry_terminal","stadium","university","library","school","animal","toilets","drinking_water","post_office","building","town
825hall","restaurant","fast_food","cafe","bar","supermarket","convenience","books","beauty","electronics","clothes","attraction","museum","theatre","artwork"]]],[">=",["zoom"],["+",["get","min_zoom"],0]]],layout:{"icon-image":["match",["get","kind"],"station","train_station",["get","kind"]],"text-font":[F.regular||"Noto Sans Regular"],"text-justify":"auto","text-field":Jr(N,X,F.regular),"text-size":["interpolate",["linear"],["zoom"],17,10,19,16],"text-max-width":8,"text-offset":[1.1,0],"text-variable-anchor":["left","right"]},paint:{"text-color":["case",["in",["get","kind"],["literal",["beach","forest","marina","park","peak","zoo","garden","bench"]]],F.pois.green,["in",["get","kind"],["literal",["aerodrome","station","bus_stop","ferry_terminal"]]],F.pois.lapis,["in",["get","kind"],["literal",["stadium","university","library","school","animal","toilets","drinking_water","post_office","building","townhall"]]],F.pois.slategray,["in",["get","kind"],["literal",["supermarket","convenience","books","beauty","electronics","clothes"]]],F.pois.blue,["in",["get","kind"],["literal",["restaurant","fast_food","cafe","bar"]]],F.pois.tangerine,["in",["get","kind"],["literal",["attraction","museum","theatre","artwork"]]],F.pois.pink,F.earth],"text-halo-color":F.earth,"text-halo-width":1}}]:[],{id:"places_subplace",type:"symbol",source:R,"source-layer":"places",filter:["in","kind","neighbourhood","macrohood"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":Jr(N,X,F.regular),"text-font":[F.regular||"Noto Sans Regular"],"text-max-width":7,"text-letter-spacing":.1,"text-padding":["interpolate",["linear"],["zoom"],5,2,8,4,12,18,15,20],"text-size":["interpolate",["exponential",1.2],["zoom"],11,8,14,14,18,24],"text-transform":"uppercase"},paint:{"text-color":F.subplace_label,"text-halo-color":F.subplace_label_halo,"text-halo-width":1}},{id:"places_region",type:"symbol",source:R,"source-layer":"places",filter:["==","kind","region"],layout:{"symbol-sort-key":["get","sort_key"],"text-field":["step",["zoom"],["coalesce",["get","ref:en"],["get","ref"]],6,Jr(N,X,F.regular)],"text-font":[F.regular||"Noto Sans Regular"],"text-size":["interpolate",["linear"],["zoom"],3,11,7,16],"text-radial-offset":.2,"text-anchor":"center","text-transform":"uppercase"},paint:{"text-color":F.state_label,"text-halo-color":F.state_label_halo,"text-halo-width":1}},{id:"places_locality",type:"symbol",source:R,"source-layer":"places",filter:["==","kind","locality"],layout:{"icon-image":["step",["zoom"],["case",["==",["get","capital"],"yes"],"capital","townspot"],8,""],"icon-size":.7,"text-field":Jr(N,X,F.regular),"text-font":["case",["<=",["get","min_zoom"],5],["literal",[F.bold||"Noto Sans Medium"]],["literal",[F.regular||"Noto Sans Regular"]]],"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-padding":["interpolate",["linear"],["zoom"],5,3,8,7,12,11],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],13],8,[">=",["get","population_rank"],13],13,0],4,["case",["<",["get","population_rank"],13],10,[">=",["get","population_rank"],13],15,0],6,["case",["<",["get","population_rank"],12],11,[">=",["get","population_rank"],12],17,0],8,["case",["<",["get","population_rank"],11],11,[">=",["get","population_rank"],11],18,0],10,["case",["<",["get","population_rank"],9],12,[">=",["get","population_rank"],9],20,0],15,["case",["<",["get","population_rank"],8],12,[">=",["get","population_rank"],8],22,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,0,8,4,10,8,12,6,22,2],"text-justify":"auto","text-variable-anchor":["step",["zoom"],["literal",["bottom","left","right","top"]],8,["literal",["center"]]],"text-radial-offset":.3},paint:{"text-color":F.city_label,"text-halo-color":F.city_label_halo,"text-halo-width":1}},{id:"places_country",type:"symbol",source:R,"source-layer":"places",filter:["==","kind","country"],layout:{"symbol-sort-key":["case",["has","sort_key"],["get","sort_key"],["get","min_zoom"]],"text-field":tm(N,X),"text-font":[F.bold||"Noto Sans Medium"],"text-size":["interpolate",["linear"],["zoom"],2,["case",["<",["get","population_rank"],10],8,[">=",["get","population_rank"],10],12,0],6,["case",["<",["get","population_rank"],8],10,[">=",["get","population_rank"],8],18,0],8,["case",["<",["get","population_rank"],7],11,[">=",["get","population_rank"],7],20,0]],"icon-padding":["interpolate",["linear"],["zoom"],0,2,14,2,16,20,17,2,22,2],"text-transform":"uppercase"},paint:{"text-color":F.country_label,"text-halo-color":F.earth,"text-halo-width":1}}]}Pn(rm,"labels_layers");var H_={background:"#cccccc",earth:"#e2dfda",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_c
825asing:"#e0e0e0",link_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#728dd4",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3",address_label:"#91888b",address_label_halo:"#ffffff",pois:{blue:"#1A8CBD",green:"#20834D",lapis:"#315BCF",pink:"#EF56BA",red:"#F2567A",slategray:"#6A5B8F",tangerine:"#CB6704",turquoise:"#00C3D4"},landcover:{grassland:"rgba(210, 239, 207, 1)",barren:"rgba(255, 243, 215, 1)",urban_area:"rgba(230, 230, 230, 1)",farmland:"rgba(216, 239, 210, 1)",glacier:"rgba(255, 255, 255, 1)",scrub:"rgba(234, 239, 210, 1)",forest:"rgba(196, 231, 210, 1)"}},X_={background:"#34373d",earth:"#1f1f1f",park_a:"#1c2421",park_b:"#192a24",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#31353f",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c",address_label:"#525252",address_label_halo:"#1f1f1f",pois:{blue:"#4299BB",green:"#30C573",lapis:"#2B5CEA",pink:"#EF56BA",red:"#F2567A",slategray:"#93939F",tangerine:"#F19B6E",turquoise:"#00C3D4"},landcover:{grassland:"rgba(30, 41, 31, 1)",barren:"rgba(38, 38, 36, 1)",urban_area:"rgba(28, 28, 28, 1)",farmland:"rgba(31, 36, 32, 1)",glacier:"rgba(43, 43, 43, 1)",scrub:"rgba(34, 36, 30, 1)",forest:"rgba(28, 41, 37, 1)"}},Y_={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boun
825daries:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8",address_label:"#adadad",address_label_halo:"#ffffff"},K_={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585",address_label:"#999999",address_label_halo:"#e0e0e0"},J_={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070",address_label:"#525252",address_label_halo:"#141414"};function nm(R){switch(R){case"light":return H_;case"dark":return X_;case"white":return Y_;case"grayscale":return K_;case"black":return J_}throw new Error("Flavor not found")}Pn(nm,"namedFlavor");function am(R,F,N){let X=[];return N!=null&&N.labelsOnly||(X=im(R,F)),N!=null&&N.lang&&(X=X.concat(rm(R,F,N.lang))),X}Pn(am,"layers");
825class Ed extends Error{constructor(N,X,pe){const Fe=N.status||N.status===0?N.status:"",C=N.statusText??"",c=`${Fe} ${C}`.trim(),be=c?`status code ${c}`:"an unknown error";super(`Request failed with ${be}: ${X.method} ${X.url}`);Ze(this,"response");Ze(this,"request");Ze(this,"options");this.name="HTTPError",this.response=N,this.request=X,this.options=pe}}class sm extends Error{constructor(N){let X="Non-error value was thrown";try{typeof N=="string"?X=N:N&&typeof N=="object"&&"message"in N&&typeof N.message=="string"&&(X=N.message)}catch{}super(X);Ze(this,"name","NonError");Ze(this,"value");this.value=N}}class Md extends Error{constructor(N){const X=N!=null&&N.cause?N.cause instanceof Error?N.cause:new sm(N.cause):void 0;super(N!=null&&N.code?`Forced retry: ${N.code}`:"Forced retry",X?{cause:X}:void 0);Ze(this,"name","ForceRetryError");Ze(this,"customDelay");Ze(this,"code");Ze(this,"customRequest");this.customDelay=N==null?void 0:N.delay,this.code=N==null?void 0:N.code,this.customRequest=N==null?void 0:N.request}}const Jf=(()=>{let R=!1,F=!1;const N=typeof globalThis.ReadableStream=="function",X=typeof globalThis.Request=="function";if(N&&X)try{F=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return R=!0,"half"}}).headers.has("Content-Type")}catch(pe){if(pe instanceof Error&&pe.message==="unsupported BodyInit type")return!1;throw pe}return R&&!F})(),Q_=typeof globalThis.AbortController=="function",om=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",ey=typeof globalThis.ReadableStream=="function",ty=typeof globalThis.FormData=="function",lm=["get","post","put","patch","head","delete"],iy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Id=2147483647,ry=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,cm=Symbol("stop");class um{constructor(F){Ze(this,"options");this.options=F}}const ny=R=>new um(R),ay={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},sy={next:!0},oy={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},ly=R=>{if(!R)return 0;if(R instanceof FormData){let F=0;for(const[N,X]of R)F+=ry,F+=new TextEncoder().encode(`Content-Disposition: form-data; name="${N}"`).length,F+=typeof X=="string"?new TextEncoder().encode(X).length:X.size;return F}if(R instanceof Blob)return R.size;if(R instanceof ArrayBuffer)return R.byteLength;if(typeof R=="string")return new TextEncoder().encode(R).length;if(R instanceof URLSearchParams)return new TextEncoder().encode(R.toString()).length;if("byteLength"in R)return R.byteLength;if(typeof R=="object"&&R!==null)try{const F=JSON.stringify(R);return new TextEncoder().encode(F).length}catch{return 0}return 0},hm=(R,F,N)=>{let X,pe=0;return R.pipeThrough(new TransformStream({transform(Fe,C){if(C.enqueue(Fe),X){pe+=X.byteLength;let c=F===0?0:pe/F;c>=1&&(c=1-Number.EPSILON),N==null||N({percent:c,totalBytes:Math.max(F,pe),transferredBytes:pe},X)}X=Fe},flush(){X&&(pe+=X.byteLength,N==null||N({percent:1,totalBytes:Math.max(F,pe),transferredBytes:pe},X))}}))},cy=(R,F)=>{if(!R.body)return R;if(R.status===204)return new Response(null,{status:R.status,statusText:R.statusText,headers:R.headers});const N=Math.max(0,Number(R.headers.get("content-length"))||0);return new Response(hm(R.body,N,F),{status:R.status,statusText:R.statusText,headers:R.headers})},uy=(R,F,N)=>{if(!R.body)return R;const X=ly(N??R.body);return new Request(R,{duplex:"half",body:hm(R.body,X,F)})},qs=R=>R!==null&&typeof R=="object",Hu=(...R)=>{for(const F of R)if((!qs(F)||Array.isArray(F))&&F!==void 0)throw new TypeError("The `options` argument must be an object");return Ld({},...R)},dm=(R={},F={})=>{const N=new globalThis.Headers(R),X=F instanceof globalThis.Headers,pe=new globalThis.Headers(F);for(const[Fe,C]of pe.entries())X&&C==="undefined"||C===void 0?N.delete(Fe):N.set(Fe,C);return N};function Xu(R,F,N){return Object.hasOwn(F,N)&&F[N]===void 0?[]:Ld(R[N]??[],F[N]??[])}const pm=(R={},F={})=>({beforeRequest:Xu(R,F,"beforeRequest"),beforeRetry:Xu(R,F,"beforeRetry"),afterResponse:Xu(R,F,"afterResponse"),beforeError:Xu(R,F,"beforeError")}),hy=(R,F)=>{const N=new URLSearchParams;for(const X of[R,F])if(X!==void 0)if(X instanceof URLSearchParams)for(const[pe,Fe]of X.entries())N.append(pe,Fe);else if(Array.isArray(X))for(const pe of X){if(!Array.isArray(pe)||pe.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");N.append(String(pe[0]),String(pe[1]))}else if(qs(X))for(const[pe,Fe]of Object.entries(X))Fe!==void 0&&N.append(pe,String(Fe));
825else{const pe=new URLSearchParams(X);for(const[Fe,C]of pe.entries())N.append(Fe,C)}return N},Ld=(...R)=>{let F={},N={},X={},pe;const Fe=[];for(const C of R)if(Array.isArray(C))Array.isArray(F)||(F=[]),F=[...F,...C];else if(qs(C)){for(let[c,be]of Object.entries(C)){if(c==="signal"&&be instanceof globalThis.AbortSignal){Fe.push(be);continue}if(c==="context"){if(be!=null&&(!qs(be)||Array.isArray(be)))throw new TypeError("The `context` option must be an object");F={...F,context:be==null?{}:{...F.context,...be}};continue}if(c==="searchParams"){be==null?pe=void 0:pe=pe===void 0?be:hy(pe,be);continue}qs(be)&&c in F&&(be=Ld(F[c],be)),F={...F,[c]:be}}qs(C.hooks)&&(X=pm(X,C.hooks),F.hooks=X),qs(C.headers)&&(N=dm(N,C.headers),F.headers=N)}return pe!==void 0&&(F.searchParams=pe),Fe.length>0&&(Fe.length===1?F.signal=Fe[0]:om?F.signal=AbortSignal.any(Fe):F.signal=Fe.at(-1)),F.context===void 0&&(F.context={}),F},dy=R=>lm.includes(R)?R.toUpperCase():R,py=["get","put","head","delete","options","trace"],fy=[408,413,429,500,502,503,504],my=[413,429,503],Qf={limit:2,methods:py,statusCodes:fy,afterStatusCodes:my,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:R=>.3*2**(R-1)*1e3,jitter:void 0,retryOnTimeout:!1},gy=(R={})=>{if(typeof R=="number")return{...Qf,limit:R};if(R.methods&&!Array.isArray(R.methods))throw new Error("retry.methods must be an array");if(R.statusCodes&&!Array.isArray(R.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Qf,...R}};class Cd extends Error{constructor(N){super(`Request timed out: ${N.method} ${N.url}`);Ze(this,"request");this.name="TimeoutError",this.request=N}}async function _y(R,F,N,X){return new Promise((pe,Fe)=>{const C=setTimeout(()=>{N&&N.abort(),Fe(new Cd(R))},X.timeout);X.fetch(R,F).then(pe).catch(Fe).then(()=>{clearTimeout(C)})})}async function yy(R,{signal:F}){return new Promise((N,X)=>{F&&(F.throwIfAborted(),F.addEventListener("abort",pe,{once:!0}));function pe(){clearTimeout(Fe),X(F.reason)}const Fe=setTimeout(()=>{F==null||F.removeEventListener("abort",pe),N()},R)})}const xy=(R,F)=>{const N={};for(const X in F)Object.hasOwn(F,X)&&!(X in oy)&&!(X in ay)&&(!(X in R)||X in sy)&&(N[X]=F[X]);return N},vy=R=>R===void 0?!1:Array.isArray(R)?R.length>0:R instanceof URLSearchParams?R.size>0:typeof R=="object"?Object.keys(R).length>0:typeof R=="string"?R.trim().length>0:!!R;function by(R){return R instanceof Ed||(R==null?void 0:R.name)===Ed.name}function wy(R){return R instanceof Cd||(R==null?void 0:R.name)===Cd.name}var eh,fm,en,Or,Yi,$e,qa,Sn,Zs,Rt,Ku,mm,Ad,zd,gm,_c,Ju,kd;const yc=class yc{constructor(F,N={}){wn(this,Rt);Ze(this,"request");wn(this,en);wn(this,Or,0);wn(this,Yi);wn(this,$e);wn(this,qa);wn(this,Sn);wn(this,Zs);var pe,Fe,C;if(Kr(this,Yi,F),Kr(this,$e,{...N,headers:dm(ze(this,Yi).headers,N.headers),hooks:pm({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},N.hooks),method:dy(N.method??ze(this,Yi).method??"GET"),prefixUrl:String(N.prefixUrl||""),retry:gy(N.retry),throwHttpErrors:N.throwHttpErrors??!0,timeout:N.timeout??1e4,fetch:N.fetch??globalThis.fetch.bind(globalThis),context:N.context??{}}),typeof ze(this,Yi)!="string"&&!(ze(this,Yi)instanceof URL||ze(this,Yi)instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(ze(this,$e).prefixUrl&&typeof ze(this,Yi)=="string"){if(ze(this,Yi).startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");ze(this,$e).prefixUrl.endsWith("/")||(ze(this,$e).prefixUrl+="/"),Kr(this,Yi,ze(this,$e).prefixUrl+ze(this,Yi))}Q_&&om&&(Kr(this,Sn,ze(this,$e).signal??ze(this,Yi).signal),Kr(this,en,new globalThis.AbortController),ze(this,$e).signal=ze(this,Sn)?AbortSignal.any([ze(this,Sn),ze(this,en).signal]):ze(this,en).signal),Jf&&(ze(this,$e).duplex="half"),ze(this,$e).json!==void 0&&(ze(this,$e).body=((Fe=(pe=ze(this,$e)).stringifyJson)==null?void 0:Fe.call(pe,ze(this,$e).json))??JSON.stringify(ze(this,$e).json),ze(this,$e).headers.set("content-type",ze(this,$e).headers.get("content-type")??"application/json"));const X=N.headers&&new globalThis.Headers(N.headers).has("content-type");if(ze(this,Yi)instanceof globalThis.Request&&(ty&&ze(this,$e).body instanceof globalThis.FormData||ze(this,$e).body instanceof URLSearchParams)&&!X&&ze(this,$e).headers.delete("content-type"),this.request=new globalThis.Request(ze(this,Yi),ze(this,$e)),vy(ze(this,$e).searchParams)){const be="?"+(typeof ze(this,$e).searchParams=="string"?ze(this,$e).searchParams.replace(/^\?/,""):new URLSearchParams(yi(C=yc,eh,fm).call(C,ze(this,$e).searchParams)).toString()),Ne=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,be);this.request=new globalThis.Request(Ne,ze(this,$e))}if(ze(this,$e).onUploadProgress){if(typeof ze(this,$e).onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Jf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=yi(this,Rt,kd).call(this,this.request,ze(this,$e).body??void 0)}}static create(F,N){var C,c,be;const X=new yc(F,N),pe=async()=>{var nt,At,Lt,_t,ki,st,xe;if(typeof ze(X,$e).timeout=="number"&&ze(X,$e).timeout>Id)throw new RangeError(`The \`timeout\` option cannot be greater than ${Id}`);await Promise.resolve();let Ne=await yi(nt=X,Rt,gm).call(nt);for(const sr of ze(X,$e).hooks.afterResponse){const St=yi(At=X,Rt,Ad).call(At,Ne.clone()),vt=await sr(X.request,yi(Lt=X,Rt,_c).c
825all(Lt),St,{retryCount:ze(X,Or)});if(vt instanceof globalThis.Response&&(Ne=vt),vt instanceof um)throw await Promise.all([(_t=St.body)==null?void 0:_t.cancel(),(ki=Ne.body)==null?void 0:ki.cancel()]),new Md(vt.options)}if(yi(st=X,Rt,Ad).call(st,Ne),!Ne.ok&&(typeof ze(X,$e).throwHttpErrors=="function"?ze(X,$e).throwHttpErrors(Ne.status):ze(X,$e).throwHttpErrors)){let sr=new Ed(Ne,X.request,yi(xe=X,Rt,_c).call(xe));for(const St of ze(X,$e).hooks.beforeError)sr=await St(sr,{retryCount:ze(X,Or)});throw sr}if(ze(X,$e).onDownloadProgress){if(typeof ze(X,$e).onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!ey)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return cy(Ne.clone(),ze(X,$e).onDownloadProgress)}return Ne},Fe=yi(C=X,Rt,zd).call(C,pe).finally(async()=>{var At,Lt;const Ne=ze(X,qa),nt=[];Ne&&!Ne.bodyUsed&&nt.push((At=Ne.body)==null?void 0:At.cancel()),X.request.bodyUsed||nt.push((Lt=X.request.body)==null?void 0:Lt.cancel()),await Promise.all(nt)});for(const[Ne,nt]of Object.entries(iy))Ne==="bytes"&&typeof((be=(c=globalThis.Response)==null?void 0:c.prototype)==null?void 0:be.bytes)!="function"||(Fe[Ne]=async()=>{X.request.headers.set("accept",X.request.headers.get("accept")||nt);const At=await Fe;if(Ne==="json"){if(At.status===204)return"";const Lt=await At.text();return Lt===""?"":N.parseJson?N.parseJson(Lt):JSON.parse(Lt)}return At[Ne]()});return Fe}};eh=new WeakSet,fm=function(F){return F&&typeof F=="object"&&!Array.isArray(F)&&!(F instanceof URLSearchParams)?Object.fromEntries(Object.entries(F).filter(([,N])=>N!==void 0)):F},en=new WeakMap,Or=new WeakMap,Yi=new WeakMap,$e=new WeakMap,qa=new WeakMap,Sn=new WeakMap,Zs=new WeakMap,Rt=new WeakSet,Ku=function(){const F=ze(this,$e).retry.delay(ze(this,Or));let N=F;return ze(this,$e).retry.jitter===!0?N=Math.random()*F:typeof ze(this,$e).retry.jitter=="function"&&(N=ze(this,$e).retry.jitter(F),(!Number.isFinite(N)||N<0)&&(N=F)),Math.min(ze(this,$e).retry.backoffLimit,N)},mm=async function(F){if(Xf(this,Or)._++,ze(this,Or)>ze(this,$e).retry.limit)throw F;const N=F instanceof Error?F:new sm(F);if(N instanceof Md)return N.customDelay??yi(this,Rt,Ku).call(this);if(!ze(this,$e).retry.methods.includes(this.request.method.toLowerCase()))throw F;if(ze(this,$e).retry.shouldRetry!==void 0){const X=await ze(this,$e).retry.shouldRetry({error:N,retryCount:ze(this,Or)});if(X===!1)throw F;if(X===!0)return yi(this,Rt,Ku).call(this)}if(wy(F)&&!ze(this,$e).retry.retryOnTimeout)throw F;if(by(F)){if(!ze(this,$e).retry.statusCodes.includes(F.response.status))throw F;const X=F.response.headers.get("Retry-After")??F.response.headers.get("RateLimit-Reset")??F.response.headers.get("X-RateLimit-Retry-After")??F.response.headers.get("X-RateLimit-Reset")??F.response.headers.get("X-Rate-Limit-Reset");if(X&&ze(this,$e).retry.afterStatusCodes.includes(F.response.status)){let pe=Number(X)*1e3;Number.isNaN(pe)?pe=Date.parse(X)-Date.now():pe>=Date.parse("2024-01-01")&&(pe-=Date.now());const Fe=ze(this,$e).retry.maxRetryAfter??pe;return pe<Fe?pe:Fe}if(F.response.status===413)throw F}return yi(this,Rt,Ku).call(this)},Ad=function(F){return ze(this,$e).parseJson&&(F.json=async()=>ze(this,$e).parseJson(await F.text())),F},zd=async function(F){try{return await F()}catch(N){const X=Math.min(await yi(this,Rt,mm).call(this,N),Id);if(ze(this,Or)<1)throw N;if(await yy(X,ze(this,Sn)?{signal:ze(this,Sn)}:{}),N instanceof Md&&N.customRequest){const pe=ze(this,$e).signal?new globalThis.Request(N.customRequest,{signal:ze(this,$e).signal}):new globalThis.Request(N.customRequest);yi(this,Rt,Ju).call(this,pe)}for(const pe of ze(this,$e).hooks.beforeRetry){const Fe=await pe({request:this.request,options:yi(this,Rt,_c).call(this),error:N,retryCount:ze(this,Or)});if(Fe instanceof globalThis.Request){yi(this,Rt,Ju).call(this,Fe);break}if(Fe instanceof globalThis.Response)return Fe;if(Fe===cm)return}return yi(this,Rt,zd).call(this,F)}},gm=async function(){var N;(N=ze(this,en))!=null&&N.signal.aborted&&(Kr(this,en,new globalThis.AbortController),ze(this,$e).signal=ze(this,Sn)?AbortSignal.any([ze(this,Sn),ze(this,en).signal]):ze(this,en).signal,this.request=new globalThis.Request(this.request,{signal:ze(this,$e).signal}));for(const X of ze(this,$e).hooks.beforeRequest){const pe=await X(this.request,yi(this,Rt,_c).c
825all(this),{retryCount:ze(this,Or)});if(pe instanceof Response)return pe;if(pe instanceof globalThis.Request){yi(this,Rt,Ju).call(this,pe);break}}const F=xy(this.request,ze(this,$e));return Kr(this,qa,this.request),this.request=ze(this,qa).clone(),ze(this,$e).timeout===!1?ze(this,$e).fetch(ze(this,qa),F):_y(ze(this,qa),F,ze(this,en),ze(this,$e))},_c=function(){if(!ze(this,Zs)){const{hooks:F,...N}=ze(this,$e);Kr(this,Zs,Object.freeze(N))}return ze(this,Zs)},Ju=function(F){Kr(this,Zs,void 0),this.request=yi(this,Rt,kd).call(this,F)},kd=function(F,N){return!ze(this,$e).onUploadProgress||!F.body?F:uy(F,ze(this,$e).onUploadProgress,N??ze(this,$e).body??void 0)},wn(yc,eh);let Qu=yc;/*! MIT License © Sindre Sorhus */const Dd=R=>{const F=(N,X)=>Qu.create(N,Hu(R,X));for(const N of lm)F[N]=(X,pe)=>Qu.create(X,Hu(R,pe,{method:N}));return F.create=N=>Dd(Hu(N)),F.extend=N=>(typeof N=="function"&&(N=N(R??{})),Dd(Hu(R,N))),F.stop=cm,F.retry=ny,F},Ty=Dd(),$s={get searchResultElement(){return $("#pharmacy-search-result")},init:function(){$("#pharmacy-search-result .list-group-item").length>0&&(new Yf("pharmacy-search-result",{valueNames:["name"],page:10,pagination:[{paginationClass:"pagination",innerWindow:2,outerWindow:1}]}),$s.bindPaginationEvents())},createList:function(R,F){var X;const N=$s.searchResultElement;if((X=R==null?void 0:R.apotheken)!=null&&X.apotheke){const pe=$('<ul class="list list-group mb-4 shadow-sm"></ul>'),Fe='<p class="pt-3 mb-3">'+R.apotheken.apotheke.length+" Apotheken im Umkreis von "+R.parameter.radius+" Kilometern gefunden.</p>";Object.values(R.apotheken.apotheke).forEach(C=>{var c=$s.createListItem(C,F.interface);pe.append(c)}),N.empty().append(Fe).append(pe),N.append($('<ul class="pagination"></ul>')),new Yf("pharmacy-search-result",{valueNames:["name"],page:10,pagination:[{paginationClass:"pagination",innerWindow:2,outerWindow:1}]}),$s.bindPaginationEvents()}else N.empty()},bindPaginationEvents:function(){$("#pharmacy-search-result .pagination a.page").off().on("click",function(R){R.preventDefault(),setTimeout(function(){let N=$("#pharmacy-search-result").offset().top;""+N,$("html, body").scrollTop(N-120),$s.bindPaginationEvents()},100)})},createListItem:function(R,F){var N='<li class="list-group-item'+(R.uid?" premium":"")+'"><div class="d-flex justify-content-between align-items-center"><h2 class="name">'+R.name+'</h2><div class="distanz badge badge-light"><span class="d-none d-sm-inline">Entfernung: </span>'+parseFloat(R.distanz).toFixed(2)+" km</div></div>";if(R.local_services!==void 0){var X=R.local_services.split(",");X[X.length-1]===""&&delete X[X.length-1],N+='<div><ul class="local-services-list list-unstyled">',X.forEach(function(pe,Fe){N+='<li class="'+pe+' my-1 me-1">'+(pe==="lieferservice"?"Lieferservice":"")+(pe==="barrierefreiheit"?"Barrierefreiheit":"")+(pe==="parkmoeglichkeit"?"Parkmöglichkeit vor Ort":"")+"</li>"}),N+="</ul></div>"}return F==="emergency"&&(N+='<div class="mb-2"><p>Notdienst vom '+R.startdatum+" um "+R.startzeit+" Uhr bis "+R.enddatum+" um "+R.endzeit+" Uhr.</p></div>"),R.homepage&&R.homepage.length&&(R.homepage.startsWith("http")||(R.homepage="http://"+R.homepage)),N+='<div class="row"><div class="col-md-4"><p><span class="strasse">'+R.strasse+'</span><br><span class="plz">'+R.plz+'</span> <span class="ort">'+R.ort+'</span><br></p></div><div class="col-md-4"><p>'+(R.telefon&&R.telefon.length?'<span>Tel: </span><a href="tel:'+R.telefon+'">'+R.telefon+"</a>":"")+(R.fax&&R.fax.length?"<br><span>Fax: </span>"+R.fax:"")+(R.email&&R.email.length?'<br><a href="mailto:'+R.email+'">'+R.email+"</a>":"")+(R.homepage&&R.homepage.length?'<br><a href="'+R.homepage+'" target="_blank" title="'+R.name+'">'+R.homepage+"</a>":"")+'</p></div><div class="col-md-4 d-flex flex-column align-items-end justify-content-end">'+(R.uri?'<a href="'+R.uri+'" class="showapo">mehr erfahren</a>':"")+'<a class="showapo" target="_blank" href="https://maps.google.de/maps?q='+R.strasse+",+"+R.plz+"+"+R.ort+'+,+Germany&z=17&basemap=roadmap">Google Navigation</a><a class="btn btn-secondary-small-invert btn-busbahn" target="_blank" href="https://www.awin1.com/cread.php?awinmid=14964&awinaffid=640337&linkid=3441876&p=https%3A%2F%2Fwww.bahn.de%2Fbuchung%2Fstart%3FSTS%3Dfalse%26SO%3D%26ZO%3D'+R.plz+"+"+R.ort+"+"+R.strasse+')%26dbkanal_003%3DL01_S01_D001_KAF0001_14964_AFFILIATE-CPC_KOOP-APONET-2023-!!!affid!!!_LZ03">Mit Bus / Bahn erreichen</a></div></div>',N+="</li>",N}};var Sy=G_();const Py=new Date,My=Py.toISOString().split("T")[0],Oe={GEOLOCATION_RADIUS:20,get plzort(){return $('input[name="tx_aponetpharmacy_search[search][plzort]"]').val()},set plzort(R){$('input[name="tx_aponetpharmacy_search[search][plzort]"]').val(R)},get date(){return $('input[name="tx_aponetpharmacy_search[search][date]"]').val()},set date(R){$('input[name="tx_aponetpharmacy_search[search][date]"]').val(R)},get radius(){return $('input[name="tx_aponetpharmacy_search[search][radius]"]').val()},set radius(R){$('input[name="tx_aponetpharmacy_search[search][radius]"]').val(R)},get street(){return $('input[name="tx_aponetpharmacy_search[search][street]"]').val()},set street(R){$('input[name="tx_aponetpharmacy_search[search][street]"]').val(R)},get alternativesElement(){return $("#alternatives")},get pharmacyAlertsElement(){return $("#pharmacy-alerts")},get formPath(){return $("form#pharmacy-searchform").attr("action").split("?")[0]},init:function(){Oe.bindEvents(),Oe.loadFormByUrl(),Oe.cleanUrlParameters(),Oe.setupUrlCleaning()},setupUrlCleaning:function(){const R=window.history.pushState,F=window.history.replaceState;window.history.pushState=function(...N){R.apply(this,N),setTimeout(()=>Oe.cleanUrlParameters(),0)},window.history.replaceState=function(...N){F.apply(this,N),setTimeout(()=>Oe.cleanUrlParameters(),0)},window.addEventListener("popstate",function(){setTimeout(()=>Oe.cleanUrlParameters(),0)})},loadFormByUrl:function(){let F=window.location.pathname.replace(Oe.formPath,"").substring(1);const N=new URLSearchParams(window.location.search);F=F.replace(/^plz\//,"").replace(/^plzort\//,"");const X=F.split("/");let pe=decodeURI(X[0]??"").trim(),Fe=decodeURI(X[1]??"").trim(),C=decodeURI(X[2]??"").trim();N.has("s")&&(Fe=decodeURI(N.get("s")).trim()),N.has("r")&&(C=decodeURI(N.get("r")).trim());let c="";
825typeof pe=="string"&&pe!==""&&(c=Oe.sanitizePlzort(pe),Oe.plzort=c),typeof Fe=="string"&&Fe!==""&&(Oe.street=Fe,setTimeout(function(){$("#search-filters").collapse("show")},100)),(typeof C=="string"||typeof C=="number")&&C!==""&&(Oe.radius=C),c!==""&&$("#pharmacy-search-result .list-group-item").length===0&&$("#pharmacy-searchform").submit()},bindEvents:function(){$("#select-alternative").length>0&&$("#select-alternative").on("change",function(X){X.preventDefault();const pe=$(this).val();Oe.plzort=pe,$("#pharmacy-searchform").submit()}),setTimeout(function(){$("#select-alternative option").length===1&&$("#alternatives").empty()},2e3),at.mapElement.addEventListener(at.EVENT_RESULTS_LOADED,function(X){var C,c;const{status:pe,response:Fe}=X.detail;if(pe==="error"){Oe.createAlerts([{title:"Keine Suchergebnisse gefunden",message:"Bitte versuchen Sie es erneut."}]);return}if(Fe){const{results:be,args:Ne,alerts:nt}=Fe;Oe.createAlternatives(be),Oe.createAlerts(nt),(C=Ne==null?void 0:Ne.search)!=null&&C.lat&&((c=Ne==null?void 0:Ne.search)!=null&&c.lng)&&Oe.updateGeolocationUrl(be),be.apotheken&&be.apotheken.apotheke&&(Oe.radius=Ne.search.radius,$(".radius-val").html(Ne.search.radius))}}),$("#search-filters").on("shown.bs.collapse",function(){Oe.date||(Oe.date=My)}),$("#search-filters").on("hidden.bs.collapse",function(){Oe.date=""}),$("#pharmacy-searchform").on("submit",function(X){X.preventDefault(),Oe.updateMetaDescription(Oe.plzort),window.pharmacySearchTerm!==void 0&&window.pharmacySearchTerm!==""?Oe.updateHeader(window.pharmacySearchTerm):Oe.updateHeader(Oe.plzort),Oe.loadContent()});const R=$("#search-filters .radius"),F=$("#search-filters .radius-val");let N=R.val();F.html(N),R.on("change",function(){N=$(this).val(),F.html(N)}),window.addEventListener("popstate",function(X){}),$(".form-control").on("keydown",function(X){(X.keyCode===13||X.which===13||X.key==="Enter"||X.code==="Enter"||X.code==="NumpadEnter")&&(X.preventDefault(),$(this).closest("form").find('button[type="submit"]').click())}),$('input[name="tx_aponetpharmacy_search[search][plzort]"]').on("input",function(){Oe.alternativesElement.empty(),Oe.street="",$("#search-filters").collapse("hide")}),$('button[data-bs-target="#search-filters"]').on("click",function(){Oe.alternativesElement.empty()}),$("#alternatives select").length<1&&$("#pharmacy-searchform").submit()},createAlternatives:function(R){var Fe;const F=this.alternativesElement;F.empty();const N=(Fe=R==null?void 0:R.parameter)==null?void 0:Fe.alternative,X=Array.isArray(N)&&N.length>1,pe=R.apotheken&&R.apotheken.apotheke&&R.apotheken.apotheke.length>0;if(X||pe&&!X){let C;window.pharmacySearchTerm!==void 0&&window.pharmacySearchTerm!==null&&window.pharmacySearchTerm!==""?C=window.pharmacySearchTerm:C=Oe.plzort,Oe.sanitizePlzort(C);let be='<label for="alternatives" class="form-label">'+"Anderen Stadtteil oder Ort auswählen:"+'</label><select class="form-select" id="select-alternative"><option value="" disabled selected>--- Suche hier verfeinern ---</option>',Ne=[];X?Ne=R.parameter.alternative:pe&&(Ne=[]),Ne.sort((nt,At)=>{const Lt=nt.plz?nt.plz.toString():"",_t=At.plz?At.plz.toString():"";return Lt.localeCompare(_t)}),Ne.forEach(nt=>{const At=Oe.sanitizePlzort(nt.plz),Lt=Oe.sanitizePlzort(nt.ort),_t=nt.teilort!==void 0?Oe.sanitizePlzort(nt.teilort):"",ki=At+" "+Lt+(_t?" "+_t:""),st=Oe.sanitizePlzort(ki);be+='<option value="'+st+'">'+ki+"</option>"}),be+="</select>",F.append(be),$("#select-alternative").on("change",function(nt){nt.preventDefault();const At=$(this).val();Oe.plzort=At,$("#pharmacy-searchform").submit()})}},createAlerts:function(R){const F=Oe.pharmacyAlertsElement;if(F.empty(),!R.length)return;let N="";R.forEach(X=>{const pe=Oe.sanitizeHtmlText(X.title),Fe=Oe.sanitizeHtmlText(X.message);var C='<div class="alert alert-info mt-3" role="alert"><h5 class="mt-0">'+pe+'</h5><p class="mb-0">'+Fe+"</p></div>";N+=C}),F.append($(N))},sanitizeHtmlText:function(R){return R==null?"":String(R).replace(/[<>"']/g,function(F){switch(F){case"<":return"";case">":return"";case'"':return"";case"'":return"";case"+":return" ";case"-":return" ";default:return F}})},sanitizePlzort:function(R){return R?(/^\d{5}-/.test(R)&&(R=R.replace(/-/g," ")),R.replace(/[+\/!"§$%()=?]/g," ").replace(/[^a-zA-Z0-9\s\-äöüÄÖÜß]/g,"").trim()):""},formatPlzortForUrl:function(R){if(!R)return"";const F=Oe.sanitizePlzort(R),N=F.match(/^(\d{5})\s+(.+)$/),X=F.match(/^(\d{5})$/),pe=F.match(/^([^\d].+)$/);if(N){const Fe=N[1],c=N[2].replace(/\s+/g,"-");return Fe+"-"+c}else if(X||pe){const Fe=document.getElementById("select-alternative");if(Fe&&Fe.options.length>0){const C=Fe.options[Fe.selectedIndex];if(C){const c=C.value,Ne=Oe.sanitizePlzort(c).match(/^(\d{5})\s+(.+)$/);if(Ne){const nt=Ne[1],Lt=Ne[2].replace(/\s+/g,"-"),_t=nt+"-"+Lt;return""+_t,Oe.plzort=nt+" "+Lt,$("#pharmacy-searchform").submit(),_t}}}}return F},containsNotdienst:function(){const R=document.querySelector(".content.container");if(!R)return!1;const F=R.querySelector("h1");return F&&F.textContent.includes("Notdienst")},updateMetaDescription:function(R){if(R&&R!==" "){let F=Oe.sanitizeHtmlText(Oe.sanitizePlzort(R));F=F.replace(/^\d{5}\s+/,"");let N="Alle Apotheken in "+F+": Finde schnell die passende Apotheke in deiner Nähe – mit Adresse und Navigation.";Oe.containsNotdienst()&&(N="Apotheken-Notdienst heute in "+F+": Finde jetzt die nächste geöffnete Notfallapotheke in deiner Nähe.");let X=document.querySelector('meta[name="description"]');X?X.setAttribute("content",N):(X=document.createElement("meta"),X.setAttribute("name","description"),X.setAttribute("content",N),document.head.appendChild(X));let pe=document.querySelector('meta[property="og:description"]');pe?pe.setAttribute("content",N):(pe=document.createElement("meta"),pe.setAttribute("property","og:description"),pe.setAttribute("content",N),document.head.appendChild(pe))}}
825,capitalizeFirstNonNumber:function(R){if(!R)return"";const F=R.match(/[^\d\s]/);if(!F)return R;const N=F.index;return R.substring(0,N)+R.charAt(N).toUpperCase()+R.substring(N+1)},updateHeader:function(R){if(R&&R!==" "){let F;F=Oe.sanitizeHtmlText(Oe.sanitizePlzort(R));let N=F.replace(/^\d{5}\s+/,"");if(!N.trim()){const be=document.getElementById("select-alternative");be&&be.options.length>0&&be.options[be.selectedIndex]}N=Oe.capitalizeFirstNonNumber(N);let X="Apothekensuche: Hier finden Sie jede Apotheke in "+N;Oe.containsNotdienst()&&(X="Apotheken-Notdienst in "+N+": Notfallapotheken für heute"),document.title=X+" | aponet.de";const pe=document.querySelector(".content.container");let Fe=null;pe&&(Fe=pe.querySelector("h1")),Fe&&(Fe.textContent=X);const C=document.querySelector('link[rel="canonical"]');if(C){const be=Oe.formatPlzortForUrl(R),Ne=Oe.formPath,nt=window.location.origin+Ne+"/"+encodeURIComponent(be);C.setAttribute("href",nt)}const c=document.querySelectorAll(".seo-breadcrumb .breadcrumb-item");if(c.length>0){const Ne=c[c.length-1].querySelector(".breadcrumb-text");Ne&&(Ne.textContent=Oe.sanitizeHtmlText(Oe.sanitizePlzort(Oe.capitalizeFirstNonNumber(R.replace("-"," ").trim()))))}}},loadContentByCoordinates:function(R){const F=Number(R==null?void 0:R.longitude),N=Number(R==null?void 0:R.latitude);!Number.isFinite(F)||!Number.isFinite(N)||(Oe.plzort="",Oe.street="",Oe.radius=Oe.GEOLOCATION_RADIUS,$(".radius-val").html(Oe.GEOLOCATION_RADIUS),Oe.loadContent(F,N))},updateGeolocationUrl:function(R){var c,be;const F=(c=R==null?void 0:R.apotheken)==null?void 0:c.apotheke,N=Array.isArray(F)?F[0]:F,X=[(be=R==null?void 0:R.parameter)==null?void 0:be.current,R==null?void 0:R.parameter,N].find(Ne=>(Ne==null?void 0:Ne.plz)&&(Ne==null?void 0:Ne.ort));if(!X)return;const pe=`${X.plz} ${X.ort}`,Fe=Oe.formatPlzortForUrl(pe),C=`${Oe.formPath}/${encodeURIComponent(Fe)}`;Oe.plzort=pe,window.history.replaceState({plzort:pe},"",C),Oe.updateMetaDescription(pe),Oe.updateHeader(pe)},loadContent:function(R="",F=""){const N=Oe.formPath,X=R!==""&&F!==""&&Number.isFinite(Number(R))&&Number.isFinite(Number(F));let pe=Oe.plzort?Oe.plzort:" ";if(pe!==" "){const nt=Oe.sanitizePlzort(pe);nt!==pe&&(Oe.plzort=nt,pe=nt)}else if(!X)return;const Fe=Oe.street?Oe.street:" ",C=Oe.radius,c=$("#search-filters").is(":visible")?Oe.date:"",be=Oe.formatPlzortForUrl(pe);let Ne=N+"/"+encodeURIComponent(be);X||window.history.pushState({plzort:pe,street:Fe,radius:C},"",Ne),Oe.updateMetaDescription(pe),Oe.updateHeader(pe),at.loadResults({plzort:pe,street:Fe,radius:C,date:c,lng:R,lat:F})},cleanUrlParameters:function(){const R=["tx_aponetpharmacy_search[action]","tx_aponetpharmacy_search[controller]","cHash"],F=window.location.href;if(F.includes("?")){const[N,X]=F.split("?"),pe=new URLSearchParams(X);let Fe=!1;if(R.forEach(C=>{pe.has(C)&&(pe.delete(C),Fe=!0)}),Fe){const C=pe.toString(),c=C?N+"?"+C:N;window.history.replaceState(window.history.state,"",c)}}}},at={lat:51.133481,lng:10.018343,get mapElement(){return document.getElementById("pharmacy-map")},map:null,geolocateControl:null,positionMarker:null,EVENT_RESULTS_LOADED:"pharmacy_map:loaded",init:function(){const R=window.location.origin;if(at.map=new tl.Map({container:"pharmacy-map",center:[at.lng,at.lat],maxZoom:18,minZoom:5,zoom:6,pixelRatio:2,antialias:!0,bearingSnap:7,fadeDuration:100,renderWorldCopies:!0,maxBounds:[[4.5703129,45.3984499],[16.523438,55.153766]],style:{version:8,glyphs:R+"/basemaps-assets/fonts/{fontstack}/{range}.pbf",sprite:R+"/basemaps-assets/sprites/v4/light",sources:{protomaps:{type:"vector",tiles:["https://tile-aponet.aponet.de/tiles/aponet/{z}/{x}/{y}.mvt"],maxzoom:15,attribution:'<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>'}},layers:am("protomaps",nm("light"),{lang:"de"})}}),at.addControls(),at.bindEvents(),at.map.on("load",function(){at.customizeHouseNumbers()}),$("#pharmacy-search-result .list-group-item").length>0){const F=[];if($("#pharmacy-search-result .list-group-item").each(function(){const N=$(this),X=N.find(".name").text(),pe=N.find(".strasse").text(),Fe=N.find(".plz").text(),C=N.find(".ort").text(),c=N.find('a[href^="tel:"]').text()||"";let be="";const Ne=N.find('span:contains("Fax: ")');if(Ne.length){const st=Ne.parent().text().match(/Fax: ([^\n]+)/);st&&st[1]&&(be=st[1].trim())}const nt=N.find('a[href^="mailto:"]').text()||"",At=N.find('a[target="_blank"][title="'+X+'"]').text()||"";let Lt=N.data("latitude"),_t=N.data("longitude");Lt&&_t&&F.push({id:N.data("id")||Math.random().toString(36).substring(2,15),name:X,strasse:pe,plz:Fe,ort:C,telefon:c,fax:be,email:nt,homepage:At,latitude:Lt,longitude:_t})}),F.length>0){at.setPharmacyMarkers(F);const N=at.mapElement.dataset.latitude,X=at.mapElement.dataset.longitude;if(N&&X&&N.length&&X.length){const pe=[parseFloat(X),parseFloat(N)];at.coordinatesMatchPharmacy(pe,F)||at.addPositionMarker(X,N)}}}at.map.on("error",F=>{console.error("🗺️🔴 Map Error:",F)}),at.map.on("styleimagemissing",F=>{console.warn("🗺️⚠️ Missing image:",F.id)})}
825,addControls:function(){const R=at.map;at.geolocateControl=new tl.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!1,showUserHeading:!0,showUserLocation:!0,fitBoundsOptions:{maxZoom:15}}),R.addControl(at.geolocateControl),R.addControl(new tl.NavigationControl({showCompass:!0,showZoom:!0,visualizePitch:!0}),"top-left")},bindEvents:function(){const R=at.map;at.geolocateControl.on("geolocate",Sy.debounce(F=>{at.removePositionMarkerFromMap(),Oe.loadContentByCoordinates(F.coords)},200)),R.on("click","pharmacy-clusters",async F=>{const N=R.queryRenderedFeatures(F.point,{layers:["pharmacy-clusters"]}),X=N[0].properties.cluster_id,pe=await R.getSource("pharmacies").getClusterExpansionZoom(X);R.easeTo({center:N[0].geometry.coordinates,zoom:pe})}),R.on("click","pharmacies",F=>{const N=F.features[0].geometry.coordinates.slice(),X=F.features[0].properties.description;for(;Math.abs(F.lngLat.lng-N[0])>180;)N[0]+=F.lngLat.lng>N[0]?360:-360;new tl.Popup({maxWidth:"300px",offset:[2,-20]}).setLngLat(N).setHTML(X).addTo(R)}),R.on("mouseenter","pharmacy-clusters",()=>{R.getCanvas().style.cursor="pointer"}),R.on("mouseleave","pharmacy-clusters",()=>{R.getCanvas().style.cursor=""}),R.on("mouseenter","pharmacies",()=>{R.getCanvas().style.cursor="pointer"}),R.on("mouseleave","pharmacies",()=>{R.getCanvas().style.cursor=""})},loadResults:async function(R={lat:"",lng:"",plzort:"",street:"",radius:"",date:""}){const N=$("form#pharmacy-searchform").attr("action").split("?")[0];try{const X=await Ty.post(N,{headers:{"X-Pharmacy-Token":at.mapElement.dataset.token??""},searchParams:{type:"1981"},body:new URLSearchParams({"tx_aponetpharmacy_search[action]":"result","tx_aponetpharmacy_search[controller]":"Search","tx_aponetpharmacy_search[search][plzort]":R.plzort??"","tx_aponetpharmacy_search[search][date]":R.date??"","tx_aponetpharmacy_search[search][street]":R.street??"","tx_aponetpharmacy_search[search][radius]":R.radius??10,"tx_aponetpharmacy_search[search][lat]":R.lat??"","tx_aponetpharmacy_search[search][lng]":R.lng??""}),retry:0}).json();if(X.redirect&&X.url){""+X.url,window.location.href=X.url;return}const{results:pe,settings:Fe}=X;if($s.createList(pe,Fe),at.clearPharmacyMarkers(),pe.apotheken&&pe.apotheken.apotheke){let C="";if(pe.apotheken&&pe.apotheken.apotheke&&pe.apotheken.apotheke[0]){const Ne=pe.apotheken.apotheke[0];Ne.plz&&Ne.ort&&(C=Oe.formPath+"/"+(Ne.plz+"-"+Oe.sanitizePlzort(Ne.ort)),C=C.replace(/\s+/g,"-"))}let c=window.location.pathname.split("?")[0];C!==""&&(decodeURIComponent(c),decodeURIComponent(C));let be=null;if(!(R.lat&&R.lng)&&pe.parameter.latitude&&pe.parameter.longitude){be={longitude:pe.parameter.longitude,latitude:pe.parameter.latitude};const Ne=[parseFloat(pe.parameter.longitude),parseFloat(pe.parameter.latitude)];at.coordinatesMatchPharmacy(Ne,pe.apotheken.apotheke)||at.addPositionMarker(pe.parameter.longitude,pe.parameter.latitude)}await at.setPharmacyMarkers(pe.apotheken.apotheke,be)}at.mapElement.dispatchEvent(new CustomEvent(at.EVENT_RESULTS_LOADED,{detail:{status:"success",response:X}}))}catch(X){console.error("Apothekensuche fehlgeschlagen:",X),at.mapElement.dispatchEvent(new CustomEvent(at.EVENT_RESULTS_LOADED,{detail:{status:"error",response:null}}))}},addPositionMarker:function(R,F){const N=[R,F];at.positionMarker||(at.positionMarker=new tl.Marker),at.removePositionMarkerFromMap(),at.positionMarker.setLngLat(N).addTo(at.map)},removePositionMarkerFromMap:function(){at.positionMarker&&at.positionMarker.remove()},clearPharmacyMarkers:function(){const R=at.map;["pharmacy-clusters","cluster-count","pharmacies"].forEach(N=>{R.getLayer(N)&&R.removeLayer(N)}),R.getSource("pharmacies")&&R.removeSource("pharmacies")},setPharmacyMarkers:async function(R,F=null){const N=at.map,X=at.getPharmacyFeatures(R);if(N.hasImage("pharmacy-marker")===!1){const pe=await N.loadImage(at.mapElement.dataset.marker);N.addImage("pharmacy-marker",pe.data)}N.addSource("pharmacies",{type:"geojson",data:X,cluster:!0}),N.addLayer({id:"pharmacy-clusters",type:"circle",source:"pharmacies",filter:["has","point_count"],paint:{"circle-color":"#e2001a","circle-radius":20}}),N.addLayer({id:"cluster-count",type:"symbol",source:"pharmacies",filter:["has","point_count"],paint:{"text-color":"#ffffff"},layout:{"text-field":"{point_count_abbreviated}","text-font":["Noto Sans Medium"],"text-size":12}}),N.addLayer({id:"pharmacies",type:"symbol",source:"pharmacies",filter:["!",["has","point_count"]],layout:{"icon-image":"pharmacy-marker","text-font":["Noto Sans Regular","Noto Sans Medium"],"text-offset":[0,1.25],"text-anchor":"top"}}),at.fitMapToMarkers(X,F)},customizeHouseNumbers:function(){const R=at.map,F=R.getStyle().layers;for(let N=0;N<F.length;N++){const X=F[N];
825if(X.id&&(X.id.includes("housenumber")||X.id.includes("house_number")||X.id.includes("address")||X.id.includes("addr")))X.id,this.applyHouseNumberStyling(R,X.id);else if(X.type==="symbol"&&X.layout&&X.layout["text-field"]){const pe=X.layout["text-field"];typeof pe=="string"&&(pe.includes("{housenumber}")||pe.includes("{addr:housenumber}")||pe.includes("{address}"))&&(X.id,this.applyHouseNumberStyling(R,X.id))}}},applyHouseNumberStyling:function(R,F){R.setLayoutProperty(F,"text-size",16),R.setPaintProperty(F,"text-halo-width",2),R.setPaintProperty(F,"text-halo-color","rgba(255, 255, 255, 0.9)"),R.setPaintProperty(F,"text-weight",500),R.setPaintProperty(F,"text-opacity",1),R.setPaintProperty(F,"text-halo-blur",.5)},fitMapToMarkers:function(R,F=null){if(!R.features||R.features.length===0)return;const N=new tl.LngLatBounds;if(R.features.forEach(X=>{N.extend(X.geometry.coordinates)}),F&&F.longitude&&F.latitude){const X=[parseFloat(F.longitude),parseFloat(F.latitude)];N.extend(X),at.map.fitBounds(N,{padding:{top:50,bottom:50,left:70,right:70},maxZoom:16,duration:2e3})}else at.map.fitBounds(N,{padding:{top:50,bottom:50,left:70,right:70},maxZoom:16,duration:2e3})},coordinatesMatchPharmacy:function(R,F){for(const X of F){const pe=parseFloat(X.longitude),Fe=parseFloat(X.latitude);if(Math.sqrt(Math.pow(R[0]-pe,2)+Math.pow(R[1]-Fe,2))<2e-4)return!0}return!1},getPharmacyFeatures:function(R){const F={type:"FeatureCollection",features:[]};return Object.values(R).forEach(N=>{let X="<h5>"+N.name+"</h5>";X+="<p>",N.strasse&&(X+=N.strasse),N.plz&&(X+="<br>"+N.plz),N.ort&&(X+=" "+N.ort),X+="</p><p>",N.telefon&&N.telefon.length&&(X+='<span>Tel: </span><a href="tel:'+N.telefon+'">'+N.telefon+"</a>"),N.fax&&N.fax.length&&(X+="<br><span>Fax: </span>"+N.fax),N.email&&N.email.length&&(X+='<br><a href="mailto:'+N.email+'">'+N.email+"</a>"),N.homepage&&N.homepage.length&&(N.homepage.startsWith("http")||(N.homepage="http://"+N.homepage),X+='<br><a target="_blank" href="'+N.homepage+'" title="'+N.name+'">'+N.homepage+"</a>"),X+="</p>",F.features.push({type:"Feature",properties:{id:N.id,name:N.name,description:X},geometry:{type:"Point",coordinates:[parseFloat(N.longitude),parseFloat(N.latitude)]}})}),F},updateBrowserHistory:function(R){if(R.apotheken.apotheke[0]!==void 0&&R.apotheken.apotheke[0].plz&&R.apotheken.apotheke[0].ort&&R.parameter.radius){const F=R.apotheken.apotheke[0].plz+"-"+R.apotheken.apotheke[0].ort,N={location:F,title:"",radius:R.parameter.radius||5};let X=F.replace(/[+\/!"§$%()=?]/g,"");X=X.replace(/[^a-zA-Z0-9üäö]/g,"-"),window.history.pushState(N,"",X)}}};document.addEventListener("DOMContentLoaded",function(){at.init(),Oe.init(),$s.init()});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.