1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2644],{24613:function(R){/** 2 * MapLibre GL JS 3 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.23.0/LICENSE.txt 4 */R.exports=function(){"use strict";var R={},eh={};function define(eu,em,e_){if(eh[eu]=e_,"index"===eu){var eg="var sharedModule = {}; ("+eh.shared+")(sharedModule); ("+eh.worker+")(sharedModule);",ev={};return eh.shared(ev),eh.index(R,ev),"undefined"!=typeof window&&R.setWorkerUrl(window.URL.createObjectURL(new Blob([eg],{type:"text/javascript"}))),R}}return define("shared",["exports"],function(R){let eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD;function e(R,eh,eu,em){return new(eu||(eu=Promise))(function(e_,eg){function o(R){try{l(em.next(R))}catch(R){eg(R)}}function a(R){try{l(em.throw(R))}catch(R){eg(R)}}function l(R){var eh;R.done?e_(R.value):((eh=R.value)instanceof eu?eh:new eu(function(R){R(eh)})).then(o,a)}l((em=em.apply(R,eh||[])).next())})}function n(R,eh){this.x=R,this.y=eh}function r(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}"function"==typeof SuppressedError&&SuppressedError,n.prototype={clone(){return new n(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,eh){return this.clone()._rotateAround(R,eh)},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){let eh=R.x-this.x,eu=R.y-this.y;return eh*eh+eu*eu},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,eh){return Math.atan2(this.x*eh-this.y*R,this.x*R+this.y*eh)},_matMult(R){let eh=R[2]*this.x+R[3]*this.y;return this.x=R[0]*this.x+R[1]*this.y,this.y=eh,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(){let R=this.y;return this.y=this.x,this.x=-R,this},_rotate(R){let eh=Math.cos(R),eu=Math.sin(R),em=eu*this.x+eh*this.y;return this.x=eh*this.x-eu*this.y,this.y=em,this},_rotateAround(R,eh){let eu=Math.cos(R),em=Math.sin(R),e_=eh.y+em*(this.x-eh.x)+eu*(this.y-eh.y);return this.x=eh.x+eu*(this.x-eh.x)-em*(this.y-eh.y),this.y=e_,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(R){if(R instanceof n)return R;if(Array.isArray(R))return new n(+R[0],+R[1]);if(void 0!==R.x&&void 0!==R.y)return new n(+R.x,+R.y);throw Error("Expected [x, y] or {x, y} point format")};var ek,eR,eL,eF,eB,eO,eV,ej,eN,eU,eG,e$,eZ,eq,eW,eX,eH,eY,eJ,eK,eQ,e0,e1,e2,e3=r(function(){if(tH)return tX;function t(R,eh,eu,em){this.cx=3*R,this.bx=3*(eu-R)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*eh,this.by=3*(em-eh)-this.cy,this.ay=1-this.cy-this.by,this.p1x=R,this.p1y=eh,this.p2x=eu,this.p2y=em}return tH=1,tX=t,t.prototype={sampleCurveX:function(R){return((this.ax*R+this.bx)*R+this.cx)*R},sampleCurveY:function(R){return((this.ay*R+this.by)*R+this.cy)*R},sampleCurveDerivativeX:function(R){return(3*this.ax*R+2*this.bx)*R+this.cx},solveCurveX:function(R,eh){if(void 0===eh&&(eh=1e-6),R<0)return 0;if(R>1)return 1;for(var eu=R,em=0;em<8;em++){var e_=this.sampleCurveX(eu)-R;if(Math.abs(e_)<eh)return eu;var eg=this.sampleCurveDerivativeX(eu);if(1e-6>Math.abs(eg))break;eu-=e_/eg}var ev=0,ex=1;for(eu=R,em=0;em<20&&!(Math.abs((e_=this.sampleCurveX(eu))-R)<eh);em++)R>e_?ev=eu:ex=eu,eu=.5*(ex-ev)+ev;return eu}
4,solve:function(R,eh){return this.sampleCurveY(this.solveCurveX(R,eh))}},tX}());function c(){return null==eh&&(eh="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),eh}function h(){if(null==eu&&(eu=!1,c())){let R=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(R){for(let eh=0;eh<25;eh++){let eu=4*eh;R.fillStyle=`rgb(${eu},${eu+1},${eu+2})`,R.fillRect(eh%5,Math.floor(eh/5),1,1)}let eh=R.getImageData(0,0,5,5).data;for(let R=0;R<100;R++)if(R%4!=3&&eh[R]!==R){eu=!0;break}}}return eu||!1}var e5="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var R=new e5(9);return e5!=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 y(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 m(){var R=new e5(3);return e5!=Float32Array&&(R[0]=0,R[1]=0,R[2]=0),R}function g(R){var eh=R[0],eu=R[1],em=R[2];return Math.sqrt(eh*eh+eu*eu+em*em)}function x(R,eh,eu){var em=new e5(3);return em[0]=R,em[1]=eh,em[2]=eu,em}function v(R,eh,eu){return R[0]=eh[0]+eu[0],R[1]=eh[1]+eu[1],R[2]=eh[2]+eu[2],R}function b(R,eh,eu){return R[0]=eh[0]*eu,R[1]=eh[1]*eu,R[2]=eh[2]*eu,R}function w(R,eh,eu){var em=eh[0],e_=eh[1],eg=eh[2],ev=eu[0],ex=eu[1],eb=eu[2];return R[0]=e_*eb-eg*ex,R[1]=eg*ev-em*eb,R[2]=em*ex-e_*ev,R}function A(R,eh,eu){var em=eh[0],e_=eh[1],eg=eh[2],ev=eh[3];return R[0]=eu[0]*em+eu[4]*e_+eu[8]*eg+eu[12]*ev,R[1]=eu[1]*em+eu[5]*e_+eu[9]*eg+eu[13]*ev,R[2]=eu[2]*em+eu[6]*e_+eu[10]*eg+eu[14]*ev,R[3]=eu[3]*em+eu[7]*e_+eu[11]*eg+eu[15]*ev,R}function M(){var R=new e5(4);return e5!=Float32Array&&(R[0]=0,R[1]=0,R[2]=0),R[3]=1,R}function k(R,eh,eu,em){var e_=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",eg=Math.PI/360;eh*=eg,em*=eg,eu*=eg;var ev=Math.sin(eh),ex=Math.cos(eh),eb=Math.sin(eu),ew=Math.cos(eu),eT=Math.sin(em),eS=Math.cos(em);switch(e_){case"xyz":R[0]=ev*ew*eS+ex*eb*eT,R[1]=ex*eb*eS-ev*ew*eT,R[2]=ex*ew*eT+ev*eb*eS,R[3]=ex*ew*eS-ev*eb*eT;break;case"xzy":R[0]=ev*ew*eS-ex*eb*eT,R[1]=ex*eb*eS-ev*ew*eT,R[2]=ex*ew*eT+ev*eb*eS,R[3]=ex*ew*eS+ev*eb*eT;break;case"yxz":R[0]=ev*ew*eS+ex*eb*eT,R[1]=ex*eb*eS-ev*ew*eT,R[2]=ex*ew*eT-ev*eb*eS,R[3]=ex*ew*eS+ev*eb*eT;break;case"yzx":R[0]=ev*ew*eS+ex*eb*eT,R[1]=ex*eb*eS+ev*ew*eT,R[2]=ex*ew*eT-ev*eb*eS,R[3]=ex*ew*eS-ev*eb*eT;break;case"zxy":R[0]=ev*ew*eS-ex*eb*eT,R[1]=ex*eb*eS+ev*ew*eT,R[2]=ex*ew*eT+ev*eb*eS,R[3]=ex*ew*eS-ev*eb*eT;break;case"zyx":R[0]=ev*ew*eS-ex*eb*eT,R[1]=ex*eb*eS+ev*ew*eT,R[2]=ex*ew*eT-ev*eb*eS,R[3]=ex*ew*eS+ev*eb*eT;break;default:throw Error("Unknown angle order "+e_)}return R}function I(){var R=new e5(2);return e5!=Float32Array&&(R[0]=0,R[1]=0),R}function E(R,eh){var eu=new e5(2);return eu[0]=R,eu[1]=eh,eu}function F(R,eh,eu){return eh*(8192/(R.tileSize*Math.pow(2,eu-R.tileID.overscaledZ)))}function P(R){return R instanceof Error?R:Error("string"==typeof R?R:String(R))}function D(R,eh){return(R%eh+eh)%eh}function z(R,eh,eu){return R*(1-eu)+eh*eu}function B(R){if(R<=0)return 0;if(R>=1)return 1;let eh=R*R,eu=eh*R;return 4*(R<.5?eu:3*(R-eh)+eu-.75)}function C(R,eh,eu,em){let e_=new e3(R,eh,eu,em);return R=>e_.solve(R)}m(),tY=new e5(4),e5!=Float32Array&&(tY[0]=0,tY[1]=0,tY[2]=0,tY[3]=0),m(),x(1,0,0),x(0,1,0),M(),M(),d(),I();let e4=C(.25,.1,.25,1);function L(R,eh,eu){return Math.min(eu,Math.max(eh,R))}function O(R,eh,eu){let em=eu-eh,e_=((R-eh)%em+em)%em+eh;return e_===eh?eu:e_}function $(R,...eh){for(let eu of eh)for(let eh in eu)R[eh]=eu[eh];return R}let e6=1;function N(R,eh,eu){let em={};for(let eu in R)em[eu]=eh.call(this,R[eu],eu,R);return em}function U(R,eh,eu){let em={};for(let eu in R)eh.call(this,R[eu],eu,R)&&(em[eu]=R[eu]);return em}function j(R){return Array.isArray(R)?R.map(j):"object"==typeof R&&R?N(R,j):R}let e8={};function G(R){e8[R]||("undefined"!=typeof console&&console.warn(R),e8[R]=!0)}function X(R,eh,eu){return(eu.y-R.y)*(eh.x-R.x)>(eh.y-R.y)*(eu.x-R.x)}function Y(R){return"undefined"!=typeof WorkerGlobalScope&&void 0!==R&&R instanceof WorkerGlobalScope}let e7=null;function H(R){return"undefined"!=typeof ImageBitmap&&R instanceof ImageBitmap}let e9="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(R,eh,eu,em,e_){return e(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw Error("VideoFrame not supported");let eg=new VideoFrame(R,{timestamp:0});try{let ev=null==eg?void 0:eg.format;if(!ev||!ev.startsWith("BGR")&&!ev.startsWith("RGB"))throw Error(`Unrecognized format ${ev}`);let ex=ev.startsWith("BGR"),eb=new Uint8ClampedArray(em*e_*4);if(yield eg.copyTo(eb,function(R,eh,eu,em,e_){let eg=Math.max(0,eh),ev=Math.max(0,eu);return{rect:{x:eg,y:ev,width:Math.min(R.width,eh+em)-eg,height:Math.min(R.height,eu+e_)-ev},layout:[{offset:(Math.max(0,eu)-eu)*em*4+4*Math.max(-eh,0),stride:4*em}]}}(R,eh,eu,em,e_)),ex)for(let R=0;R<eb.length;R+=4){let eh=eb[R];eb[R]=eb[R+2],eb[R+2]=eh}return eb}finally{eg.close()}})}function tt(R,eh,eu,em){return R.addEventListener(eh,eu,em),{unsubscribe:()=>{R.removeEventListener(eh,eu,em)}}}function et(R){return R*Math.PI/180}function nt(R){return R/Math.PI*180}let tl={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
4,th={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},tu="AbortError";let ot=class ot extends Error{constructor(R=tu){super(R instanceof Error?R.message:R),this.name=tu,R instanceof Error&&R.stack&&(this.stack=R.stack)}};function at(R){return R instanceof Error&&R.name===tu}function lt(R){if(R.aborted)throw new ot(R.reason)}let tc={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ct(R){return tc.REGISTERED_PROTOCOLS[R.substring(0,R.indexOf("://"))]}let tm="global-dispatcher";let pt=class pt extends Error{constructor(R,eh,eu,em){super(`AJAXError: ${eh} (${R}): ${eu}`),this.status=R,this.statusText=eh,this.url=eu,this.body=em}};let ft=()=>{var R;return Y(self)?null===(R=self.worker)||void 0===R?void 0:R.referrer:("blob:"===window.location.protocol?window.parent:window).location.href},dt=function(R,eh){return e(this,void 0,void 0,function*(){var eu,em,e_,eg;if(R.url.includes("://")&&!/^https?:|^file:/.test(R.url)){let em=ct(R.url);if(em){let eu=yield em(R,eh);return eu.data||"arrayBuffer"!==R.type?eu:$(eu,{data:new ArrayBuffer(0)})}if(Y(self)&&(null===(eu=self.worker)||void 0===eu?void 0:eu.actor))return self.worker.actor.sendAsync({type:"GR",data:R,targetMapId:tm},eh)}if(!((e_=R.url).startsWith("file:")||(null===(eg=ft())||void 0===eg?void 0:eg.startsWith("file:"))&&!/^\w+:/.test(e_))){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(R,eh){return e(this,void 0,void 0,function*(){let eu,em;let e_=new Request(R.url,{method:R.method||"GET",body:R.body,credentials:R.credentials,headers:R.headers,cache:R.cache,referrer:ft(),referrerPolicy:R.referrerPolicy,signal:eh.signal});"json"!==R.type||e_.headers.has("Accept")||e_.headers.set("Accept","application/json");try{eu=yield fetch(e_)}catch(eh){if(at(eh))throw eh;throw new pt(0,P(eh).message,R.url,new Blob)}if(!eu.ok){let eh=yield eu.blob();throw new pt(eu.status,eu.statusText,R.url,eh)}em="arrayBuffer"===R.type||"image"===R.type?eu.arrayBuffer():"json"===R.type?eu.json():eu.text();let eg=yield em;return lt(eh.signal),{data:eg,cacheControl:eu.headers.get("Cache-Control"),expires:eu.headers.get("Expires"),etag:eu.headers.get("ETag")}})}(R,eh);if(Y(self)&&(null===(em=self.worker)||void 0===em?void 0:em.actor))return self.worker.actor.sendAsync({type:"GR",data:R,mustQueue:!0,targetMapId:tm},eh)}return new Promise((eu,em)=>{var e_;let eg=new XMLHttpRequest;for(let eh in eg.open(R.method||"GET",R.url,!0),"arrayBuffer"!==R.type&&"image"!==R.type||(eg.responseType="arraybuffer"),R.headers)eg.setRequestHeader(eh,R.headers[eh]);"json"===R.type&&(eg.responseType="text",(null===(e_=R.headers)||void 0===e_?void 0:e_.Accept)||eg.setRequestHeader("Accept","application/json")),eg.withCredentials="include"===R.credentials,eg.onerror=()=>{em(Error(eg.statusText))},eg.onload=()=>{if(!eh.signal.aborted){if((eg.status>=200&&eg.status<300||0===eg.status)&&null!==eg.response){let eh=eg.response;if("json"===R.type)try{eh=JSON.parse(eg.response)}catch(R){return void em(R)}eu({data:eh,cacheControl:eg.getResponseHeader("Cache-Control"),expires:eg.getResponseHeader("Expires"),etag:eg.getResponseHeader("ETag")})}else{let eh=new Blob([eg.response],{type:eg.getResponseHeader("Content-Type")});em(new pt(eg.status,eg.statusText,R.url,eh))}}},eh.signal.addEventListener("abort",()=>{eg.abort(),em(new ot(eh.signal.reason))}),eg.send(R.body)})})};function yt(R){if(!R||0>=R.indexOf("://")||R.startsWith("data:image/")||R.startsWith("blob:"))return!0;let eh=new URL(R),eu=window.location;return eh.protocol===eu.protocol&&eh.host===eu.host}function mt(R,eh,eu){var em;(null===(em=eu[R])||void 0===em?void 0:em.includes(eh))||(eu[R]=eu[R]||[],eu[R].push(eh))}function gt(R,eh,eu){if(null==eu?void 0:eu[R]){let em=eu[R].indexOf(eh);-1!==em&&eu[R].splice(em,1)}}let xt=class xt{constructor(R,eh={}){$(this,eh),this.type=R}};let vt=class vt extends xt{constructor(R,eh={}){super("error",$({error:R},eh))}};let bt=class bt{on(R,eh){return this._listeners=this._listeners||{},mt(R,eh,this._listeners),{unsubscribe:()=>{this.off(R,eh)}}}off(R,eh){return gt(R,eh,this._listeners),gt(R,eh,this._oneTimeListeners),this}once(R,eh){return eh?(this._oneTimeListeners=this._oneTimeListeners||{},mt(R,eh,this._oneTimeListeners),this):new Promise(eh=>this.once(R,eh))}fire(R,eh){var eu,em;"string"==typeof R&&(R=new xt(R,eh||{}));let e_=R.type;if(this.listens(e_)){R.target=this;let eh=(null===(eu=this._listeners)||void 0===eu?void 0:eu[e_])?this._listeners[e_].slice():[];for(let eu of eh)eu.call(this,R);let eg=(null===(em=this._oneTimeListeners)||void 0===em?void 0:em[e_])?this._oneTimeListeners[e_].slice():[];for(let eh of eg)gt(e_,eh,this._oneTimeListeners),eh.call(this,R);let ev=this._eventedParent;ev&&($(R,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),ev.fire(R))}else R instanceof vt&&console.error(R.error);return this}listens(R){var eh,eu,em,e_,eg;return(null===(eu=null===(eh=this._listeners)||void 0===eh?void 0:eh[R])||void 0===eu?void 0:eu.length)>0||(null===(e_=null===(em=this._oneTimeListeners)||void 0===em?void 0:em[R])||void 0===e_?void 0:e_.length)>0||(null===(eg=this._eventedParent)||void 0===eg?void 0:eg.listens(R))}setEventedParent(R,eh){return this._eventedParent=R,this._eventedParentData=eh,this}};
vendor: 5,387 bytes, line 4
4var t_={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{}
vendor: 15,845 bytes, line 4
4,miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven
vendor: 12,722 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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}}
4;let tg=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function At(R,eh){if(Array.isArray(R)){if(!Array.isArray(eh)||R.length!==eh.length)return!1;for(let eu=0;eu<R.length;eu++)if(!At(R[eu],eh[eu]))return!1;return!0}if("object"==typeof R&&null!==R&&null!==eh){if("object"!=typeof eh||Object.keys(R).length!==Object.keys(eh).length)return!1;for(let eu in R)if(!At(R[eu],eh[eu]))return!1;return!0}return R===eh}function Mt(R,eh){R.push(eh)}function kt(R,eh,eu){Mt(eu,{command:"addSource",args:[R,eh[R]]})}function It(R,eh,eu){Mt(eh,{command:"removeSource",args:[R]}),eu[R]=!0}function Ft(R,eh,eu,em,e_,eg){for(let ev in eh=eh||{},R=R||{})Object.prototype.hasOwnProperty.call(R,ev)&&(At(R[ev],eh[ev])||eu.push({command:eg,args:[em,ev,eh[ev],e_]}));for(let ev in eh)Object.prototype.hasOwnProperty.call(eh,ev)&&!Object.prototype.hasOwnProperty.call(R,ev)&&(At(R[ev],eh[ev])||eu.push({command:eg,args:[em,ev,eh[ev],e_]}))}function Pt(R){return R.id}function Dt(R,eh){return R[eh.id]=eh,R}let zt=class zt{constructor(R,eh,eu,em){this.message=(R?`${R}: `:"")+eu,em&&(this.identifier=em),null!=eh&&eh.__line__&&(this.line=eh.__line__)}};function Bt(R,...eh){for(let eu of eh)for(let eh in eu)R[eh]=eu[eh];return R}let Ct=class Ct extends Error{constructor(R,eh){super(eh),this.message=eh,this.key=R}};let Vt=class Vt{constructor(R,eh=[]){for(let[eu,em]of(this.parent=R,this.bindings={},eh))this.bindings[eu]=em}concat(R){return new Vt(this,R)}get(R){if(this.bindings[R])return this.bindings[R];if(this.parent)return this.parent.get(R);throw Error(`${R} not found in scope.`)}has(R){return!!this.bindings[R]||!!this.parent&&this.parent.has(R)}};let tv={kind:"null"},tx={kind:"number"},tb={kind:"string"},tw={kind:"boolean"},tT={kind:"color"},tS={kind:"projectionDefinition"},tP={kind:"object"},tI={kind:"value"},tM={kind:"collator"},tE={kind:"formatted"},tC={kind:"padding"},tA={kind:"colorArray"},tz={kind:"numberArray"},tD={kind:"resolvedImage"},tk={kind:"variableAnchorOffsetCollection"};function Jt(R,eh){return{kind:"array",itemType:R,N:eh}}function Qt(R){if("array"===R.kind){let eh=Qt(R.itemType);return"number"==typeof R.N?`array<${eh}, ${R.N}>`:"value"===R.itemType.kind?"array":`array<${eh}>`}return R.kind}let tR=[tv,tx,tb,tw,tT,tS,tE,tP,Jt(tI),tC,tz,tA,tD,tk];function ee(R,eh){if("error"===eh.kind)return null;if("array"===R.kind){if("array"===eh.kind&&(0===eh.N&&"value"===eh.itemType.kind||!ee(R.itemType,eh.itemType))&&("number"!=typeof R.N||R.N===eh.N))return null}else{if(R.kind===eh.kind)return null;if("value"===R.kind){for(let R of tR)if(!ee(R,eh))return null}}return`Expected ${Qt(R)} but found ${Qt(eh)} instead.`}function ne(R,eh){return eh.some(eh=>eh.kind===R.kind)}function re(R,eh){return eh.some(eh=>"null"===eh?null===R:"array"===eh?Array.isArray(R):"object"===eh?R&&!Array.isArray(R)&&"object"==typeof R:eh===typeof R)}function ie(R,eh){return"array"===R.kind&&"array"===eh.kind?R.itemType.kind===eh.itemType.kind&&"number"==typeof R.N:R.kind===eh.kind}let tL=4/29,tF=6/29,tB=3*tF*tF,tO=tF*tF*tF,tV=Math.PI/180,tj=180/Math.PI;function fe(R){return(R%=360)<0&&(R+=360),R}function de([R,eh,eu,em]){let e_,eg;let ev=me((.2225045*(R=ye(R))+.7168786*(eh=ye(eh))+.0606169*(eu=ye(eu)))/1);R===eh&&eh===eu?e_=eg=ev:(e_=me((.4360747*R+.3850649*eh+.1430804*eu)/.96422),eg=me((.0139322*R+.0971045*eh+.7141733*eu)/.82521
4));let ex=116*ev-16;return[ex<0?0:ex,500*(e_-ev),200*(ev-eg),em]}function ye(R){return R<=.04045?R/12.92:Math.pow((R+.055)/1.055,2.4)}function me(R){return R>tO?Math.pow(R,1/3):R/tB+tL}function ge([R,eh,eu,em]){let e_=(R+16)/116,eg=isNaN(eh)?e_:e_+eh/500,ev=isNaN(eu)?e_:e_-eu/200;return e_=1*ve(e_),[xe(3.1338561*(eg=.96422*ve(eg))-1.6168667*e_-.4906146*(ev=.82521*ve(ev))),xe(-.9787684*eg+1.9161415*e_+.033454*ev),xe(.0719453*eg-.2289914*e_+1.4052427*ev),em]}function xe(R){return(R=R<=.00304?12.92*R:1.055*Math.pow(R,1/2.4)-.055)<0?0:R>1?1:R}function ve(R){return R>tF?R*R*R:tB*(R-tL)}let tN=Object.hasOwn||function(R,eh){return Object.prototype.hasOwnProperty.call(R,eh)};function we(R,eh){return tN(R,eh)?R[eh]:void 0}function _e(R){return parseInt(R.padEnd(2,R),16)/255}function Se(R,eh){return Ae(eh?R/100:R,0,1)}function Ae(R,eh,eu){return Math.min(Math.max(eh,R),eu)}function Me(R){return!R.some(Number.isNaN)}let tU={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 Ee(R,eh,eu){return R.map((R,em)=>R+eu*(eh[em]-R))}let Te=class Te{constructor(R,eh,eu,em=1,e_=!0){this.r=R,this.g=eh,this.b=eu,this.a=em,e_||(this.r*=em,this.g*=em,this.b*=em,em||this.overwriteGetter("rgb",[R,eh,eu,em]))}static parse(R){if(R instanceof Te)return R;if("string"!=typeof R)return;let eh=function(R){if("transparent"===(R=R.toLowerCase().trim()))return[0,0,0,0];let eh=we(tU,R);if(eh){let[R,eu,em]=eh;return[R/255,eu/255,em/255,1]}if(R.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(R)){let eh=R.length<6?1:2,eu=1;return[_e(R.slice(eu,eu+=eh)),_e(R.slice(eu,eu+=eh)),_e(R.slice(eu,eu+=eh)),_e(R.slice(eu,eu+eh)||"ff")]}if(R.startsWith("rgb")){let eh=R.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(eh){let[R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP]=eh,eI=[e_||" ",ex||" ",eT].join("");if(" "===eI||" /"===eI||",,"===eI||",,,"===eI){let R=[em,ev,ew].join(""),eh="%%%"===R?100:""===R?255:0;if(eh){let R=[Ae(+eu/eh,0,1),Ae(+eg/eh,0,1),Ae(+eb/eh,0,1),eS?Se(+eS,eP):1];if(Me(R))return R}}return}}let eu=R.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(eu){let[R,eh,em,e_,eg,ev,ex,eb,ew]=eu,eT=[em||" ",eg||" ",ex].join("");if(" "===eT||" /"===eT||",,"===eT||",,,"===eT){let R=[+eh,Ae(+e_,0,100),Ae(+ev,0,100),eb?Se(+eb,ew):1];if(Me(R))return function([R,eh,eu,em]){function i(em){let e_=(em+R/30)%12,eg=eh*Math.min(eu,1-eu);return eu-eg*Math.max(-1,Math.min(e_-3,9-e_,1))}return R=fe(R),eh/=100,eu/=100,[i(0),i(8),i(4),em]}(R)}}}(R);return eh?new Te(...eh,!1):void 0}get rgb(){let{r:R,g:eh,b:eu,a:em}=this,e_=em||1/0;return this.overwriteGetter("rgb",[R/e_,eh/e_,eu/e_,em])}get hcl(){return this.overwriteGetter("hcl",function(R){let[eh,eu,em,e_]=de(R),eg=Math.sqrt(eu*eu+em*em);return[Math.round(1e4*eg)?fe(Math.atan2(em,eu)*tj):NaN,eg,eh,e_]}(this.rgb))}get lab(){return this.overwriteGetter("lab",de(this.rgb))}overwriteGetter(R,eh){return Object.defineProperty(this,R,{value:eh}),eh}toString(){let[R,eh,eu,em]=this.rgb;return`rgba(${[R,eh,eu].map(R=>Math.round(255*R)).join(",")},${em})`}static interpolate(R,eh,eu,em="rgb"){switch(em){case"rgb":{let[em,e_,eg,ev]=Ee(R.rgb,eh.rgb,eu);return new Te(em,e_,eg,ev,!1)}case"hcl":{let em,e_;let[eg,ev,ex,eb]=R.hcl,[ew,eT,eS,eP]=eh.hcl;if(isNaN(eg)||isNaN(ew))isNaN(eg)?isNaN(ew)?em=NaN:(em=ew,1!==ex&&0!==ex||(e_=eT)):(em=eg,1!==eS&&0!==eS||(e_=ev));else{let R=ew-eg;ew>eg&&R>180?R-=360:ew<eg&&eg-ew>180&&(R+=360),em=eg+eu*R}let[eI,eM,eE,eC]=function([R,eh,eu,em]){return ge([eu,Math.cos(R=isNaN(R)?0:R*tV)*eh,Math.sin(R)*eh,em])}
4([em,null!=e_?e_:ev+eu*(eT-ev),ex+eu*(eS-ex),eb+eu*(eP-eb)]);return new Te(eI,eM,eE,eC,!1)}case"lab":{let[em,e_,eg,ev]=ge(Ee(R.lab,eh.lab,eu));return new Te(em,e_,eg,ev,!1)}}}};Te.black=new Te(0,0,0,1),Te.white=new Te(1,1,1,1),Te.transparent=new Te(0,0,0,0),Te.red=new Te(1,0,0,1);let Fe=class Fe{constructor(R,eh,eu){this.sensitivity=R?eh?"variant":"case":eh?"accent":"base",this.locale=eu,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(R,eh){return this.collator.compare(R,eh)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};let tG=["bottom","center","top"];let De=class De{constructor(R,eh,eu,em,e_,eg){this.text=R,this.image=eh,this.scale=eu,this.fontStack=em,this.textColor=e_,this.verticalAlign=eg}};let ze=class ze{constructor(R){this.sections=R}static fromString(R){return new ze([new De(R,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(R=>0!==R.text.length||R.image&&0!==R.image.name.length)}static factory(R){return R instanceof ze?R:ze.fromString(R)}toString(){return 0===this.sections.length?"":this.sections.map(R=>R.text).join("")}};let Be=class Be{constructor(R){this.values=R.slice()}static parse(R){if(R instanceof Be)return R;if("number"==typeof R)return new Be([R,R,R,R]);if(Array.isArray(R)&&!(R.length<1||R.length>4)){for(let eh of R)if("number"!=typeof eh)return;switch(R.length){case 1:R=[R[0],R[0],R[0],R[0]];break;case 2:R=[R[0],R[1],R[0],R[1]];break;case 3:R=[R[0],R[1],R[2],R[1]]}return new Be(R)}}toString(){return JSON.stringify(this.values)}static interpolate(R,eh,eu){return new Be(Ee(R.values,eh.values,eu))}};let Ce=class Ce{constructor(R){this.values=R.slice()}static parse(R){if(R instanceof Ce)return R;if("number"==typeof R)return new Ce([R]);if(Array.isArray(R)){for(let eh of R)if("number"!=typeof eh)return;return new Ce(R)}}toString(){return JSON.stringify(this.values)}static interpolate(R,eh,eu){return new Ce(Ee(R.values,eh.values,eu))}};let Ve=class Ve{constructor(R){this.values=R.slice()}static parse(R){if(R instanceof Ve)return R;if("string"==typeof R){let eh=Te.parse(R);if(!eh)return;return new Ve([eh])}if(!Array.isArray(R))return;let eh=[];for(let eu of R){if("string"!=typeof eu)return;let R=Te.parse(eu);if(!R)return;eh.push(R)}return new Ve(eh)}toString(){return JSON.stringify(this.values)}static interpolate(R,eh,eu,em="rgb"){let e_=[];if(R.values.length!=eh.values.length)throw Error(`colorArray: Arrays have mismatched length (${R.values.length} vs. ${eh.values.length}), cannot interpolate.`);for(let eg=0;eg<R.values.length;eg++)e_.push(Te.interpolate(R.values[eg],eh.values[eg],eu,em));return new Ve(e_)}};let Le=class Le extends Error{constructor(R){super(R),this.name="RuntimeError"}toJSON(){return this.message}};let t$=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);let $e=class $e{constructor(R){this.values=R.slice()}static parse(R){if(R instanceof $e)return R;if(Array.isArray(R)&&!(R.length<1)&&R.length%2==0){for(let eh=0;eh<R.length;eh+=2){let eu=R[eh],em=R[eh+1];if("string"!=typeof eu||!t$.has(eu)||!Array.isArray(em)||2!==em.length||"number"!=typeof em[0]||"number"!=typeof em[1])return}return new $e(R)}}toString(){return JSON.stringify(this.values)}static interpolate(R,eh,eu){let em=R.values,e_=eh.values;if(em.length!==e_.length)throw new Le(`Cannot interpolate values of different length. from: ${R.toString()}, to: ${eh.toString()}`);let eg=[];for(let R=0;R<em.length;R+=2){if(em[R]!==e_[R])throw new Le(`Cannot interpolate values containing mismatched anchors. from[${R}]: ${em[R]}, to[${R}]: ${e_[R]}`);eg.push(em[R]);let[eh,ev]=em[R+1],[ex,eb]=e_[R+1];eg.push([eh+eu*(ex-eh),ev+eu*(eb-ev)])}return new $e(eg)}};let Re=class Re{constructor(R){this.name=R.name,this.available=R.available}toString(){return this.name}static fromString(R){return R?new Re({name:R,available:!1}):null}};let Ne=class Ne{constructor(R,eh,eu){this.from=R,this.to=eh,this.transition=eu}static interpolate(R,eh,eu){return new Ne(R,eh,eu)}static parse(R){return R instanceof Ne?R:Array.isArray(R)&&3===R.length&&"string"==typeof R[0]&&"string"==typeof R[1]&&"number"==typeof R[2]?new Ne(R[0],R[1],R[2]):"object"==typeof R&&"string"==typeof R.from&&"string"==typeof R.to&&"number"==typeof R.transition?new Ne(R.from,R.to,R.transition):"string"==typeof R?new Ne(R,R,1):void 0}};function Ue(R,eh,eu,em){return"number"==typeof R&&R>=0&&R<=255&&"number"==typeof eh&&eh>=0&&eh<=255&&"number"==typeof eu&&eu>=0&&eu<=255?void 0===em||"number"==typeof em&&em>=0&&em<=1?null:`Invalid rgba value [${[R,eh,eu,em].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof em?[R,eh,eu,em]:[R,eh,eu]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function je(R){if(null===R||"string"==typeof R||"boolean"==typeof R||"number"==typeof R||R instanceof Ne||R instanceof Te||R instanceof Fe||R instanceof ze||R instanceof Be||R instanceof Ce||R instanceof Ve||R instanceof $e||R instanceof Re)return!0;
4if(Array.isArray(R)){for(let eh of R)if(!je(eh))return!1;return!0}if("object"==typeof R){for(let eh in R)if(!je(R[eh]))return!1;return!0}return!1}function qe(R){if(null===R)return tv;if("string"==typeof R)return tb;if("boolean"==typeof R)return tw;if("number"==typeof R)return tx;if(R instanceof Te)return tT;if(R instanceof Ne)return tS;if(R instanceof Fe)return tM;if(R instanceof ze)return tE;if(R instanceof Be)return tC;if(R instanceof Ce)return tz;if(R instanceof Ve)return tA;if(R instanceof $e)return tk;if(R instanceof Re)return tD;if(Array.isArray(R)){let eh;let eu=R.length;for(let eu of R){let R=qe(eu);if(eh){if(eh===R)continue;eh=tI;break}eh=R}return Jt(eh||tI,eu)}return tP}function Ge(R){let eh=typeof R;return null===R?"":"string"===eh||"number"===eh||"boolean"===eh?String(R):R instanceof Te||R instanceof Ne||R instanceof ze||R instanceof Be||R instanceof Ce||R instanceof Ve||R instanceof $e||R instanceof Re?R.toString():JSON.stringify(R)}let Xe=class Xe{constructor(R,eh){this.type=R,this.value=eh}static parse(R,eh){if(2!==R.length)return eh.error(`'literal' expression requires exactly one argument, but found ${R.length-1} instead.`);if(!je(R[1]))return eh.error("invalid value");let eu=R[1],em=qe(eu),e_=eh.expectedType;return"array"===em.kind&&0===em.N&&e_&&"array"===e_.kind&&("number"!=typeof e_.N||0===e_.N)&&(em=e_),new Xe(em,eu)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};let tZ={string:tb,number:tx,boolean:tw,object:tP};let Ze=class Ze{constructor(R,eh){this.type=R,this.args=eh}static parse(R,eh){if(R.length<2)return eh.error("Expected at least one argument.");let eu,em=1,e_=R[0];if("array"===e_){let e_,eg;if(R.length>2){let eu=R[1];if("string"!=typeof eu||!(eu in tZ)||"object"===eu)return eh.error('The item type argument of "array" must be one of string, number, boolean',1);e_=tZ[eu],em++}else e_=tI;if(R.length>3){if(null!==R[2]&&("number"!=typeof R[2]||R[2]<0||R[2]!==Math.floor(R[2])))return eh.error('The length argument to "array" must be a positive integer literal',2);eg=R[2],em++}eu=Jt(e_,eg)}else{if(!tZ[e_])throw Error(`Types doesn't contain name = ${e_}`);eu=tZ[e_]}let eg=[];for(;em<R.length;em++){let eu=eh.parse(R[em],em,tI);if(!eu)return null;eg.push(eu)}return new Ze(eu,eg)}evaluate(R){for(let eh=0;eh<this.args.length;eh++){let eu=this.args[eh].evaluate(R);if(!ee(this.type,qe(eu)))return eu;if(eh===this.args.length-1)throw new Le(`Expected value to be of type ${Qt(this.type)}, but found ${Qt(qe(eu))} instead.`)}throw Error()}eachChild(R){this.args.forEach(R)}outputDefined(){return this.args.every(R=>R.outputDefined())}};let tq={"to-boolean":tw,"to-color":tT,"to-number":tx,"to-string":tb};let We=class We{constructor(R,eh){this.type=R,this.args=eh}static parse(R,eh){if(R.length<2)return eh.error("Expected at least one argument.");let eu=R[0];if(!tq[eu])throw Error(`Can't parse ${eu} as it is not part of the known types`);if(("to-boolean"===eu||"to-string"===eu)&&2!==R.length)return eh.error("Expected one argument.");let em=tq[eu],e_=[];for(let eu=1;eu<R.length;eu++){let em=eh.parse(R[eu],eu,tI);if(!em)return null;e_.push(em)}return new We(em,e_)}evaluate(R){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(R);case"color":{let eh,eu;for(let em of this.args){if(eh=em.evaluate(R),eu=null,eh instanceof Te)return eh;if("string"==typeof eh){let eu=R.parseColor(eh);if(eu)return eu}else if(Array.isArray(eh)&&!(eu=eh.length<3||eh.length>4?`Invalid rgba value ${JSON.stringify(eh)}: expected an array containing either three or four numeric values.`:Ue(eh[0],eh[1],eh[2],eh[3])))return new Te(eh[0]/255,eh[1]/255,eh[2]/255,eh[3])}throw new Le(eu||`Could not parse color from value '${"string"==typeof eh?eh:JSON.stringify(eh)}'`)}case"padding":{let eh;for(let eu of this.args){eh=eu.evaluate(R);let em=Be.parse(eh);if(em)return em}throw new Le(`Could not parse padding from value '${"string"==typeof eh?eh:JSON.stringify(eh)}'`)}case"numberArray":{let eh;for(let eu of this.args){eh=eu.evaluate(R);let em=Ce.parse(eh);if(em)return em}throw new Le(`Could not parse numberArray from value '${"string"==typeof eh?eh:JSON.stringify(eh)}'`)}case"colorArray":{let eh;for(let eu of this.args){eh=eu.evaluate(R);let em=Ve.parse(eh);if(em)return em}throw new Le(`Could not parse colorArray from value '${"string"==typeof eh?eh:JSON.stringify(eh)}'`)}case"variableAnchorOffsetCollection":{let eh;for(let eu of this.args){eh=eu.evaluate(R);let em=$e.parse(eh);if(em)return em}throw new Le(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof eh?eh:JSON.stringify(eh)}'`)}case"number":{let eh=null;for(let eu of this.args){if(null===(eh=eu.evaluate(R)))return 0;let em=Number(eh);if(!isNaN(em))return em}throw new Le(`Could not convert ${JSON.stringify(eh)} to number.`)}case"formatted":return ze.fromString(Ge(this.args[0].evaluate(R)));case"resolvedImage":return Re.fromString(Ge(this.args[0].evaluate(R)));case"projectionDefinition":return this.args[0].evaluate(R);default:return Ge(this.args[0].evaluate(R))}}
4eachChild(R){this.args.forEach(R)}outputDefined(){return this.args.every(R=>R.outputDefined())}};let tW=["Unknown","Point","LineString","Polygon"];let Je=class Je{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?tW[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(R){let eh=this._parseColorCache.get(R);return eh||(eh=Te.parse(R),this._parseColorCache.set(R,eh)),eh}};let Qe=class Qe{constructor(R,eh,eu=[],em,e_=new Vt,eg=[]){this.registry=R,this.path=eu,this.key=eu.map(R=>`[${R}]`).join(""),this.scope=e_,this.errors=eg,this.expectedType=em,this._isConstant=eh}parse(R,eh,eu,em,e_={}){return eh?this.concat(eh,eu,em)._parse(R,e_):this._parse(R,e_)}_parse(R,eh){function n(R,eh,eu){return"assert"===eu?new Ze(eh,[R]):"coerce"===eu?new We(eh,[R]):R}if(null!==R&&"string"!=typeof R&&"boolean"!=typeof R&&"number"!=typeof R||(R=["literal",R]),Array.isArray(R)){if(0===R.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let eu=R[0];if("string"!=typeof eu)return this.error(`Expression name must be a string, but found ${typeof eu} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let em=this.registry[eu];if(em){let eu=em.parse(R,this);if(!eu)return null;if(this.expectedType){let R=this.expectedType,em=eu.type;if("string"!==R.kind&&"number"!==R.kind&&"boolean"!==R.kind&&"object"!==R.kind&&"array"!==R.kind||"value"!==em.kind){if("projectionDefinition"===R.kind&&["string","array"].includes(em.kind)||["color","formatted","resolvedImage"].includes(R.kind)&&["value","string"].includes(em.kind)||["padding","numberArray"].includes(R.kind)&&["value","number","array"].includes(em.kind)||"colorArray"===R.kind&&["value","string","array"].includes(em.kind)||"variableAnchorOffsetCollection"===R.kind&&["value","array"].includes(em.kind))eu=n(eu,R,eh.typeAnnotation||"coerce");else if(this.checkSubtype(R,em))return null}else eu=n(eu,R,eh.typeAnnotation||"assert")}if(!(eu instanceof Xe)&&"resolvedImage"!==eu.type.kind&&this._isConstant(eu)){let R=new Je;try{eu=new Xe(eu.type,eu.evaluate(R))}catch(R){return this.error(R.message),null}}return eu}return this.error(`Unknown expression "${eu}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===R?"'undefined' value invalid. Use null instead.":"object"==typeof R?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof R} instead.`)}concat(R,eh,eu){let em="number"==typeof R?this.path.concat(R):this.path,e_=eu?this.scope.concat(eu):this.scope;return new Qe(this.registry,this._isConstant,em,eh||null,e_,this.errors)}error(R,...eh){let eu=`${this.key}${eh.map(R=>`[${R}]`).join("")}`;this.errors.push(new Ct(eu,R))}checkSubtype(R,eh){let eu=ee(R,eh);return eu&&this.error(eu),eu}};let tn=class tn{constructor(R,eh){this.type=eh.type,this.bindings=[].concat(R),this.result=eh}evaluate(R){return this.result.evaluate(R)}eachChild(R){for(let eh of this.bindings)R(eh[1]);R(this.result)}static parse(R,eh){if(R.length<4)return eh.error(`Expected at least 3 arguments, but found ${R.length-1} instead.`);let eu=[];for(let em=1;em<R.length-1;em+=2){let e_=R[em];if("string"!=typeof e_)return eh.error(`Expected string, but found ${typeof e_} instead.`,em);if(/[^a-zA-Z0-9_]/.test(e_))return eh.error("Variable names must contain only alphanumeric characters or '_'.",em);let eg=eh.parse(R[em+1],em+1);if(!eg)return null;eu.push([e_,eg])}let em=eh.parse(R[R.length-1],R.length-1,eh.expectedType,eu);return em?new tn(eu,em):null}outputDefined(){return this.result.outputDefined()}};let en=class en{constructor(R,eh){this.type=eh.type,this.name=R,this.boundExpression=eh}static parse(R,eh){if(2!==R.length||"string"!=typeof R[1])return eh.error("'var' expression requires exactly one string literal argument.");let eu=R[1];return eh.scope.has(eu)?new en(eu,eh.scope.get(eu)):eh.error(`Unknown variable "${eu}". Make sure "${eu}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(R){return this.boundExpression.evaluate(R)}eachChild(){}outputDefined(){return!1}};let nn=class nn{constructor(R,eh,eu){this.type=R,this.index=eh,this.input=eu}static parse(R,eh){if(3!==R.length)return eh.error(`Expected 2 arguments, but found ${R.length-1} instead.`);let eu=eh.parse(R[1],1,tx),em=eh.parse(R[2],2,Jt(eh.expectedType||tI));return eu&&em?new nn(em.type.itemType,eu,em):null}evaluate(R){let eh=this.index.evaluate(R),eu=this.input.evaluate(R);if(eh<0)throw new Le(`Array index out of bounds: ${eh} < 0.`);if(eh>=eu.length)throw new Le(`Array index out of bounds: ${eh} > ${eu.length-1}.`);if(eh!==Math.floor(eh))throw new Le(`Array index must be an integer, but found ${eh} instead.`);return eu[eh]}eachChild(R){R(this.index),R(this.input)}outputDefined(){return!1}};let rn=class rn{constructor(R,eh){this.type=tw,this.needle=R,this.haystack=eh}static parse(R,eh){if(3!==R.length)return eh.error(`Expected 2 arguments, but found ${R.length-1} instead.`);let eu=eh.parse(R[1],1,tI),em=eh.parse(R[2],2,tI);return eu&&em?ne(eu.type,[tw,tb,tx,tv,tI])?new rn(eu,em):eh.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(eu.type)} instead`):null}evaluate(R){let eh=this.needle.evaluate(R),eu=this.haystack.evaluate(R);if(!eu)return!1;if(!re(eh,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(qe(eh))} instead.`);if(!re(eu,["string","array"]))throw new Le(`Expected second argument to be of type array or string, but found ${Qt(qe(eu))} instead.`);return eu.indexOf(eh)>=0}eachChild(R){R(this.needle),R(this.haystack)}outputDefined(){return!0}};let sn=class sn{constructor(R,eh,eu){this.type=tx,this.needle=R,this.haystack=eh,this.fromIndex=eu}static parse(R,eh){if(R.length<=2||R.length>=5)return eh.error(`Expected 2 or 3 arguments, but found ${R.length-1} instead.`);let eu=eh.parse(R[1],1,tI),em=eh.parse(R[2],2,tI);if(!eu||!em)return null;if(!ne(eu.type,[tw,tb,tx,tv,tI]))return eh.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(eu.type)} instead`);if(4===R.length){let e_=eh.parse(R[3],3,tx);return e_?new sn(eu,em,e_):null}return new sn(eu,em)}evaluate(R){let eh;let eu=this.needle.evaluate(R),em=this.haystack.evaluate(R);if(!re(eu,["boolean","string","number","null"]))throw new Le(`Expected first argument to be of type boolean, string, number or null, but found ${Qt(qe(eu))} instead.`);if(this.fromIndex&&(eh=this.fromIndex.evaluate(R)),re(em,["string"])){let R=em.indexOf(eu,eh);return -1===R?-1:[...em.slice(0,R)].length}if(re(em,["array"]))return em.indexOf(eu,eh);throw new Le(`Expected second argument to be of type array or string, but found ${Qt(qe(em))} instead.`)}eachChild(R){R(this.needle),R(this.haystack),this.fromIndex&&R(this.fromIndex)}outputDefined(){return!1}};let on=class on{constructor(R,eh,eu,em,e_,eg){this.inputType=R,this.type=eh,this.input=eu,this.cases=em,this.outputs=e_,this.otherwise=eg}static parse(R,eh){let eu,em;if(R.length<5)return eh.error(`Expected at least 4 arguments, but found only ${R.length-1}.`);if(R.length%2!=1)return eh.error("Expected an even number of arguments.");eh.expectedType&&"value"!==eh.expectedType.kind&&(em=eh.expectedType);let e_={},eg=[];for(let ev=2;ev<R.length-1;ev+=2){let ex=R[ev],eb=R[ev+1];Array.isArray(ex)||(ex=[ex]);let ew=eh.concat(ev);if(0===ex.length)return ew.error("Expected at least one branch label.");for(let R of ex){if("number"!=typeof R&&"string"!=typeof R)return ew.error("Branch labels must be numbers or strings.");if("number"==typeof R&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return ew.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof R&&Math.floor(R)!==R)return ew.error("Numeric branch labels must be integer values.");if(eu){if(ew.checkSubtype(eu,qe(R)))return null}else eu=qe(R);if(void 0!==e_[String(R)])return ew.error("Branch labels must be unique.");e_[String(R)]=eg.length}let eT=eh.parse(eb,ev,em);if(!eT)return null;em=em||eT.type,eg.push(eT)}let ev=eh.parse(R[1],1,tI);if(!ev)return null;let ex=eh.parse(R[R.length-1],R.length-1,em);return ex?"value"!==ev.type.kind&&eh.concat(1).checkSubtype(eu,ev.type)?null:new on(eu,em,ev,e_,eg,ex):null}evaluate(R){let eh=this.input.evaluate(R);return(qe(eh)===this.inputType&&this.outputs[this.cases[eh]]||this.otherwise).evaluate(R)}
4eachChild(R){R(this.input),this.outputs.forEach(R),R(this.otherwise)}outputDefined(){return this.outputs.every(R=>R.outputDefined())&&this.otherwise.outputDefined()}};let an=class an{constructor(R,eh,eu){this.type=R,this.branches=eh,this.otherwise=eu}static parse(R,eh){let eu;if(R.length<4)return eh.error(`Expected at least 3 arguments, but found only ${R.length-1}.`);if(R.length%2!=0)return eh.error("Expected an odd number of arguments.");eh.expectedType&&"value"!==eh.expectedType.kind&&(eu=eh.expectedType);let em=[];for(let e_=1;e_<R.length-1;e_+=2){let eg=eh.parse(R[e_],e_,tw);if(!eg)return null;let ev=eh.parse(R[e_+1],e_+1,eu);if(!ev)return null;em.push([eg,ev]),eu=eu||ev.type}let e_=eh.parse(R[R.length-1],R.length-1,eu);if(!e_)return null;if(!eu)throw Error("Can't infer output type");return new an(eu,em,e_)}evaluate(R){for(let[eh,eu]of this.branches)if(eh.evaluate(R))return eu.evaluate(R);return this.otherwise.evaluate(R)}eachChild(R){for(let[eh,eu]of this.branches)R(eh),R(eu);R(this.otherwise)}outputDefined(){return this.branches.every(([R,eh])=>eh.outputDefined())&&this.otherwise.outputDefined()}};let ln=class ln{constructor(R,eh,eu,em){this.type=R,this.input=eh,this.beginIndex=eu,this.endIndex=em}static parse(R,eh){if(R.length<=2||R.length>=5)return eh.error(`Expected 2 or 3 arguments, but found ${R.length-1} instead.`);let eu=eh.parse(R[1],1,tI),em=eh.parse(R[2],2,tx);if(!eu||!em)return null;if(!ne(eu.type,[Jt(tI),tb,tI]))return eh.error(`Expected first argument to be of type array or string, but found ${Qt(eu.type)} instead`);if(4===R.length){let e_=eh.parse(R[3],3,tx);return e_?new ln(eu.type,eu,em,e_):null}return new ln(eu.type,eu,em)}evaluate(R){let eh;let eu=this.input.evaluate(R),em=this.beginIndex.evaluate(R);if(this.endIndex&&(eh=this.endIndex.evaluate(R)),re(eu,["string"]))return[...eu].slice(em,eh).join("");if(re(eu,["array"]))return eu.slice(em,eh);throw new Le(`Expected first argument to be of type array or string, but found ${Qt(qe(eu))} instead.`)}eachChild(R){R(this.input),R(this.beginIndex),this.endIndex&&R(this.endIndex)}outputDefined(){return!1}};function un(R,eh){let eu=R.length-1,em,e_,eg=0,ev=eu,ex=0;for(;eg<=ev;)if(em=R[ex=Math.floor((eg+ev)/2)],e_=R[ex+1],em<=eh){if(ex===eu||eh<e_)return ex;eg=ex+1}else{if(!(em>eh))throw new Le("Input is not a number.");ev=ex-1}return 0}let cn=class cn{constructor(R,eh,eu){for(let[em,e_]of(this.type=R,this.input=eh,this.labels=[],this.outputs=[],eu))this.labels.push(em),this.outputs.push(e_)}static parse(R,eh){if(R.length-1<4)return eh.error(`Expected at least 4 arguments, but found only ${R.length-1}.`);if((R.length-1)%2!=0)return eh.error("Expected an even number of arguments.");let eu=eh.parse(R[1],1,tx);if(!eu)return null;let em=[],e_=null;eh.expectedType&&"value"!==eh.expectedType.kind&&(e_=eh.expectedType);for(let eu=1;eu<R.length;eu+=2){let eg=1===eu?-1/0:R[eu],ev=R[eu+1],ex=eu,eb=eu+1;if("number"!=typeof eg)return eh.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',ex);if(em.length&&em[em.length-1][0]>=eg)return eh.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',ex);let ew=eh.parse(ev,eb,e_);if(!ew)return null;e_=e_||ew.type,em.push([eg,ew])}return new cn(e_,eu,em)}evaluate(R){let eh=this.labels,eu=this.outputs;if(1===eh.length)return eu[0].evaluate(R);let em=this.input.evaluate(R);if(em<=eh[0])return eu[0].evaluate(R);let e_=eh.length;return em>=eh[e_-1]?eu[e_-1].evaluate(R):eu[un(eh,em)].evaluate(R)}eachChild(R){for(let eh of(R(this.input),this.outputs))R(eh)}outputDefined(){return this.outputs.every(R=>R.outputDefined())}};var tX,tH,tY,tJ,tK,tQ,t0=(tJ=function(){if(tQ)return tK;function t(R,eh,eu,em){this.cx=3*R,this.bx=3*(eu-R)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*eh,this.by=3*(em-eh)-this.cy,this.ay=1-this.cy-this.by,this.p1x=R,this.p1y=eh,this.p2x=eu,this.p2y=em}return tQ=1,tK=t,t.prototype={sampleCurveX:function(R){return((this.ax*R+this.bx)*R+this.cx)*R},sampleCurveY:function(R){return((this.ay*R+this.by)*R+this.cy)*R},sampleCurveDerivativeX:function(R){return(3*this.ax*R+2*this.bx)*R+this.cx},solveCurveX:function(R,eh){if(void 0===eh&&(eh=1e-6),R<0)return 0;if(R>1)return 1;for(var eu=R,em=0;em<8;em++){var e_=this.sampleCurveX(eu)-R;
4if(Math.abs(e_)<eh)return eu;var eg=this.sampleCurveDerivativeX(eu);if(1e-6>Math.abs(eg))break;eu-=e_/eg}var ev=0,ex=1;for(eu=R,em=0;em<20&&!(Math.abs((e_=this.sampleCurveX(eu))-R)<eh);em++)R>e_?ev=eu:ex=eu,eu=.5*(ex-ev)+ev;return eu},solve:function(R,eh){return this.sampleCurveY(this.solveCurveX(R,eh))}},tK}())&&tJ.__esModule&&Object.prototype.hasOwnProperty.call(tJ,"default")?tJ.default:tJ;let mn=class mn{constructor(R,eh,eu,em,e_){for(let[eg,ev]of(this.type=R,this.operator=eh,this.interpolation=eu,this.input=em,this.labels=[],this.outputs=[],e_))this.labels.push(eg),this.outputs.push(ev)}static interpolationFactor(R,eh,eu,em){let e_=0;if("exponential"===R.name)e_=gn(eh,R.base,eu,em);else if("linear"===R.name)e_=gn(eh,1,eu,em);else if("cubic-bezier"===R.name){let eg=R.controlPoints;e_=new t0(eg[0],eg[1],eg[2],eg[3]).solve(gn(eh,1,eu,em))}return e_}static parse(R,eh){let[eu,em,e_,...eg]=R;if(!Array.isArray(em)||0===em.length)return eh.error("Expected an interpolation type expression.",1);if("linear"===em[0])em={name:"linear"};else if("exponential"===em[0]){let R=em[1];if("number"!=typeof R)return eh.error("Exponential interpolation requires a numeric base.",1,1);em={name:"exponential",base:R}}else{if("cubic-bezier"!==em[0])return eh.error(`Unknown interpolation type ${String(em[0])}`,1,0);{let R=em.slice(1);if(4!==R.length||R.some(R=>"number"!=typeof R||R<0||R>1))return eh.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);em={name:"cubic-bezier",controlPoints:R}}}if(R.length-1<4)return eh.error(`Expected at least 4 arguments, but found only ${R.length-1}.`);if((R.length-1)%2!=0)return eh.error("Expected an even number of arguments.");if(!(e_=eh.parse(e_,2,tx)))return null;let ev=[],ex=null;"interpolate-hcl"!==eu&&"interpolate-lab"!==eu||eh.expectedType==tA?eh.expectedType&&"value"!==eh.expectedType.kind&&(ex=eh.expectedType):ex=tT;for(let R=0;R<eg.length;R+=2){let eu=eg[R],em=eg[R+1],e_=R+3,eb=R+4;if("number"!=typeof eu)return eh.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',e_);if(ev.length&&ev[ev.length-1][0]>=eu)return eh.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',e_);let ew=eh.parse(em,eb,ex);if(!ew)return null;ex=ex||ew.type,ev.push([eu,ew])}return ie(ex,tx)||ie(ex,tS)||ie(ex,tT)||ie(ex,tC)||ie(ex,tz)||ie(ex,tA)||ie(ex,tk)||ie(ex,Jt(tx))?new mn(ex,eu,em,e_,ev):eh.error(`Type ${Qt(ex)} is not interpolatable.`)}evaluate(R){let eh=this.labels,eu=this.outputs;if(1===eh.length)return eu[0].evaluate(R);let em=this.input.evaluate(R);if(em<=eh[0])return eu[0].evaluate(R);let e_=eh.length;if(em>=eh[e_-1])return eu[e_-1].evaluate(R);let eg=un(eh,em),ev=mn.interpolationFactor(this.interpolation,em,eh[eg],eh[eg+1]),ex=eu[eg].evaluate(R),eb=eu[eg+1].evaluate(R);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ex+ev*(eb-ex);case"color":return Te.interpolate(ex,eb,ev);case"padding":return Be.interpolate(ex,eb,ev);case"colorArray":return Ve.interpolate(ex,eb,ev);case"numberArray":return Ce.interpolate(ex,eb,ev);case"variableAnchorOffsetCollection":return $e.interpolate(ex,eb,ev);case"array":return Ee(ex,eb,ev);case"projectionDefinition":return Ne.interpolate(ex,eb,ev)}case"interpolate-hcl":switch(this.type.kind){case"color":return Te.interpolate(ex,eb,ev,"hcl");case"colorArray":return Ve.interpolate(ex,eb,ev,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Te.interpolate(ex,eb,ev,"lab");case"colorArray":return Ve.interpolate(ex,eb,ev,"lab")}}}eachChild(R){for(let eh of(R(this.input),this.outputs))R(eh)}outputDefined(){return this.outputs.every(R=>R.outputDefined())}};function gn(R,eh,eu,em){let e_=em-eu,eg=R-eu;return 0===e_?0:1===eh?eg/e_:(Math.pow(eh,eg)-1)/(Math.pow(eh,e_)-1)}let t1={color:Te.interpolate,number:function(R,eh,eu){return R+eu*(eh-R)},padding:Be.interpolate,numberArray:Ce.interpolate,colorArray:Ve.interpolate,variableAnchorOffsetCollection:$e.interpolate,array:Ee};let vn=class vn{constructor(R,eh){this.type=R,this.args=eh}static parse(R,eh){if(R.length<2)return eh.error("Expected at least one argument.");let eu=null,em=eh.expectedType;em&&"value"!==em.kind&&(eu=em);let e_=[];for(let em of R.slice(1)){let R=eh.parse(em,1+e_.length,eu,void 0,{typeAnnotation:"omit"});if(!R)return null;eu=eu||R.type,e_.push(R)}if(!eu)throw Error("No output type");let eg=em&&e_.some(R=>ee(em,R.type));return new vn(eg?tI:eu,e_)}evaluate(R){let eh,eu=null,em=0;for(let e_ of this.args)if(em++,(eu=e_.evaluate(R))&&eu instanceof Re&&!eu.available&&(eh||(eh=eu.name),eu=null,em===this.args.length&&(eu=eh)),null!==eu)break;return eu}
4eachChild(R){this.args.forEach(R)}outputDefined(){return this.args.every(R=>R.outputDefined())}};function bn(R,eh){return"=="===R||"!="===R?"boolean"===eh.kind||"string"===eh.kind||"number"===eh.kind||"null"===eh.kind||"value"===eh.kind:"string"===eh.kind||"number"===eh.kind||"value"===eh.kind}function wn(R,eh,eu,em){return 0===em.compare(eh,eu)}function _n(R,eh,eu){let em="=="!==R&&"!="!==R;return class i{constructor(R,eh,eu){this.type=tw,this.lhs=R,this.rhs=eh,this.collator=eu,this.hasUntypedArgument="value"===R.type.kind||"value"===eh.type.kind}static parse(R,eh){if(3!==R.length&&4!==R.length)return eh.error("Expected two or three arguments.");let eu=R[0],e_=eh.parse(R[1],1,tI);if(!e_)return null;if(!bn(eu,e_.type))return eh.concat(1).error(`"${eu}" comparisons are not supported for type '${Qt(e_.type)}'.`);let eg=eh.parse(R[2],2,tI);if(!eg)return null;if(!bn(eu,eg.type))return eh.concat(2).error(`"${eu}" comparisons are not supported for type '${Qt(eg.type)}'.`);if(e_.type.kind!==eg.type.kind&&"value"!==e_.type.kind&&"value"!==eg.type.kind)return eh.error(`Cannot compare types '${Qt(e_.type)}' and '${Qt(eg.type)}'.`);em&&("value"===e_.type.kind&&"value"!==eg.type.kind?e_=new Ze(eg.type,[e_]):"value"!==e_.type.kind&&"value"===eg.type.kind&&(eg=new Ze(e_.type,[eg])));let ev=null;if(4===R.length){if("string"!==e_.type.kind&&"string"!==eg.type.kind&&"value"!==e_.type.kind&&"value"!==eg.type.kind)return eh.error("Cannot use collator to compare non-string types.");if(!(ev=eh.parse(R[3],3,tM)))return null}return new i(e_,eg,ev)}evaluate(e_){let eg=this.lhs.evaluate(e_),ev=this.rhs.evaluate(e_);if(em&&this.hasUntypedArgument){let eh=qe(eg),eu=qe(ev);if(eh.kind!==eu.kind||"string"!==eh.kind&&"number"!==eh.kind)throw new Le(`Expected arguments for "${R}" to be (string, string) or (number, number), but found (${eh.kind}, ${eu.kind}) instead.`)}if(this.collator&&!em&&this.hasUntypedArgument){let R=qe(eg),eu=qe(ev);if("string"!==R.kind||"string"!==eu.kind)return eh(e_,eg,ev)}return this.collator?eu(e_,eg,ev,this.collator.evaluate(e_)):eh(e_,eg,ev)}eachChild(R){R(this.lhs),R(this.rhs),this.collator&&R(this.collator)}outputDefined(){return!0}}}let t2=_n("==",function(R,eh,eu){return eh===eu},wn),t3=_n("!=",function(R,eh,eu){return eh!==eu},function(R,eh,eu,em){return!wn(0,eh,eu,em)}),t5=_n("<",function(R,eh,eu){return eh<eu},function(R,eh,eu,em){return 0>em.compare(eh,eu)}),t4=_n(">",function(R,eh,eu){return eh>eu},function(R,eh,eu,em){return em.compare(eh,eu)>0}),t6=_n("<=",function(R,eh,eu){return eh<=eu},function(R,eh,eu,em){return 0>=em.compare(eh,eu)}),t8=_n(">=",function(R,eh,eu){return eh>=eu},function(R,eh,eu,em){return em.compare(eh,eu)>=0});let Tn=class Tn{constructor(R,eh,eu){this.type=tM,this.locale=eu,this.caseSensitive=R,this.diacriticSensitive=eh}static parse(R,eh){if(2!==R.length)return eh.error("Expected one argument.");let eu=R[1];if("object"!=typeof eu||Array.isArray(eu))return eh.error("Collator options argument must be an object.");let em=eh.parse(void 0!==eu["case-sensitive"]&&eu["case-sensitive"],1,tw);if(!em)return null;let e_=eh.parse(void 0!==eu["diacritic-sensitive"]&&eu["diacritic-sensitive"],1,tw);if(!e_)return null;let eg=null;return!eu.locale||(eg=eh.parse(eu.locale,1,tb))?new Tn(em,e_,eg):null}evaluate(R){return new Fe(this.caseSensitive.evaluate(R),this.diacriticSensitive.evaluate(R),this.locale?this.locale.evaluate(R):null)}eachChild(R){R(this.caseSensitive),R(this.diacriticSensitive),this.locale&&R(this.locale)}outputDefined(){return!1}};let Fn=class Fn{constructor(R,eh,eu,em,e_,eg){this.type=tb,this.number=R,this.locale=eh,this.currency=eu,this.unit=em,this.minFractionDigits=e_,this.maxFractionDigits=eg}static parse(R,eh){if(3!==R.length)return eh.error("Expected two arguments.");let eu=eh.parse(R[1],1,tx);if(!eu)return null;let em=R[2];if("object"!=typeof em||Array.isArray(em))return eh.error("NumberFormat options argument must be an object.");let e_=null;if(em.locale&&!(e_=eh.parse(em.locale,1,tb)))return null;let eg=null;if(em.currency&&!(eg=eh.parse(em.currency,1,tb)))return null;let ev=null;if(em.unit&&!(ev=eh.parse(em.unit,1,tb)))return null;if(eg&&ev)return eh.error("NumberFormat options `currency` and `unit` are mutually exclusive");let ex=null;if(em["min-fraction-digits"]&&!(ex=eh.parse(em["min-fraction-digits"],1,tx)))return null;let eb=null;return!em["max-fraction-digits"]||(eb=eh.parse(em["max-fraction-digits"],1,tx))?new Fn(eu,e_,eg,ev,ex,eb):null}evaluate(R){return new Intl.NumberFormat(this.locale?this.locale.evaluate(R):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(R):void 0,unit:this.unit?this.unit.evaluate(R):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(R):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(R):void 0}).format(this.number.evaluate(R))}eachChild(R){R(this.number),this.locale&&R(this.locale),this.currency&&R(this.currency),this.unit&&R(this.unit),this.minFractionDigits&&R(this.minFractionDigits),this.maxFractionDigits&&R(this.maxFractionDigits)}outputDefined(){return!1}};let Pn=class Pn{constructor(R){this.type=tE,this.sections=R}static parse(R,eh){if(R.length<2)return eh.error("Expected at least one argument.");let eu=R[1];if(!Array.isArray(eu)&&"object"==typeof eu)return eh.error("First argument must be an image or text section.");let em=[],e_=!1;for(let eu=1;eu<=R.length-1;++eu){let eg=R[eu];if(e_&&"object"==typeof eg&&!Array.isArray(eg)){e_=!1;let R=null;if(eg["font-scale"]&&!(R=eh.parse(eg["font-scale"],1,tx)))return null;let eu=null;if(eg["text-font"]&&!(eu=eh.parse(eg["text-font"],1,Jt(tb))))return null;let ev=null;if(eg["text-color"]&&!(ev=eh.parse(eg["text-color"],1,tT)))return null;let ex=null;if(eg["vertical-align"]){if("string"==typeof eg["vertical-align"]&&!tG.includes(eg["vertical-align"]))return eh.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${eg["vertical-align"]}' instead.`);if(!(ex=eh.parse(eg["vertical-align"],1,tb)))return null}let eb=em[em.length-1];eb.scale=R,eb.font=eu,eb.textColor=ev,eb.verticalAlign=ex}else{let eg=eh.parse(R[eu],1,tI);if(!eg)return null;let ev=eg.type.kind;if("string"!==ev&&"value"!==ev&&"null"!==ev&&"resolvedImage"!==ev)return eh.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");e_=!0,em.push({content:eg,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Pn(em)}evaluate(R){return new ze(this.sections.map(eh=>{let eu=eh.content.evaluate(R);return qe(eu)===tD?new De("",eu,null,null,null,eh.verticalAlign?eh.verticalAlign.evaluate(R):null):new De(Ge(eu),null,eh.scale?eh.scale.evaluate(R):null,eh.font?eh.font.evaluate(R).join(","):null,eh.textColor?eh.textColor.evaluate(R):null,eh.verticalAlign?eh.verticalAlign.evaluate(R):null)}))}eachChild(R){for(let eh of this.sections)R(eh.content),eh.scale&&R(eh.scale),eh.font&&R(eh.font),eh.textColor&&R(eh.textColor),eh.verticalAlign&&R(eh.verticalAlign)}outputDefined(){return!1}};let Dn=class Dn{constructor(R){this.type=tD,this.input=R}static parse(R,eh){if(2!==R.length)return eh.error("Expected two arguments.");let eu=eh.parse(R[1],1,tb);return eu?new Dn(eu):eh.error("No image name provided.")}evaluate(R){let eh=this.input.evaluate(R),eu=Re.fromString(eh);return eu&&R.availableImages&&(eu.available=R.availableImages.indexOf(eh)>-1),eu}eachChild(R){R(this.input)}outputDefined(){return!1}};let zn=class zn{constructor(R){this.type=tx,this.input=R}static parse(R,eh){if(2!==R.length)return eh.error(`Expected 1 argument, but found ${R.length-1} instead.`);let eu=eh.parse(R[1],1);return eu?"array"!==eu.type.kind&&"string"!==eu.type.kind&&"value"!==eu.type.kind?eh.error(`Expected argument of type string or array, but found ${Qt(eu.type)} instead.`):new zn(eu):null}evaluate(R){let eh=this.input.evaluate(R);if("string"==typeof eh)return[...eh].length;if(Array.isArray(eh))return eh.length;throw new Le(`Expected value to be of type string or array, but found ${Qt(qe(eh))} instead.`)}eachChild(R){R(this.input)}outputDefined(){return!1}};function Vn(R,eh){let eu=Math.pow(2,eh.z);return[360*((R[0]/8192+eh.x)/eu)-180,360/Math.PI*Math.atan(Math.exp((180-360*((R[1]/8192+eh.y)/eu))*Math.PI/180)
4)-90]}function Ln(R,eh){R[0]=Math.min(R[0],eh[0]),R[1]=Math.min(R[1],eh[1]),R[2]=Math.max(R[2],eh[0]),R[3]=Math.max(R[3],eh[1])}function On(R,eh){return!(R[0]<=eh[0]||R[2]>=eh[2]||R[1]<=eh[1]||R[3]>=eh[3])}function Rn(R,eh,eu,em){var e_,eg;return 0!=(e_=[em[0]-eu[0],em[1]-eu[1]])[0]*(eg=[eh[0]-R[0],eh[1]-R[1]])[1]-e_[1]*eg[0]&&!(!Xn(R,eh,eu,em)||!Xn(eu,em,R,eh))}function Un(R,eh,eu=!1){var em,e_;let eg=!1;for(let ev of eh)for(let eh=0;eh<ev.length-1;eh++){if(function(R,eh,eu){let em=R[0]-eh[0],e_=R[1]-eh[1],eg=R[0]-eu[0],ev=R[1]-eu[1];return em*ev-eg*e_==0&&em*eg<=0&&e_*ev<=0}(R,ev[eh],ev[eh+1]))return eu;(em=ev[eh])[1]>R[1]!=(e_=ev[eh+1])[1]>R[1]&&R[0]<(e_[0]-em[0])*(R[1]-em[1])/(e_[1]-em[1])+em[0]&&(eg=!eg)}return eg}function qn(R,eh){for(let eu of R)if(!Un(eu,eh))return!1;for(let eu=0;eu<R.length-1;++eu)if(function(R,eh,eu){for(let em of eu)for(let eu=0;eu<em.length-1;++eu)if(Rn(R,eh,em[eu],em[eu+1]))return!0;return!1}(R[eu],R[eu+1],eh))return!1;return!0}function Xn(R,eh,eu,em){let e_=em[0]-eu[0],eg=em[1]-eu[1],ev=(R[0]-eu[0])*eg-e_*(R[1]-eu[1]),ex=(eh[0]-eu[0])*eg-e_*(eh[1]-eu[1]);return ev>0&&ex<0||ev<0&&ex>0}function Yn(R,eh,eu){let em=[];for(let e_=0;e_<R.length;e_++){let eg=[];for(let em=0;em<R[e_].length;em++){let ev=function(R,eh){let eu=(180+R[0])/360,em=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+R[1]*Math.PI/360)))/360,e_=Math.pow(2,eh.z);return[Math.round(eu*e_*8192),Math.round(em*e_*8192)]}(R[e_][em],eu);Ln(eh,ev),eg.push(ev)}em.push(eg)}return em}function Zn(R,eh,eu){let em=[];for(let e_=0;e_<R.length;e_++){let eg=Yn(R[e_],eh,eu);em.push(eg)}return em}function Hn(R,eh,eu,em){if(R[0]<eu[0]||R[0]>eu[2]){let eh=.5*em,e_=R[0]-eu[0]>eh?-em:eu[0]-R[0]>eh?em:0;0===e_&&(e_=R[0]-eu[2]>eh?-em:eu[2]-R[0]>eh?em:0),R[0]+=e_}Ln(eh,R)}function Wn(R,eh,eu,em){let e_=8192*Math.pow(2,em.z),eg=[8192*em.x,8192*em.y],ev=[];for(let em of R)for(let R of em){let em=[R.x+eg[0],R.y+eg[1]];Hn(em,eh,eu,e_),ev.push(em)}return ev}function Kn(R,eh,eu,em){let e_=8192*Math.pow(2,em.z),eg=[8192*em.x,8192*em.y],ev=[];for(let eu of R){let R=[];for(let em of eu){let eu=[em.x+eg[0],em.y+eg[1]];Ln(eh,eu),R.push(eu)}ev.push(R)}if(eh[2]-eh[0]<=e_/2)for(let R of(eh[0]=eh[1]=1/0,eh[2]=eh[3]=-1/0,ev))for(let em of R)Hn(em,eh,eu,e_);return ev}let Jn=class Jn{constructor(R,eh){this.type=tw,this.geojson=R,this.geometries=eh}static parse(R,eh){if(2!==R.length)return eh.error(`'within' expression requires exactly one argument, but found ${R.length-1} instead.`);if(je(R[1])){let eh=R[1];if("FeatureCollection"===eh.type){let R=[];for(let eu of eh.features){let{type:eh,coordinates:em}=eu.geometry;"Polygon"===eh&&R.push(em),"MultiPolygon"===eh&&R.push(...em)}if(R.length)return new Jn(eh,{type:"MultiPolygon",coordinates:R})}else if("Feature"===eh.type){let R=eh.geometry.type;if("Polygon"===R||"MultiPolygon"===R)return new Jn(eh,eh.geometry)}else if("Polygon"===eh.type||"MultiPolygon"===eh.type)return new Jn(eh,eh)}return eh.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(R){if(null!=R.geometry()&&null!=R.canonicalID()){if("Point"===R.geometryType())return function(R,eh){let eu=[1/0,1/0,-1/0,-1/0],em=[1/0,1/0,-1/0,-1/0],e_=R.canonicalID();if("Polygon"===eh.type){let eg=Yn(eh.coordinates,em,e_),ev=Wn(R.geometry(),eu,em,e_);if(!On(eu,em))return!1;for(let R of ev)if(!Un(R,eg))return!1}if("MultiPolygon"===eh.type){let eg=Zn(eh.coordinates,em,e_),ev=Wn(R.geometry(),eu,em,e_);if(!On(eu,em))return!1;for(let R of ev)if(!function(R,eh){for(let eu of eh)if(Un(R,eu))return!0;return!1}(R,eg))return!1}return!0}(R,this.geometries);if("LineString"===R.geometryType())return function(R,eh){let eu=[1/0,1/0,-1/0,-1/0],em=[1/0,1/0,-1/0,-1/0],e_=R.canonicalID();if("Polygon"===eh.type){let eg=Yn(eh.coordinates,em,e_),ev=Kn(R.geometry(),eu,em,e_);if(!On(eu,em))return!1;for(let R of ev)if(!qn(R,eg))return!1}if("MultiPolygon"===eh.type){let eg=Zn(eh.coordinates,em,e_),ev=Kn(R.geometry(),eu,em,e_);if(!On(eu,em))return!1;for(let R of ev)if(!function(R,eh){for(let eu of eh)if(qn(R,eu))return!0;return!1}(R,eg))return!1}return!0}(R,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}};let t7=class{constructor(R=[],eh=(R,eh)=>R<eh?-1:R>eh?1:0){if(this.data=R,this.length=this.data.length,this.compare=eh,this.length>0)for(let R=(this.length>>1)-1;R>=0;R--)this._down(R)}push(R){this.data.push(R),this._up(this.length++)}pop(){if(0===this.length)return;let R=this.data[0],eh=this.data.pop();return--this.length>0&&(this.data[0]=eh,this._down(0)),R}peek(){return this.data[0]}_up(R){let{data:eh,compare:eu}=this,em=eh[R];for(;R>0;){let e_=R-1>>1,eg=eh[e_];if(eu(em,eg)>=0)break;eh[R]=eg,R=e_}eh[R]=em}_down(R){let{data:eh,compare:eu}=this,em=this.length>>1,e_=eh[R];for(;R<em;){let em=1+(R<<1),eg=em+1;if(eg<this.length&&0>eu(eh[eg],eh[em])&&(em=eg),eu(eh[em],e_)>=0)break;eh[R]=eh[em],R=em}eh[R]=e_}};function er(R,eh,eu){let em=R[eh];R[eh]=R[eu],R[eu]=em}function rr(R,eh){let eu,em;if(R.length<=1)return[R];let e_=[];for(let eh of R){let R=function(R){let eh=0;for(let eu,em,e_=0,eg=R.length,ev=eg-1;e_<eg;ev=e_++)eu=R[e_],eh+=((em=R[ev]).x-eu.x)*(eu.y+em.y);return eh}(eh);0!==R&&(eh.area=Math.abs(R),void 0===em&&(em=R<0),em===R<0?(eu&&e_.push(eu),eu=[eh]):eu.push(eh))}if(eu&&e_.push(eu),eh>1)for(let R=0;R<e_.length;R++)e_[R].length<=eh||(function tr(R,eh,eu=0,em=R.length-1,e_=function(R,eh){return R<eh?-1:R>eh?1:0}){for(;em>eu;){if(em-eu>600){let eg=em-eu+1,ev=eh-eu+1,ex=Math.log(eg),eb=.5*Math.exp(2*ex/3),ew=.5*Math.sqrt(ex*eb*(eg-eb)/eg)*(ev-eg/2<0?-1:1);tr(R,eh,Math.max(eu,Math.floor(eh-ev*eb/eg+ew)),Math.min(em,Math.floor(eh+(eg-ev)*eb/eg+ew)),e_)}let eg=R[eh],ev=eu,ex=em;for(er(R,eu,eh),e_(R[em],eg)>0&&er(R,eu,em);ev<ex;){for(er(R,ev,ex),ev++,ex--;0>e_(R[ev],eg);)ev++;for(;e_(R[ex],eg)>0;)ex--}0===e_(R[eu],eg)?er(R,eu,ex):er(R,++ex,em),ex<=eh&&(eu=ex+1),eh<=ex&&(em=ex-1)}}(e_[R],eh,1,e_[R].length-1,ir),e_[R]=e_[R].slice(0,eh));return e_}function ir(R,eh){return eh.area-R.area}let t9=1/298.257223563,it=t9*(2-t9),ip=Math.PI/180;let ur=class ur{constructor(R){let eh=6378.137*ip*1e3,eu=Math.cos(R*ip),em=1/(1-it*(1-eu*eu)),e_=Math.sqrt(em);this.kx=eh*e_*eu,this.ky=eh*e_*em*(1-it)}distance(R,eh){let eu=this.wrap(R[0]-eh[0])*this.kx,em=(R[1]-eh[1])*this.ky;return Math.sqrt(eu*eu+em*em)}pointOnLine(R,eh){let eu,em,e_,eg,ev=1/0;for(let ex=0;ex<R.length-1;ex++){let eb=R[ex][0],ew=R[ex][1],eT=this.wrap(R[ex+1][0]-eb)*this.kx,eS=(R[ex+1][1]-ew)*this.ky,eP=0;0===eT&&0===eS||((eP=(this.wrap(eh[0]-eb)*this.kx*eT+(eh[1]-ew)*this.ky*eS)/(eT*eT+eS*eS))>1?(eb=R[ex+1][0],ew=R[ex+1][1]):eP>0&&(eb+=eT/this.kx*eP,ew+=eS/this.ky*eP)),eT=this.wrap(eh[0]-eb)*this.kx,eS=(eh[1]-ew)*this.ky;let eI=eT*eT+eS*eS;eI<ev&&(ev=eI,eu=eb,em=ew,e_=ex,eg=eP)}return{point:[eu,em],index:e_,t:Math.max(0,Math.min(1,eg))}}wrap(R){for(;R<-180;)R+=360;for(;R>180;)R-=360;return R}};function cr(R,eh){return eh[0]-R[0]}function hr(R){return R[1]-R[0]+1}function pr(R,eh){return R[1]>=R[0]&&R[1]<eh}function fr(R,eh){if(R[0]>
vendor: 6,752 bytes, line 4
4R[1])return[null,null];let eu=hr(R);if(eh){if(2===eu)return[R,null];let eh=Math.floor(eu/2);return[[R[0],R[0]+eh],[R[0]+eh,R[1]]]}if(1===eu)return[R,null];let em=Math.floor(eu/2)-1;return[[R[0],R[0]+em],[R[0]+em+1,R[1]]]}function dr(R,eh){if(!pr(eh,R.length))return[1/0,1/0,-1/0,-1/0];let eu=[1/0,1/0,-1/0,-1/0];for(let em=eh[0];em<=eh[1];++em)Ln(eu,R[em]);return eu}function yr(R){let eh=[1/0,1/0,-1/0,-1/0];for(let eu of R)for(let R of eu)Ln(eh,R);return eh}function mr(R){return R[0]!==-1/0&&R[1]!==-1/0&&R[2]!==1/0&&R[3]!==1/0}function gr(R,eh,eu){if(!mr(R)||!mr(eh))return NaN;let em=0,e_=0;return R[2]<eh[0]&&(em=eh[0]-R[2]),R[0]>eh[2]&&(em=R[0]-eh[2]),R[1]>eh[3]&&(e_=R[1]-eh[3]),R[3]<eh[1]&&(e_=eh[1]-R[3]),eu.distance([0,0],[em,e_])}function xr(R,eh,eu){let em=eu.pointOnLine(eh,R);return eu.distance(R,em.point)}function vr(R,eh,eu,em,e_){let eg=Math.min(xr(R,[eu,em],e_),xr(eh,[eu,em],e_)),ev=Math.min(xr(eu,[R,eh],e_),xr(em,[R,eh],e_));return Math.min(eg,ev)}function Ar(R,eh){for(let eu of R)for(let R of eu)if(Un(R,eh,!0))return!0;return!1}function kr(R,eh,eu,em,e_,eg){if(!eg)return;let ev=gr(dr(em,eg),e_,eu);ev<eh&&R.push([ev,eg,[0,0]])}function Ir(R,eh,eu,em,e_,eg,ev){if(!eg||!ev)return;let ex=gr(dr(em,eg),dr(e_,ev),eu);ex<eh&&R.push([ex,eg,ev])}function Er(R,eh,eu,em,e_=1/0){let eg=Math.min(em.distance(R[0],eu[0][0]),e_);if(0===eg)return eg;let ev=new t7([[0,[0,R.length-1],[0,0]]],cr),ex=yr(eu);for(;ev.length>0;){let e_=ev.pop();if(e_[0]>=eg)continue;let eb=e_[1],ew=eh?50:100;if(hr(eb)<=ew){if(!pr(eb,R.length))return NaN;if(eh){let eh=function(R,eh,eu,em){if(!pr(eh,R.length))return NaN;for(let em=eh[0];em<=eh[1];++em)if(Un(R[em],eu,!0))return 0;let e_=1/0;for(let eg=eh[0];eg<eh[1];++eg){let eh=R[eg],ev=R[eg+1];for(let R of eu)for(let eu=0,eg=R.length,ex=eg-1;eu<eg;ex=eu++){let eg=R[ex],eb=R[eu];if(Rn(eh,ev,eg,eb))return 0;e_=Math.min(e_,vr(eh,ev,eg,eb,em))}}return e_}(R,eb,eu,em);if(isNaN(eh)||0===eh)return eh;eg=Math.min(eg,eh)}else for(let eh=eb[0];eh<=eb[1];++eh){let e_=function(R,eh,eu){if(Un(R,eh,!0))return 0;let em=1/0;for(let e_ of eh){let eh=e_[0],eg=e_[e_.length-1];if(eh!==eg&&0===(em=Math.min(em,xr(R,[eg,eh],eu))))break;let ev=eu.pointOnLine(e_,R);if(0===(em=Math.min(em,eu.distance(R,ev.point))))break}return em}(R[eh],eu,em);if(0===(eg=Math.min(eg,e_)))return 0}}else{let eu=fr(eb,eh);kr(ev,eg,em,R,ex,eu[0]),kr(ev,eg,em,R,ex,eu[1])}}return eg}function Tr(R,eh,eu,em,e_,eg=1/0){let ev=Math.min(eg,e_.distance(R[0],eu[0]));if(0===ev)return ev;let ex=new t7([[0,[0,R.length-1],[0,eu.length-1]]],cr);for(;ex.length>0;){let eg=ex.pop();if(eg[0]>=ev)continue;let eb=eg[1],ew=eg[2],eT=eh?50:100,eS=em?50:100;if(hr(eb)<=eT&&hr(ew)<=eS){if(!pr(eb,R.length)&&pr(ew,eu.length))return NaN;if(eh&&em)ev=Math.min(ev,function(R,eh,eu,em,e_){if(!pr(eh,R.length)||!pr(em,eu.length))return 1/0;let eg=1/0;for(let ev=eh[0];ev<eh[1];++ev){let eh=R[ev],ex=R[ev+1];for(let R=em[0];R<em[1];++R){let em=eu[R],ev=eu[R+1];if(Rn(eh,ex,em,ev))return 0;eg=Math.min(eg,vr(eh,ex,em,ev,e_))}}return eg}(R,eb,eu,ew,e_));else if(eh&&!em){let eh=R.slice(eb[0],eb[1]+1);for(let R=ew[0];R<=ew[1];++R)if(0===(ev=Math.min(ev,xr(eu[R],eh,e_))))return ev}else if(!eh&&em){let eh=eu.slice(ew[0],ew[1]+1);for(let eu=eb[0];eu<=eb[1];++eu)if(0===(ev=Math.min(ev,xr(R[eu],eh,e_))))return ev}else ev=Math.min(ev,function(R,eh,eu,em,e_){if(!pr(eh,R.length)||!pr(em,eu.length))return NaN;let eg=1/0;for(let ev=eh[0];ev<=eh[1];++ev)for(let eh=em[0];eh<=em[1];++eh)if(0===(eg=Math.min(eg,e_.distance(R[ev],eu[eh]))))return eg;return eg}(R,eb,eu,ew,e_))}else{let eg=fr(eb,eh),eT=fr(ew,em);Ir(ex,ev,e_,R,eu,eg[0],eT[0]),Ir(ex,ev,e_,R,eu,eg[0],eT[1]),Ir(ex,ev,e_,R,eu,eg[1],eT[0]),Ir(ex,ev,e_,R,eu,eg[1],eT[1])}}return ev}function Fr(R){return"MultiPolygon"===R.type?R.coordinates.map(R=>({type:"Polygon",coordinates:R})):"MultiLineString"===R.type?R.coordinates.map(R=>({type:"LineString",coordinates:R})):"MultiPoint"===R.type?R.coordinates.map(R=>({type:"Point",coordinates:R})):[R]}let Pr=class Pr{constructor(R,eh){this.type=tx,this.geojson=R,this.geometries=eh}static parse(R,eh){if(2!==R.length)return eh.error(`'distance' expression requires exactly one argument, but found ${R.length-1} instead.`);if(je(R[1])){let eh=R[1];if("FeatureCollection"===eh.type)return new Pr(eh,eh.features.map(R=>Fr(R.geometry)).flat());if("Feature"===eh.type)return new Pr(eh,Fr(eh.geometry));if("type"in eh&&"coordinates"in eh)return new Pr(eh,Fr(eh))}return eh.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(R){if(null!=R.geometry()&&null!=R.canonicalID()){if("Point"===R.geometryType())return function(R,eh){let eu=R.geometry(),em=eu.flat().map(eh=>Vn([eh.x,eh.y],R.canonical));if(0===eu.length)return NaN;let e_=new ur(em[0][1]),eg=1/0;for(let R of eh){switch(R.type){case"Point":eg=Math.min(eg,Tr(em,!1,[R.coordinates],!1,e_,eg));break;case"LineString":eg=Math.min(eg,Tr(em,!1,R.coordinates,!0,e_,eg));break;case"Polygon":eg=Math.min(eg,Er(em,!1,R.coordinates,e_,eg))}if(0===eg)break}return eg}(R,this.geometries);if("LineString"===R.geometryType())return function(R,eh){let eu=R.geometry(),em=eu.flat().map(eh=>Vn([eh.x,eh.y],R.canonical));if(0===eu.length)return NaN;let e_=new ur(em[0][1]),eg=1/0;for(let R of eh){switch(R.type){case"Point":eg=Math.min(eg,Tr(em,!0,[R.coordinates],!1,e_,eg));break;case"LineString":eg=Math.min(eg,Tr(em,!0,R.coordinates,!0,e_,eg));break;case"Polygon":eg=Math.min(eg,Er(em,!0,R.coordinates,e_,eg))}if(0===eg)break}return eg}(R,this.geometries);if("Polygon"===R.geometryType())return function(R,eh){let eu=R.geometry();if(0===eu.length||0===eu[0].length)return NaN;let em=rr(eu,0).map(eh=>eh.map(eh=>eh.map(eh=>Vn([eh.x,eh.y],R.canonical)))),e_=new ur(em[0][0][0][1]),eg=1/0;for(let R of eh)for(let eh of em){switch(R.type){case"Point":eg=Math.min(eg,Er([R.coordinates],!1,eh,e_,eg));break;case"LineString":eg=Math.min(eg,Er(R.coordinates,!0,eh,e_,eg));break;case"Polygon":eg=Math.min(eg,function(R,eh,eu,em=1/0){let e_=yr(R),eg=yr(eh);if(em!==1/0&&gr(e_,eg,eu)>=em)return em;if(On(e_,eg)){if(Ar(R,eh))return 0}else if(Ar(eh,R))return 0;let ev=1/0;for(let em of R)for(let R=0,e_=em.length,eg=e_-1;R<e_;eg=R++){let e_=em[eg],ex=em[R];for(let R of eh)for(let eh=0,em=R.length,eg=em-1;eh<em;eg=eh++){let em=R[eg],eb=R[eh];if(Rn(e_,ex,em,eb))return 0;ev=Math.min(ev,vr(e_,ex,em,eb,eu))}}return ev}(eh,R.coordinates,e_,eg))}if(0===eg)return eg}return eg}(R,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}};let Dr=class Dr{constructor(R){this.type=tI,this.key=R}static parse(R,eh){if(2!==R.length)return eh.error(`Expected 1 argument, but found ${R.length-1} instead.`);let eu=R[1];return null==eu?eh.error("Global state property must be defined."):"str
4ing"!=typeof eu?eh.error(`Global state property must be string, but found ${typeof R[1]} instead.`):new Dr(eu)}evaluate(R){var eh;let eu=null===(eh=R.globals)||void 0===eh?void 0:eh.globalState;return eu&&0!==Object.keys(eu).length?we(eu,this.key):null}eachChild(){}outputDefined(){return!1}};let im={"==":t2,"!=":t3,">":t4,"<":t5,">=":t8,"<=":t6,array:Ze,at:nn,boolean:Ze,case:an,coalesce:vn,collator:Tn,format:Pn,image:Dn,in:rn,"index-of":sn,interpolate:mn,"interpolate-hcl":mn,"interpolate-lab":mn,length:zn,let:tn,literal:Xe,match:on,number:Ze,"number-format":Fn,object:Ze,slice:ln,step:cn,string:Ze,"to-boolean":We,"to-color":We,"to-number":We,"to-string":We,var:en,within:Jn,distance:Pr,"global-state":Dr};let Br=class Br{constructor(R,eh,eu,em){this.name=R,this.type=eh,this._evaluate=eu,this.args=em}evaluate(R){return this._evaluate(R,this.args)}eachChild(R){this.args.forEach(R)}outputDefined(){return!1}static parse(R,eh){let eu=R[0],em=Br.definitions[eu];if(!em)return eh.error(`Unknown expression "${eu}". If you wanted a literal array, use ["literal", [...]].`,0);let e_=Array.isArray(em)?em[0]:em.type,eg=Array.isArray(em)?[[em[1],em[2]]]:em.overloads,ev=eg.filter(([eh])=>!Array.isArray(eh)||eh.length===R.length-1),ex=null;for(let[em,eg]of ev){ex=new Qe(eh.registry,$r,eh.path,null,eh.scope);let ev=[],eb=!1;for(let eh=1;eh<R.length;eh++){let eu=R[eh],e_=Array.isArray(em)?em[eh-1]:em.type,eg=ex.parse(eu,1+ev.length,e_);if(!eg){eb=!0;break}ev.push(eg)}if(!eb){if(Array.isArray(em)&&em.length!==ev.length)ex.error(`Expected ${em.length} arguments, but found ${ev.length} instead.`);else{for(let R=0;R<ev.length;R++){let eh=Array.isArray(em)?em[R]:em.type,eu=ev[R];ex.concat(R+1).checkSubtype(eh,eu.type)}if(0===ex.errors.length)return new Br(eu,e_,eg,ev)}}}if(1===ev.length)eh.errors.push(...ex.errors);else{let eu=(ev.length?ev:eg).map(([R])=>Array.isArray(R)?`(${R.map(Qt).join(", ")})`:`(${Qt(R.type)}...)`).join(" | "),em=[];for(let eu=1;eu<R.length;eu++){let e_=eh.parse(R[eu],1+em.length);if(!e_)return null;em.push(Qt(e_.type))}eh.error(`Expected arguments of type ${eu}, but found (${em.join(", ")}) instead.`)}return null}static register(R,eh){for(let eu in Br.definitions=eh,eh)R[eu]=Br}};function Cr(R,[eh,eu,em,e_]){eh=eh.evaluate(R),eu=eu.evaluate(R),em=em.evaluate(R);let eg=e_?e_.evaluate(R):1,ev=Ue(eh,eu,em,eg);if(ev)throw new Le(ev);return new Te(eh/255,eu/255,em/255,eg,!1)}function Lr(R,eh){let eu=eh[R];return void 0===eu?null:eu}function Or(R){return{type:R}}function $r(R){if(R instanceof en)return $r(R.boundExpression);if(R instanceof Br&&"error"===R.name||R instanceof Tn||R instanceof Jn||R instanceof Pr||R instanceof Dr)return!1;let eh=R instanceof We||R instanceof Ze,eu=!0;return R.eachChild(R=>{eu=eh?eu&&$r(R):eu&&R instanceof Xe}),!!eu&&Rr(R)&&Ur(R,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Rr(R){if(R instanceof Br&&("get"===R.name&&1===R.args.length||"feature-state"===R.name||"has"===R.name&&1===R.args.length||"properties"===R.name||"geometry-type"===R.name||"id"===R.name||/^filter-/.test(R.name))||R instanceof Jn||R instanceof Pr)return!1;let eh=!0;return R.eachChild(R=>{eh&&!Rr(R)&&(eh=!1)}),eh}function Nr(R){if(R instanceof Br&&"feature-state"===R.name)return!1;let eh=!0;return R.eachChild(R=>{eh&&!Nr(R)&&(eh=!1)}),eh}function Ur(R,eh){if(R instanceof Br&&eh.indexOf(R.name)>=0)return!1;let eu=!0;return R.eachChild(R=>{eu&&!Ur(R,eh)&&(eu=!1)}),eu}function jr(R){return{result:"success",value:R}}function qr(R){return{result:"error",value:R}}function Gr(R){return"data-driven"===R["property-type"]||"cross-faded-data-driven"===R["property-type"]}function Xr(R){return!!R.expression&&R.expression.parameters.indexOf("zoom")>-1}function Yr(R){return!!R.expression&&R.expression.interpolated}function Zr(R){return R instanceof Number?"number":R instanceof String?"string":R instanceof Boolean?"boolean":Array.isArray(R)?"array":null===R?"null":typeof R}function Hr(R){return"object"==typeof R&&null!==R&&!Array.isArray(R)&&qe(R)===tP}function Wr(R){return R}function Jr(R,eh,eu){return void 0!==R?R:void 0!==eh?eh:void 0!==eu?eu:void 0}function Qr(R,eh,eu,em,e_){return Jr(typeof eu===e_?em[eu]:void 0,R.default,eh.default)}function ti(R,eh,eu){if("number"!==Zr(eu))return Jr(R.default,eh.default);let em=R.stops.length;if(1===em||eu<=R.stops[0][0])return R.stops[0][1];if(eu>=R.stops[em-1][0])return R.stops[em-1][1];let e_=un(R.stops.map(R=>R[0]),eu);return R.stops[e_][1]}function ei(R,eh,eu){let em=void 0!==R.base?R.base:1;if("number"!==Zr(eu))return Jr(R.default,eh.default);let e_=R.stops.length;if(1===e_||eu<=R.stops[0][0])return R.stops[0][1];if(eu>=R.stops[e_-1][0])return R.stops[e_-1][1];let eg=un(R.stops.map(R=>R[0]),eu),ev=function(R,eh,eu,em){let e_=em-eu,eg=R-eu;return 0===e_?0:1===eh?eg/e_:(Math.pow(eh,eg)-1)/(Math.pow(eh,e_)-1)}(eu,em,R.stops[eg][0],R.stops[eg+1][0]),ex=R.stops[eg][1],eb=R.stops[eg+1][1],ew=t1[eh.type]||Wr;return"function"==typeof ex.evaluate?{evaluate(...eh){let eu=ex.evaluate.apply(void 0,eh),em=eb.evaluate.apply(void 0,eh);if(void 0!==eu&&void 0!==em)return ew(eu,em,ev,R.colorSpace)}}:ew(ex,eb,ev,R.colorSpace)}function ni(R,eh,eu){switch(eh.type){case"color":eu=Te.parse(eu);break;case"formatted":eu=ze.fromString(eu.toString());break;case"resolvedImage":eu=Re.fromString(eu.toString());break;case"padding":eu=Be.parse(eu);break;case"colorArray":eu=Ve.parse(eu);break;case"numberArray":eu=Ce.parse(eu);break;default:Zr(eu)===eh.type||"enum"===eh.type&&eh.values[eu]||(eu=void 0)}return Jr(eu,R.default,eh.default)}Br.register(im,{error:[{kind:"error"},[tb],(R,[eh])=>{throw new Le(eh.evaluate(R))}],typeof:[tb,[tI],(R,[eh])=>
vendor: 9,951 bytes, line 4
4Qt(qe(eh.evaluate(R)))],"to-rgba":[Jt(tx,4),[tT],(R,[eh])=>{let[eu,em,e_,eg]=eh.evaluate(R).rgb;return[255*eu,255*em,255*e_,eg]}],rgb:[tT,[tx,tx,tx],Cr],rgba:[tT,[tx,tx,tx,tx],Cr],has:{type:tw,overloads:[[[tb],(R,[eh])=>eh.evaluate(R) in R.properties()],[[tb,tP],(R,[eh,eu])=>eh.evaluate(R) in eu.evaluate(R)]]},get:{type:tI,overloads:[[[tb],(R,[eh])=>Lr(eh.evaluate(R),R.properties())],[[tb,tP],(R,[eh,eu])=>Lr(eh.evaluate(R),eu.evaluate(R))]]},"feature-state":[tI,[tb],(R,[eh])=>Lr(eh.evaluate(R),R.featureState||{})],properties:[tP,[],R=>R.properties()],"geometry-type":[tb,[],R=>R.geometryType()],id:[tI,[],R=>R.id()],zoom:[tx,[],R=>R.globals.zoom],"heatmap-density":[tx,[],R=>R.globals.heatmapDensity||0],elevation:[tx,[],R=>R.globals.elevation||0],"line-progress":[tx,[],R=>R.globals.lineProgress||0],accumulated:[tI,[],R=>void 0===R.globals.accumulated?null:R.globals.accumulated],"+":[tx,Or(tx),(R,eh)=>{let eu=0;for(let em of eh)eu+=em.evaluate(R);return eu}],"*":[tx,Or(tx),(R,eh)=>{let eu=1;for(let em of eh)eu*=em.evaluate(R);return eu}],"-":{type:tx,overloads:[[[tx,tx],(R,[eh,eu])=>eh.evaluate(R)-eu.evaluate(R)],[[tx],(R,[eh])=>-eh.evaluate(R)]]},"/":[tx,[tx,tx],(R,[eh,eu])=>eh.evaluate(R)/eu.evaluate(R)],"%":[tx,[tx,tx],(R,[eh,eu])=>eh.evaluate(R)%eu.evaluate(R)],ln2:[tx,[],()=>Math.LN2],pi:[tx,[],()=>Math.PI],e:[tx,[],()=>Math.E],"^":[tx,[tx,tx],(R,[eh,eu])=>Math.pow(eh.evaluate(R),eu.evaluate(R))],sqrt:[tx,[tx],(R,[eh])=>Math.sqrt(eh.evaluate(R))],log10:[tx,[tx],(R,[eh])=>Math.log(eh.evaluate(R))/Math.LN10],ln:[tx,[tx],(R,[eh])=>Math.log(eh.evaluate(R))],log2:[tx,[tx],(R,[eh])=>Math.log(eh.evaluate(R))/Math.LN2],sin:[tx,[tx],(R,[eh])=>Math.sin(eh.evaluate(R))],cos:[tx,[tx],(R,[eh])=>Math.cos(eh.evaluate(R))],tan:[tx,[tx],(R,[eh])=>Math.tan(eh.evaluate(R))],asin:[tx,[tx],(R,[eh])=>Math.asin(eh.evaluate(R))],acos:[tx,[tx],(R,[eh])=>Math.acos(eh.evaluate(R))],atan:[tx,[tx],(R,[eh])=>Math.atan(eh.evaluate(R))],min:[tx,Or(tx),(R,eh)=>Math.min(...eh.map(eh=>eh.evaluate(R)))],max:[tx,Or(tx),(R,eh)=>Math.max(...eh.map(eh=>eh.evaluate(R)))],abs:[tx,[tx],(R,[eh])=>Math.abs(eh.evaluate(R))],round:[tx,[tx],(R,[eh])=>{let eu=eh.evaluate(R);return eu<0?-Math.round(-eu):Math.round(eu)}],floor:[tx,[tx],(R,[eh])=>Math.floor(eh.evaluate(R))],ceil:[tx,[tx],(R,[eh])=>Math.ceil(eh.evaluate(R))],"filter-==":[tw,[tb,tI],(R,[eh,eu])=>R.properties()[eh.value]===eu.value],"filter-id-==":[tw,[tI],(R,[eh])=>R.id()===eh.value],"filter-type-==":[tw,[tb],(R,[eh])=>R.geometryType()===eh.value],"filter-<":[tw,[tb,tI],(R,[eh,eu])=>{let em=R.properties()[eh.value],e_=eu.value;return typeof em==typeof e_&&em<e_}],"filter-id-<":[tw,[tI],(R,[eh])=>{let eu=R.id(),em=eh.value;return typeof eu==typeof em&&eu<em}],"filter->":[tw,[tb,tI],(R,[eh,eu])=>{let em=R.properties()[eh.value],e_=eu.value;return typeof em==typeof e_&&em>e_}],"filter-id->":[tw,[tI],(R,[eh])=>{let eu=R.id(),em=eh.value;return typeof eu==typeof em&&eu>em}],"filter-<=":[tw,[tb,tI],(R,[eh,eu])=>{let em=R.properties()[eh.value],e_=eu.value;return typeof em==typeof e_&&em<=e_}],"filter-id-<=":[tw,[tI],(R,[eh])=>{let eu=R.id(),em=eh.value;return typeof eu==typeof em&&eu<=em}],"filter->=":[tw,[tb,tI],(R,[eh,eu])=>{let em=R.properties()[eh.value],e_=eu.value;return typeof em==typeof e_&&em>=e_}],"filter-id->=":[tw,[tI],(R,[eh])=>{let eu=R.id(),em=eh.value;return typeof eu==typeof em&&eu>=em}],"filter-has":[tw,[tI],(R,[eh])=>eh.value in R.properties()],"filter-has-id":[tw,[],R=>null!==R.id()&&void 0!==R.id()],"filter-type-in":[tw,[Jt(tb)],(R,[eh])=>eh.value.indexOf(R.geometryType())>=0],"filter-id-in":[tw,[Jt(tI)],(R,[eh])=>eh.value.indexOf(R.id())>=0],"filter-in-small":[tw,[tb,Jt(tI)],(R,[eh,eu])=>eu.value.indexOf(R.properties()[eh.value])>=0],"filter-in-large":[tw,[tb,Jt(tI)],(R,[eh,eu])=>(function(R,eh,eu,em){for(;eu<=em;){let e_=eu+em>>1;if(eh[e_]===R)return!0;eh[e_]>R?em=e_-1:eu=e_+1}return!1})(R.properties()[eh.value],eu.value,0,eu.value.length-1)],all:{type:tw,overloads:[[[tw,tw],(R,[eh,eu])=>eh.evaluate(R)&&eu.evaluate(R)],[Or(tw),(R,eh)=>{for(let eu of eh)if(!eu.evaluate(R))return!1;return!0}]]},any:{type:tw,overloads:[[[tw,tw],(R,[eh,eu])=>eh.evaluate(R)||eu.evaluate(R)],[Or(tw),(R,eh)=>{for(let eu of eh)if(eu.evaluate(R))return!0;return!1}]]},"!":[tw,[tw],(R,[eh])=>!eh.evaluate(R)],"is-supported-script":[tw,[tb],(R,[eh])=>{let eu=R.globals&&R.globals.isSupportedScript;return!eu||eu(eh.evaluate(R))}],upcase:[tb,[tb],(R,[eh])=>eh.evaluate(R).toUpperCase()],downcase:[tb,[tb],(R,[eh])=>eh.evaluate(R).toLowerCase()],concat:[tb,Or(tI),(R,eh)=>eh.map(eh=>Ge(eh.evaluate(R))).join("")],split:[Jt(tb),[tb,tb],(R,[eh,eu])=>eh.evaluate(R).split(eu.evaluate(R))],join:[tb,[Jt(tb),tb],(R,[eh,eu])=>eh.evaluate(R).join(eu.evaluate(R))],"resolved-locale":[tb,[tM],(R,[eh])=>eh.evaluate(R).resolvedLocale()]});let ri=class ri{constructor(R,eh,eu){this.expression=R,this._warningHistory={},this._evaluator=new Je,this._defaultValue=eh?function(R){if("color"===R.type&&Hr(R.default))return new Te(0,0,0,0);switch(R.type){case"color":return Te.parse(R.default)||null;case"padding":return Be.parse(R.default)||null;case"numberArray":return Ce.parse(R.default)||null;case"colorArray":return Ve.parse(R.default)||null;case"variableAnchorOffsetCollection":return $e.parse(R.default)||null;case"projectionDefinition":return Ne.parse(R.default)||null;default:return void 0===R.default?null:R.default}}(eh):null,this._enumValues=eh&&"enum"===eh.type?eh.values:null,this._globalState=eu}evaluateWithoutErrorHandling(R,eh,eu,em,e_,eg){return this._globalState&&(R=pi(R,this._globalState)),this._evaluator.globals=R,this._evaluator.feature=eh,this._evaluator.featureState=eu,this._evaluator.canonical=em,this._evaluator.availableImages=e_||null,this._evaluator.formattedSection=eg,this.expression.evaluate(this._evaluator)}evaluate(R,eh,eu,em,e_,eg){this._globalState&&(R=pi(R,this._globalState)),this._evaluator.globals=R,this._evaluator.feature=eh||null,this._evaluator.featureState=eu||null,this._evaluator.canonical=em,this._evaluator.availableImages=e_||null,this._evaluator.formattedSection=eg||null;try{let R=this.expression.evaluate(this._evaluator);if(null==R||"number"==typeof R&&R!=R)return this._defaultValue;if(this._enumValues&&!(R in this._enumValues))throw new Le(`Expected value to be one of ${Object.keys(this._enumValues).map(R=>JSON.stringify(R)).join(", ")}, but found ${JSON.stringify(R)} instead.`);return R}catch(R){return this._warningHistory[R.message]||(this._warningHistory[R.message]=!0,"undefined"!=typeof console&&console.warn(R.message)),this._defaultValue}}};function ii(R){return Array.isArray(R)&&R.length>0&&"string"==typeof R[0]&&R[0]in im}function si(R,eh,eu){let em=new Qe(im,$r,[],eh?function(R){let eh={color:tT,string:tb,number:tx,enum:tb,boolean:tw,formatted:tE,padding:tC,numberArray:tz,colorArray:tA,projectionDefinition:tS,resolvedImage:tD,variableAnchorOffsetCollection:tk};return"array"===R.type?Jt(eh[R.value]||tI,R.length):eh[R.type]}(eh):void 0),e_=em.parse(R,void 0,void 0,void 0,eh&&"string"===eh.type?{typeAnnotation:"coerce"}:void 0);return e_?jr(new ri(e_,eh,eu)):qr(em.errors)}let oi=class oi{constructor(R,eh,eu){this.kind=R,this._styleExpression=eh,this.isStateDependent="constant"!==R&&!Nr(eh.expression),this.globalStateRefs=hi(eh.expression),this._globalState=eu}evaluateWithoutErrorHandling(R,eh,eu,em,e_,eg){return this._globalState&&(R=pi(R,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(R,eh,eu,em,e_,eg)}evaluate(R,eh,eu,em,e_,eg){return this._globalState&&(R=pi(R,this._globalState)),this._styleExpression.evaluate(R,eh,eu,em,e_,eg)}};let ai=class ai{constructor(R,eh,eu,em,e_){this.kind=R,this.zoomStops=eu,this._styleExpression=eh,this.isStateDependent="camera"!==R&&!Nr(eh.expression),this.globalStateRefs=hi(eh.expression),this.interpolationType=em,this._globalState=e_}evaluateWithoutErrorHandling(R,eh,eu,em,e_,eg){return this._globalState&&(R=pi(R,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(R,eh,eu,em,e_,eg)}evaluate(R,eh,eu,em,e_,eg){return this._globalState&&(R=pi(R,this._globalState)),this._styleExpression.evaluate(R,eh,eu,em,e_,eg)}interpolationFactor(R,eh,eu){return this.interpolationType?mn.interpolationFactor(this.interpolationType,R,eh,eu):0}};function li(R,eh,eu){let em=si(R,eh,eu);if("error"===em.result)return em;let e_=em.value.expression,eg=Rr(e_);if(!eg&&!Gr(eh))return qr([new Ct("","data expressions not supported")]);let ev=Ur(e_,["zoom"]);if(!ev&&!Xr(eh))return qr([new Ct("","zoom expressions not supported")]);let ex=function ci(R){let eh=null;if(R instanceof tn)eh=ci(R.result);else if(R instanceof vn){for(let eu of R.args)if(eh=ci(eu))break}else(R instanceof cn||R instanceof mn)&&R.input instanceof Br&&"zoom"===R.input.name&&(eh=R);return eh instanceof Ct||R.eachChild(R=>{let eu=ci(R);eu instanceof Ct?eh=eu:!eh&&eu?eh=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):eh&&eu&&eh!==eu&&(eh=new Ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),eh}(e_);return ex||ev?ex instanceof Ct?qr([ex]):ex instanceof mn&&!Yr(eh)?qr([new Ct("",'"interpolate" expressions cannot be used with this property')]):jr(ex?new ai(eg?"camera":"composite",em.value,ex.labels,ex instanceof mn?ex.interpolation:void 0,eu):new oi(eg?"constant":"source",em.value,eu)):qr([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}let ui=class ui{constructor(R,eh){this._parameters=R,this._specification=eh,Bt(this,function Kr(R,eh){var eu;let em,e_;let eg=R.stops&&"object"==typeof R.stops[0][0],ev=eg||!(eg||void 0!==R.property),ex=R.type||(Yr(eh)?"exponential":"interval"),eb=function(R){switch(R.type){case"color":return Te.parse;case"padding":return Be.parse;case"numberArray":return Ce.parse;case"colorArray":return Ve.parse;default:return null}}(eh);if(eb&&((R=Bt({}
4,R)).stops&&(R.stops=R.stops.map(R=>[R[0],eb(R[1])])),R.default=eb(R.default?R.default:eh.default)),R.colorSpace&&"rgb"!==(eu=R.colorSpace)&&"hcl"!==eu&&"lab"!==eu)throw Error(`Unknown color space: "${R.colorSpace}"`);let ew=function(R){switch(R){case"exponential":return ei;case"interval":return ti;case"categorical":return Qr;case"identity":return ni;default:throw Error(`Unknown function type "${R}"`)}}(ex);if("categorical"===ex){for(let eh of(em=Object.create(null),R.stops))em[eh[0]]=eh[1];e_=typeof R.stops[0][0]}if(eg){let eu={},em=[];for(let eh=0;eh<R.stops.length;eh++){let e_=R.stops[eh],eg=e_[0].zoom;void 0===eu[eg]&&(eu[eg]={zoom:eg,type:R.type,property:R.property,default:R.default,stops:[]},em.push(eg)),eu[eg].stops.push([e_[0].value,e_[1]])}let e_=[];for(let R of em)e_.push([eu[R].zoom,Kr(eu[R],eh)]);let eg={name:"linear"};return{kind:"composite",interpolationType:eg,interpolationFactor:mn.interpolationFactor.bind(void 0,eg),zoomStops:e_.map(R=>R[0]),evaluate:({zoom:eu},em)=>ei({stops:e_,base:R.base},eh,eu).evaluate(eu,em)}}if(ev){let eu="exponential"===ex?{name:"exponential",base:void 0!==R.base?R.base:1}:null;return{kind:"camera",interpolationType:eu,interpolationFactor:mn.interpolationFactor.bind(void 0,eu),zoomStops:R.stops.map(R=>R[0]),evaluate:({zoom:eu})=>ew(R,eh,eu,em,e_)}}return{kind:"source",evaluate(eu,eg){let ev=eg&&eg.properties?eg.properties[R.property]:void 0;return void 0===ev?Jr(R.default,eh.default):ew(R,eh,ev,em,e_)}}}(this._parameters,this._specification))}static deserialize(R){return new ui(R._parameters,R._specification)}static serialize(R){return{_parameters:R._parameters,_specification:R._specification}}};function hi(R,eh=new Set){return R instanceof Dr&&eh.add(R.key),R.eachChild(R=>{hi(R,eh)}),eh}function pi(R,eh){let{zoom:eu,heatmapDensity:em,elevation:e_,lineProgress:eg,isSupportedScript:ev,accumulated:ex}=null!=R?R:{};return{zoom:eu,heatmapDensity:em,elevation:e_,lineProgress:eg,isSupportedScript:ev,accumulated:ex,globalState:eh}}function fi(R){if(!0===R||!1===R)return!0;if(!Array.isArray(R)||0===R.length)return!1;switch(R[0]){case"has":return R.length>=2&&"$id"!==R[1]&&"$type"!==R[1];case"in":return R.length>=3&&("string"!=typeof R[1]||Array.isArray(R[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==R.length||Array.isArray(R[1])||Array.isArray(R[2]);case"any":case"all":for(let eh of R.slice(1))if(!fi(eh)&&"boolean"!=typeof eh)return!1;return!0;default:return!0}}let i_={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yi(R,eh){if(null==R)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};fi(R)||(R=function xi(R){if(!R)return!0;let eh=R[0];return R.length<=1?"any"!==eh:"=="===eh?vi(R[1],R[2],"=="):"!="===eh?_i(vi(R[1],R[2],"==")):"<"===eh||">"===eh||"<="===eh||">="===eh?vi(R[1],R[2],eh):"any"===eh?["any"].concat(R.slice(1).map(xi)):"all"===eh?["all"].concat(R.slice(1).map(xi)):"none"===eh?["all"].concat(R.slice(1).map(xi).map(_i)):"in"===eh?bi(R[1],R.slice(2)):"!in"===eh?_i(bi(R[1],R.slice(2))):"has"===eh?wi(R[1]):"!has"!==eh||_i(wi(R[1]))}(R));let eu=si(R,i_,eh);if("error"===eu.result)throw Error(eu.value.map(R=>`${R.key}: ${R.message}`).join(", "));return{filter:(R,eh,em)=>eu.value.evaluate(R,eh,{},em),needGeometry:function gi(R){if(!Array.isArray(R))return!1;if("within"===R[0]||"distance"===R[0])return!0;for(let eh=1;eh<R.length;eh++)if(gi(R[eh]))return!0;return!1}(R),getGlobalStateRefs:()=>hi(eu.value.expression)}}function mi(R,eh){return R<eh?-1:R>eh?1:0}function vi(R,eh,eu){switch(R){case"$type":return[`filter-type-${eu}`,eh];case"$id":return[`filter-id-${eu}`,eh];default:return[`filter-${eu}`,R,eh]}}function bi(R,eh){if(0===eh.length)return!1;switch(R){case"$type":return["filter-type-in",["literal",eh]];case"$id":return["filter-id-in",["literal",eh]];default:return eh.length>200&&!eh.some(R=>typeof R!=typeof eh[0])?["filter-in-large",R,["literal",eh.sort(mi)]]:["filter-in-small",R,["literal",eh]]}}function wi(R){switch(R){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",R]}}function _i(R){return["!",R]}function Mi(R){let eh=R.value;return eh?[new zt(R.key,eh,"constants have been deprecated as of v8")]:[]}function ki(R){return R instanceof Number||R instanceof String||R instanceof Boolean?R.valueOf():R}
vendor: 1,325 bytes, line 4
4function Ii(R){if(Array.isArray(R))return R.map(Ii);if(R instanceof Object&&!(R instanceof Number||R instanceof String||R instanceof Boolean)){let eh={};for(let eu in R)eh[eu]=Ii(R[eu]);return eh}return ki(R)}function Ei(R){let eh=R.key,eu=R.value,em=R.valueSpec||{},e_=R.objectElementValidators||{},eg=R.style,ev=R.styleSpec,ex=R.validateSpec,eb=[],ew=Zr(eu);if("object"!==ew)return[new zt(eh,eu,`object expected, ${ew} found`)];for(let R in eu){let ew;let eT=R.split(".")[0],eS=we(em,eT)||em["*"];if(we(e_,eT))ew=e_[eT];else if(we(em,eT)){if(void 0===eu[R])continue;ew=ex}else if(e_["*"])ew=e_["*"];else{if(!em["*"]){eb.push(new zt(eh,eu[R],`unknown property "${R}"`));continue}ew=ex}eb=eb.concat(ew({key:(eh?`${eh}.`:eh)+R,value:eu[R],valueSpec:eS,style:eg,styleSpec:ev,object:eu,objectKey:R,validateSpec:ex},eu))}for(let R in em)e_[R]||em[R].required&&void 0===em[R].default&&void 0===eu[R]&&eb.push(new zt(eh,eu,`missing required property "${R}"`));return eb}function Ti(R){let eh=R.value,eu=R.valueSpec,em=R.style,e_=R.styleSpec,eg=R.key,ev=R.arrayElementValidator||R.validateSpec;if("array"!==Zr(eh))return[new zt(eg,eh,`array expected, ${Zr(eh)} found`)];if(eu.length&&eh.length!==eu.length)return[new zt(eg,eh,`array length ${eu.length} expected, length ${eh.length} found`)];let ex={type:eu.value,values:eu.values};
vendor: 5,569 bytes, line 4
4e_.$version<7&&(ex.function=eu.function),"object"===Zr(eu.value)&&(ex=eu.value);let eb=[];for(let eu=0;eu<eh.length;eu++)eb=eb.concat(ev({array:eh,arrayIndex:eu,value:eh[eu],valueSpec:ex,validateSpec:R.validateSpec,style:em,styleSpec:e_,key:`${eg}[${eu}]`}));return eb}function Fi(R){let eh=R.key,eu=R.value,em=R.valueSpec,e_=Zr(eu);return"number"===e_&&eu!=eu&&(e_="NaN"),"number"!==e_?[new zt(eh,eu,`number expected, ${e_} found`)]:"minimum"in em&&eu<em.minimum?[new zt(eh,eu,`${eu} is less than the minimum value ${em.minimum}`)]:"maximum"in em&&eu>em.maximum?[new zt(eh,eu,`${eu} is greater than the maximum value ${em.maximum}`)]:[]}function Pi(R){let eh=R.valueSpec,eu=ki(R.value.type),em,e_,eg,ev={},ex="categorical"!==eu&&void 0===R.value.property,eb="array"===Zr(R.value.stops)&&"array"===Zr(R.value.stops[0])&&"object"===Zr(R.value.stops[0][0]),ew=Ei({key:R.key,value:R.value,valueSpec:R.styleSpec.function,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{stops:function(R){if("identity"===eu)return[new zt(R.key,R.value,'identity function may not have a "stops" property')];let eh=[],em=R.value;return eh=eh.concat(Ti({key:R.key,value:em,valueSpec:R.valueSpec,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:h})),"array"===Zr(em)&&0===em.length&&eh.push(new zt(R.key,em,"array must have at least one stop")),eh},default:function(R){return R.validateSpec({key:R.key,value:R.value,valueSpec:eh,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec})}}});return"identity"===eu&&ex&&ew.push(new zt(R.key,R.value,'missing required property "property"')),"identity"===eu||R.value.stops||ew.push(new zt(R.key,R.value,'missing required property "stops"')),"exponential"===eu&&R.valueSpec.expression&&!Yr(R.valueSpec)&&ew.push(new zt(R.key,R.value,"exponential functions not supported")),R.styleSpec.$version>=8&&(ex||Gr(R.valueSpec)?ex&&!Xr(R.valueSpec)&&ew.push(new zt(R.key,R.value,"zoom functions not supported")):ew.push(new zt(R.key,R.value,"property functions not supported"))),("categorical"===eu||eb)&&void 0===R.value.property&&ew.push(new zt(R.key,R.value,'"property" property is required')),ew;function h(R){let eu=[],em=R.value,ex=R.key;if("array"!==Zr(em))return[new zt(ex,em,`array expected, ${Zr(em)} found`)];if(2!==em.length)return[new zt(ex,em,`array length 2 expected, length ${em.length} found`)];if(eb){if("object"!==Zr(em[0]))return[new zt(ex,em,`object expected, ${Zr(em[0])} found`)];if(void 0===em[0].zoom)return[new zt(ex,em,"object stop key must have zoom")];if(void 0===em[0].value)return[new zt(ex,em,"object stop key must have value")];if(eg&&eg>ki(em[0].zoom))return[new zt(ex,em[0].zoom,"stop zoom values must appear in ascending order")];ki(em[0].zoom)!==eg&&(eg=ki(em[0].zoom),e_=void 0,ev={}),eu=eu.concat(Ei({key:`${ex}[0]`,value:em[0],valueSpec:{zoom:{}},validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:Fi,value:p}}))}else eu=eu.concat(p({key:`${ex}[0]`,value:em[0],validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec},em));return ii(Ii(em[1]))?eu.concat([new zt(`${ex}[1]`,em[1],"expressions are not allowed in function stops.")]):eu.concat(R.validateSpec({key:`${ex}[1]`,value:em[1],valueSpec:eh,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec}))}function p(R,eg){let ex=Zr(R.value),eb=ki(R.value),ew=null!==R.value?R.value:eg;if(em){if(ex!==em)return[new zt(R.key,ew,`${ex} stop domain type must match previous stop domain type ${em}`)]}else em=ex;if("number"!==ex&&"string"!==ex&&"boolean"!==ex)return[new zt(R.key,ew,"stop domain value must be a number, string, or boolean")];if("number"!==ex&&"categorical"!==eu){let em=`number expected, ${ex} found`;return Gr(eh)&&void 0===eu&&(em+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zt(R.key,ew,em)]}return"categorical"!==eu||"number"!==ex||isFinite(eb)&&Math.floor(eb)===eb?"categorical"!==eu&&"number"===ex&&void 0!==e_&&eb<e_?[new zt(R.key,ew,"stop domain values must appear in ascending order")]:(e_=eb,"categorical"===eu&&eb in ev?[new zt(R.key,ew,"stop domain values must be unique")]:(ev[eb]=!0,[])):[new zt(R.key,ew,`integer expected, found ${eb}`)]}}function Di(R){let eh=("property"===R.expressionContext?li:si)(Ii(R.value),R.valueSpec);if("error"===eh.result)return eh.value.map(eh=>new zt(`${R.key}${eh.key}`,R.value,eh.message));let eu=eh.value.expression||eh.value._styleExpression.expression;if("property"===R.expressionContext&&"text-font"===R.propertyKey&&!eu.outputDefined())return[new zt(R.key,R.value,`Invalid data expression for "${R.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===R.expressionContext&&"layout"===R.propertyType&&!Nr(eu))return[new zt(R.key,R.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===R.expressionContext&&!Nr(eu))return[new zt(R.key,R.value,'"feature-state" data expressions are not supported with filters.')];if(R.expressionContext&&0===R.expressionContext.indexOf("cluster")){if(!Ur(eu,["zoom","feature-state"]))return[new zt(R.key,R.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===R.expressionContext&&!Rr(eu))return[new zt(R.key,R.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function zi(R){let eh=R.key,eu=R.value,em=Zr(eu);return"string"!==em?[new zt(eh,eu,`color expected, ${em}
4 found`)]:Te.parse(String(eu))?[]:[new zt(eh,eu,`color expected, "${eu}" found`)]}function Bi(R){let eh=R.key,eu=R.value,em=R.valueSpec,e_=[];return Array.isArray(em.values)?-1===em.values.indexOf(ki(eu))&&e_.push(new zt(eh,eu,`expected one of [${em.values.join(", ")}], ${JSON.stringify(eu)} found`)):-1===Object.keys(em.values).indexOf(ki(eu))&&e_.push(new zt(eh,eu,`expected one of [${Object.keys(em.values).join(", ")}], ${JSON.stringify(eu)} found`)),e_}function Ci(R){return fi(Ii(R.value))?Di(Bt({},R,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function Vi(R){let eh=R.value,eu=R.key;if("array"!==Zr(eh))return[new zt(eu,eh,`array expected, ${Zr(eh)} found`)];let em=R.styleSpec,e_,eg=[];if(eh.length<1)return[new zt(eu,eh,"filter array must have at least 1 element")];switch(eg=eg.concat(Bi({key:`${eu}[0]`,value:eh[0],valueSpec:em.filter_operator,style:R.style,styleSpec:R.styleSpec})),ki(eh[0])){case"<":case"<=":case">":case">=":eh.length>=2&&"$type"===ki(eh[1])&&eg.push(new zt(eu,eh,`"$type" cannot be use with operator "${eh[0]}"`));case"==":case"!=":3!==eh.length&&eg.push(new zt(eu,eh,`filter array for operator "${eh[0]}" must have 3 elements`));case"in":case"!in":eh.length>=2&&"string"!==(e_=Zr(eh[1]))&&eg.push(new zt(`${eu}[1]`,eh[1],`string expected, ${e_} found`));for(let ev=2;ev<eh.length;ev++)e_=Zr(eh[ev]),"$type"===ki(eh[1])?eg=eg.concat(Bi({key:`${eu}[${ev}]`,value:eh[ev],valueSpec:em.geometry_type,style:R.style,styleSpec:R.styleSpec})):"string"!==e_&&"number"!==e_&&"boolean"!==e_&&eg.push(new zt(`${eu}[${ev}]`,eh[ev],`string, number, or boolean expected, ${e_} found`));break;case"any":case"all":case"none":for(let em=1;em<eh.length;em++)eg=eg.concat(Vi({key:`${eu}[${em}]`,value:eh[em],style:R.style,styleSpec:R.styleSpec}));break;case"has":case"!has":e_=Zr(eh[1]),2!==eh.length?eg.push(new zt(eu,eh,`filter array for "${eh[0]}" operator must have 2 elements`)):"string"!==e_&&eg.push(new zt(`${eu}[1]`,eh[1],`string expected, ${e_} found`))}return eg}(R)}function Li(R,eh){let eu;let em=R.key,e_=R.validateSpec,eg=R.style,ev=R.styleSpec,ex=R.value,eb=R.objectKey,ew=ev[`${eh}_${R.layerType}`];if(!ew)return[];let eT=eb.match(/^(.*)-transition$/);if("paint"===eh&&eT&&ew[eT[1]]&&ew[eT[1]].transition)return e_({key:em,value:ex,valueSpec:ev.transition,style:eg,styleSpec:ev});let eS=R.valueSpec||ew[eb];if(!eS)return[new zt(em,ex,`unknown property "${eb}"`)];if("string"===Zr(ex)&&Gr(eS)&&!eS.tokens&&(eu=/^{([^}]+)}$/.exec(ex)))return[new zt(em,ex,`"${eb}" does not support interpolation syntax 5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(eu[1])} }\`.`)];let eP=[];return"symbol"===R.layerType&&"text-font"===eb&&Hr(Ii(ex))&&"identity"===ki(ex.type)&&eP.push(new zt(em,ex,'"text-font" does not support identity functions')),eP.concat(e_({key:R.key,value:ex,valueSpec:eS,style:eg,styleSpec:ev,expressionContext:"property",propertyType:eh,propertyKey:eb}))}function Oi(R){return Li(R,"paint")}function $i(R){return Li(R,"layout")}function Ri(R){var eh,eu;let em=[],e_=R.value,eg=R.key,ev=R.style,ex=R.styleSpec;if("object"!==Zr(e_))return[new zt(eg,e_,`object expected, ${Zr(e_)} found`)];e_.type||e_.ref||em.push(new zt(eg,e_,'either "type" or "ref" is required'));let eb=ki(e_.type),ew=ki(e_.ref);if(e_.id){let eh=ki(e_.id);for(let eu=0;eu<R.arrayIndex;eu++){let R=ev.layers[eu];ki(R.id)===eh&&em.push(new zt(eg,e_.id,`duplicate layer id "${e_.id}", previously used at line ${R.id.__line__}`))}}if("ref"in e_){let R;["type","source","source-layer","filter","layout"].forEach(R=>{R in e_&&em.push(new zt(eg,e_[R],`"${R}" is prohibited for ref layers`))}),ev.layers.forEach(eh=>{ki(eh.id)===ew&&(R=eh)}),R?R.ref?em.push(new zt(eg,e_.ref,"ref cannot reference another ref layer")):eb=ki(R.type):em.push(new zt(eg,e_.ref,`ref layer "${ew}" not found`))}else if("background"!==eb){if(e_.source){let R=ev.sources&&ev.sources[e_.source],eh=R&&ki(R.type);R?"vector"===eh&&"raster"===eb?em.push(new zt(eg,e_.source,`layer "${e_.id}" requires a raster source`)):"raster-dem"!==eh&&"hillshade"===eb||"raster-dem"!==eh&&"color-relief"===eb?em.push(new zt(eg,e_.source,`layer "${e_.id}" requires a raster-dem source`)):"raster"===eh&&"raster"!==eb?em.push(new zt(eg,e_.source,`layer "${e_.id}" requires a vector source`)):"vector"!==eh||e_["source-layer"]?"raster-dem"===eh&&"hillshade"!==eb&&"color-relief"!==eb?em.push(new zt(eg,e_.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===eb&&e_.paint&&e_.paint["line-gradient"]&&("geojson"!==eh||!R.lineMetrics)&&em.push(new zt(eg,e_,`layer "${e_.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):em.push(new zt(eg,e_,`layer "${e_.id}" must specify a "source-layer"`)):em.push(new zt(eg,e_.source,`source "${e_.source}" not found`))}else em.push(new zt(eg,e_,'missing required property "source"'))}return"raster"===eb&&(null===(eh=e_.paint)||void 0===eh?void 0:eh.resampling)&&(null===(eu=e_.paint)||void 0===eu?void 0:eu["raster-resampling"])&&em.push(new zt(eg,e_.paint,`layer "${e_.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),em=em.concat(Ei({key:eg,value:e_,valueSpec:ex.layer,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":()=>[],type:()=>R.validateSpec({key:`${eg}.type`,value:e_.type,valueSpec:ex.layer.type,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,object:e_,objectKey:"type"}),filter:Ci,layout:R=>Ei({layer:e_,key:R.key,value:R.value,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":R=>$i(Bt({layerType:eb},R))}}),paint:R=>Ei({layer:e_,key:R.key,value:R.value,style:R.style,styleSpec:R.styleSpec,validateSpec:R.validateSpec,objectElementValidators:{"*":R=>Oi(Bt({layerType:eb},R))}})}}))}function Ni(R){let eh=R.value,eu=R.key,em=Zr(eh);return"string"!==em?[new zt(eu,eh,`string expected, ${em}
5 found`)]:[]}let ig={promoteId:function({key:R,value:eh}){if("string"===Zr(eh))return Ni({key:R,value:eh});{let eu=[];for(let em in eh)eu.push(...Ni({key:`${R}.${em}`,value:eh[em]}));return eu}}};function ji(R){let eh;let eu=R.value,em=R.key,e_=R.styleSpec,eg=R.style,ev=R.validateSpec;if(!eu.type)return[new zt(em,eu,'"type" is required')];let ex=ki(eu.type);switch(ex){case"vector":case"raster":return Ei({key:em,value:eu,valueSpec:e_[`source_${ex.replace("-","_")}`],style:R.style,styleSpec:e_,objectElementValidators:ig,validateSpec:ev});case"raster-dem":return function(R){var eh;let eu=null!==(eh=R.sourceName)&&void 0!==eh?eh:"",em=R.value,e_=R.styleSpec,eg=e_.source_raster_dem,ev=R.style,ex=[],eb=Zr(em);if(void 0===em)return ex;if("object"!==eb)return ex.push(new zt("source_raster_dem",em,`object expected, ${eb} found`)),ex;let ew="custom"===ki(em.encoding),eT=["redFactor","greenFactor","blueFactor","baseShift"],eS=R.value.encoding?`"${R.value.encoding}"`:"Default";for(let eh in em)!ew&&eT.includes(eh)?ex.push(new zt(eh,em[eh],`In "${eu}": "${eh}" is only valid when "encoding" is set to "custom". ${eS} encoding found`)):eg[eh]?ex=ex.concat(R.validateSpec({key:eh,value:em[eh],valueSpec:eg[eh],validateSpec:R.validateSpec,style:ev,styleSpec:e_})):ex.push(new zt(eh,em[eh],`unknown property "${eh}"`));return ex}({sourceName:em,value:eu,style:R.style,styleSpec:e_,validateSpec:ev});case"geojson":if(eh=Ei({key:em,value:eu,valueSpec:e_.source_geojson,style:eg,styleSpec:e_,validateSpec:ev,objectElementValidators:ig}),eu.cluster)for(let R in eu.clusterProperties){let[e_,eg]=eu.clusterProperties[R],ev="string"==typeof e_?[e_,["accumulated"],["get",R]]:e_;eh.push(...Di({key:`${em}.${R}.map`,value:eg,expressionContext:"cluster-map"})),eh.push(...Di({key:`${em}.${R}.reduce`,value:ev,expressionContext:"cluster-reduce"}))}return eh;case"video":return Ei({key:em,value:eu,valueSpec:e_.source_video,style:eg,validateSpec:ev,styleSpec:e_});case"image":return Ei({key:em,value:eu,valueSpec:e_.source_image,style:eg,validateSpec:ev,styleSpec:e_});case"canvas":return[new zt(em,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Bi({key:`${em}.type`,value:eu.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function qi(R){let eh=R.value,eu=R.styleSpec,em=eu.light,e_=R.style,eg=[],ev=Zr(eh);if(void 0===eh)return eg;if("object"!==ev)return eg.concat([new zt("light",eh,`object expected, ${ev} found`)]);for(let ev in eh){let ex=ev.match(/^(.*)-transition$/);eg=eg.concat(ex&&em[ex[1]]&&em[ex[1]].transition?R.validateSpec({key:ev,value:eh[ev],valueSpec:eu.transition,validateSpec:R.validateSpec,style:e_,styleSpec:eu}):em[ev]?R.validateSpec({key:ev,value:eh[ev],valueSpec:em[ev],validateSpec:R.validateSpec,style:e_,styleSpec:eu}):[new zt(ev,eh[ev],`unknown property "${ev}"`)])}return eg}function Gi(R){let eh=R.value,eu=R.styleSpec,em=eu.sky,e_=R.style,eg=Zr(eh);if(void 0===eh)return[];if("object"!==eg)return[new zt("sky",eh,`object expected, ${eg} found`)];let ev=[];for(let eg in eh)ev=ev.concat(em[eg]?R.validateSpec({key:eg,value:eh[eg],valueSpec:em[eg],style:e_,styleSpec:eu}):[new zt(eg,eh[eg],`unknown property "${eg}"`)]);return ev}function Xi(R){let eh=R.value,eu=R.styleSpec,em=eu.terrain,e_=R.style,eg=[],ev=Zr(eh);if(void 0===eh)return eg;if("object"!==ev)return eg.concat([new zt("terrain",eh,`object expected, ${ev} found`)]);for(let ev in eh)eg=eg.concat(em[ev]?R.validateSpec({key:ev,value:eh[ev],valueSpec:em[ev],validateSpec:R.validateSpec,style:e_,styleSpec:eu}):[new zt(ev,eh[ev],`unknown property "${ev}"`)]);return eg}function Yi(R){let eh=[],eu=R.value,em=R.key;if(Array.isArray(eu)){let e_=[],eg=[];for(let ev in eu)eu[ev].id&&e_.includes(eu[ev].id)&&eh.push(new zt(em,eu,`all the sprites' ids must be unique, but ${eu[ev].id} is duplicated`)),e_.push(eu[ev].id),eu[ev].url&&eg.includes(eu[ev].url)&&eh.push(new zt(em,eu,`all the sprites' URLs must be unique, but ${eu[ev].url} is duplicated`)),eg.push(eu[ev].url),eh=eh.concat(Ei({key:`${em}[${ev}]`,value:eu[ev],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:R.validateSpec}));return eh}return Ni({key:em,value:eu})}function Zi(R){return!!R&&R.constructor===Object}function Hi(R){return Zi(R.value)?[]:[new zt(R.key,R.value,`object expected, ${Zr(R.value)} found`)]}let iv={"*":()=>[],array:Ti,boolean:function(R){let eh=R.value,eu=R.key,em=Zr(eh);return"boolean"!==em?[new zt(eu,eh,`boolean expected, ${em}
5 found`)]:[]},number:Fi,color:zi,constants:Mi,enum:Bi,filter:Ci,function:Pi,layer:Ri,object:Ei,source:ji,light:qi,sky:Gi,terrain:Xi,projection:function(R){let eh=R.value,eu=R.styleSpec,em=eu.projection,e_=R.style,eg=Zr(eh);if(void 0===eh)return[];if("object"!==eg)return[new zt("projection",eh,`object expected, ${eg} found`)];let ev=[];for(let eg in eh)ev=ev.concat(em[eg]?R.validateSpec({key:eg,value:eh[eg],valueSpec:em[eg],style:e_,styleSpec:eu}):[new zt(eg,eh[eg],`unknown property "${eg}"`)]);return ev},projectionDefinition:function(R){var eh;let eu=R.key,em=R.value;em=em instanceof String?em.valueOf():em;let e_=Zr(em);return"array"!==e_||Array.isArray(eh=em)&&3===eh.length&&"string"==typeof eh[0]&&"string"==typeof eh[1]&&"number"==typeof eh[2]||["interpolate","step","literal"].includes(em[0])?["array","string"].includes(e_)?[]:[new zt(eu,em,`projection expected, invalid type "${e_}" found`)]:[new zt(eu,em,`projection expected, invalid array ${JSON.stringify(em)} found`)]},string:Ni,formatted:function(R){return 0===Ni(R).length?[]:Di(R)},resolvedImage:function(R){return 0===Ni(R).length?[]:Di(R)},padding:function(R){let eh=R.key,eu=R.value;if("array"===Zr(eu)){if(eu.length<1||eu.length>4)return[new zt(eh,eu,`padding requires 1 to 4 values; ${eu.length} values found`)];let em={type:"number"},e_=[];for(let eg=0;eg<eu.length;eg++)e_=e_.concat(R.validateSpec({key:`${eh}[${eg}]`,value:eu[eg],validateSpec:R.validateSpec,valueSpec:em}));return e_}return Fi({key:eh,value:eu,valueSpec:{}})},numberArray:function(R){let eh=R.key,eu=R.value;if("array"===Zr(eu)){let em={type:"number"};if(eu.length<1)return[new zt(eh,eu,"array length at least 1 expected, length 0 found")];let e_=[];for(let eg=0;eg<eu.length;eg++)e_=e_.concat(R.validateSpec({key:`${eh}[${eg}]`,value:eu[eg],validateSpec:R.validateSpec,valueSpec:em}));return e_}return Fi({key:eh,value:eu,valueSpec:{}})},colorArray:function(R){let eh=R.key,eu=R.value;if("array"===Zr(eu)){if(eu.length<1)return[new zt(eh,eu,"array length at least 1 expected, length 0 found")];let R=[];for(let em=0;em<eu.length;em++)R=R.concat(zi({key:`${eh}[${em}]`,value:eu[em]}));return R}return zi({key:eh,value:eu})},variableAnchorOffsetCollection:function(R){let eh=R.key,eu=R.value,em=Zr(eu),e_=R.styleSpec;if("array"!==em||eu.length<1||eu.length%2!=0)return[new zt(eh,eu,"variableAnchorOffsetCollection requires a non-empty array of even length")];let eg=[];for(let em=0;em<eu.length;em+=2)eg=(eg=eg.concat(Bi({key:`${eh}[${em}]`,value:eu[em],valueSpec:e_.layout_symbol["text-anchor"]}))).concat(Ti({key:`${eh}[${em+1}]`,value:eu[em+1],valueSpec:{length:2,value:"number"},validateSpec:R.validateSpec,style:R.style,styleSpec:e_}));return eg},sprite:Yi,state:Hi,fontFaces:function(R){let eh=R.key,eu=R.value,em=R.validateSpec,e_=R.styleSpec,eg=R.style;if(!Zi(eu))return[new zt(eh,eu,`object expected, ${Zr(eu)} found`)];let ev=[];for(let R in eu){let ex=eu[R],eb=Zr(ex);if("string"===eb)ev.push(...Ni({key:`${eh}.${R}`,value:ex}));else if("array"===eb){let eu={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[eb,ew]of ex.entries())ev.push(...Ei({key:`${eh}.${R}[${eb}]`,value:ew,valueSpec:eu,styleSpec:e_,style:eg,validateSpec:em}))}else ev.push(new zt(`${eh}.${R}`,ex,`string or array expected, ${eb} found`))}return ev}};function Ki(R){let eh=R.value,eu=R.valueSpec,em=R.styleSpec;return R.validateSpec=Ki,eu.expression&&Hr(ki(eh))?Pi(R):eu.expression&&ii(Ii(eh))?Di(R):eu.type&&iv[eu.type]?iv[eu.type](R):Ei(Bt({},R,{valueSpec:eu.type?em[eu.type]:eu}))}function Ji(R){let eh=R.value,eu=R.key,em=Ni(R);return em.length||(-1===eh.indexOf("{fontstack}")&&em.push(new zt(eu,eh,'"glyphs" url must include a "{fontstack}" token')),-1===eh.indexOf("{range}")&&em.push(new zt(eu,eh,'"glyphs" url must include a "{range}" token'))),em}function Qi(R,eh=t_){let eu=[];return eu=eu.concat(Ki({key:"",value:R,valueSpec:eh.$root,styleSpec:eh,style:R,validateSpec:Ki,objectElementValidators:{glyphs:Ji,"*":()=>[]}})),R.constants&&(eu=eu.concat(Mi({key:"constants",value:R.constants}))),es(eu)}function ts(R){return function(eh){return R(Object.assign({},eh,{validateSpec:Ki}))}}function es(R){return[].concat(R).sort((R,eh)=>R.line-eh.line)}function ns(R){return function(...eh){return es(R.apply(this,eh))}}Qi.source=ns(ts(ji)),Qi.sprite=ns(ts(Yi)),Qi.glyphs=ns(ts(Ji)),Qi.light=ns(ts(qi)),Qi.sky=ns(ts(Gi)),Qi.terrain=ns(ts(Xi)),Qi.state=ns(ts(Hi)),Qi.layer=ns(ts(Ri)),Qi.filter=ns(ts(Ci)),Qi.paintProperty=ns(ts(Oi)),Qi.layoutProperty=ns(ts($i));let ix={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};let is=class is{constructor(R,eh){this._globalState=eh,this.setValue(R)}evaluate(){var R;return null!==(R=this._literalValue)&&void 0!==R?R:this._compiledValue.evaluate({})}setValue(R){if(null==R||"visible"===R||"none"===R)return this._literalValue="none"===R?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let eh=si(R,ix,this._globalState);if("error"===eh.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(eh.value.map(R=>`${R.key}: ${R.message}`).join(", "));this._literalValue=void 0,this._compiledValue=eh.value,this._globalStateRefs=hi(eh.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};let ib=Qi.light,iw=Qi.sky,iT=Qi.paintProperty,iS=Qi.layoutProperty;function hs(R,eh){let eu=!1;if(null==eh?void 0:eh.length)for(let em of eh)R.fire(new vt(Error(em.message))),eu=!0;return eu}let ps=class ps{constructor(R,eh,eu){let em=this.cells=[];if(R instanceof ArrayBuffer){this.arrayBuffer=R;let e_=new Int32Array(this.arrayBuffer);R=e_[0],this.d=(eh=e_[1])+2*(eu=e_[2]);for(let R=0;R<this.d*this.d;R++){let eh=e_[3+R],eu=e_[3+R+1];em.push(eh===eu?null:e_.subarray(eh,eu))}let eg=e_[3+em.length+1];this.keys=e_.subarray(e_[3+em.length],eg),this.bboxes=e_.subarray(eg),this.insert=this._insertReadonly}else{this.d=eh+2*eu;for(let R=0;R<this.d*this.d;R++)em.push([]);this.keys=[],this.bboxes=[]}this.n=eh,this.extent=R,this.padding=eu,this.scale=eh/R,this.uid=0;let e_=eu/eh*R;this.min=-e_,this.max=R+e_}
5insert(R,eh,eu,em,e_){this._forEachCell(eh,eu,em,e_,this._insertCell,this.uid++,void 0,void 0),this.keys.push(R),this.bboxes.push(eh),this.bboxes.push(eu),this.bboxes.push(em),this.bboxes.push(e_)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(R,eh,eu,em,e_,eg){this.cells[e_].push(eg)}query(R,eh,eu,em,e_){let eg=this.min,ev=this.max;if(R<=eg&&eh<=eg&&ev<=eu&&ev<=em&&!e_)return[...this.keys];{let eg=[];return this._forEachCell(R,eh,eu,em,this._queryCell,eg,{},e_),eg}}_queryCell(R,eh,eu,em,e_,eg,ev,ex){let eb=this.cells[e_];if(null!==eb){let e_=this.keys,ew=this.bboxes;for(let eT of eb)if(void 0===ev[eT]){let eb=4*eT;(ex?ex(ew[eb+0],ew[eb+1],ew[eb+2],ew[eb+3]):R<=ew[eb+2]&&eh<=ew[eb+3]&&eu>=ew[eb+0]&&em>=ew[eb+1])?(ev[eT]=!0,eg.push(e_[eT])):ev[eT]=!1}}}_forEachCell(R,eh,eu,em,e_,eg,ev,ex){let eb=this._convertToCellCoord(R),ew=this._convertToCellCoord(eh),eT=this._convertToCellCoord(eu),eS=this._convertToCellCoord(em);for(let eP=eb;eP<=eT;eP++)for(let eb=ew;eb<=eS;eb++){let ew=this.d*eb+eP;if((!ex||ex(this._convertFromCellCoord(eP),this._convertFromCellCoord(eb),this._convertFromCellCoord(eP+1),this._convertFromCellCoord(eb+1)))&&e_.call(this,R,eh,eu,em,ew,eg,ev,ex))return}}_convertFromCellCoord(R){return(R-this.padding)/this.scale}_convertToCellCoord(R){return Math.max(0,Math.min(this.d-1,Math.floor(R*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let R=this.cells,eh=3+this.cells.length+1+1,eu=0;for(let R of this.cells)eu+=R.length;let em=new Int32Array(eh+eu+this.keys.length+this.bboxes.length);em[0]=this.extent,em[1]=this.n,em[2]=this.padding;let e_=eh;for(let eh=0;eh<R.length;eh++){let eu=R[eh];em[3+eh]=e_,em.set(eu,e_),e_+=eu.length}return em[3+R.length]=e_,em.set(this.keys,e_),e_+=this.keys.length,em[3+R.length+1]=e_,em.set(this.bboxes,e_),e_+=this.bboxes.length,em.buffer}static serialize(R,eh){let eu=R.toArrayBuffer();return eh&&eh.push(eu),{buffer:eu}}static deserialize(R){return new ps(R.buffer)}};let iP={};function ds(R,eh,eu={}){if(iP[R])throw Error(`${R} is already registered.`);Object.defineProperty(eh,"_classRegistryKey",{value:R,writeable:!1}),iP[R]={klass:eh,omit:eu.omit||[],shallow:eu.shallow||[]}}for(let R in ds("Object",Object),ds("Set",Set),ds("TransferableGridIndex",ps),ds("Color",Te),ds("Error",Error),ds("AJAXError",pt),ds("ResolvedImage",Re),ds("StylePropertyFunction",ui),ds("StyleExpression",ri,{omit:["_evaluator"]}),ds("ZoomDependentExpression",ai),ds("ZoomConstantExpression",oi),ds("CompoundExpression",Br,{omit:["_evaluate"]}),im)im[R]._classRegistryKey||ds(`Expression_${R}`,im[R]);function ys(R){var eh;return R&&"undefined"!=typeof ArrayBuffer&&(R instanceof ArrayBuffer||"ArrayBuffer"===(null===(eh=R.constructor)||void 0===eh?void 0:eh.name))}function ms(R){return R.$name||R.constructor._classRegistryKey}function gs(R){return!function(R){if(null===R||"object"!=typeof R)return!1;let eh=ms(R);return eh&&"Object"!==eh}(R)&&(null==R||"boolean"==typeof R||"number"==typeof R||"string"==typeof R||R instanceof Boolean||R instanceof Number||R instanceof String||R instanceof Date||R instanceof RegExp||R instanceof Blob||R instanceof Error||ys(R)||H(R)||ArrayBuffer.isView(R)||R instanceof ImageData)}function xs(R,eh){if(gs(R))return(ys(R)||H(R))&&eh&&eh.push(R),ArrayBuffer.isView(R)&&eh&&eh.push(R.buffer),R instanceof ImageData&&eh&&eh.push(R.data.buffer),R;if(Array.isArray(R)){let eu=[];for(let em of R)eu.push(xs(em,eh));return eu}if("object"!=typeof R)throw Error("can't serialize object of type "+typeof R);let eu=ms(R);if(!eu)throw Error(`can't serialize object of unregistered class ${R.constructor.name}`);if(!iP[eu])throw Error(`${eu} is not registered.`);let{klass:em}=iP[eu],e_=em.serialize?em.serialize(R,eh):{};if(em.serialize){if(e_===(null==eh?void 0:eh[eh.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let em in R){if(!R.hasOwnProperty(em)||iP[eu].omit.includes(em))continue;let eg=R[em];e_[em]=iP[eu].shallow.includes(em)?eg:xs(eg,eh)}R instanceof Error&&(e_.message=R.message)}if(e_.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==eu&&(e_.$name=eu),e_}function vs(R){if(gs(R))return R;
5if(Array.isArray(R))return R.map(vs);if("object"!=typeof R)throw Error("can't deserialize object of type "+typeof R);let eh=ms(R)||"Object";if(!iP[eh])throw Error(`can't deserialize unregistered class ${eh}`);let{klass:eu}=iP[eh];if(!eu)throw Error(`can't deserialize unregistered class ${eh}`);if(eu.deserialize)return eu.deserialize(R);let em=Object.create(eu.prototype);for(let eu of Object.keys(R)){if("$name"===eu)continue;let e_=R[eu];em[eu]=iP[eh].shallow.includes(eu)?e_:vs(e_)}return em}let bs=class bs{constructor(){this.first=!0}update(R,eh){let eu=Math.floor(R);return this.first?(this.first=!1,this.lastIntegerZoom=eu,this.lastIntegerZoomTime=0,this.lastZoom=R,this.lastFloorZoom=eu,!0):(this.lastFloorZoom>eu?(this.lastIntegerZoom=eu+1,this.lastIntegerZoomTime=eh):this.lastFloorZoom<eu&&(this.lastIntegerZoom=eu,this.lastIntegerZoomTime=eh),R!==this.lastZoom&&(this.lastZoom=R,this.lastFloorZoom=eu,!0))}};function _s(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 Ss(R){return/\s/u.test(String.fromCodePoint(R))}function As(R){for(let eh of R)if(_s(eh.codePointAt(0)))return!0;return!1}function ks(R){let eh=R.map(R=>{try{return RegExp(`\\p{sc=${R}}`,"u").source}catch(R){return null}}).filter(R=>R);return RegExp(eh.join("|"),"u")}let iI=ks(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ts(R){return!(_s(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(R)))}let iM=ks(["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 Ps(R){return iM.test(String.fromCodePoint(R))}let iE=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(iE.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=R.applyArabicShaping,this.processBidirectionalText=R.processBidirectionalText,this.processStyledBidirectionalText=R.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(R,eh){return e(this,void 0,void 0,function*(){if(this.isParsed())return this.get
5State();if("loading"!==R.pluginStatus)return this.setState(R),R;let eu=R.pluginURL,em=new Promise(R=>{this.loadScriptResolve=R});eh(eu);let e_=new Promise(R=>setTimeout(()=>R(),this.TIMEOUT));if(yield Promise.race([em,e_]),this.isParsed()){let R={pluginStatus:"loaded",pluginURL:eu};return this.setState(R),R}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${eu}`)})}};let Cs=class Cs{constructor(R,eh){this.isSupportedScript=Vs,this.zoom=R,eh?(this.now=eh.now||0,this.fadeDuration=eh.fadeDuration||0,this.zoomHistory=eh.zoomHistory||new bs,this.transition=eh.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new bs,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let R=this.zoom,eh=R-Math.floor(R),eu=this.crossFadingFactor();return R>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:eh+(1-eh)*eu}:{fromScale:.5,toScale:1,t:1-(1-eu)*eh}}};function Vs(R){return function(R,eh){for(let em of R){var eu;if(eu=em.codePointAt(0),!eh&&Ps(eu)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(eu)))return!1}return!0}(R,"loaded"===iE.getRTLTextPluginStatus())}let iC="-transition";let Os=class Os{constructor(R,eh,eu){this.property=R,this.value=eh,this.expression=function(R,eh,eu){if(Hr(R))return new ui(R,eh);if(ii(R)){let em=li(R,eh,eu);if("error"===em.result)throw Error(em.value.map(R=>`${R.key}: ${R.message}`).join(", "));return em.value}{let eu=R;return"color"===eh.type&&"string"==typeof R?eu=Te.parse(R):"padding"===eh.type&&("number"==typeof R||Array.isArray(R))?eu=Be.parse(R):"numberArray"===eh.type&&("number"==typeof R||Array.isArray(R))?eu=Ce.parse(R):"colorArray"===eh.type&&("string"==typeof R||Array.isArray(R))?eu=Ve.parse(R):"variableAnchorOffsetCollection"===eh.type&&Array.isArray(R)?eu=$e.parse(R):"projectionDefinition"===eh.type&&"string"==typeof R&&(eu=Ne.parse(R)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>eu}}}(void 0===eh?R.specification.default:eh,R.specification,eu)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(R,eh,eu){return this.property.possiblyEvaluate(this,R,eh,eu)}};let $s=class $s{constructor(R,eh){this.property=R,this.value=new Os(R,void 0,eh)}transitioned(R,eh){return new Ns(this.property,this.value,eh,$({},R.transition,this.transition),R.now)}untransitioned(){return new Ns(this.property,this.value,null,{},0)}};let Rs=class Rs{constructor(R,eh){this._properties=R,this._values=Object.create(R.defaultTransitionablePropertyValues),this._globalState=eh}hasProperty(R){return R in this._properties.defaultTransitionablePropertyValues}getValue(R){return j(this._values[R].value.value)}setValue(R,eh){Object.hasOwn(this._values,R)||(this._values[R]=new $s(this._values[R].property,this._globalState)),this._values[R].value=new Os(this._values[R].property,null===eh?void 0:j(eh),this._globalState)}getTransition(R){return j(this._values[R].transition)}setTransition(R,eh){Object.hasOwn(this._values,R)||(this._values[R]=new $s(this._values[R].property,this._globalState)),this._values[R].transition=j(eh)||void 0}serialize(){let R={};for(let eh of Object.keys(this._values)){let eu=this.getValue(eh);void 0!==eu&&(R[eh]=eu);let em=this.getTransition(eh);void 0!==em&&(R[`${eh}${iC}`]=em)}return R}transitioned(R,eh){let eu=new Us(this._properties);for(let em of Object.keys(this._values))eu._values[em]=this._values[em].transitioned(R,eh._values[em]);return eu}untransitioned(){let R=new Us(this._properties);for(let eh of Object.keys(this._values))R._values[eh]=this._values[eh].untransitioned();return R}};let Ns=class Ns{constructor(R,eh,eu,em,e_){this.property=R,this.value=eh,this.begin=e_+em.delay||0,this.end=this.begin+em.duration||0,R.specification.transition&&(em.delay||em.duration)&&(this.prior=eu)}possiblyEvaluate(R,eh,eu){let em=R.now||0,e_=this.value.possiblyEvaluate(R,eh,eu),eg=this.prior;if(eg){if(em>this.end||this.value.isDataDriven())return this.prior=null,e_;if(em<this.begin)return eg.possiblyEvaluate(R,eh,eu);{let ev=(em-this.begin)/(this.end-this.begin);return this.property.interpolate(eg.possiblyEvaluate(R,eh,eu),e_,B(ev))}}return e_}};let Us=class Us{constructor(R){this._properties=R,this._values=Object.create(R.defaultTransitioningPropertyValues)}possiblyEvaluate(R,eh,eu){let em=new Gs(this._properties);for(let e_ of Object.keys(this._values))em._values[e_]=this._values[e_].possiblyEvaluate(R,eh,eu);return em}hasTransition(){for(let R of Object.keys(this._values))if(this._values[R].prior)return!0;return!1}};let js=class js{constructor(R,eh){this._properties=R,this._values=Object.create(R.defaultPropertyValues),this._globalState=eh}hasValue(R){return void 0!==this._values[R].value}hasProperty(R){return R in this._properties.defaultPropertyValues}getValue(R){return j(this._values[R].value)}setValue(R,eh){this._values[R]=new Os(this._values[R].property,null===eh?void 0:j(eh),this._globalState)}serialize(){let R={};for(let eh of Object.keys(this._values)){let eu=this.getValue(eh);void 0!==eu&&(R[eh]=eu)}return R}possiblyEvaluate(R,eh,eu){let em=new Gs(this._properties);for(let e_ of Object.keys(this._values))em._values[e_]=this._values[e_].possiblyEvaluate(R,eh,eu);return em}};let qs=class qs{constructor(R,eh,eu){this.property=R,this.value=eh,this.parameters=eu}isConstant(){return"constant"===this.value.kind}constantOr(R){return"constant"===this.value.kind?this.value.value:R}evaluate(R,eh,eu,em){return this.property.evaluate(this.value,this.parameters,R,eh,eu,em)}};let Gs=class Gs{constructor(R){this._properties=R,this._values=Object.create(R.defaultPossiblyEvaluatedValues)}get(R){return this._values[R]}};let Xs=class Xs{constructor(R){this.specification=R}possiblyEvaluate(R,eh){if(R.isDataDriven())throw Error("Value should not be data driven");return R.expression.evaluate(eh)}interpolate(R,eh,eu){let em=t1[this.specification.type];return em?em(R,eh,eu):R}};let Ys=class Ys{constructor(R,eh){this.specification=R,this.overrides=eh}possiblyEvaluate(R,eh,eu,em){return new qs(this,"constant"===R.expression.kind||"camera"===R.expression.kind?{kind:"constant",value:R.expression.evaluate(eh,null,{},eu,em)}:R.expression,eh)}interpolate(R,eh,eu){if("constant"!==R.value.kind||"constant"!==eh.value.kind)return R;if(void 0===R.value.value||void 0===eh.value.value)return new qs(this,{kind:"constant",value:void 0},R.parameters);let em=t1[this.specification.type];if(em){let e_=em(R.value.value,eh.value.value,eu);return new qs(this,{kind:"constant",value:e_},R.parameters)}return R}evaluate(R,eh,eu,em,e_,eg){return"constant"===R.kind?R.value:R.evaluate(eh,eu,em,e_,eg)}};let Zs=class Zs extends Ys{possiblyEvaluate(R,eh,eu,em){if(void 0===R.value)return new qs(this,{kind:"constant",value:void 0},eh);if("constant"===R.expression.kind){let e_=R.expression.evaluate(eh,null,{},eu,em),eg="resolvedImage"===R.property.specification.type&&"string"!=typeof e_?e_.name:e_,ev=this._calculate(eg,eg,eg,eh);return new qs(this,{kind:"constant",value:ev},eh)}if("camera"===R.expression.kind){let eu=this._calculate(R.expression.evaluate({zoom:eh.zoom
5-1}),R.expression.evaluate({zoom:eh.zoom}),R.expression.evaluate({zoom:eh.zoom+1}),eh);return new qs(this,{kind:"constant",value:eu},eh)}return new qs(this,R.expression,eh)}evaluate(R,eh,eu,em,e_,eg){if("source"===R.kind){let ev=R.evaluate(eh,eu,em,e_,eg);return this._calculate(ev,ev,ev,eh)}return"composite"===R.kind?this._calculate(R.evaluate({zoom:Math.floor(eh.zoom)-1},eu,em),R.evaluate({zoom:Math.floor(eh.zoom)},eu,em),R.evaluate({zoom:Math.floor(eh.zoom)+1},eu,em),eh):R.value}_calculate(R,eh,eu,em){return em.zoom>em.zoomHistory.lastIntegerZoom?{from:R,to:eh}:{from:eu,to:eh}}interpolate(R){return R}};let Hs=class Hs{constructor(R){this.specification=R}possiblyEvaluate(R,eh,eu,em){if(void 0!==R.value){if("constant"===R.expression.kind){let e_=R.expression.evaluate(eh,null,{},eu,em);return this._calculate(e_,e_,e_,eh)}return this._calculate(R.expression.evaluate(new Cs(Math.floor(eh.zoom-1),eh)),R.expression.evaluate(new Cs(Math.floor(eh.zoom),eh)),R.expression.evaluate(new Cs(Math.floor(eh.zoom+1),eh)),eh)}}_calculate(R,eh,eu,em){return em.zoom>em.zoomHistory.lastIntegerZoom?{from:R,to:eh}:{from:eu,to:eh}}interpolate(R){return R}};let Ws=class Ws{constructor(R){this.specification=R}possiblyEvaluate(R,eh,eu,em){return!!R.expression.evaluate(eh,null,{},eu,em)}interpolate(){return!1}};let Ks=class Ks{constructor(R){for(let eh in this.properties=R,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],R){let eu=R[eh];eu.specification.overridable&&this.overridableProperties.push(eh);let em=this.defaultPropertyValues[eh]=new Os(eu,void 0,void 0),e_=this.defaultTransitionablePropertyValues[eh]=new $s(eu,void 0);this.defaultTransitioningPropertyValues[eh]=e_.untransitioned(),this.defaultPossiblyEvaluatedValues[eh]=em.possiblyEvaluate({})}}};ds("DataDrivenProperty",Ys),ds("DataConstantProperty",Xs),ds("CrossFadedDataDrivenProperty",Zs),ds("CrossFadedProperty",Hs),ds("ColorRampProperty",Ws);let iA=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",iz=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";let to=class to extends bt{constructor(R,eh,eu){var em;if(super(),this.id=R.id,this.type=R.type,this._globalState=eu,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(em=this.visibility,new is(em,eu)),"custom"!==R.type&&(this.metadata=R.metadata,this.minzoom=R.minzoom,this.maxzoom=R.maxzoom,"background"!==R.type&&(this.source=R.source,this.sourceLayer=R["source-layer"],this.filter=R.filter,this._featureFilter=yi(R.filter,eu)),eh.layout&&(this._unevaluatedLayout=new js(eh.layout,eu)),eh.paint)){for(let em in this._transitionablePaint=new Rs(eh.paint,eu),R.paint)this.setPaintProperty(em,R.paint[em],{validate:!1});for(let eh in R.layout)this.setLayoutProperty(eh,R.layout[eh],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Gs(eh.paint)}}setFilter(R){this.filter=R,this._featureFilter=yi(R,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(R){var eh;if("visibility"===R)return this.visibility;if(null===(eh=this._transitionablePaint)||void 0===eh?void 0:eh.hasProperty(R))throw Error(R+iA);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${R}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(R)}getLayoutAffectingGlobalStateRefs(){let R=new Set;for(let eh of this._visibilityExpression.getGlobalStateRefs())R.add(eh);if(this._unevaluatedLayout)for(let eh in this._unevaluatedLayout._values){let eu=this._unevaluatedLayout._values[eh];for(let eh of eu.getGlobalStateRefs())R.add(eh)}for(let eh of this._featureFilter.getGlobalStateRefs())R.add(eh);return R}getPaintAffectingGlobalStateRefs(){var R;let eh=new globalThis.Map;if(this._transitionablePaint)for(let eu in this._transitionablePaint._values){let em=this._transitionablePaint._values[eu].value;for(let e_ of em.getGlobalStateRefs()){let eg=null!==(R=eh.get(e_))&&void 0!==R?R:[];eg.push({name:eu,value:em.value}),eh.set(e_,eg)}}return eh}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(R,eh,eu={}){var em;if("visibility"===R)return this.visibility=eh,this._visibilityExpression.setValue(eh),void this.recalculateVisibility();(null===(em=this._transitionablePaint)||void 0===em?void 0:em.hasProperty(R))?this.fire(new vt(Error(R+iA))):null!=eh&&this._val
5idate(iS,`layers.${this.id}.layout.${R}`,R,eh,eu)||this._unevaluatedLayout.setValue(R,eh)}getPaintProperty(R){var eh,eu;if(R.endsWith(iC)){let eu=R.slice(0,-11);if("visibility"===eu||(null===(eh=this._unevaluatedLayout)||void 0===eh?void 0:eh.hasProperty(eu)))throw Error(R+iz);return this._transitionablePaint.getTransition(eu)}if("visibility"===R||(null===(eu=this._unevaluatedLayout)||void 0===eu?void 0:eu.hasProperty(R)))throw Error(R+iz);return this._transitionablePaint.getValue(R)}setPaintProperty(R,eh,eu={}){var em;if("visibility"===R||(null===(em=this._unevaluatedLayout)||void 0===em?void 0:em.hasProperty(R)))return this.fire(new vt(Error(R+iz))),!1;if(null!=eh&&this._validate(iT,`layers.${this.id}.paint.${R}`,R,eh,eu))return!1;if(R.endsWith(iC))return this._transitionablePaint.setTransition(R.slice(0,-11),eh||void 0),!1;{let eu=this._transitionablePaint._values[R],em="cross-faded-data-driven"===eu.property.specification["property-type"],e_=eu.value.isDataDriven(),eg=eu.value;this._transitionablePaint.setValue(R,eh),this._handleSpecialPaintPropertyUpdate(R);let ev=this._transitionablePaint._values[R].value;return ev.isDataDriven()||e_||em||this._handleOverridablePaintPropertyUpdate(R,eg,ev)}}_handleSpecialPaintPropertyUpdate(R){}_handleOverridablePaintPropertyUpdate(R,eh,eu){return!1}isHidden(R=this.minzoom,eh=!1){return!!(this.minzoom&&R<(eh?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&R>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(R){this._transitioningPaint=this._transitionablePaint.transitioned(R,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(R,eh){R.getCrossfadeParameters&&(this._crossfadeParameters=R.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(R,void 0,eh)),this.paint=this._transitioningPaint.possiblyEvaluate(R,void 0,eh)}serialize(){var R,eh;
5let eu={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:null===(R=this._unevaluatedLayout)||void 0===R?void 0:R.serialize(),paint:null===(eh=this._transitionablePaint)||void 0===eh?void 0:eh.serialize()};return this.visibility&&(eu.layout=eu.layout||{},eu.layout.visibility=this.visibility),U(eu,(R,eh)=>!(void 0===R||"layout"===eh&&!Object.keys(R).length||"paint"===eh&&!Object.keys(R).length))}_validate(R,eh,eu,em,e_={}){return!1!==(null==e_?void 0:e_.validate)&&hs(this,R.call(Qi,{key:eh,layerType:this.type,objectKey:eu,value:em,styleSpec:t_,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let R in this.paint._values){let eh=this.paint.get(R);if(eh instanceof qs&&Gr(eh.property.specification)&&("source"===eh.value.kind||"composite"===eh.value.kind)&&eh.value.isStateDependent)return!0}return!1}};var iD={get paint(){return eg=eg||new Ks({"raster-opacity":new Xs(t_.paint_raster["raster-opacity"]),"raster-hue-rotate":new Xs(t_.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Xs(t_.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Xs(t_.paint_raster["raster-brightness-max"]),"raster-saturation":new Xs(t_.paint_raster["raster-saturation"]),"raster-contrast":new Xs(t_.paint_raster["raster-contrast"]),resampling:new Xs(t_.paint_raster.resampling),"raster-resampling":new Xs(t_.paint_raster["raster-resampling"]),"raster-fade-duration":new Xs(t_.paint_raster["raster-fade-duration"])})}};let ro=class ro extends to{constructor(R,eh){super(R,iD,eh)}};let ik={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};let so=class so{constructor(R,eh){this._structArray=R,this._pos1=eh*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};let oo=class oo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(R,eh){return R._trim(),eh&&(R.isTransferred=!0,eh.push(R.arrayBuffer)),{length:R.length,arrayBuffer:R.arrayBuffer}}static deserialize(R){let eh=Object.create(this.prototype);return eh.arrayBuffer=R.arrayBuffer,eh.length=R.length,eh.capacity=R.arrayBuffer.byteLength/eh.bytesPerElement,eh._refreshViews(),eh}_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(R){this.reserve(R),this.length=R}reserve(R){if(R>this.capacity){this.capacity=Math.max(R,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let eh=this.uint8;this._refreshViews(),eh&&this.uint8.set(eh)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function ao(R,eh=1){let eu=0,em=0;return{members:R.map(R=>{let e_=ik[R.type].BYTES_PER_ELEMENT,eg=eu=lo(eu,Math.max(eh,e_)),ev=R.components||1;return em=Math.max(em,e_),eu+=e_*ev,{name:R.name,type:R.type,components:ev,offset:eg}}),size:lo(eu,Math.max(em,eh)),alignment:eh}}function lo(R,eh){return Math.ceil(R/eh)*eh}let uo=class uo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh){let eu=this.length;return this.resize(eu+1),this.emplace(eu,R,eh)}emplace(R,eh,eu){let em=2*R;return this.int16[em+0]=eh,this.int16[em+1]=eu,R}};uo.prototype.bytesPerElement=4,ds("StructArrayLayout2i4",uo);let co=class co extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu){let em=this.length;return this.resize(em+1),this.emplace(em,R,eh,eu)}emplace(R,eh,eu,em){let e_=3*R;return this.int16[e_+0]=eh,this.int16[e_+1]=eu,this.int16[e_+2]=em,R}};co.prototype.bytesPerElement=6,ds("StructArrayLayout3i6",co);let ho=class ho extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em){let e_=this.length;return this.resize(e_+1),this.emplace(e_,R,eh,eu,em)}emplace(R,eh,eu,em,e_){let eg=4*R;return this.int16[eg+0]=eh,this.int16[eg+1]=eu,this.int16[eg+2]=em,this.int16[eg+3]=e_,R}};ho.prototype.bytesPerElement=8,ds("StructArrayLayout4i8",ho);let po=class po extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg){let ev=this.length;return this.resize(ev+1),this.emplace(ev,R,eh,eu,em,e_,eg)}emplace(R,eh,eu,em,e_,eg,ev){let ex=6*R;return this.int16[ex+0]=eh,this.int16[ex+1]=eu,this.int16[ex+2]=em,this.int16[ex+3]=e_,this.int16[ex+4]=eg,this.int16[ex+5]=ev,R}};po.prototype.bytesPerElement=12,ds("StructArrayLayout2i4i12",po);let fo=class fo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg){let ev=this.length;return this.resize(ev+1),this.emplace(ev,R,eh,eu,em,e_,eg)}emplace(R,eh,eu,em,e_,eg,ev){let ex=4*R,eb=8*R;return this.int16[ex+0]=eh,this.int16[ex+1]=eu,this.uint8[eb+4]=em,this.uint8[eb+5]=e_,this.uint8[eb+6
5]=eg,this.uint8[eb+7]=ev,R}};fo.prototype.bytesPerElement=8,ds("StructArrayLayout2i4ub8",fo);let yo=class yo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(R,eh){let eu=this.length;return this.resize(eu+1),this.emplace(eu,R,eh)}emplace(R,eh,eu){let em=2*R;return this.float32[em+0]=eh,this.float32[em+1]=eu,R}};yo.prototype.bytesPerElement=8,ds("StructArrayLayout2f8",yo);let mo=class mo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg,ev,ex,eb,ew){let eT=this.length;return this.resize(eT+1),this.emplace(eT,R,eh,eu,em,e_,eg,ev,ex,eb,ew)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT){let eS=10*R;return this.uint16[eS+0]=eh,this.uint16[eS+1]=eu,this.uint16[eS+2]=em,this.uint16[eS+3]=e_,this.uint16[eS+4]=eg,this.uint16[eS+5]=ev,this.uint16[eS+6]=ex,this.uint16[eS+7]=eb,this.uint16[eS+8]=ew,this.uint16[eS+9]=eT,R}};mo.prototype.bytesPerElement=20,ds("StructArrayLayout10ui20",mo);let go=class go extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg,ev,ex){let eb=this.length;return this.resize(eb+1),this.emplace(eb,R,eh,eu,em,e_,eg,ev,ex)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=8*R;return this.uint16[ew+0]=eh,this.uint16[ew+1]=eu,this.uint16[ew+2]=em,this.uint16[ew+3]=e_,this.uint16[ew+4]=eg,this.uint16[ew+5]=ev,this.uint16[ew+6]=ex,this.uint16[ew+7]=eb,R}};go.prototype.bytesPerElement=16,ds("StructArrayLayout8ui16",go);let xo=class xo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS){let eP=this.length;return this.resize(eP+1),this.emplace(eP,R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI=12*R;return this.int16[eI+0]=eh,this.int16[eI+1]=eu,this.int16[eI+2]=em,this.int16[eI+3]=e_,this.uint16[eI+4]=eg,this.uint16[eI+5]=ev,this.uint16[eI+6]=ex,this.uint16[eI+7]=eb,this.int16[eI+8]=ew,this.int16[eI+9]=eT,this.int16[eI+10]=eS,this.int16[eI+11]=eP,R}};xo.prototype.bytesPerElement=24,ds("StructArrayLayout4i4ui4i24",xo);let vo=class vo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(R,eh,eu){let em=this.length;return this.resize(em+1),this.emplace(em,R,eh,eu)}emplace(R,eh,eu,em){let e_=3*R;return this.float32[e_+0]=eh,this.float32[e_+1]=eu,this.float32[e_+2]=em,R}};vo.prototype.bytesPerElement=12,ds("StructArrayLayout3f12",vo);let bo=class bo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(R){let eh=this.length;return this.resize(eh+1),this.emplace(eh,R)}emplace(R,eh){return this.uint32[1*R+0]=eh,R}};bo.prototype.bytesPerElement=4,ds("StructArrayLayout1ul4",bo);let wo=class wo extends oo{_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(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=this.length;return this.resize(ew+1),this.emplace(ew,R,eh,eu,em,e_,eg,ev,ex,eb)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb,ew){let eT=10*R;return this.int16[eT+0]=eh,this.int16[eT+1]=eu,this.int16[eT+2]=em,this.int16[eT+3]=e_,this.int16[eT+4]=eg,this.int16[eT+5]=ev,this.uint32[5*R+3]=ex,this.uint16[eT+8]=eb,this.uint16[eT+9]=ew,R}};wo.prototype.bytesPerElement=20,ds("StructArrayLayout6i1ul2ui20",wo);let _o=class _o extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg){let ev=this.length;return this.resize(ev+1),this.emplace(ev,R,eh,eu,em,e_,eg)}emplace(R,eh,eu,em,e_,eg,ev){let ex=6*R;return this.int16[ex+0]=eh,this.int16[ex+1]=eu,this.int16[ex+2]=em,this.int16[ex+3]=e_,this.int16[ex+4]=eg,this.int16[ex+5]=ev,R}};_o.prototype.bytesPerElement=12,ds("StructArrayLayout2i2i2i12",_o);let So=class So extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_){let eg=this.length;return this.resize(eg+1),this.emplace(eg,R,eh,eu,em,e_)}emplace(R,eh,eu,em,e_,eg){let ev=4*R,ex=8*R;return this.float32[ev+0]=eh,this.float32[ev+1]=eu,this.float32[ev+2]=em,this.int16[ex+6]=e_,this.int16[ex+7]=eg,R}};So.prototype.bytesPerElement=16,ds("StructArrayLayout2f1f2i16",So);let Ao=class Ao extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em,e_,eg){let ev=this.length;return this.resize(ev+1),this.emplace(ev,R,eh,eu,em,e_,eg)}emplace(R,eh,eu,em,e_,eg,ev){let ex=16*R,eb=4*R,ew=8*R;return this.uint8[ex+0]=eh,this.uint8[ex+1]=eu,this.float32[eb+1]=em,this.float32[eb+2]=e_,this.int16[ew+6]=eg,this.int16[ew+7]=ev,R}};Ao.prototype.bytesPerElement=16,ds("StructArrayLayout2ub2f2i16",Ao);let Mo=class Mo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh,eu){let em=this.length;return this.resize(em+1),this.emplace(em,R,eh,eu)}emplace(R,eh,eu,em){let e_=3*R;return this.uint16[e_+0]=eh,this.uint16[e_+1]=eu,this.uint16[e_+2]=em,R}};Mo.prototype.bytesPerElement=6,ds("StructArrayLayout3ui6",Mo);let ko=class ko extends oo{_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(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC){let eA=this.length;return this.resize(eA+1),this.emplace(eA,R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA){let ez=24*R,eD=12*R,ek=48*R;return this.int16[ez+0]=eh,this.int16[ez+1]=eu,this.uint16[ez+2]=em,this.uint16[ez+3]=e_,this.uint32[eD+2]=eg,this.uint32[eD+3]=ev,this.uint32[eD+4]=ex,this.uint16[ez+10]=eb,this.uint16[ez+11]=ew,this.uint16[ez+12]=eT,this.float32[eD+7]=eS,this.float32[eD+8]=eP,this.uint8[ek+36]=eI,this.uint8[ek+37]=eM,this.uint8[ek+38]=eE,this.uint32[eD+10]=eC,this.int16[ez+22]=eA,R}};ko.prototype.bytesPerElement=48,ds("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ko);let Io=class Io extends oo{_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(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek,eR,eL,eF,eB,eO,eV,ej){let eN=this.length;return this.resize(eN+1),this.emplace(eN,R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek,eR,eL,eF,eB,eO,eV,ej)}emplace(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek,eR,eL,eF,eB,eO,eV,ej,eN){let eU=32*R,eG=16*R;return this.int16[eU+0]=eh,this.int16[eU+1]=eu,this.int16[eU+2]=em,this.int16[eU+3]=e_,this.int16[eU+4]=eg,this.int16[eU+5]=ev,this.int16[eU+6]=ex,this.int16[eU+7]=eb,this.uint16[eU+8]=ew,this.uint16[eU+9]=eT,this.uint16[eU+10]=eS,this.uint16[eU+11]=eP,this.uint16[eU+12]=eI,this.uint16[eU+13]=eM,this.uint16[eU+14]=eE,this.uint16[eU+15]=eC,this.uint16[eU+16]=eA,this.uint16[eU+17]=ez,this.uint16[eU+18]=eD,this.uint16[eU+19]=ek,this.uint16[eU+20]=eR,this.uint16[eU+21]=eL,this.uint16[eU+22]=eF,this.uint32[eG+12]=eB,this.float32[eG+13]=eO,this.float32[eG+14]=eV,this.uint16[eU+30]=ej,this.uint16[eU+31]=eN,R}};Io.prototype.bytesPerElement=64,ds("StructArrayLayout8i15ui1ul2f2ui64",Io);let Eo=class Eo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(R){let eh=this.length;return this.resize(eh+1),this.emplace(eh,R)}emplace(R,eh){return this.float32[1*R+0]=eh,R}};Eo.prototype.bytesPerElement=4,ds("StructArrayLayout1f4",Eo);let To=class To extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(R,eh,eu){let em=this.length;return this.resize(em+1),this.emplace(em,R,eh,eu)}emplace(R,eh,eu,em){let e_=3*R;return this.uint16[6*R+0]=eh,this.float32[e_+1]=eu,this.float32[e_+2]=em,R}};To.prototype.bytesPerElement=12,ds("StructArrayLayout1ui2f12",To);let Fo=class Fo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh,eu){let em=this.length;return this.resize(em+1),this.emplace(em,R,eh,eu)}emplace(R,eh,eu,em){let e_=4*R;return this.uint32[2*R+0]=eh,this.uint16[e_+2]=eu,this.uint16[e_+3]=em,R}};Fo.prototype.bytesPerElement=8,ds("StructArrayLayout1ul2ui8",Fo);let Po=class Po extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R,eh){let eu=this.length;return this.resize(eu+1),this.emplace(eu,R,eh)}emplace(R,eh,eu){let em=2*R;return this.uint16[em+0]=eh,this.uint16[em+1]=eu,R}};Po.prototype.bytesPerElement=4,ds("StructArrayLayout2ui4",Po);let Do=class Do extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(R){let eh=this.length;return this.resize(eh+1),this.emplace(eh,R)}emplace(R,eh){return this.uint16[1*R+0]=eh,R}};Do.prototype.bytesPerElement=2,ds("StructArrayLayout1ui2",Do);let zo=class zo extends oo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(R,eh,eu,em){let e_=this.length;return this.resize(e_+1),this.emplace(e_,R,eh,eu,em)}emplace(R,eh,eu,em,e_){let eg=4*R;return this.float32[eg+0]=eh,this.float32[eg+1]=eu,this.float32[eg+2]=em,this.float32[eg+3]=e_,R}};zo.prototype.bytesPerElement=16,ds("StructArrayLayout4f16",zo);let Bo=class Bo extends so{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]}
5get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}};Bo.prototype.size=20;let Co=class Co extends wo{get(R){return new Bo(this,R)}};ds("CollisionBoxArray",Co);let Vo=class Vo extends so{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(R){this._structArray.uint8[this._pos1+37]=R}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(R){this._structArray.uint8[this._pos1+38]=R}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(R){this._structArray.uint32[this._pos4+10]=R}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};Vo.prototype.size=48;let Lo=class Lo extends ko{get(R){return new Vo(this,R)}};ds("PlacedSymbolArray",Lo);let Oo=class Oo extends so{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(R){this._structArray.uint32[this._pos4+12]=R}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]}};Oo.prototype.size=64;let $o=class $o extends Io{get(R){return new Oo(this,R)}};ds("SymbolInstanceArray",$o);let Ro=class Ro extends Eo{getoffsetX(R){return this.float32[1*R+0]}};ds("GlyphOffsetArray",Ro);let No=class No extends co{getx(R){return this.int16[3*R+0]}gety(R){return this.int16[3*R+1]}gettileUnitDistanceFromAnchor(R){return this.int16[3*R+2]}};ds("SymbolLineVertexArray",No);let Uo=class Uo extends so{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]}};Uo.prototype.size=12;let jo=class jo extends To{get(R){return new Uo(this,R)}};ds("TextAnchorOffsetArray",jo);let qo=class qo extends so{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]}};qo.prototype.size=8;let Go=class Go extends Fo{get(R){return new qo(this,R)}};ds("FeatureIndexArray",Go);let Xo=class Xo extends uo{};let Yo=class Yo extends uo{};let Zo=class Zo extends uo{};let Ho=class Ho extends po{};let Wo=class Wo extends fo{};let Ko=class Ko extends yo{};let Jo=class Jo extends mo{};let Qo=class Qo extends go{};let ta=class ta extends xo{};let ea=class ea extends vo{};let na=class na extends bo{};let ra=class ra extends _o{};let ia=class ia extends Ao{};let sa=class sa extends Mo{};let oa=class oa extends Po{};let iR=ao([{name:"a_pos",components:2,type:"Int16"}],4),{members:iL}=iR;let ua=class ua{constructor(R=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=R}prepareSegment(R,eh,eu,em){let e_=this.segments[this.segments.length-1];return R>ua.MAX_VERTEX_ARRAY_LENGTH&&G(`Max vertices per segment is ${ua.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${R}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ua.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!e_||e_.vertexLength+R>ua.MAX_VERTEX_ARRAY_LENGTH||e_.sortKey!==em?this.createNewSegment(eh,eu,em):e_}createNewSegment(R,eh,eu){let em={vertexOffset:R.length,primitiveOffset:eh.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==eu&&(em.sortKey=eu),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(em),em}getOrCreateLatestSegment(R,eh,eu){return this.prepareSegment(0,R,eh,eu)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let R of this.segments)for(let eh in R.vaos)R.vaos[eh].destroy()}static simpleSegment(R,eh,eu,em){return new ua([{vertexOffset:R,primitiveOffset:eh,vertexLength:eu,primitiveLength:em,vaos:{},sortKey:0}])}};function ca(R,eh){return 256*(R=L(Math.floor(R),0,255))+L(Math.floor(eh),0,255)}ua.MAX_VERTEX_ARRAY_LENGTH=65535,ds("SegmentVector",ua);let iF=ao([{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"}]),iB=ao([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var iO,iV,ij,iN={exports:{}},iU={exports:{}},iG={exports:{}},i$=r(function(){if(ij)return iN.exports;ij=1;var R=(iO||(iO=1,iU.exports=function(R,eh){var eu,em,e_,eg,ev,ex;for(em=R.length-(eu=3&R.length),e_=eh,ex=0;ex<em;)ev=255&R.charCodeAt(ex)|(255&R.charCodeAt(++ex))<<8|(255&R.charCodeAt(++ex))<<16|(255&R.charCodeAt(++ex))<<24,++ex,e_=27492+(65535&(eg=5*(65535&(e_=(e_^=ev=(65535&(ev=(ev=(65535&ev)*3432918353+(((ev>>>16)*3432918353&65535)<<16)&4294967295)<<15|ev>>>17))*461845907+(((ev>>>16)*461845907&65535)<<16)&4294967295)<<13|e_>>>19))+((5*(e_>>>16)&65535)<<16)&4294967295))+((58964+(eg>>>16)&65535)<<16);switch(ev=0,eu){case 3:ev^=(255&R.charCodeAt(ex+2))<<16;case 2:ev^=(255&R.charCodeAt(ex+1))<<8;case 1:e_^=ev=(65535&(ev=(ev=(65535&(ev^=255&R.charCodeAt(ex)))*3432918353+(((ev>>>16)*3432918353&65535)<<16)&4294967295)<<15|ev>>>17))*461845907+(((ev>>>16)*461845907&65535)<<16)&4294967295}
5return e_^=R.length,e_=2246822507*(65535&(e_^=e_>>>16))+((2246822507*(e_>>>16)&65535)<<16)&4294967295,e_=3266489909*(65535&(e_^=e_>>>13))+((3266489909*(e_>>>16)&65535)<<16)&4294967295,(e_^=e_>>>16)>>>0}),iU.exports),eh=(iV||(iV=1,iG.exports=function(R,eh){for(var eu,em=R.length,e_=eh^em,eg=0;em>=4;)eu=1540483477*(65535&(eu=255&R.charCodeAt(eg)|(255&R.charCodeAt(++eg))<<8|(255&R.charCodeAt(++eg))<<16|(255&R.charCodeAt(++eg))<<24))+((1540483477*(eu>>>16)&65535)<<16),e_=1540483477*(65535&e_)+((1540483477*(e_>>>16)&65535)<<16)^(eu=1540483477*(65535&(eu^=eu>>>24))+((1540483477*(eu>>>16)&65535)<<16)),em-=4,++eg;switch(em){case 3:e_^=(255&R.charCodeAt(eg+2))<<16;case 2:e_^=(255&R.charCodeAt(eg+1))<<8;case 1:e_=1540483477*(65535&(e_^=255&R.charCodeAt(eg)))+((1540483477*(e_>>>16)&65535)<<16)}return e_=1540483477*(65535&(e_^=e_>>>13))+((1540483477*(e_>>>16)&65535)<<16),(e_^=e_>>>15)>>>0}),iG.exports);return iN.exports=R,iN.exports.murmur3=R,iN.exports.murmur2=eh,iN.exports}());let wa=class wa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(R,eh,eu,em){this.ids.push(_a(R)),this.positions.push(eh,eu,em)}getPositions(R){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let eh=_a(R),eu=0,em=this.ids.length-1;for(;eu<em;){let R=eu+em>>1;this.ids[R]>=eh?em=R:eu=R+1}let e_=[];for(;this.ids[eu]===eh;)e_.push({index:this.positions[3*eu],start:this.positions[3*eu+1],end:this.positions[3*eu+2]}),eu++;return e_}static serialize(R,eh){let eu=new Float64Array(R.ids),em=new Uint32Array(R.positions);return function Sa(R,eh,eu,em){for(;eu<em;){let e_=R[eu+em>>1],eg=eu-1,ev=em+1;for(;;){do eg++;while(R[eg]<e_);do ev--;while(R[ev]>e_);if(eg>=ev)break;Aa(R,eg,ev),Aa(eh,3*eg,3*ev),Aa(eh,3*eg+1,3*ev+1),Aa(eh,3*eg+2,3*ev+2)}ev-eu<em-ev?(Sa(R,eh,eu,ev),eu=ev+1):(Sa(R,eh,ev+1,em),em=ev)}}(eu,em,0,eu.length-1),eh&&eh.push(eu.buffer,em.buffer),{ids:eu,positions:em}}static deserialize(R){let eh=new wa;return eh.ids=R.ids,eh.positions=R.positions,eh.indexed=!0,eh}};function _a(R){let eh=+R;return!isNaN(eh)&&eh<=Number.MAX_SAFE_INTEGER?eh:i$(String(R))}function Aa(R,eh,eu){let em=R[eh];R[eh]=R[eu],R[eu]=em}ds("FeaturePositionMap",wa);let Ma=class Ma{constructor(R,eh){this.gl=R.gl,this.location=eh}};let ka=class ka extends Ma{constructor(R,eh){super(R,eh),this.current=0}set(R){this.current!==R&&(this.current=R,this.gl.uniform1f(this.location,R))}};let Ia=class Ia extends Ma{constructor(R,eh){super(R,eh),this.current=[0,0,0,0]}set(R){R[0]===this.current[0]&&R[1]===this.current[1]&&R[2]===this.current[2]&&R[3]===this.current[3]||(this.current=R,this.gl.uniform4f(this.location,R[0],R[1],R[2],R[3]))}};let Ea=class Ea extends Ma{constructor(R,eh){super(R,eh),this.current=Te.transparent}set(R){R.r===this.current.r&&R.g===this.current.g&&R.b===this.current.b&&R.a===this.current.a||(this.current=R,this.gl.uniform4f(this.location,R.r,R.g,R.b,R.a))}};let iZ=new Float32Array(16);function Fa(R){return[ca(255*R.r,255*R.g),ca(255*R.b,255*R.a)]}let Pa=class Pa{constructor(R,eh,eu){this.value=R,this.uniformNames=eh.map(R=>`u_${R}`),this.type=eu}setUniform(R,eh,eu){R.set(eu.constantOr(this.value))}getBinding(R,eh,eu){return"color"===this.type?new Ea(R,eh):new ka(R,eh)}};let Da=class Da{constructor(R,eh){this.uniformNames=eh.map(R=>`u_${R}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(R,eh){this.pixelRatioFrom=eh.pixelRatio,this.pixelRatioTo=R.pixelRatio,this.patternFrom=eh.tlbr,this.patternTo=R.tlbr}setConstantDashPositions(R,eh){this.dashTo=[0,R.y,R.height,R.width],this.dashFrom=[0,eh.y,eh.height,eh.width]}setUniform(R,eh,eu,em){let e_=null;"u_pattern_to"===em?e_=this.patternTo:"u_pattern_from"===em?e_=this.patternFrom:"u_dasharray_to"===em?e_=this.dashTo:"u_dasharray_from"===em?e_=this.dashFrom:"u_pixel_ratio_to"===em?e_=this.pixelRatioTo:"u_pixel_ratio_from"===em&&(e_=this.pixelRatioFrom),null!==e_&&R.set(e_)}getBinding(R,eh,eu){return eu.startsWith("u_pattern")||eu.startsWith("u_dasharray_")?new Ia(R,eh):new ka(R,eh)}};let za=class za{constructor(R,eh,eu,em){this.expression=R,this.type=eu,this.maxValue=0,this.paintVertexAttributes=eh.map(R=>({name:`a_${R}`,type:"Float32",components:"color"===eu?2:1,offset:0})),this.paintVertexArray=new em}populatePaintArray(R,eh,eu){let em=this.paintVertexArray.length,e_=this.expression.evaluate(new Cs(0,eu),eh,{},eu.canonical,[],eu.formattedSection);this.paintVertexArray.resize(R),this._setPaintValue(em,R,e_)}updatePaintArray(R,eh,eu,em,e_){let eg=this.expression.evaluate(new Cs(0,e_),eu,em);this._setPaintValue(R,eh,eg)}_setPaintValue(R,eh,eu){if("color"===this.type){let em=Fa(eu);for(let eu=R;eu<eh;eu++)this.paintVertexArray.emplace(eu,em[0],em[1])}else{for(let em=R;em<eh;em++)this.paintVertexArray.emplace(em,eu);this.maxValue=Math.max(this.maxValue,Math.abs(eu))}}upload(R){var eh,eu;(null===(eh=this.paintVertexArray)||void 0===eh?void 0:eh.arrayBuffer.byteLength)&&((null===(eu=this.paintVertexBuffer)||void 0===eu?void 0:eu.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=R.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};let Ba=class Ba{constructor(R,eh,eu,em,e_,eg){this.expression=R,this.uniformNames=eh.map(R=>`u_${R}_t`),this.type=eu,this.useIntegerZoom=em,this.zoom=e_,this.maxValue=0,this.paintVertexAttributes=eh.map(R=>({name:`a_${R}`,type:"Float32",components:"color"===eu?4:2,offset:0})),this.paintVertexArray=new eg}populatePaintArray(R,eh,eu){let em=this.expression.evaluate(new Cs(this.zoom,eu),eh,{},eu.canonical,[],eu.formattedSection),e_=this.expression.evaluate(new Cs(this.zoom+1,eu),eh,{},eu.canonical,[],eu.formattedSection),eg=this.paintVertexArray.length;this.paintVertexArray.resize(R),this._setPaintValue(eg,R,em,e_)}updatePaintArray(R,eh,eu,em,e_){let eg=this.expression.evaluate(new Cs(this.zoom,e_),eu,em),ev=this.expression.evaluate(new Cs(this.zoom+1,e_),eu,em);this._setPaintValue(R,eh,eg,ev)}_setPaintValue(R,eh,eu,em){if("color"===this.type){let e_=Fa(eu),eg=Fa(em);for(let eu=R;eu<eh;eu++)this.paintVertexArray.emplace(eu,e_[0],e_[1],eg[0],eg[1])}else{for(let e_=R;e_<eh;e_++)this.paintVertexArray.emplace(e_,eu,em);this.maxValue=Math.max(this.maxValue,Math.abs(eu),Math.abs(em))}}upload(R){var eh,eu;(null===(eh=this.paintVertexArray)||void 0===eh?void 0:eh.arrayBuffer.byteLength)&&((null===(eu=this.paintVertexBuffer)||void 0===eu?void 0:eu.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=R.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(R,eh){let eu=this.useIntegerZoom?Math.floor(eh.zoom):eh.zoom,em=L(this.expression.interpolationFactor(eu,this.zoom,this.zoom+1),0,1);R.set(em)}getBinding(R,eh,eu){return new ka(R,eh)}};let Ca=class Ca{constructor(R,eh,eu,em,e_,eg){this.expression=R,this.type=eh,this.useIntegerZoom=eu,this.zoom=em,this.layerId=eg,this.zoomInPaintVertexArray=new e_,this.zoomOutPaintVertexArray=new e_}populatePaintArray(R,eh,eu){let em=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(R),this.zoomOutPaintVertexArray.resize(R),this._setPaintValues(em,R,this.getPositionIds(eh),eu)}updatePaintArray(R,eh,eu,em,e_){this._setPaintValues(R,eh,this.getPositionIds(eu),e_)}_setPaintValues(R,eh,eu,em){let e_=this.getPositions(em);if(!e_||!eu)return;let eg=e_[eu.min],ev=e_[eu.mid],ex=e_[eu.max];if(eg&&ev&&ex)for(let eu=R;eu<eh;eu++)this.emplace(this.zoomInPaintVertexArray,eu,ev,eg),this.emplace(this.zoomOutPaintVertexArray,eu,ev,ex)}upload(R){var eh,eu;if((null===(eh=this.zoomInPaintVertexArray)||void 0===eh?void 0:eh.arrayBuffer.byteLength)&&(null===(eu=this.zoomOutPaintVertexArray)||void 0===eu?void 0:eu.arrayBuffer.byteLength)){let eh=this.getVertexAttributes();this.zoomInPaintVertexBuffer=R.createVertexBuffer(this.zoomInPaintVertexArray,eh,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=R.createVertexBuffer(this.zoomOutPaintVertexArray,eh,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};let Va=class Va extends Ca{getPositions(R){return R.imagePositions}getPositionIds(R){var eh;return null===(eh=R.patterns)||void 0===eh?void 0:eh[this.layerId]}getVertexAttributes(){return iF.members}emplace(R,eh,eu,em){R.emplace(eh,eu.tlbr[0],eu.tlbr[1],eu.tlbr[2],eu.tlbr[3],em.tlbr[0],em.tlbr[1],em.tlbr[2],em.tlbr[3],eu.pixelRatio,em.pixelRatio)}};let La=class La extends Ca{getPositions(R){return R.dashPositions}getPositionIds(R){var eh;return null===(eh=R.dashes)||void 0===eh?void 0:eh[this.layerId]}getVertexAttributes(){return iB.members}emplace(R,eh,eu,em){R.emplace(eh,0,eu.y,eu.height,eu.width,0,em.y,em.height,em.width)}};let Oa=class Oa{constructor(R,eh,eu){this.binders={},this._buffers=[];let em=[];for(let eg in R.paint._values){var e_;if(!eu(eg))continue;let ev=R.paint.get(eg);if(!(ev instanceof qs&&Gr(ev.property.specification)))continue;let ex=(e_=R.type,({"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":["ga
5pwidth"],"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"]})[eg]||[eg.replace(`${e_}-`,"").replace(/-/g,"_")]),eb=ev.value,ew=ev.property.specification.type,eT=ev.property.useIntegerZoom,eS=ev.property.specification["property-type"],eP="cross-faded"===eS||"cross-faded-data-driven"===eS;if("constant"===eb.kind)this.binders[eg]=eP?new Da(eb.value,ex):new Pa(eb.value,ex,ew),em.push(`/u_${eg}`);else if("source"===eb.kind||eP){let eu=Na(eg,ew,"source");this.binders[eg]=eP?"line-dasharray"===eg?new La(eb,ew,eT,eh,eu,R.id):new Va(eb,ew,eT,eh,eu,R.id):new za(eb,ex,ew,eu),em.push(`/a_${eg}`)}else{let R=Na(eg,ew,"composite");this.binders[eg]=new Ba(eb,ex,ew,eT,eh,R),em.push(`/z_${eg}`)}}this.cacheKey=em.sort().join("")}getMaxValue(R){let eh=this.binders[R];return eh instanceof za||eh instanceof Ba?eh.maxValue:0}populatePaintArrays(R,eh,eu){for(let em in this.binders){let e_=this.binders[em];(e_ instanceof za||e_ instanceof Ba||e_ instanceof Ca)&&e_.populatePaintArray(R,eh,eu)}}setConstantPatternPositions(R,eh){for(let eu in this.binders){let em=this.binders[eu];em instanceof Da&&em.setConstantPatternPositions(R,eh)}}setConstantDashPositions(R,eh){for(let eu in this.binders){let em=this.binders[eu];em instanceof Da&&em.setConstantDashPositions(R,eh)}}updatePaintArrays(R,eh,eu,em,e_){let eg=!1;for(let ev in R){let ex=eh.getPositions(ev);for(let eh of ex){let ex=eu.feature(eh.index);for(let eu in this.binders){let eb=this.binders[eu];if((eb instanceof za||eb instanceof Ba||eb instanceof Ca)&&!0===eb.expression.isStateDependent){let ew=em.paint.get(eu);eb.expression=ew.value,eb.updatePaintArray(eh.start,eh.end,ex,R[ev],e_),eg=!0}}}}return eg}defines(){let R=[];for(let eh in this.binders){let eu=this.binders[eh];(eu instanceof Pa||eu instanceof Da)&&R.push(...eu.uniformNames.map(R=>`#define HAS_UNIFORM_${R}`))}return R}getBinderAttributes(){let R=[];for(let eh in this.binders){let eu=this.binders[eh];if(eu instanceof za||eu instanceof Ba)for(let eh of eu.paintVertexAttributes)R.push(eh.name);else if(eu instanceof Ca){let eh=eu.getVertexAttributes();for(let eu of eh)R.push(eu.name)}}return R}getBinderUniforms(){let R=[];for(let eh in this.binders){let eu=this.binders[eh];if(eu instanceof Pa||eu instanceof Da||eu instanceof Ba)for(let eh of eu.uniformNames)R.push(eh)}return R}getPaintVertexBuffers(){return this._buffers}getUniforms(R,eh){let eu=[];for(let em in this.binders){let e_=this.binders[em];if(e_ instanceof Pa||e_ instanceof Da||e_ instanceof Ba){for(let eg of e_.uniformNames)if(eh[eg]){let ev=e_.getBinding(R,eh[eg],eg);eu.push({name:eg,property:em,binding:ev})}}}return eu}setUniforms(R,eh,eu,em){for(let{name:R,property:e_,binding:eg}of eh)this.binders[e_].setUniform(eg,em,eu.get(e_),R)}updatePaintBuffers(R){for(let eh in this._buffers=[],this.binders){let eu=this.binders[eh];if(R&&eu instanceof Ca){let eh=2===R.fromScale?eu.zoomInPaintVertexBuffer:eu.zoomOutPaintVertexBuffer;eh&&this._buffers.push(eh)}else(eu instanceof za||eu instanceof Ba)&&eu.paintVertexBuffer&&this._buffers.push(eu.paintVertexBuffer)}}upload(R){for(let eh in this.binders){let eu=this.binders[eh];(eu instanceof za||eu instanceof Ba||eu instanceof Ca)&&eu.upload(R)}this.updatePaintBuffers()}destroy(){for(let R in this.binders){let eh=this.binders[R];(eh instanceof za||eh instanceof Ba||eh instanceof Ca)&&eh.destroy()}}};let $a=class $a{constructor(R,eh,eu=()=>!0){for(let em of(this.programConfigurations={},R))this.programConfigurations[em.id]=new Oa(em,eh,eu);this.needsUpload=!1,this._featureMap=new wa,this._bufferOffset=0}populatePaintArrays(R,eh,eu,em){for(let eu in this.programConfigurations)this.programConfigurations[eu].populatePaintArrays(R,eh,em);void 0!==eh.id&&this._featureMap.add(eh.id,eu,this._bufferOffset,R),this._bufferOffset=R,this.needsUpload=!0}updatePaintArrays(R,eh,eu,em){for(let e_ of eu)this.needsUpload=this.programConfigurations[e_.id].updatePaintArrays(R,this._featureMap,eh,e_,em)||this.needsUpload}get(R){return this.programConfigurations[R]}upload(R){if(this.needsUpload){for(let eh in this.programConfigurations)this.programConfigurations[eh].upload(R);this.needsUpload=!1}}destroy(){for(let R in this.programConfigurations)this.programConfigurations[R].destroy()}};function Na(R,eh,eu){let em={"line-pattern":{source:Jo,composite:Jo},"fill-pattern":{source:Jo,composite:Jo},"fill-extrusion-pattern":{source:Jo,composite:Jo},"line-dasharray":{source:Qo,composite:Qo}}[R];return(null==em?void 0:em[eu])||({color:{source:yo,composite:zo},number:{source:Eo,composite:yo}})[eh][eu]}ds("ConstantBinder",Pa),ds("CrossFadedConstantBinder",Da),ds("SourceExpressionBinder",za),ds("CrossFadedPatternBinder",Va),ds("CrossFadedDash
5arrayBinder",La),ds("CompositeExpressionBinder",Ba),ds("ProgramConfiguration",Oa,{omit:["_buffers"]}),ds("ProgramConfigurationSet",$a);let iq=-16383-1;function qa(R){let eh=8192/R.extent,eu=R.loadGeometry();for(let R of eu)for(let eu of R){let R=Math.round(eu.x*eh),em=Math.round(eu.y*eh);eu.x=L(R,iq,16383),eu.y=L(em,iq,16383),(R<eu.x||R>eu.x+1||em<eu.y||em>eu.y+1)&&G("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return eu}function Ga(R,eh){return{type:R.type,id:R.id,properties:R.properties,geometry:eh?qa(R):[]}}let Za=class Za{constructor(R){this.zoom=R.zoom,this.overscaling=R.overscaling,this.layers=R.layers,this.layerIds=this.layers.map(R=>R.id),this.index=R.index,this.hasDependencies=!1,this.layoutVertexArray=new Yo,this.indexArray=new sa,this.segments=new ua,this.programConfigurations=new $a(R.layers,R.zoom),this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id)}populate(R,eh,eu){let em=this.layers[0],e_=[],eg=null,ev=!1,ex="heatmap"===em.type;"circle"===em.type&&(ev=!(eg=em.layout.get("circle-sort-key")).isConstant(),ex=ex||"map"===em.paint.get("circle-pitch-alignment"));let eb=ex?eh.subdivisionGranularity.circle:1;for(let{feature:eh,id:em,index:ex,sourceLayerIndex:eb}of R){let R=this.layers[0]._featureFilter.needGeometry,ew=Ga(eh,R);if(!this.layers[0]._featureFilter.filter(new Cs(this.zoom),ew,eu))continue;let eT=ev?eg.evaluate(ew,{},eu):void 0,eS={id:em,properties:eh.properties,type:eh.type,sourceLayerIndex:eb,index:ex,geometry:R?ew.geometry:qa(eh),patterns:{},sortKey:eT};e_.push(eS)}for(let em of(ev&&e_.sort((R,eh)=>R.sortKey-eh.sortKey),e_)){let{geometry:e_,index:eg,sourceLayerIndex:ev}=em,ex=R[eg].feature;this.addFeature(em,e_,eg,eu,eb),eh.featureIndex.insert(ex,e_,eg,ev,this.index)}}update(R,eh,eu){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(R,eh,this.stateDependentLayers,{imagePositions:eu})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(R){this.uploaded||(this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,iL),this.indexBuffer=R.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(R),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(R,eh,eu,em,e_=1){let eg;switch(e_){case 1:eg=[0,7];break;case 3:eg=[0,2,5,7];break;case 5:eg=[0,1,3,4,6,7];break;case 7:eg=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${e_}; valid values are 1, 3, 5, 7.`)}let ev=eg.length;for(let eu of eh)for(let eh of eu){let eu=eh.x,em=eh.y;if(eu<0||eu>=8192||em<0||em>=8192)continue;let e_=this.segments.prepareSegment(ev*ev,this.layoutVertexArray,this.indexArray,R.sortKey),ex=e_.vertexLength;for(let R=0;R<ev;R++)for(let eh=0;eh<ev;eh++)!function(R,eh,eu,em,e_){R.emplaceBack(-32768+8*eh+em,-32768+8*eu+e_)}(this.layoutVertexArray,eu,em,eg[eh],eg[R]);for(let R=0;R<ev-1;R++)for(let eh=0;eh<ev-1;eh++){let eu=ex+R*ev+eh,em=ex+(R+1)*ev+eh;this.indexArray.emplaceBack(eu,em+1,eu+1),this.indexArray.emplaceBack(eu,em,em+1)}e_.vertexLength+=ev*ev,e_.primitiveLength+=(ev-1)*(ev-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,R,eu,{imagePositions:{},canonical:em})}};function Ha(R,eh){for(let eu of R)if(il(eh,eu))return!0;for(let eu of eh)if(il(R,eu))return!0;return Qa(R,eh)}function Wa(R,eh,eu){return!!il(R,eh)||el(eh,R,eu)}function Ka(R,eh){if(1===R.length)return rl(eh,R[0]);for(let eu of eh)for(let eh of eu)if(il(R,eh))return!0;for(let eu of R)if(rl(eh,eu))return!0;for(let eu of eh)if(Qa(R,eu))return!0;return!1}function Qa(R,eh){if(0===R.length||0===eh.length)return!1;for(let e_=0;e_<R.length-1;e_++){let eg=R[e_],ev=R[e_+1];for(let R=0;R<eh.length-1;R++){var eu,em;if(X(eg,eu=eh[R],em=eh[R+1])!==X(ev,eu,em)&&X(eg,ev,eu)!==X(eg,ev,em))return!0}}return!1}function el(R,eh,eu){let em=eu*eu;if(1===eh.length)return R.distSqr(eh[0])<em;for(let eu=1;eu<eh.length;eu++)if(nl(R,eh[eu-1],eh[eu])<em)return!0;return!1}function nl(R,eh,eu){let em=eh.distSqr(eu);if(0===em)return R.distSqr(eh);
5let e_=((R.x-eh.x)*(eu.x-eh.x)+(R.y-eh.y)*(eu.y-eh.y))/em;return R.distSqr(e_<0?eh:e_>1?eu:eu.sub(eh)._mult(e_)._add(eh))}function rl(R,eh){let eu,em,e_=!1;for(let eg of R)for(let R=0,ev=eg.length-1;R<eg.length;ev=R++)eu=eg[R],em=eg[ev],eu.y>eh.y!=em.y>eh.y&&eh.x<(em.x-eu.x)*(eh.y-eu.y)/(em.y-eu.y)+eu.x&&(e_=!e_);return e_}function il(R,eh){let eu=!1;for(let em=0,e_=R.length-1;em<R.length;e_=em++){let eg=R[em],ev=R[e_];eg.y>eh.y!=ev.y>eh.y&&eh.x<(ev.x-eg.x)*(eh.y-eg.y)/(ev.y-eg.y)+eg.x&&(eu=!eu)}return eu}function ol(R,eh,eu){let em=eh.paint.get(R).value;return"constant"===em.kind?em.value:eu.programConfigurations.get(eh.id).getMaxValue(R)}function al(R){return Math.sqrt(R[0]*R[0]+R[1]*R[1])}function ll(R,eh,eu,em,e_){if(!eh[0]&&!eh[1])return R;let eg=n.convert(eh)._mult(e_);"viewport"===eu&&eg._rotate(-em);let ev=[];for(let eh of R)ev.push(eh.sub(eg));return ev}function cl({queryGeometry:R,size:eh},eu){return Wa(R,eu,eh)}function hl({queryGeometry:R,size:eh,transform:eu,unwrappedTileID:em,getElevation:e_},eg){return Wa(R,eg,eh*(eu.projectTileCoordinates(eg.x,eg.y,em,e_).signedDistanceFromCamera/eu.cameraToCenterDistance))}function pl({queryGeometry:R,size:eh,transform:eu,unwrappedTileID:em,getElevation:e_},eg){let ev=eu.projectTileCoordinates(eg.x,eg.y,em,e_).signedDistanceFromCamera,ex=eh*(eu.cameraToCenterDistance/ev);return Wa(R,yl(eg,eu,em,e_),ex)}function fl({queryGeometry:R,size:eh,transform:eu,unwrappedTileID:em,getElevation:e_},eg){return Wa(R,yl(eg,eu,em,e_),eh)}function dl({queryGeometry:R,size:eh,transform:eu,unwrappedTileID:em,getElevation:e_,pitchAlignment:eg="map",pitchScale:ev="map"},ex){let eb="map"===eg?"map"===ev?cl:hl:"map"===ev?pl:fl,ew={queryGeometry:R,size:eh,transform:eu,unwrappedTileID:em,getElevation:e_};for(let R of ex)for(let eh of R)if(eb(ew,eh))return!0;return!1}function yl(R,eh,eu,em){let e_=eh.projectTileCoordinates(R.x,R.y,eu,em).point;return new n((.5*e_.x+.5)*eh.width,(-(.5*e_.y)+.5)*eh.height)}ds("CircleBucket",Za,{omit:["layers"]});var iW={get paint(){return ex=ex||new Ks({"circle-radius":new Ys(t_.paint_circle["circle-radius"]),"circle-color":new Ys(t_.paint_circle["circle-color"]),"circle-blur":new Ys(t_.paint_circle["circle-blur"]),"circle-opacity":new Ys(t_.paint_circle["circle-opacity"]),"circle-translate":new Xs(t_.paint_circle["circle-translate"]),"circle-translate-anchor":new Xs(t_.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Xs(t_.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Xs(t_.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ys(t_.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ys(t_.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ys(t_.paint_circle["circle-stroke-opacity"])})},get layout(){return ev=ev||new Ks({"circle-sort-key":new Ys(t_.layout_circle["circle-sort-key"])})}};let vl=class vl extends to{constructor(R,eh){super(R,iW,eh)}createBucket(R){return new Za(R)}queryRadius(R){return ol("circle-radius",this,R)+ol("circle-stroke-width",this,R)+al(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:R,feature:eh,featureState:eu,geometry:em,transform:e_,pixelsToTileUnits:eg,unwrappedTileID:ev,getElevation:ex}){let eb,ew;let eT=ll(R,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-e_.bearingInRadians,eg),eS=this.paint.get("circle-radius").evaluate(eh,eu)+this.paint.get("circle-stroke-width").evaluate(eh,eu),eP=this.paint.get("circle-pitch-scale"),eI=this.paint.get("circle-pitch-alignment");return"map"===eI?(eb=eT,ew=eS*eg):(eb=eT.map(R=>yl(R,e_,ev,ex)),ew=eS),dl({queryGeometry:eb,size:ew,transform:e_,unwrappedTileID:ev,getElevation:ex,pitchAlignment:eI,pitchScale:eP},em)}};let bl=class bl extends Za{};ds("HeatmapBucket",bl,{omit:["layers"]});var iX={get paint(){return eb=eb||new Ks({"heatmap-radius":new Ys(t_.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ys(t_.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Xs(t_.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ws(t_.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Xs(t_.paint_heatmap["heatmap-opacity"])})}};function Sl(R,{width:eh,height:eu},em,e_){if(e_){if(e_ instanceof Uint8ClampedArray)e_=new Uint8Array(e_.buffer);else if(e_.length!==eh*eu*em)throw RangeError(`mismatched image size. expected: ${e_.length} but got: ${eh*eu*em}`)}else e_=new Uint8Array(eh*eu*em);return R.width=eh,R.height=eu,R.data=e_,R}function Al(R,{width:eh,height:eu},em){if(eh===R.width&&eu===R.height)return;let e_=Sl({},{width:eh,height:eu},em);Ml(R,e_,{x:0,y:0},{x:0,y:0},{width:Math.min(R.width,eh),height:Math.min(R.height,eu)},em),R.width=eh,R.height=eu,R.data=e_.data}function Ml(R,eh,eu,em,e_,eg){if(0===e_.width||0===e_.height)return eh;if(e_.width>R.width||e_.height>R.height||eu.x>R.width-e_.width||eu.y>R.height-e_.height)throw RangeError("out of range source coordinates for image copy");if(e_.width>eh.width||e_.height>eh.height||em.x>eh.width-e_.width||em.y>eh.height-e_.height)throw RangeError("out of range destination coordinates for image copy");let ev=R.data,ex=eh.data;if(ev===ex)throw Error("srcData equals dstData, so image is already copied");for(let eb=0;eb<e_.height;eb++){let ew=((eu.y+eb)*R.width+eu.x)*eg,eT=((em.y+eb)*eh.width+em.x)*eg;for(let R=0;R<e_.width*eg;R++)ex[eT+R]=ev[ew+R]}return eh}let kl=class kl{constructor(R,eh){Sl(this,R,1,eh)}resize(R){Al(this,R,1)}clone(){return new kl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(R,eh,eu,em,e_){Ml(R,eh,eu,em,e_,1)}};let Il=class Il{constructor(R,eh){Sl(this,R,4,eh)}resize(R){Al(this,R,4)}replace(R,eh){eh?this.data.set(R):this.data=R instanceof Uint8ClampedArray?new Uint8Array(R.buffer):R}clone(){return new Il({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(R,eh,eu,em,e_){Ml(R,eh,eu,em,e_,4)}setPixel(R,eh,eu){let em=4*(R*this.width+eh);this.data[em+0]=Math.round(255*eu.r/eu.a),this.data[em+1]=Math.round(255*eu.g/eu.a),this.data[em+2]=Math.round(255*eu.b/eu.a),this.data[em+3]=Math.round(255*eu.a)}};function El(R){let eh=new Uint8Array(R.length);for(let eu=0;eu<R.length;eu+=4){let em=R[eu+3];eh[eu+0]=Math.round(R[eu+0]*em/255),eh[eu+1]=Math.round(R[eu+1]*em/255),eh[eu+2]=Math.round(R[eu+2]*em/255),eh[eu+3]=em}return eh}function Tl(R){let eh={},eu=R.resolution||256,em=R.clips?R.clips.length:1,e_=R.image||new Il({width:eu,height:em});
5if(Math.log(eu)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${eu}`);let s=(em,eg,ev)=>{eh[R.evaluationKey]=ev;let ex=R.expression.evaluate(eh);e_.setPixel(em/4/eu,eg/4,ex)};if(R.clips)for(let eh=0,e_=0;eh<em;++eh,e_+=4*eu)for(let em=0,eg=0;em<eu;em++,eg+=4){let ev=em/(eu-1),{start:ex,end:eb}=R.clips[eh];s(e_,eg,ex*(1-ev)+eb*ev)}else for(let R=0,eh=0;R<eu;R++,eh+=4)s(0,eh,R/(eu-1));return e_}ds("AlphaImage",kl),ds("RGBAImage",Il);let iH="big-fb";let Pl=class Pl extends to{createBucket(R){return new bl(R)}constructor(R,eh){super(R,iX,eh),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(R){"heatmap-color"===R&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Tl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(iH)&&this.heatmapFbos.delete(iH)}queryRadius(R){return ol("heatmap-radius",this,R)}queryIntersectsFeature({queryGeometry:R,feature:eh,featureState:eu,geometry:em,transform:e_,pixelsToTileUnits:eg,unwrappedTileID:ev,getElevation:ex}){return dl({queryGeometry:R,size:this.paint.get("heatmap-radius").evaluate(eh,eu)*eg,transform:e_,unwrappedTileID:ev,getElevation:ex},em)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}};var iY={get paint(){return ew=ew||new Ks({"hillshade-illumination-direction":new Xs(t_.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Xs(t_.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Xs(t_.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Xs(t_.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Xs(t_.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Xs(t_.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Xs(t_.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Xs(t_.paint_hillshade["hillshade-method"]),resampling:new Xs(t_.paint_hillshade.resampling)})}};let Bl=class Bl extends to{constructor(R,eh){super(R,iY,eh),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let R=this.paint.get("hillshade-illumination-direction").values,eh=this.paint.get("hillshade-illumination-altitude").values,eu=this.paint.get("hillshade-highlight-color").values,em=this.paint.get("hillshade-shadow-color").values,e_=Math.max(R.length,eh.length,eu.length,em.length);R=R.concat(Array(e_-R.length).fill(R.at(-1))),eh=eh.concat(Array(e_-eh.length).fill(eh.at(-1))),eu=eu.concat(Array(e_-eu.length).fill(eu.at(-1))),em=em.concat(Array(e_-em.length).fill(em.at(-1)));let eg=eh.map(et);return{directionRadians:R.map(et),altitudeRadians:eg,shadowColor:em,highlightColor:eu}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}};var iJ={get paint(){return eT=eT||new Ks({"color-relief-opacity":new Xs(t_["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Ws(t_["paint_color-relief"]["color-relief-color"]),resampling:new Xs(t_["paint_color-relief"].resampling)})}};let Ol=class Ol{constructor(R,eh,eu,em){this.context=R,this.format=eu,this.texture=R.gl.createTexture(),this._ownedHandle=this.texture,this.update(eh,em)}update(R,eh,eu){var em;let{width:e_,height:eg}=R,ev=((null===(em=this.size)||void 0===em?void 0:em[0])!==e_||this.size[1]!==eg)&&!eu,{context:ex}=this,{gl:eb}=ex;this.useMipmap=!!(null==eh?void 0:eh.useMipmap),eb.bindTexture(eb.TEXTURE_2D,this.texture),ex.pixelStoreUnpackFlipY.set(!1),ex.pixelStoreUnpack.set(1);let ew=this.format===eb.RGBA&&!1!==(null==eh?void 0:eh.premultiply);if(ev)this.size=[e_,eg],"data"in R?(ex.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(R,ew,e_,eg,eb)):(ex.pixelStoreUnpackPremultiplyAlpha.set(ew),this._uploadDomImage(R,eb));else{let{x:eh,y:em}=eu||{x:0,y:0};"data"in R?(ex.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(R,ew,eh,em,e_,eg,eb)):(ex.pixelStoreUnpackPremultiplyAlpha.set(ew),this._updateDomImage(R,eh,em,eb))}this.useMipmap&&this.isSizePowerOfTwo()&&eb.generateMipmap(eb.TEXTURE_2D),ex.pixelStoreUnpackFlipY.setDefault(),ex.pixelStoreUnpack.setDefault(),ex.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(R,eh){eh.texImage2D(eh.TEXTURE_2D,0,this.format,this.format,eh.UNSIGNED_BYTE,R)}_uploadRawData(R,eh,eu,em,e_){let{data:eg}=R;eh&&eg&&(eg=El(eg)),e_.texImage2D(e_.TEXTURE_2D,0,this.format,eu,em,0,this.format,e_.UNSIGNED_BYTE,eg)}_updateDomImage(R,eh,eu,em){em.texSubImage2D(em.TEXTURE_2D,0,eh,eu,em.RGBA,em.UNSIGNED_BYTE,R)}_updateRawData(R,eh,eu,em,e_,eg,ev){let{data:ex}=R;eh&&ex&&(ex=El(ex)),ev.texSubImage2D(ev.TEXTURE_2D,0,eu,em,e_,eg,ev.RGBA,ev.UNSIGNED_BYTE,ex)}bind(R,eh,eu){let{context:em}=this,{gl:e_}=em;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),e_.bindTexture(e_.TEXTURE_2D,this.texture),eu!==e_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(eu=e_.LINEAR),R!==this.filter&&(e_.texParameteri(e_.TEXTURE_2D,e_.TEXTURE_MAG_FILTER,R),e_.texParameteri(e_.TEXTURE_2D,e_.TEXTURE_MIN_FILTER,eu||R),this.filter=R),eh!==this.wrap&&(e_.texParameteri(e_.TEXTURE_2D,e_.TEXTURE_WRAP_S,eh),e_.texParameteri(e_.TEXTURE_2D,e_.TEXTURE_WRAP_T,eh),this.wrap=eh)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:R}=this.context;R.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}};let $l=class $l{constructor(R,eh,eu,em=1,e_=1,eg=1,ev=0){if(this.uid=R,eh.height!==eh.width)throw RangeError("DEM tiles must be square");if(eu&&!["mapbox","terrarium","custom"].includes(eu))return void G(`"${eu}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=eh.height;let ex=this.dim=eh.height-2;switch(this.data=new Uint32Array(eh.data.buffer),eu){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
vendor: 3,645 bytes, line 5
5case"custom":this.redFactor=em,this.greenFactor=e_,this.blueFactor=eg,this.baseShift=ev;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let R=0;R<ex;R++)this.data[this._idx(-1,R)]=this.data[this._idx(0,R)],this.data[this._idx(ex,R)]=this.data[this._idx(ex-1,R)],this.data[this._idx(R,-1)]=this.data[this._idx(R,0)],this.data[this._idx(R,ex)]=this.data[this._idx(R,ex-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(ex,-1)]=this.data[this._idx(ex-1,0)],this.data[this._idx(-1,ex)]=this.data[this._idx(0,ex-1)],this.data[this._idx(ex,ex)]=this.data[this._idx(ex-1,ex-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let R=0;R<ex;R++)for(let eh=0;eh<ex;eh++){let eu=this.get(R,eh);eu>this.max&&(this.max=eu),eu<this.min&&(this.min=eu)}}get(R,eh){let eu=new Uint8Array(this.data.buffer),em=4*this._idx(R,eh);return this.unpack(eu[em],eu[em+1],eu[em+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(R,eh){if(R<-1||R>=this.dim+1||eh<-1||eh>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${R}, y: ${eh}, dim: ${this.dim}`);return(eh+1)*this.stride+(R+1)}unpack(R,eh,eu){return R*this.redFactor+eh*this.greenFactor+eu*this.blueFactor-this.baseShift}pack(R){return Rl(R,this.getUnpackVector())}getPixels(){return new Il({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(R,eh,eu){if(this.dim!==R.dim)throw Error("dem dimension mismatch");let em=eh*this.dim,e_=eh*this.dim+this.dim,eg=eu*this.dim,ev=eu*this.dim+this.dim;switch(eh){case -1:em=e_-1;break;case 1:e_=em+1}switch(eu){case -1:eg=ev-1;break;case 1:ev=eg+1}let ex=-eh*this.dim,eb=-eu*this.dim;for(let eh=eg;eh<ev;eh++)for(let eu=em;eu<e_;eu++)this.data[this._idx(eu,eh)]=R.data[this._idx(eu+ex,eh+eb)]}};function Rl(R,eh){let eu=eh[0],em=eh[1],e_=eh[2],eg=eh[3],ev=Math.min(eu,em,e_),ex=Math.round((R+eg)/ev);return{r:Math.floor(ex*ev/eu)%256,g:Math.floor(ex*ev/em)%256,b:Math.floor(ex*ev/e_)%256}}ds("DEMData",$l);let Nl=class Nl extends to{constructor(R,eh){super(R,iJ,eh)}_createColorRamp(R){let eh={elevationStops:[],colorStops:[]},eu=this._transitionablePaint._values["color-relief-color"].value.expression;if(eu instanceof oi&&eu._styleExpression.expression instanceof mn){this.colorRampExpression=eu;let R=eu._styleExpression.expression;for(let eu of(eh.elevationStops=R.labels,eh.colorStops=[],eh.elevationStops))eh.colorStops.push(R.evaluate({globals:{elevation:eu}}))}if(eh.elevationStops.length<1&&(eh.elevationStops=[0],eh.colorStops=[Te.transparent]),eh.elevationStops.length<2&&(eh.elevationStops.push(eh.elevationStops[0]+1),eh.colorStops.push(eh.colorStops[0])),eh.elevationStops.length<=R)return eh;let em={elevationStops:[],colorStops:[]},e_=(eh.elevationStops.length-1)/(R-1);for(let R=0;R<eh.elevationStops.length-.5;R+=e_)em.elevationStops.push(eh.elevationStops[Math.round(R)]),em.colorStops.push(eh.colorStops[Math.round(R)]);return G(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${R}, provided: ${eh.elevationStops.length}`),em}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(R,eh,eu){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let em=this._createColorRamp(eh),e_=new Il({width:em.colorStops.length,height:1}),eg=new Il({width:em.colorStops.length,height:1});for(let R=0;R<em.elevationStops.length;R++){let eh=Rl(em.elevationStops[R],eu);
5eg.setPixel(0,R,new Te(eh.r/255,eh.g/255,eh.b/255,1)),e_.setPixel(0,R,em.colorStops[R])}return this.colorRampTextures={elevationTexture:new Ol(R,eg,R.gl.RGBA),colorTexture:new Ol(R,e_,R.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};let iK=ao([{name:"a_pos",components:2,type:"Int16"}],4),{members:iQ}=iK;function ql(R,eh,eu){let em=eu.patternDependencies,e_=!1;for(let eu of eh){let eh=eu.paint.get(`${R}-pattern`);eh.isConstant()||(e_=!0);let eg=eh.constantOr(null);eg&&(e_=!0,em[eg.to]=!0,em[eg.from]=!0)}return e_}function Gl(R,eh,eu,em,e_){let{zoom:eg}=em,ev=e_.patternDependencies;for(let em of eh){let eh=em.paint.get(`${R}-pattern`).value;if("constant"!==eh.kind){let R=eh.evaluate({zoom:eg-1},eu,{},e_.availableImages),ex=eh.evaluate({zoom:eg},eu,{},e_.availableImages),eb=eh.evaluate({zoom:eg+1},eu,{},e_.availableImages);R=(null==R?void 0:R.name)?R.name:R,ex=(null==ex?void 0:ex.name)?ex.name:ex,eb=(null==eb?void 0:eb.name)?eb.name:eb,ev[R]=!0,ev[ex]=!0,ev[eb]=!0,eu.patterns[em.id]={min:R,mid:ex,max:eb}}}return eu}function Xl(R,eh,eu,em,e_){let eg;if(e_===function(R,eh,eu,em){let e_=0;for(let eg=eh,ev=eu-em;eg<eu;eg+=em)e_+=(R[ev]-R[eg])*(R[eg+1]+R[ev+1]),ev=eg;return e_}(R,eh,eu,em)>0)for(let e_=eh;e_<eu;e_+=em)eg=du(e_/em|0,R[e_],R[e_+1],eg);else for(let e_=eu-em;e_>=eh;e_-=em)eg=du(e_/em|0,R[e_],R[e_+1],eg);return eg&&lu(eg,eg.next)&&(yu(eg),eg=eg.next),eg}function Yl(R,eh){if(!R)return R;eh||(eh=R);let eu,em=R;do if(eu=!1,em.steiner||!lu(em,em.next)&&0!==au(em.prev,em,em.next))em=em.next;else{if(yu(em),(em=eh=em.prev)===em.next)break;eu=!0}while(eu||em!==eh);return eh}function Ql(R,eh){let eu=R.x-eh.x;return 0===eu&&0==(eu=R.y-eh.y)&&(eu=(R.next.y-R.y)/(R.next.x-R.x)-(eh.next.y-eh.y)/(eh.next.x-eh.x)),eu}function nu(R,eh,eu,em,e_){return(R=1431655765&((R=858993459&((R=252645135&((R=16711935&((R=(R-eu)*e_|0)|R<<8))|R<<4))|R<<2))|R<<1))|(eh=1431655765&((eh=858993459&((eh=252645135&((eh=16711935&((eh=(eh-em)*e_|0)|eh<<8))|eh<<4))|eh<<2))|eh<<1))<<1}function iu(R,eh,eu,em,e_,eg,ev,ex){return(e_-ev)*(eh-ex)>=(R-ev)*(eg-ex)&&(R-ev)*(em-ex)>=(eu-ev)*(eh-ex)&&(eu-ev)*(eg-ex)>=(e_-ev)*(em-ex)}function su(R,eh,eu,em,e_,eg,ev,ex){return!(R===ev&&eh===ex)&&iu(R,eh,eu,em,e_,eg,ev,ex)}function au(R,eh,eu){return(eh.y-R.y)*(eu.x-eh.x)-(eh.x-R.x)*(eu.y-eh.y)}function lu(R,eh){return R.x===eh.x&&R.y===eh.y}function uu(R,eh,eu,em){let e_=hu(au(R,eh,eu)),eg=hu(au(R,eh,em)),ev=hu(au(eu,em,R)),ex=hu(au(eu,em,eh));return e_!==eg&&ev!==ex||!(0!==e_||!cu(R,eu,eh))||!(0!==eg||!cu(R,em,eh))||!(0!==ev||!cu(eu,R,em))||!(0!==ex||!cu(eu,eh,em))}function cu(R,eh,eu){return eh.x<=Math.max(R.x,eu.x)&&eh.x>=Math.min(R.x,eu.x)&&eh.y<=Math.max(R.y,eu.y)&&eh.y>=Math.min(R.y,eu.y)}function hu(R){return R>0?1:R<0?-1:0}function pu(R,eh){return 0>au(R.prev,R,R.next)?au(R,eh,R.next)>=0&&au(R,R.prev,eh)>=0:0>au(R,eh,R.prev)||0>au(R,R.next,eh)}function fu(R,eh){let eu=mu(R.i,R.x,R.y),em=mu(eh.i,eh.x,eh.y),e_=R.next,eg=eh.prev;return R.next=eh,eh.prev=R,eu.next=e_,e_.prev=eu,em.next=eu,eu.prev=em,eg.next=em,em.prev=eg,em}function du(R,eh,eu,em){let e_=mu(R,eh,eu);return em?(e_.next=em.next,e_.prev=em,em.next.prev=e_,em.next=e_):(e_.prev=e_,e_.next=e_),e_}function yu(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 mu(R,eh,eu){return{i:R,x:eh,y:eu,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}let gu=class gu{constructor(R,eh){if(eh>R)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=R,this._minGranularity=eh}getGranularityForZoomLevel(R){return Math.max(Math.floor(this._baseZoomGranularity/(1<<R)),this._minGranularity,1)}};let xu=class xu{constructor(R){this.fill=R.fill,this.line=R.line,this.tile=R.tile,this.stencil=R.stencil,this.circle=R.circle}};xu.noSubdivision=new xu({fill:new gu(0,0),line:new gu(0,0),tile:new gu(0,0),stencil:new gu(0,0),circle:1}),ds("SubdivisionGranularityExpression",gu),ds("SubdivisionGranularitySetting",xu);let wu=class wu{constructor(R,eh){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=R,this._granularityCellSize=8192/R,this._canonical=eh}_getKey(R,eh){return(R+=32768)<<16|eh+32768}_vertexToIndex(R,eh){if(R<-32768||eh<-32768||R>32767||eh>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let eu=0|Math.round(R),em=0|Math.round(eh),e_=this._getKey(eu,em);if(this._vertexDictionary.has(e_))return this._vertexDictionary.get(e_);let eg=this._vertexBuffer.length/2;return this._vertexDictionary.set(e_,eg),this._vertexBuffer.push(eu,em),eg}_subdivideTrianglesScanline(R){if(this._granularity<2)return function(R,eh){let eu=[];for(let em=0;em<eh.length;em+=3){let e_=eh[em],eg=eh[em+1],ev=eh[em+2],ex=R[2*e_],eb=R[2*e_+1];(R[2*eg]-ex)*(R[2*ev+1]-eb)-(R[2*eg+1]-eb)*(R[2*ev]-ex)>0?(eu.push(e_),eu.push(ev),eu.push(eg)):(eu.push(e_),eu.push(eg),eu.push(ev))}return eu}(this._vertexBuffer,R);let eh=[],eu=R.length;for(let em=0;em<eu;em+=3){let eu=[R[em+0],R[em+1],R[em+2]],e_=[this._vertexBuffer[2*R[em+0]+0],this._vertexBuffer[2*R[em+0]+1],this._vertexBuffer[2*R[em+1]+0],this._vertexBuffer[2*R[em+1]+1],this._vertexBuffer[2*R[em+2]+0],this._vertexBuffer[2*R[em+2]+1]],eg=1/0,ev=1/0,ex=-1/0,eb=-1/0;for(let R=0;R<3;R++){let eh=e_[2*R],eu=e_[2*R+1];eg=Math.min(eg,eh),ex=Math.max(ex,eh),ev=Math.min(ev,eu),eb=Math.max(eb,eu)}if(eg===ex||ev===eb)continue;let ew=Math.floor(eg/this._granularityCellSize),eT=Math.ceil(ex/this._granularityCellSize),eS=Math.floor(ev/this._granularityCellSize),eP=Math.ceil(eb/this._granularityCellSize);if(ew!==eT||eS!==eP)for(let R=eS;R<eP;R++){let em=this._scanlineGenerateVertexRingForCellRow(R,e_,eu);(function(R,eh,eu){if(0===eh.length)throw Error("Subdivision vertex ring is empty.");let em=0,e_=R[2*eh[0]];for(let eu=1;eu<eh.length;eu++){let eg=R[2*eh[eu]];eg<e_&&(e_=eg,em=eu)}let eg=eh.length,ev=em,ex=(ev+1)%eg;for(;;){let em=ev-1>=0?ev-1:eg-1,e_=(ex+1)%eg,eb=R[2*eh[em]],ew=R[2*eh[e_]],eT=R[2*eh[ev]],eS=R[2*eh[ev]+1],eP=R[2*eh[ex]+1],eI=!1;if(eb<ew)eI=!0;else if(eb>ew)eI=!1;else{let eu=eP-eS,eg=-(R[2*eh[ex]]-eT),ev=eS<eP?1:-1;((eb-eT)*eu+(R[2*eh[em]+1]-eS)*eg)*ev>((ew-eT)*eu+(R[2*eh[e_]+1]-eS)*eg)*ev&&(eI=!0)}if(eI){let R=eh[em],e_=eh[ev],eb=eh[ex];R!==e_&&R!==eb&&e_!==eb&&eu.push(eb,e_,R),--ev<0&&(ev=eg-1)}else{let R=eh[e_],em=eh[ev],eb=eh[ex];R!==em&&R!==eb&&em!==eb&&eu.push(eb,em,R),++ex>=eg&&(ex=0)}if(em===e_)break}})(this._vertexBuffer,em,eh)}else eh.push(...eu)}return eh}_scanlineGenerateVertexRingForCellRow(R,eh,eu){let em=R*this._granularityCellSize,e_=em+this._granularityCellSize,eg=[];for(let R=0;R<3;R++){let ev=eh[2*R],ex=eh[2*R+1],eb=eh[2*(R+1)%6],ew=eh[(2*(R+1)+1)%6],eT=eh[2*(R+2)%6],eS=eh[(2*(R+2)+1)%6],eP=eb-ev,eI=ew-ex,eM=0===eP,eE=0===eI,eC=(em-ex)/eI,eA=(e_-ex)/eI,ez=Math.min(eC,eA),eD=Math.max(eC,eA);if(!eE&&(ez>=1||eD<=0)||eE&&(ex<em||ex>e_)){ew>=em&&ew<=e_&&eg.push(eu[(R+1)%3]);continue}!eE&&ez>0&&eg.push(this._vertexToIndex(ev+eP*ez,ex+eI*ez));let ek=ev+eP*Math.max(ez,0),eR=ev+eP*Math.min(eD,1);eM||this._generateIntraEdgeVertices(eg,ev,ex,eb,ew,ek,eR),!eE&&eD<1&&eg.push(this._vertexToIndex(ev+eP*eD,ex+eI*eD)),(eE||ew>=em&&ew<=e_)&&eg.push(eu[(R+1)%3]),!eE&&(ew<=em||ew>=e_)&&this._generateInterEdgeVertices(eg,ev,ex,eb,ew,eT,eS,eR,em,e_)}return eg}_generateIntraEdgeVertices(R,eh,eu,em,e_,eg,ev){let ex=em-eh,eb=e_-eu,ew=0===eb,eT=ew?Math.min(eh,em):Math.min(eg,ev),eS=ew?Math.max(eh,em):Math.max(eg,ev),eP=Math.floor(eT/this._granularityCellSize)+1,eI=Math.ceil(eS/this._granularityCellSize)-1;
5if(ew?eh<em:eg<ev)for(let em=eP;em<=eI;em++){let e_=em*this._granularityCellSize;R.push(this._vertexToIndex(e_,eu+eb*(e_-eh)/ex))}else for(let em=eI;em>=eP;em--){let e_=em*this._granularityCellSize;R.push(this._vertexToIndex(e_,eu+eb*(e_-eh)/ex))}}_generateInterEdgeVertices(R,eh,eu,em,e_,eg,ev,ex,eb,ew){let eT=ev-e_,eS=(eb-e_)/eT,eP=(ew-e_)/eT,eI=Math.min(eS,eP),eM=em+(eg-em)*eI,eE=Math.floor(Math.min(eM,ex)/this._granularityCellSize)+1,eC=Math.ceil(Math.max(eM,ex)/this._granularityCellSize)-1,eA=ex<eM,ez=0===eT;if(ez&&(ev===eb||ev===ew))return;if(ez||eI>=1||0>=Math.max(eS,eP)){let R=eu-ev,em=eg+(eh-eg)*Math.min((eb-ev)/R,(ew-ev)/R);eE=Math.floor(Math.min(em,ex)/this._granularityCellSize)+1,eC=Math.ceil(Math.max(em,ex)/this._granularityCellSize)-1,eA=ex<em}let eD=e_-eu>0?ew:eb;if(eA)for(let eh=eE;eh<=eC;eh++)R.push(this._vertexToIndex(eh*this._granularityCellSize,eD));else for(let eh=eC;eh>=eE;eh--)R.push(this._vertexToIndex(eh*this._granularityCellSize,eD))}_generateOutline(R){let eh=[];for(let eu of R){let R=Su(eu,this._granularity,!0),em=this._pointArrayToIndices(R),e_=[];for(let R=1;R<em.length;R++)e_.push(em[R-1]),e_.push(em[R]);eh.push(e_)}return eh}_handlePoles(R){let eh=!1,eu=!1;this._canonical&&(0===this._canonical.y&&(eh=!0),this._canonical.y===(1<<this._canonical.z)-1&&(eu=!0)),(eh||eu)&&this._fillPoles(R,eh,eu)}_ensureNoPoleVertices(){let R=this._vertexBuffer;for(let eh=0;eh<R.length;eh+=2){let eu=R[eh+1];-32768===eu&&(R[eh+1]=-32767),32767===eu&&(R[eh+1]=32766)}}_generatePoleQuad(R,eh,eu,em,e_,eg){em>e_!=(-32768===eg)?(R.push(eh),R.push(eu),R.push(this._vertexToIndex(em,eg)),R.push(eu),R.push(this._vertexToIndex(e_,eg))):(R.push(eu),R.push(eh),R.push(this._vertexToIndex(em,eg)),R.push(this._vertexToIndex(e_,eg)),R.push(eu)),R.push(this._vertexToIndex(em,eg))}_fillPoles(R,eh,eu){let em=this._vertexBuffer,e_=R.length;for(let eg=2;eg<e_;eg+=3){let e_=R[eg-2],ev=R[eg-1],ex=R[eg],eb=em[2*e_],ew=em[2*e_+1],eT=em[2*ev],eS=em[2*ev+1],eP=em[2*ex],eI=em[2*ex+1];eh&&(0===ew&&0===eS&&this._generatePoleQuad(R,e_,ev,eb,eT,-32768),0===eS&&0===eI&&this._generatePoleQuad(R,ev,ex,eT,eP,-32768),0===eI&&0===ew&&this._generatePoleQuad(R,ex,e_,eP,eb,-32768)),eu&&(8192===ew&&8192===eS&&this._generatePoleQuad(R,e_,ev,eb,eT,32767),8192===eS&&8192===eI&&this._generatePoleQuad(R,ev,ex,eT,eP,32767),8192===eI&&8192===ew&&this._generatePoleQuad(R,ex,e_,eP,eb,32767))}}_initializeVertices(R){for(let eh=0;eh<R.length;eh+=2)this._vertexToIndex(R[eh],R[eh+1])}subdividePolygonInternal(R,eh){let eu;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:em,holeIndices:e_}=function(R){let eh=[],eu=[];for(let em of R)if(0!==em.length)for(let e_ of(em!==R[0]&&eh.push(eu.length/2),em))eu.push(e_.x),eu.push(e_.y);return{flattened:eu,holeIndices:eh}}(R);this._initializeVertices(em);try{let R=function(R,eh,eu=2){let em,e_,eg;let ev=eh&&eh.length,ex=ev?eh[0]*eu:R.length,eb=Xl(R,0,ex,eu,!0),ew=[];if(!eb||eb.next===eb.prev)return ew;if(ev&&(eb=function(R,eh,eu,em){let e_=[];for(let eu=0,eg=eh.length;eu<eg;eu++){let ev=Xl(R,eh[eu]*em,eu<eg-1?eh[eu+1]*em:R.length,em,!1);ev===ev.next&&(ev.steiner=!0),e_.push(function(R){let eh=R,eu=R;do(eh.x<eu.x||eh.x===eu.x&&eh.y<eu.y)&&(eu=eh),eh=eh.next;while(eh!==R);return eu}(ev))}e_.sort(Ql);for(let R=0;R<e_.length;R++)eu=function(R,eh){let eu=function(R,eh){let eu=eh,em=R.x,e_=R.y,eg,ev=-1/0;if(lu(R,eu))return eu;do{if(lu(R,eu.next))return eu.next;if(e_<=eu.y&&e_>=eu.next.y&&eu.next.y!==eu.y){let R=eu.x+(e_-eu.y)*(eu.next.x-eu.x)/(eu.next.y-eu.y);if(R<=em&&R>ev&&(ev=R,eg=eu.x<eu.next.x?eu:eu.next,R===em))return eg}eu=eu.next}
5while(eu!==eh);if(!eg)return null;let ex=eg,eb=eg.x,ew=eg.y,eT=1/0;eu=eg;do{if(em>=eu.x&&eu.x>=eb&&em!==eu.x&&iu(e_<ew?em:ev,e_,eb,ew,e_<ew?ev:em,e_,eu.x,eu.y)){var eS,eP;let eh=Math.abs(e_-eu.y)/(em-eu.x);pu(eu,R)&&(eh<eT||eh===eT&&(eu.x>eg.x||eu.x===eg.x&&(eS=eg,eP=eu,0>au(eS.prev,eS,eP.prev)&&0>au(eP.next,eS,eS.next))))&&(eg=eu,eT=eh)}eu=eu.next}while(eu!==ex);return eg}(R,eh);if(!eu)return eh;let em=fu(eu,R);return Yl(em,em.next),Yl(eu,eu.next)}(e_[R],eu);return eu}(R,eh,eb,eu)),R.length>80*eu){em=R[0],e_=R[1];let eh=em,ev=e_;for(let eg=eu;eg<ex;eg+=eu){let eu=R[eg],ex=R[eg+1];eu<em&&(em=eu),ex<e_&&(e_=ex),eu>eh&&(eh=eu),ex>ev&&(ev=ex)}eg=Math.max(eh-em,ev-e_),eg=0!==eg?32767/eg:0}return function Zl(R,eh,eu,em,e_,eg,ev){if(!R)return;!ev&&eg&&function(R,eh,eu,em){let e_=R;do 0===e_.z&&(e_.z=nu(e_.x,e_.y,eh,eu,em)),e_.prevZ=e_.prev,e_.nextZ=e_.next,e_=e_.next;while(e_!==R);e_.prevZ.nextZ=null,e_.prevZ=null,function(R){let eh,eu=1;do{let em,e_=R;R=null;let eg=null;for(eh=0;e_;){eh++;let ev=e_,ex=0;for(let R=0;R<eu&&(ex++,ev=ev.nextZ);R++);let eb=eu;for(;ex>0||eb>0&&ev;)0!==ex&&(0===eb||!ev||e_.z<=ev.z)?(em=e_,e_=e_.nextZ,ex--):(em=ev,ev=ev.nextZ,eb--),eg?eg.nextZ=em:R=em,em.prevZ=eg,eg=em;e_=ev}eg.nextZ=null,eu*=2}while(eh>1)}(e_)}(R,em,e_,eg);let ex=R;for(;R.prev!==R.next;){let eb=R.prev,ew=R.next;if(eg?function(R,eh,eu,em){let e_=R.prev,eg=R.next;if(au(e_,R,eg)>=0)return!1;let ev=e_.x,ex=R.x,eb=eg.x,ew=e_.y,eT=R.y,eS=eg.y,eP=Math.min(ev,ex,eb),eI=Math.min(ew,eT,eS),eM=Math.max(ev,ex,eb),eE=Math.max(ew,eT,eS),eC=nu(eP,eI,eh,eu,em),eA=nu(eM,eE,eh,eu,em),ez=R.prevZ,eD=R.nextZ;for(;ez&&ez.z>=eC&&eD&&eD.z<=eA;){if(ez.x>=eP&&ez.x<=eM&&ez.y>=eI&&ez.y<=eE&&ez!==e_&&ez!==eg&&su(ev,ew,ex,eT,eb,eS,ez.x,ez.y)&&au(ez.prev,ez,ez.next)>=0||(ez=ez.prevZ,eD.x>=eP&&eD.x<=eM&&eD.y>=eI&&eD.y<=eE&&eD!==e_&&eD!==eg&&su(ev,ew,ex,eT,eb,eS,eD.x,eD.y)&&au(eD.prev,eD,eD.next)>=0))return!1;eD=eD.nextZ}for(;ez&&ez.z>=eC;){if(ez.x>=eP&&ez.x<=eM&&ez.y>=eI&&ez.y<=eE&&ez!==e_&&ez!==eg&&su(ev,ew,ex,eT,eb,eS,ez.x,ez.y)&&au(ez.prev,ez,ez.next)>=0)return!1;ez=ez.prevZ}for(;eD&&eD.z<=eA;){if(eD.x>=eP&&eD.x<=eM&&eD.y>=eI&&eD.y<=eE&&eD!==e_&&eD!==eg&&su(ev,ew,ex,eT,eb,eS,eD.x,eD.y)&&au(eD.prev,eD,eD.next)>=0)return!1;eD=eD.nextZ}return!0}(R,em,e_,eg):function(R){let eh=R.prev,eu=R.next;if(au(eh,R,eu)>=0)return!1;let em=eh.x,e_=R.x,eg=eu.x,ev=eh.y,ex=R.y,eb=eu.y,ew=Math.min(em,e_,eg),eT=Math.min(ev,ex,eb),eS=Math.max(em,e_,eg),eP=Math.max(ev,ex,eb),eI=eu.next;for(;eI!==eh;){if(eI.x>=ew&&eI.x<=eS&&eI.y>=eT&&eI.y<=eP&&su(em,ev,e_,ex,eg,eb,eI.x,eI.y)&&au(eI.prev,eI,eI.next)>=0)return!1;eI=eI.next}return!0}(R))eh.push(eb.i,R.i,ew.i),yu(R),R=ew.next,ex=ew.next;else if((R=ew)===ex){ev?1===ev?Zl(R=function(R,eh){let eu=R;do{let em=eu.prev,e_=eu.next.next;!lu(em,e_)&&uu(em,eu,eu.next,e_)&&pu(em,e_)&&pu(e_,em)&&(eh.push(em.i,eu.i,e_.i),yu(eu),yu(eu.next),eu=R=e_),eu=eu.next}while(eu!==R);return Yl(eu)}(Yl(R),eh),eh,eu,em,e_,eg,2):2===ev&&function(R,eh,eu,em,e_,eg){let ev=R;do{let R=ev.next.next;for(;R!==ev.prev;){var ex,eb;if(ev.i!==R.i&&(ex=ev,eb=R,ex.next.i!==eb.i&&ex.prev.i!==eb.i&&!function(R,eh){let eu=R;do{if(eu.i!==R.i&&eu.next.i!==R.i&&eu.i!==eh.i&&eu.next.i!==eh.i&&uu(eu,eu.next,R,eh))return!0;eu=eu.next}while(eu!==R);return!1}(ex,eb)&&(pu(ex,eb)&&pu(eb,ex)&&function(R,eh){let eu=R,em=!1,e_=(R.x+eh.x)/2,eg=(R.y+eh.y)/2;do eu.y>eg!=eu.next.y>eg&&eu.next.y!==eu.y&&e_<(eu.next.x-eu.x)*(eg-eu.y)/(eu.next.y-eu.y)+eu.x&&(em=!em),eu=eu.next;while(eu!==R);return em}(ex,eb)&&(au(ex.prev,ex,eb.prev)||au(ex,eb.prev,eb))||lu(ex,eb)&&au(ex.prev,ex,ex.next)>0&&au(eb.prev,eb,eb.next)>0))){let ex=fu(ev,R);return ev=Yl(ev,ev.next),ex=Yl(ex,ex.next),Zl(ev,eh,eu,em,e_,eg,0),void Zl(ex,eh,eu,em,e_,eg,0)}R=R.next}ev=ev.next}while(ev!==R)}(R,eh,eu,em,e_,eg):Zl(Yl(R),eh,eu,em,e_,eg,1);break}}}(eb,ew,eu,em,e_,eg,0),ew}(em,e_),eh=this._convertIndices(em,R);eu=this._subdivideTrianglesScanline(eh)}catch(R){console.error(R)}let eg=[];return eh&&(eg=this._generateOutline(R)),this._ensureNoPoleVertices(),this._handlePoles(eu),{verticesFlattened:this._vertexBuffer,indicesTriangles:eu,indicesLineList:eg}}_convertIndices(R,eh){let eu=[];for(let em of eh)eu.push(this._vertexToIndex(R[2*em],R[2*em+1]));return eu}_pointArrayToIndices(R){let eh=[];for(let eu of R)eh.push(this._vertexToIndex(eu.x,eu.y));return eh}};function _u(R,eh,eu,em=!0){return new wu(eu,eh).subdividePolygonInternal(R,em)}function Su(R,eh,eu=!1){if(!R||R.length<1||R.length<2)return[];let em=R[0],e_=R[R.length-1],eg=eu&&(em.x!==e_.x||em.y!==e_.y);if(eh<2)return eg?[...R,R[0]]:[...R];let ev=Math.floor(8192/eh),ex=[];ex.push(new n(R[0].x,R[0].y));let eb=R.length,ew=eg?eb:eb-1;for(let eh=0;eh<ew;eh++){let eu=R[eh],em=eh<eb-1?R[eh+1]:R[0],e_=eu.x,eg=eu.y,ew=em.x,eT=em.y,eS=e_!==ew,eP=eg!==eT;if(!eS&&!eP)continue;let eI=ew-e_,eM=eT-eg,eE=Math.abs(eI),eC=Math.abs(eM),eA=e_,ez=eg;for(;;){let R=eI>0?(Math.floor(eA/ev)+1)*ev:(Math.ceil(eA/ev)-1)*ev,eh=eM>0?(Math.floor(ez/ev)+1)*ev:(Math.ceil(ez/ev)-1)*ev,eu=Math.abs(eA-R),em=Math.abs(ez-eh),e_=Math.abs(eA-ew),eg=Math.abs(ez-eT),eb=eS?eu/eE:Number.POSITIVE_INFINITY,eD=eP?em/eC:Number.POSITIVE_INFINITY;if((e_<=eu||!eS)&&(eg<=em||!eP))break;if(eb<eD&&eS||!eP){eA=R,ez+=eM*eb;let eh=new n(eA,Math.round(ez));ex[ex.length-1].x===eh.x&&ex[ex.length-1].y===eh.y||ex.push(eh)}else{eA+=eI*eD,ez=eh;let R=new n(Math.round(eA),ez);ex[ex.length-1].x===R.x&&ex[ex.length-1].y===R.y||ex.push(R)}}let eD=new n(ew,eT);ex[ex.length-1].x===eD.x&&ex[ex.length-1].y===eD.y||ex.push(eD)}return ex}function Mu(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=e_.length/2,eT=ev&&ex&&eb;if(ew<ua.MAX_VERTEX_ARRAY_LENGTH){let eS,eP;let eI=eh.prepareSegment(ew,eu,em),eM=eI.vertexLength;for(let R=0;R<eg.length;R+=3)em.emplaceBack(eM+eg[R],eM+eg[R+1],eM+eg[R+2]);eI.vertexLength+=ew,eI.primitiveLength+=eg.length/3,eT&&(eS=(eP=ev.prepareSegment(ew,eu,ex)).vertexLength,eP.vertexLength+=ew);for(let eh=0;eh<e_.length;eh+=2)R(e_[eh],e_[eh+1]);if(eT)for(let R of eb){for(let eh=1;eh<R.length;eh+=2)ex.emplaceBack(eS+R[eh-1],eS+R[eh]);eP.primitiveLength+=R.length/2}}else(function(R,eh,eu,em,e_,eg){let ev=[];for(let R=0;R<em.length/2;R++)ev.push(-1);let ex={count:0},eb=0,ew=R.getOrCreateLatestSegment(eh,eu),eT=ew.vertexLength;for(let eS=2;eS<e_.length;eS+=3){let eP=e_[eS-2],eI=e_[eS-1],eM=e_[eS],eE=ev[eP]<eb,eC=ev[eI]<eb,eA=ev[eM]<eb;ew.vertexLength+((eE?1:0)+(eC?1:0)+(eA?1:0))>ua.MAX_VERTEX_ARRAY_LENGTH&&(ew=R.createNewSegment(eh,eu),eb=ex.count,eE=!0,eC=!0,eA=!0,eT=0);let ez=ku(ev,em,eg,ex,eP,eE,ew),eD=ku(ev,em,eg,ex,eI,eC,ew),ek=ku(ev,em,eg,ex,eM,eA,ew);eu.emplaceBack(eT+ez-eb,eT+eD-eb,eT+ek-eb),ew.primitiveLength++}})(eh,eu,em,e_,eg,R),eT&&function(R,eh,eu,em,e_,eg){let ev=[];for(let R=0;R<em.length/2;R++)ev.push(-1);let ex={count:0},eb=0,ew=R.getOrCreateLatestSegment(eh,eu),eT=ew.vertexLength;for(let eS of e_)for(let e_=1;e_<eS.length;e_+=2){let eP=eS[e_-1],eI=eS[e_],eM=ev[eP]<eb,eE=ev[eI]<eb;ew.vertexLength+((eM?1:0)+(eE?1:0))>ua.MAX_VERTEX_ARRAY_LENGTH&&(ew=R.createNewSegment(eh,eu),eb=ex.count,eM=!0,eE=!0,eT=0);let eC=ku(ev,em,eg,ex,eP,eM,ew),eA=ku(ev,em,eg,ex,eI,eE,ew);eu.emplaceBack(eT+eC-eb,eT+eA-eb),ew.primitiveLength++}}(ev,eu,ex,e_,eb,R),eh.forceNewSegmentOnNextPrepare(),null==ev||ev.forceNewSegmentOnNextPrepare()}function ku(R,eh,eu,em,e_,eg,ev){if(eg){let eg=em.count;return eu(eh[2*e_],eh[2*e_+1]),R[e_]=em.count,em.count++,ev.vertexLength++,eg}return R[e_]}let Iu=class Iu{constructor(R){this.zoom=R.zoom,this.overscaling=R.overscaling,this.layers=R.layers,this.layerIds=this.layers.map(R=>R.id),this.index=R.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Zo,this.indexArray=new sa,this.indexArray2=new oa,this.programConfigurations=new $a(R.layers,R.zoom),this.segments=new ua,this.segments2=new ua,this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id)}populate(R,eh,eu){this.hasDependencies=ql("fill",this.layers,eh);let em=this.layers[0].layout.get("fill-sort-key"),e_=!em.isConstant(),eg=[];for(let{feature:ev,id:ex,index:eb,sourceLayerIndex:ew}of R){let R=this.layers[0]._featureFilter.needGeometry,eT=Ga(ev,R);if(!this.layers[0]._featureFilter.filter(new Cs(this.zoom),eT,eu))continue;let eS=e_?em.evaluate(eT,{},eu,eh.availableImages):void 0,eP={id:ex,properties:ev.properties,type:ev.type,sourceLayerIndex:ew,index:eb,geometry:R?eT.geometry:qa(ev),patterns:{},sortKey:eS};eg.push(eP)}for(let em of(e_&&eg.sort((R,eh)=>R.sortKey-eh.sortKey),eg)){let{geometry:e_,index:eg,sourceLayerIndex:ev}=em;if(this.hasDependencies){let R=Gl("fill",this.layers,em,{zoom:this.zoom},eh);this.patternFeatures.push(R)}else this.addFeature(em,e_,eg,eu,{},eh.subdivisionGranularity);eh.featureIndex.insert(R[eg].feature,e_,eg,ev,this.index)}}update(R,eh,eu){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(R,eh,this.stateDependentLayers,{imagePositions:eu})}addFeatures(R,eh,eu){for(let em of this.patternFeatures)this.addFeature(em,em.geometry,em.index,eh,eu,R.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(R){this.uploaded||(this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,iQ),this.indexBuffer=R.createIndexBuffer(this.indexArray),this.indexBuffer2=R.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(R),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(R,eh,eu,em,e_,eg){for(let R of rr(eh,500)){let eh=_u(R,em,eg.fill.getGranularityForZoomLevel(em.z)),eu=this.layoutVertexArray;Mu((R,eh)=>{eu.emplaceBack(R,eh)},this.segments,this.layoutVertexArray,this.indexArray,eh.verticesFlattened,eh.indicesTriangles,this.segments2,this.indexArray2,eh.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,R,eu,{imagePositions:e_,canonical:em})}};ds("FillBucket",Iu,{omit:["layers","patternFeatures"]});var i0={get paint(){return eP=eP||new Ks({"fill-antialias":new Xs(t_.paint_fill["fill-antialias"]),"fill-opacity":new Ys(t_.paint_fill["fill-opacity"]),"fill-color":new Ys(t_.paint_fill["fill-color"]),"fill-outline-color":new Ys(t_.paint_fill["fill-outline-color"]),"fill-translate":new Xs(t_.paint_fill["fill-translate"]),"fill-translate-anchor":new Xs(t_.paint_fill["fill-translate-anchor"]),"fill-pattern":new Zs(t_.paint_fill["fill-pattern"])})},get layout(){return eS=eS||new Ks({"fill-sort-key":new Ys(t_.layout_fill["fill-sort-key"])})}};let Pu=class Pu extends to{constructor(R,eh){super(R,i0,eh)}
5recalculate(R,eh){super.recalculate(R,eh);let eu=this.paint._values["fill-outline-color"];"constant"===eu.value.kind&&void 0===eu.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(R){return new Iu(R)}queryRadius(){return al(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:R,geometry:eh,transform:eu,pixelsToTileUnits:em}){return Ka(ll(R,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-eu.bearingInRadians,em),eh)}isTileClipped(){return!0}};let i1=ao([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),i2=ao([{name:"a_centroid",components:2,type:"Int16"}],4),{members:i3}=i1;let Cu=class Cu{constructor(R,eh,eu,em,e_){this.properties={},this.extent=eu,this.type=0,this.id=void 0,this._pbf=R,this._geometry=-1,this._keys=em,this._values=e_,R.readFields(Vu,this,eh)}loadGeometry(){let R=this._pbf;R.pos=this._geometry;let eh=R.readVarint()+R.pos,eu=[],em,e_=1,eg=0,ev=0,ex=0;for(;R.pos<eh;){if(eg<=0){let eh=R.readVarint();e_=7&eh,eg=eh>>3}if(eg--,1===e_||2===e_)ev+=R.readSVarint(),ex+=R.readSVarint(),1===e_&&(em&&eu.push(em),em=[]),em&&em.push(new n(ev,ex));else{if(7!==e_)throw Error(`unknown command ${e_}`);em&&em.push(em[0].clone())}}return em&&eu.push(em),eu}bbox(){let R=this._pbf;R.pos=this._geometry;let eh=R.readVarint()+R.pos,eu=1,em=0,e_=0,eg=0,ev=1/0,ex=-1/0,eb=1/0,ew=-1/0;for(;R.pos<eh;){if(em<=0){let eh=R.readVarint();eu=7&eh,em=eh>>3}if(em--,1===eu||2===eu)e_+=R.readSVarint(),eg+=R.readSVarint(),e_<ev&&(ev=e_),e_>ex&&(ex=e_),eg<eb&&(eb=eg),eg>ew&&(ew=eg);else if(7!==eu)throw Error(`unknown command ${eu}`)}return[ev,eb,ex,ew]}toGeoJSON(R,eh,eu){let em;let e_=this.extent*Math.pow(2,eu),eg=this.extent*R,ev=this.extent*eh,ex=this.loadGeometry();function a(R){return[360*(R.x+eg)/e_-180,360/Math.PI*Math.atan(Math.exp((1-2*(R.y+ev)/e_)*Math.PI))-90]}function l(R){return R.map(a)}if(1===this.type){let R=[];for(let eh of ex)R.push(eh[0]);let eh=l(R);em=1===R.length?{type:"Point",coordinates:eh[0]}:{type:"MultiPoint",coordinates:eh}}else if(2===this.type){let R=ex.map(l);em=1===R.length?{type:"LineString",coordinates:R[0]}:{type:"MultiLineString",coordinates:R}}else{if(3!==this.type)throw Error("unknown feature type");{let R=Lu(ex),eh=[];for(let eu of R)eh.push(eu.map(l));em=1===eh.length?{type:"Polygon",coordinates:eh[0]}:{type:"MultiPolygon",coordinates:eh}}}let eb={type:"Feature",geometry:em,properties:this.properties};return null!=this.id&&(eb.id=this.id),eb}};function Vu(R,eh,eu){1===R?eh.id=eu.readVarint():2===R?function(R,eh){let eu=R.readVarint()+R.pos;for(;R.pos<eu;){let eu=eh._keys[R.readVarint()],em=eh._values[R.readVarint()];eh.properties[eu]=em}}(eu,eh):3===R?eh.type=eu.readVarint():4===R&&(eh._geometry=eu.pos)}function Lu(R){let eh,eu;let em=R.length;if(em<=1)return[R];let e_=[];for(let eg=0;eg<em;eg++){let em=function(R){let eh=0;for(let eu,em,e_=0,eg=R.length,ev=eg-1;e_<eg;ev=e_++)eu=R[e_],eh+=((em=R[ev]).x-eu.x)*(eu.y+em.y);return eh}(R[eg]);0!==em&&(void 0===eu&&(eu=em<0),eu===em<0?(eh&&e_.push(eh),eh=[R[eg]]):eh&&eh.push(R[eg]))}return eh&&e_.push(eh),e_}Cu.types=["Unknown","Point","LineString","Polygon"];let $u=class $u{constructor(R,eh){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=R,this._keys=[],this._values=[],this._features=[],R.readFields(Ru,this,eh),this.length=this._features.length}feature(R){if(R<0||R>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[R];let eh=this._pbf.readVarint()+this._pbf.pos;return new Cu(this._pbf,eh,this.extent,this._keys,this._values)}};function Ru(R,eh,eu){15===R?eh.version=eu.readVarint():1===R?eh.name=eu.readString():5===R?eh.extent=eu.readVarint():2===R?eh._features.push(eu.pos):3===R?eh._keys.push(eu.readString()):4===R&&eh._values.push(function(R){let eh=null,eu=R.readVarint()+R.pos;for(;R.pos<eu;){let eu=R.readVarint()>>3;eh=1===eu?R.readString():2===eu?R.readFloat():3===eu?R.readDouble():4===eu?R.readVarint64():5===eu?R.readVarint():6===eu?R.readSVarint():7===eu?R.readBoolean():null}if(null==eh)throw Error("unknown feature value");return eh}(eu))}let Nu=class Nu{constructor(R,eh){this.layers=R.readFields(Uu,{},eh)}};function Uu(R,eh,eu){if(3===R){let R=new $u(eu,eu.readVarint()+eu.pos);R.length&&(eh[R.name]=R)}}function qu(R,eh,eu,em,e_,eg,ev,ex){R.emplaceBack(eh,eu,2*Math.floor(8192*em)+ev,16384*e_,16384*eg,Math.round(ex))}let Gu=class Gu{constructor(R){this.zoom=R.zoom,this.overscaling=R.overscaling,this.layers=R.layers,this.layerIds=this.layers.map(R=>R.id),this.index=R.index,this.hasDependencies=!1,this.layoutVertexArray=new Ho,this.centroidVertexArray=new Xo,this.indexArray=new sa,this.programConfigurations=new $a(R.layers,R.zoom),this.segments=new ua,this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id)}populate(R,eh,eu){for(let{feature:em,id:e_,index:eg,sourceLayerIndex:ev}of(this.features=[],this.hasDependencies=ql("fill-extrusion",this.layers,eh),R)){let R=this.layers[0]._featureFilter.needGeometry,ex=Ga(em,R);if(!this.layers[0]._featureFilter.filter(new Cs(this.zoom),ex,eu))continue;let eb={id:e_,sourceLayerIndex:ev,index:eg,geometry:R?ex.geometry:qa(em),properties:em.properties,type:em.type,patterns:{}};this.hasDependencies?this.features.push(Gl("fill-extrusion",this.layers,eb,{zoom:this.zoom},eh)):this.addFeature(eb,eb.geometry,eg,eu,{},eh.subdivisionGranularity),eh.featureIndex.insert(em,eb.geometry,eg,ev,this.index,!0)}}addFeatures(R,eh,eu){for(let em of this.features){let{geometry:e_}=em;this.addFeature(em,e_,em.index,eh,eu,R.subdivisionGranularity)}}update(R,eh,eu){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(R,eh,this.stateDependentLayers,{imagePositions:eu})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(R){this.uploaded||(this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,i3),this.centroidVertexBuffer=R.createVertexBuffer(this.centroidVertexArray,i2.members,!0),this.indexBuffer=R.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(R),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(R,eh,eu,em,e_,eg){for(let eu of rr(eh,500)){let eh={x:0,y:0,sampleCount:0},e_=this.layoutVertexArray.length;this.processPolygon(eh,em,R,eu,eg);let ev=this.layoutVertexArray.length-e_,ex=Math.floor(eh.x/eh.sampleCount),eb=Math.floor(eh.y/eh.sampleCount);for(let R=0;R<ev;R++)this.centroidVertexArray.emplaceBack(ex,eb)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,R,eu,{imagePositions:e_,canonical:em})}processPolygon(R,eh,eu,em,e_){if(em.length<1||Zu(em[0]))return;for(let eh of em)0!==eh.length&&function(R,eh){for(let eu=0;eu<eh.length;eu++){let em=eh[eu];eu===eh.length-1&&eh[0].x===em.x&&eh[0].y===em.y||(R.x+=em.x,R.y+=em.y,R.sampleCount++)}}(R,eh);let eg={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},ev=e_.fill.getGranularityForZoomLevel(eh.z),ex="Polygon"===Cu.types[eu.type];for(let R of em){if(0===R.length||Zu(R))continue;let eh=Su(R,ev,ex);this._generateSideFaces(eh,eg)}if(!ex)return;let eb=_u(em,eh,ev,!1),ew=this.layoutVertexArray;Mu((R,eh)=>{qu(ew,R,eh,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,eb.verticesFlattened,eb.indicesTriangles)}_generateSideFaces(R,eh){let eu=0;for(let em=1;em<R.length;em++){let e_=R[em],eg=R[em-1];if(e_.x===eg.x&&(e_.x<0||e_.x>8192)||e_.y===eg.y&&(e_.y<0||e_.y>8192))continue;eh.segment.vertexLength+4>ua.MAX_VERTEX_ARRAY_LENGTH&&(eh.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let ev=e_.sub(eg)._perp()._unit(),ex=eg.dist(e_);eu+ex>32768&&(eu=0),qu(this.layoutVertexArray,e_.x,e_.y,ev.x,ev.y,0,0,eu),qu(this.layoutVertexArray,e_.x,e_.y,ev.x,ev.y,0,1,eu),eu+=ex,qu(this.layoutVertexArray,eg.x,eg.y,ev.x,ev.y,0,0,eu),qu(this.layoutVertexArray,eg.x,eg.y,ev.x,ev.y,0,1,eu);let eb=eh.segment.vertexLength;this.indexArray.emplaceBack(eb,eb+2,eb+1),this.indexArray.emplaceBack(eb+1,eb+2,eb+3),eh.segment.vertexLength+=4,eh.segment.primitiveLength+=2}}};function Zu(R){return R.every(R=>R.x<0)||R.every(R=>R.x>8192)||R.every(R=>R.y<0)||R.every(R=>R.y>8192)}ds("FillExtrusionBucket",Gu,{omit:["layers","features"]});
vendor: 4,665 bytes, line 5
5var i5={get paint(){return eI=eI||new Ks({"fill-extrusion-opacity":new Xs(t_["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ys(t_["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Xs(t_["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Xs(t_["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Zs(t_["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ys(t_["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ys(t_["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Xs(t_["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};let Ku=class Ku extends to{constructor(R,eh){super(R,i5,eh)}createBucket(R){return new Gu(R)}queryRadius(){return al(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:R,feature:eh,featureState:eu,geometry:em,transform:e_,pixelsToTileUnits:eg,pixelPosMatrix:ev}){let ex=ll(R,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-e_.bearingInRadians,eg),eb=this.paint.get("fill-extrusion-height").evaluate(eh,eu),ew=this.paint.get("fill-extrusion-base").evaluate(eh,eu),eT=function(R,eh){let eu=[];for(let em of R){let R=[em.x,em.y,0,1];A(R,R,eh),eu.push(new n(R[0]/R[3],R[1]/R[3]))}return eu}(ex,ev),eS=function(R,eh,eu,em){let e_=[],eg=[],ev=em[8]*eh,ex=em[9]*eh,eb=em[10]*eh,ew=em[11]*eh,eT=em[8]*eu,eS=em[9]*eu,eP=em[10]*eu,eI=em[11]*eu;for(let eh of R){let R=[],eu=[];for(let e_ of eh){let eh=e_.x,eg=e_.y,eM=em[0]*eh+em[4]*eg+em[12],eE=em[1]*eh+em[5]*eg+em[13],eC=em[2]*eh+em[6]*eg+em[14],eA=em[3]*eh+em[7]*eg+em[15],ez=eC+eb,eD=eA+ew,ek=eM+eT,eR=eE+eS,eL=eC+eP,eF=eA+eI,eB=new n((eM+ev)/eD,(eE+ex)/eD);eB.z=ez/eD,R.push(eB);let eO=new n(ek/eF,eR/eF);eO.z=eL/eF,eu.push(eO)}e_.push(R),eg.push(eu)}return[e_,eg]}(em,ew,eb,ev);return function(R,eh,eu){let em=1/0;Ka(eu,eh)&&(em=Qu(eu,eh[0]));for(let e_=0;e_<eh.length;e_++){let eg=eh[e_],ev=R[e_];for(let R=0;R<eg.length-1;R++){let eh=eg[R],e_=[eh,eg[R+1],ev[R+1],ev[R],eh];Ha(eu,e_)&&(em=Math.min(em,Qu(eu,e_)))}}return em!==1/0&&em}(eS[0],eS[1],eT)}};function Ju(R,eh){return R.x*eh.x+R.y*eh.y}function Qu(R,eh){if(1===R.length){let eu,em=0,e_=eh[em++];for(;!eu||e_.equals(eu);)if(!(eu=eh[em++]))return 1/0;for(;em<eh.length;em++){let eg=eh[em],ev=R[0],ex=eu.sub(e_),eb=eg.sub(e_),ew=ev.sub(e_),eT=Ju(ex,ex),eS=Ju(ex,eb),eP=Ju(eb,eb),eI=Ju(ew,ex),eM=Ju(ew,eb),eE=eT*eP-eS*eS,eC=(eP*eI-eS*eM)/eE,eA=(eT*eM-eS*eI)/eE,ez=e_.z*(1-eC-eA)+eu.z*eC+eg.z*eA;if(isFinite(ez))return ez}return 1/0}{let R=1/0;for(let eu of eh)R=Math.min(R,eu.z);return R}}let i4=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];let ec=class ec{static from(R){if(!(R instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[eh,eu]=new Uint8Array(R,0,2);if(219!==eh)throw Error("Data does not appear to be in a KDBush format.");let em=eu>>4;if(1!==em)throw Error(`Got v${em} data when expected v1.`);let e_=i4[15&eu];if(!e_)throw Error("Unrecognized array type.");let[eg]=new Uint16Array(R,2,1),[ev]=new Uint32Array(R,4,1);return new ec(ev,eg,e_,R)}constructor(R,eh=64,eu=Float64Array,em){if(isNaN(R)||R<0)throw Error(`Unpexpected numItems value: ${R}.`);this.numItems=+R,this.nodeSize=Math.min(Math.max(+eh,2),65535),this.ArrayType=eu,this.IndexArrayType=R<65536?Uint16Array:Uint32Array;let e_=i4.indexOf(this.ArrayType),eg=2*R*this.ArrayType.BYTES_PER_ELEMENT,ev=R*this.IndexArrayType.BYTES_PER_ELEMENT,ex=(8-ev%8)%8;if(e_<0)throw Error(`Unexpected typed array class: ${eu}.`);em&&em instanceof ArrayBuffer?(this.data=em,this.ids=new this.IndexArrayType(this.data,8,R),this.coords=new this.ArrayType(this.data,8+ev+ex,2*R),this._pos=2*R,this._finished=!0):(this.data=new ArrayBuffer(8+eg+ev+ex),this.ids=new this.IndexArrayType(this.data,8,R),this.coords=new this.ArrayType(this.data,8+ev+ex,2*R),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+e_]),new Uint16Array(this.data,2,1)[0]=eh,new Uint32Array(this.data,4,1)[0]=R)}add(R,eh){let eu=this._pos>>1;return this.ids[eu]=eu,this.coords[this._pos++]=R,this.coords[this._pos++]=eh,eu}finish(){let R=this._pos>>1;if(R!==this.numItems)throw Error(`Added ${R} items when expected ${this.numItems}.`);return function nc(R,eh,eu,em,e_,eg){if(e_-em<=eu)return;let ev=em+e_>>1;(function rc(R,eh,eu,em,e_,eg){for(;e_>em;){if(e_-em>600){let ev=e_-em+1,ex=eu-em+1,eb=Math.log(ev),ew=.5*Math.exp(2*eb/3),eT=.5*Math.sqrt(eb*ew*(ev-ew)
5/ev)*(ex-ev/2<0?-1:1);rc(R,eh,eu,Math.max(em,Math.floor(eu-ex*ew/ev+eT)),Math.min(e_,Math.floor(eu+(ev-ex)*ew/ev+eT)),eg)}let ev=eh[2*eu+eg],ex=em,eb=e_;for(ic(R,eh,em,eu),eh[2*e_+eg]>ev&&ic(R,eh,em,e_);ex<eb;){for(ic(R,eh,ex,eb),ex++,eb--;eh[2*ex+eg]<ev;)ex++;for(;eh[2*eb+eg]>ev;)eb--}eh[2*em+eg]===ev?ic(R,eh,em,eb):ic(R,eh,++eb,e_),eb<=eu&&(em=eb+1),eu<=eb&&(e_=eb-1)}})(R,eh,ev,em,e_,eg),nc(R,eh,eu,em,ev-1,1-eg),nc(R,eh,eu,ev+1,e_,1-eg)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(R,eh,eu,em){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:e_,coords:eg,nodeSize:ev}=this,ex=[0,e_.length-1,0],eb=[];for(;ex.length;){let ew=ex.pop()||0,eT=ex.pop()||0,eS=ex.pop()||0;if(eT-eS<=ev){for(let ev=eS;ev<=eT;ev++){let ex=eg[2*ev],ew=eg[2*ev+1];ex>=R&&ex<=eu&&ew>=eh&&ew<=em&&eb.push(e_[ev])}continue}let eP=eS+eT>>1,eI=eg[2*eP],eM=eg[2*eP+1];eI>=R&&eI<=eu&&eM>=eh&&eM<=em&&eb.push(e_[eP]),(0===ew?R<=eI:eh<=eM)&&(ex.push(eS),ex.push(eP-1),ex.push(1-ew)),(0===ew?eu>=eI:em>=eM)&&(ex.push(eP+1),ex.push(eT),ex.push(1-ew))}return eb}within(R,eh,eu){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:em,coords:e_,nodeSize:eg}=this,ev=[0,em.length-1,0],ex=[],eb=eu*eu;for(;ev.length;){let ew=ev.pop()||0,eT=ev.pop()||0,eS=ev.pop()||0;if(eT-eS<=eg){for(let eu=eS;eu<=eT;eu++)oc(e_[2*eu],e_[2*eu+1],R,eh)<=eb&&ex.push(em[eu]);continue}let eP=eS+eT>>1,eI=e_[2*eP],eM=e_[2*eP+1];oc(eI,eM,R,eh)<=eb&&ex.push(em[eP]),(0===ew?R-eu<=eI:eh-eu<=eM)&&(ev.push(eS),ev.push(eP-1),ev.push(1-ew)),(0===ew?R+eu>=eI:eh+eu>=eM)&&(ev.push(eP+1),ev.push(eT),ev.push(1-ew))}return ex}};function ic(R,eh,eu,em){sc(R,eu,em),sc(eh,2*eu,2*em),sc(eh,2*eu+1,2*em+1)}function sc(R,eh,eu){let em=R[eh];R[eh]=R[eu],R[eu]=em}function oc(R,eh,eu,em){let e_=R-eu,eg=eh-em;return e_*e_+eg*eg}function uc(R,eh,eu,em){let e_={type:eh,geom:eu},eg={id:null==R?null:R,type:e_.type,geometry:e_.geom,tags:em,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(e_.type){case"Point":case"MultiPoint":hc(eg,e_.geom);break;case"LineString":hc(eg,e_.geom.points);break;case"Polygon":hc(eg,e_.geom[0].points);break;case"MultiLineString":for(let R of e_.geom)hc(eg,R.points);break;case"MultiPolygon":for(let R of e_.geom)hc(eg,R[0].points)}return eg}function cc(R){R.points.length>64&&(R.points=new Float64Array(R.points))}function hc(R,eh){for(let eu=0;eu<eh.length;eu+=3)R.minX=Math.min(R.minX,eh[eu]),R.minY=Math.min(R.minY,eh[eu+1]),R.maxX=Math.max(R.maxX,eh[eu]),R.maxY=Math.max(R.maxY,eh[eu+1])}function pc(R,eh){let eu=[];switch(R.type){case"FeatureCollection":for(let em=0;em<R.features.length;em++)fc(eu,R.features[em],eh,em);break;case"Feature":fc(eu,R,eh);break;default:fc(eu,{geometry:R,properties:void 0},eh)}return eu}function fc(R,eh,eu,em){if(!eh.geometry)return;if("GeometryCollection"===eh.geometry.type)return void function(R,eh,eu,em,e_){for(let eg of eu.geometries)fc(R,{id:eh.id,geometry:eg,properties:eh.properties},em,e_)}(R,eh,eh.geometry,eu,em);let e_=eh.geometry.coordinates;if(!e_?.length)return;let eg=eu.promoteId?eh.properties?.[eu.promoteId]:eu.generateId?em||0:eh.id,ev=Math.pow(eu.tolerance/((1<<eu.maxZoom)*eu.extent),2);switch(eh.geometry.type){case"Point":return void function(R,eh,eu,em){let e_=[];e_.push(mc(eu.coordinates[0]),gc(eu.coordinates[1]),0),R.push(uc(eh,"Point",e_,em))}(R,eg,eh.geometry,eh.properties);case"MultiPoint":return void function(R,eh,eu,em){let e_=[];for(let R of eu.coordinates)e_.push(mc(R[0]),gc(R[1]),0);R.push(uc(eh,"MultiPoint",e_,em))}(R,eg,eh.geometry,eh.properties);case"LineString":return void function(R,eh,eu,em,e_){let eg={points:[]};dc(eu.coordinates,eg,em,!1),R.push(uc(eh,"LineString",eg,e_))}(R,eg,eh.geometry,ev,eh.properties);case"MultiLineString":return void function(R,eh,eu,em,e_,eg){if(e_.lineMetrics)for(let e_ of eu.coordinates){let eu={points:[]};dc(e_,eu,em,!1),R.push(uc(eh,"LineString",eu,eg))}else{let e_=[];yc(eu.coordinates,e_,em,!1),R.push(uc(eh,"MultiLineString",e_,eg))}}(R,eg,eh.geometry,ev,eu,eh.properties);case"Polygon":return void function(R,eh,eu,em,e_){let eg=[];yc(eu.coordinates,eg,em,!0),R.push(uc(eh,"Polygon",eg,e_))}(R,eg,eh.geometry,ev,eh.properties);case"MultiPolygon":return void function(R,eh,eu,em,e_){let eg=[];for(let R of eu.coordinates){let eh=[];yc(R,eh,em,!0),eg.push(eh)}R.push(uc(eh,"MultiPolygon",eg,e_))}(R,eg,eh.geometry,ev,eh.properties);default:throw Error("Input data is not a valid GeoJSON object.")}}function dc(R,eh,eu,em){let e_,eg,ev=0;for(let eu=0;eu<R.length;eu++){let ex=mc(R[eu][0]),eb=gc(R[eu][1]);eh.points.push(ex,eb,0),eu>0&&(ev+=em?(e_*eb-ex*eg)/2:Math.sqrt(Math.pow(ex-e_,2)+Math.pow(eb-eg,2))),e_=ex,eg=eb}let ex=eh.points.length-3;eh.points[2]=1,eu>0&&function ac(R,eh,eu,em){let e_=em,eg=eh+(eu-eh>>1),ev,ex=eu-eh,eb=R[eh],ew=R[eh+1],eT=R[eu],eS=R[eu+1];for(let em=eh+3;em<eu;em+=3){let eh=function(R,eh,eu,em,e_,eg){let ev=e_-eu,ex=eg-em;if(0!==ev||0!==ex){let eb=((R-eu)*ev+(eh-em)*ex)/(ev*ev+ex*ex);eb>1?(eu=e_,em=eg):eb>0&&(eu+=ev*eb,em+=ex*eb)}return(ev=R-eu)*ev+(ex=eh-em)*ex}(R[em],R[em+1],eb,ew,eT,eS);if(eh>e_)ev=em,e_=eh;else if(eh===e_){let R=Math.abs(em-eg);R<ex&&(ev=em,ex=R)}}e_>em&&(ev-eh>3&&ac(R,eh,ev,em),R[ev+2]=e_,eu-ev>3&&ac(R,ev,eu,em))}(eh.points,0,ex,eu),eh.points[ex+2]=1,cc(eh),eh.size=Math.abs(ev),eh.start=0,eh.end=eh.size}function yc(R,eh,eu,em){for(let e_=0;e_<R.length;e_++){let eg={points:[]};dc(R[e_],eg,eu,em),eh.push(eg)}}function mc(R){return R/360+.5}function gc(R){let eh=Math.sin(R*Math.PI/180),eu=.5-.25*Math.log((1+eh)/(1-eh))/Math.PI;return eu<0?0:eu>1?1:eu}function xc(R){let eh={type:"Feature",geometry:function(R){let{type:eh,geometry:eu}=R;switch(eh){case"Point":var em,e_;return{type:eh,coordinates:(em=eu[0],e_=eu[1],[_c(em),Sc(e_)])};case"MultiPoint":return{type:eh,coordinates:bc(eu)};case"LineString":return{type:eh,coordinates:bc(eu.points)};case"MultiLineString":case"Polygon":return{type:eh,coordinates:eu.map(R=>bc(R.points))};case"MultiPolygon":return{type:eh,coordinates:eu.map(R=>R.map(R=>bc(R.points)))}}}(R),properties:R.tags};return null!=R.id&&(eh.id=R.id),eh}function bc(R){let eh=[];for(let e_=0;e_<R.length;e_+=3){var eu,em;eh.push((eu=R[e_],em=R[e_+1],[_c(eu),Sc(em)]))}return eh}function _c(R){return 360*(R-.5)}function Sc(R){return 360*Math.atan(Math.exp((180-360*R)*Math.PI/180)
5)/Math.PI-90}function Mc(R,eh,eu,em,e_,eg,ev,ex){if(em/=eh,eg>=(eu/=eh)&&ev<em)return R;if(ev<eu||eg>=em)return null;let eb=[];for(let eh of R){let R=e_===e$.X?eh.minX:eh.minY,eg=e_===e$.X?eh.maxX:eh.maxY;if(R>=eu&&eg<em)eb.push(eh);else if(!(eg<eu||R>=em))switch(eh.type){case"Point":case"MultiPoint":(function(R,eh,eu,em,e_){let eg=[];(function(R,eh,eu,em,e_){for(let eg=0;eg<R.length;eg+=3){let ev=R[eg+e_];ev>=eu&&ev<=em&&Bc(eh,R[eg],R[eg+1],R[eg+2])}})(R.geometry,eg,eu,em,e_),eg.length&&eh.push(uc(R.id,3===eg.length?"Point":"MultiPoint",eg,R.tags))})(eh,eb,eu,em,e_);continue;case"LineString":(function(R,eh,eu,em,e_,eg){let ev=[];if(Pc(R.geometry,ev,eu,em,e_,!1,eg.lineMetrics),ev.length){if(eg.lineMetrics)for(let eu of ev)eh.push(uc(R.id,"LineString",eu,R.tags));else eh.push(ev.length>1?uc(R.id,"MultiLineString",ev,R.tags):uc(R.id,"LineString",ev[0],R.tags))}})(eh,eb,eu,em,e_,ex);continue;case"MultiLineString":(function(R,eh,eu,em,e_){let eg=[];zc(R.geometry,eg,eu,em,e_,!1),eg.length&&eh.push(1!==eg.length?uc(R.id,"MultiLineString",eg,R.tags):uc(R.id,"LineString",eg[0],R.tags))})(eh,eb,eu,em,e_);continue;case"Polygon":(function(R,eh,eu,em,e_){let eg=[];zc(R.geometry,eg,eu,em,e_,!0),eg.length&&eh.push(uc(R.id,"Polygon",eg,R.tags))})(eh,eb,eu,em,e_);continue;case"MultiPolygon":(function(R,eh,eu,em,e_){let eg=[];for(let eh of R.geometry){let R=[];zc(eh,R,eu,em,e_,!0),R.length&&eg.push(R)}eg.length&&eh.push(uc(R.id,"MultiPolygon",eg,R.tags))})(eh,eb,eu,em,e_);continue}}return eb.length?eb:null}function Pc(R,eh,eu,em,e_,eg,ev){let ex=Dc(R),eb=e_===e$.X?Cc:Vc,ew,eT,eS=R.start;for(let eP=0;eP<R.points.length-3;eP+=3){let eI=R.points[eP],eM=R.points[eP+1],eE=R.points[eP+2],eC=R.points[eP+3],eA=R.points[eP+4],ez=e_===e$.X?eI:eM,eD=e_===e$.X?eC:eA,ek=!1;ev&&(ew=Math.sqrt(Math.pow(eI-eC,2)+Math.pow(eM-eA,2))),ez<eu?eD>eu&&(eT=eb(ex,eI,eM,eC,eA,eu),ev&&(ex.start=eS+ew*eT)):ez>em?eD<em&&(eT=eb(ex,eI,eM,eC,eA,em),ev&&(ex.start=eS+ew*eT)):Bc(ex.points,eI,eM,eE),eD<eu&&ez>=eu&&(eT=eb(ex,eI,eM,eC,eA,eu),ek=!0),eD>em&&ez<=em&&(eT=eb(ex,eI,eM,eC,eA,em),ek=!0),!eg&&ek&&(ev&&(ex.end=eS+ew*eT),eh.push(ex),ex=Dc(R)),ev&&(eS+=ew)}let eP=R.points.length-3,eI=R.points[eP],eM=R.points[eP+1],eE=e_===e$.X?eI:eM;eE>=eu&&eE<=em&&Bc(ex.points,eI,eM,R.points[eP+2]),eP=ex.points.length-3,eg&&eP>=3&&(ex.points[eP]!==ex.points[0]||ex.points[eP+1]!==ex.points[1])&&Bc(ex.points,ex.points[0],ex.points[1],ex.points[2]),ex.points.length&&(cc(ex),eh.push(ex))}function Dc(R){return{points:[],size:R.size,start:R.start,end:R.end}}function zc(R,eh,eu,em,e_,eg){for(let ev of R)Pc(ev,eh,eu,em,e_,eg,!1)}function Bc(R,eh,eu,em){R.push(eh,eu,em)}function Cc(R,eh,eu,em,e_,eg){let ev=(eg-eh)/(em-eh);return Bc(R.points,eg,eu+(e_-eu)*ev,1),ev}function Vc(R,eh,eu,em,e_,eg){let ev=(eg-eu)/(e_-eu);return Bc(R.points,eh+(em-eh)*ev,eg,1),ev}function Lc(R,eh){let eu=eh.buffer/eh.extent,em=R,e_=Mc(R,1,-1-eu,eu,e$.X,-1,2,eh),eg=Mc(R,1,1-eu,2+eu,e$.X,-1,2,eh);return(e_||eg)&&(em=Mc(R,1,-eu,1+eu,e$.X,-1,2,eh)||[],e_&&(em=Oc(e_,1).concat(em)),eg&&(em=em.concat(Oc(eg,-1)))),em}function Oc(R,eh){let eu=[];for(let em of R)switch(em.type){case"Point":case"MultiPoint":{let R=function(R,eh){let eu=[];for(let em=0;em<R.length;em+=3)eu.push(R[em]+eh,R[em+1],R[em+2]);return eu}(em.geometry,eh);eu.push(uc(em.id,em.type,R,em.tags));continue}case"LineString":{let R=Rc(em.geometry,eh);eu.push(uc(em.id,em.type,R,em.tags));continue}case"MultiLineString":case"Polygon":{let R=[];for(let eu of em.geometry)R.push(Rc(eu,eh));eu.push(uc(em.id,em.type,R,em.tags));continue}case"MultiPolygon":{let R=[];for(let eu of em.geometry){let em=[];for(let R of eu)em.push(Rc(R,eh));R.push(em)}eu.push(uc(em.id,em.type,R,em.tags));continue}}return eu}function Rc(R,eh){let eu={points:[],size:R.size};void 0!==R.start&&(eu.start=R.start,eu.end=R.end);for(let em=0;em<R.points.length;em+=3)eu.points.push(R.points[em]+eh,R.points[em+1],R.points[em+2]);return cc(eu),eu}function Uc(R,eh){if(eh.removeAllProperties)return{};let eu={...R||{}};if(eh.removeProperties)for(let R of eh.removeProperties)delete eu[R];if(eh.addOrUpdateProperties)for(let{key:R,value:em}of eh.addOrUpdateProperties)eu[R]=em;return eu}(ek=e$||(e$={}
5))[ek.X=0]="X",ek[ek.Y=1]="Y";let i6={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:R=>R};let qc=class qc{constructor(R){this.options=Object.assign(Object.create(i6),R),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(R){let eh=[];for(let eu of R){if(!eu.geometry)continue;let[R,em]=eu.geometry.coordinates,[e_,eg]=[mc(R),gc(em)];eh.push({id:eu.id,type:"Point",geometry:[e_,eg],tags:eu.properties})}this.createIndex(eh)}initialize(R){let eh=[];for(let eu of R)"Point"===eu.type&&eh.push(eu);this.createIndex(eh)}updateIndex(R,eh,eu){this.options=Object.assign(Object.create(i6),eu.clusterOptions),this.initialize(R)}createIndex(R){let{log:eh,minZoom:eu,maxZoom:em}=this.options;eh&&console.time("total time");let e_=`prepare ${R.length} points`;eh&&console.time(e_),this.points=R;let eg=[];for(let eh=0;eh<R.length;eh++){let eu=R[eh];if(!eu?.geometry)continue;let[em,e_]=eu.geometry;em=Math.fround(em),e_=Math.fround(e_),eg.push(em,e_,1/0,eh,-1,1),this.options.reduce&&eg.push(0)}let ev=this.trees[em+1]=this.createTree(eg);eh&&console.timeEnd(e_);for(let R=em;R>=eu;R--){let eu=Date.now();ev=this.trees[R]=this.createTree(this.cluster(ev,R)),eh&&console.log("z%d: %d clusters in %dms",R,ev.numItems,Date.now()-eu)}eh&&console.timeEnd("total time")}getClusters(R,eh){return this.getClustersInternal(R,eh).map(R=>xc(R))}getClustersInternal(R,eh){let eu=((R[0]+180)%360+360)%360-180,em=Math.max(-90,Math.min(90,R[1])),e_=180===R[2]?180:((R[2]+180)%360+360)%360-180,eg=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)eu=-180,e_=180;else if(eu>e_){let R=this.getClustersInternal([eu,em,180,eg],eh),ev=this.getClustersInternal([-180,em,e_,eg],eh);return R.concat(ev)}let ev=this.trees[this.limitZoom(eh)],ex=ev.range(mc(eu),gc(eg),mc(e_),gc(em)),eb=ev.flatData,ew=[];for(let R of ex){var eT;let eh=this.stride*R;ew.push(eb[eh+5]>1?(eT=this.clusterProps,{id:eb[eh+3],type:"Point",tags:Yc(eb,eh,eT),geometry:[eb[eh],eb[eh+1]]}):this.points[eb[eh+3]])}return ew}getChildren(R){let eh=this.getOriginId(R),eu=this.getOriginZoom(R),em=Error("No cluster with the specified id: "+R),e_=this.trees[eu];if(!e_)throw em;let eg=e_.flatData;if(eh*this.stride>=eg.length)throw em;let ev=this.options.radius/(this.options.extent*Math.pow(2,eu-1)),ex=e_.within(eg[eh*this.stride],eg[eh*this.stride+1],ev),eb=[];for(let eh of ex){var ew;let eu=eh*this.stride;eg[eu+4]===R&&eb.push(eg[eu+5]>1?(ew=this.clusterProps,{type:"Feature",id:eg[eu+3],properties:Yc(eg,eu,ew),geometry:{type:"Point",coordinates:[_c(eg[eu]),Sc(eg[eu+1])]}}):xc(this.points[eg[eu+3]]))}if(0===eb.length)throw em;return eb}getLeaves(R,eh,eu){let em=[];return this.appendLeaves(em,R,eh=eh||10,eu=eu||0,0),em}getTile(R,eh,eu){let em=this.trees[this.limitZoom(R)];if(!em)return null;let e_=Math.pow(2,R),{extent:eg,radius:ev}=this.options,ex=ev/eg,eb=(eu-ex)/e_,ew=(eu+1+ex)/e_,eT={transformed:!0,features:[],source:null,x:eh,y:eu,z:R};return this.addTileFeatures(em.range((eh-ex)/e_,eb,(eh+1+ex)/e_,ew),em.flatData,eh,eu,e_,eT),0===eh&&this.addTileFeatures(em.range(1-ex/e_,eb,1,ew),em.flatData,e_,eu,e_,eT),eh===e_-1&&this.addTileFeatures(em.range(0,eb,ex/e_,ew),em.flatData,-1,eu,e_,eT),eT}getClusterExpansionZoom(R){return this.getOriginZoom(R)}appendLeaves(R,eh,eu,em,e_){let eg=this.getChildren(eh);for(let eh of eg){let eg=eh.properties;if(eg?.cluster?e_+eg.point_count<=em?e_+=eg.point_count:e_=this.appendLeaves(R,eg.cluster_id,eu,em,e_):e_<em?e_++:R.push(eh),R.length===eu)break}return e_}createTree(R){let eh=new ec(R.length/this.stride|0,this.options.nodeSize,Float32Array);for(let eu=0;eu<R.length;eu+=this.stride)eh.add(R[eu],R[eu+1]);return eh.finish(),eh.flatData=R,eh.data=null,eh}addTileFeatures(R,eh,eu,em,e_,eg){for(let ev of R){let R,ex,eb,ew;let eT=ev*this.stride,eS=eh[eT+5]>1;if(eS)R=Yc(eh,eT,this.clusterProps),ex=eh[eT],eb=eh[eT+1];else{let eu=this.points[eh[eT+3]];R=eu.tags,[ex,eb]=eu.geometry}let eP={type:1,geometry:[[Math.round(this.options.extent*(ex*e_-eu)),Math.round(this.options.extent*(eb*e_-em))]],tags:R};void 0!==(ew=eS||this.options.generateId?eh[eT+3]:this.points[eh[eT+3]].id)&&(eP.id=ew),eg.features.push(eP)}}limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}cluster(R,eh){let{radius:eu,extent:em,reduce:e_,minPoints:eg}=this.options,ev=eu/(em*Math.pow(2,eh)),ex=R.flatData,eb=[],ew=this.stride;for(let eu=0;eu<ex.length;eu+=ew){if(ex[eu+2]<=eh)continue;ex[eu+2]=eh;let em=ex[eu],eT=ex[eu+1],eS=R.within(ex[eu],ex[eu+1],ev),eP=ex[eu+5],eI=eP;for(let R of eS){let eu=R*ew;ex[eu+2]>eh&&(eI+=ex[eu+5])}if(eI>eP&&eI>=eg){let R,eg=em*eP,ev=eT*eP,eM=-1,eE=(eu/ew<<5)+(eh+1)+this.points.length;for(let em of eS){let eb=em*ew;if(ex[eb+2]<=eh)continue;ex[eb+2]=eh;let eT=ex[eb+5];eg+=ex[eb]*eT,ev+=ex[eb+1]*eT,ex[eb+4]=eE,e_&&(R||(R=this.map(ex,eu,!0),eM=this.clusterProps.length,this.clusterProps.push(R)),e_(R,this.map(ex,eb)))}ex[eu+4]=eE,eb.push(eg/eI,ev/eI,1/0,eE,-1,eI),e_&&eb.push(eM)}else{for(let R=0;R<ew;R++)eb.push(ex[eu+R]);if(eI>1)for(let R of eS){let eu=R*ew;if(!(ex[eu+2]<=eh)){ex[eu+2]=eh;for(let R=0;R<ew;R++)eb.push(ex[eu+R])}}}}return eb}getOriginId(R){return R-this.points.length>>5}getOriginZoom(R){return(R-this.points.length)%32}map(R,eh,eu){if(R[eh+5]>1){let em=this.clusterProps[R[eh+6]];return eu?Object.assign({},em):em}let em=this.points[R[eh+3]].tags,e_=this.options.map(em);return eu&&e_===em?Object.assign({},e_):e_}};function Yc(R,eh,eu){let em=R[eh+5],e_=em>=1e4?`${Math.round(em/1e3)}k`:em>=1e3?Math.round(em/100)/10+"k":em,eg=R[eh+6],ev=-1===eg?{}:Object.assign({},eu[eg]);return Object.assign(ev,{cluster:!0,cluster_id:R[eh+3],point_count:em,point_count_abbreviated:e_})}let i8="geojsonvt_clip_start",i7="geojsonvt_clip_end";function Wc(R,eh,eu,em,e_){let eg=eh===e_.maxZoom?0:e_.tolerance/((1<<eh)*e_.extent),ev={transformed:!1,features:[],source:null,x:eu,y:em,z:eh,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:R.length};for(let eh of R)(function(R,eh,eu,em){switch(R.minX=Math.min(R.minX,eh.minX),R.minY=Math.min(R.minY,eh.minY),R.maxX=Math.max(R.maxX,eh.maxX),R.maxY=Math.max(R.maxY,eh.maxY),eh.type){case"Point":case"MultiPoint":return void function(R,eh){let eu=[];for(let em=0;em<eh.geometry.length;em+=3)eu.push(eh.geometry[em],eh.geometry[em+1]),R.numPoints++,R.numSimplified++;if(!eu.length)return;let em={type:1,tags:eh.tags||null,geometry:eu};null!==eh.id&&(em.id=eh.id),R.features.push(em)}(R,eh);case"LineString":return void function(R,eh,eu,em){let e_=[];
5if(Jc(e_,eh.geometry,R,eu,!1,!1),!e_.length)return;let eg=eh.tags||null;if(em.lineMetrics){for(let R in eg={},eh.tags)eg[R]=eh.tags[R];eg[i8]=eh.geometry.start/eh.geometry.size,eg[i7]=eh.geometry.end/eh.geometry.size}let ev={type:2,tags:eg,geometry:e_};null!==eh.id&&(ev.id=eh.id),R.features.push(ev)}(R,eh,eu,em);case"MultiLineString":case"Polygon":return void function(R,eh,eu){let em=[];for(let e_=0;e_<eh.geometry.length;e_++)Jc(em,eh.geometry[e_],R,eu,"Polygon"===eh.type,0===e_);if(!em.length)return;let e_={type:"Polygon"===eh.type?3:2,tags:eh.tags||null,geometry:em};null!==eh.id&&(e_.id=eh.id),R.features.push(e_)}(R,eh,eu);case"MultiPolygon":return void function(R,eh,eu){let em=[];for(let e_=0;e_<eh.geometry.length;e_++){let eg=eh.geometry[e_];for(let eh=0;eh<eg.length;eh++)Jc(em,eg[eh],R,eu,!0,0===eh)}if(!em.length)return;let e_={type:3,tags:eh.tags||null,geometry:em};null!==eh.id&&(e_.id=eh.id),R.features.push(e_)}(R,eh,eu)}})(ev,eh,eg,e_);return ev}function Jc(R,eh,eu,em,e_,eg){let ev=em*em;if(em>0&&eh.size<(e_?ev:em))return void(eu.numPoints+=eh.points.length/3);let ex=[];for(let R=0;R<eh.points.length;R+=3)(0===em||eh.points[R+2]>ev)&&(eu.numSimplified++,ex.push(eh.points[R],eh.points[R+1])),eu.numPoints++;e_&&function(R,eh){let eu=0;for(let eh=0,em=R.length,e_=em-2;eh<em;e_=eh,eh+=2)eu+=(R[eh]-R[e_])*(R[eh+1]+R[e_+1]);if(eu>0===eh)for(let eh=0,eu=R.length;eh<eu/2;eh+=2){let em=R[eh],e_=R[eh+1];R[eh]=R[eu-2-eh],R[eh+1]=R[eu-1-eh],R[eu-2-eh]=em,R[eu-1-eh]=e_}}(ex,eg),R.push(ex)}function Qc(R,eh){if(R.transformed)return R;let eu=1<<R.z,em=R.x,e_=R.y;for(let eg of R.features)1===eg.type?function(R,eh,eu,em,e_){let eg=R.geometry,ev=[];for(let R=0;R<eg.length;R+=2)ev.push(nh(eg[R],eg[R+1],eh,eu,em,e_));return R.geometry=ev,R}(eg,eh,eu,em,e_):function(R,eh,eu,em,e_){let eg=R.geometry,ev=[];for(let R of eg){let eg=[];for(let ev=0;ev<R.length;ev+=2)eg.push(nh(R[ev],R[ev+1],eh,eu,em,e_));ev.push(eg)}return R.geometry=ev,R}(eg,eh,eu,em,e_);return R.transformed=!0,R}function nh(R,eh,eu,em,e_,eg){return[Math.round(eu*(R*em-e_)),Math.round(eu*(eh*em-eg))]}let rh=class rh{constructor(R){this.options=R,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(R){this.splitTile(R,0,0,0),this.options.debug&&(R.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(R,eh,eu){eu.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(eh),eu.debug>1&&console.timeEnd("invalidating");let[em,e_,eg]=[0,0,0],ev=Wc(R,em,e_,eg,eu);ev.source=R;let ex=ih(em,e_,eg);if(this.tiles[ex]=ev,this.tileCoords.push({z:em,x:e_,y:eg,id:ex}),eu.debug){let R=`z${em}`;this.stats[R]=(this.stats[R]||0)+1,this.total++}}getClusterExpansionZoom(R){return null}getChildren(R){return null}getLeaves(R,eh,eu){return null}getTile(R,eh,eu){let{extent:em,debug:e_}=this.options,eg=1<<R,ev=ih(R,eh=eh+eg&eg-1,eu);if(this.tiles[ev])return Qc(this.tiles[ev],em);e_>1&&console.log("drilling down to z%d-%d-%d",R,eh,eu);let ex,eb=R,ew=eh,eT=eu;for(;!ex&&eb>0;)eb--,ew>>=1,eT>>=1,ex=this.tiles[ih(eb,ew,eT)];return ex?.source?(e_>1&&(console.log("found parent tile z%d-%d-%d",eb,ew,eT),console.time("drilling down")),this.splitTile(ex.source,eb,ew,eT,R,eh,eu),e_>1&&console.timeEnd("drilling down"),this.tiles[ev]?Qc(this.tiles[ev],em):null):null}splitTile(R,eh,eu,em,e_,eg,ev){let ex=[R,eh,eu,em],eb=this.options,ew=eb.debug;for(;ex.length;){em=ex.pop(),eu=ex.pop(),eh=ex.pop(),R=ex.pop();let eT=1<<eh,eS=ih(eh,eu,em),eP=this.tiles[eS];if(!eP&&(ew>1&&console.time("creation"),eP=this.tiles[eS]=Wc(R,eh,eu,em,eb),this.tileCoords.push({z:eh,x:eu,y:em,id:eS}),ew)){ew>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",eh,eu,em,eP.numFeatures,eP.numPoints,eP.numSimplified),console.timeEnd("creation"));let R=`z${eh}`;this.stats[R]=(this.stats[R]||0)+1,this.total++}if(eP.source=R,null==e_){if(eh===eb.indexMaxZoom||eP.numPoints<=eb.indexMaxPoints)continue}else{if(eh===eb.maxZoom||eh===e_)continue;if(null!=e_){let R=e_-eh;if(eu!==eg>>R||em!==ev>>R)continue}}if(eP.source=null,!R.length)continue;ew>1&&console.time("clipping");let eI=.5*eb.buffer/eb.extent,eM=.5-eI,eE=.5+eI,eC=1+eI,eA=null,ez=null,eD=null,ek=null,eR=Mc(R,eT,eu-eI,eu+eE,e$.X,eP.minX,eP.maxX,eb),eL=Mc(R,eT,eu+eM,eu+eC,e$.X,eP.minX,eP.maxX,eb);eR&&(eA=Mc(eR,eT,em-eI,em+eE,e$.Y,eP.minY,eP.maxY,eb),ez=Mc(eR,eT,em+eM,em+eC,e$.Y,eP.minY,eP.maxY,eb)),eL&&(eD=Mc(eL,eT,em-eI,em+eE,e$.Y,eP.minY,eP.maxY,eb),ek=Mc(eL,eT,em+eM,em+eC,e$.Y,eP.minY,eP.maxY,eb)),ew>1&&console.timeEnd("clipping"),ex.push(eA||[],eh+1,2*eu,2*em),ex.push(ez||[],eh+1,2*eu,2*em+1),ex.push(eD||[],eh+1,2*eu+1,2*em),ex.push(ek||[],eh+1,2*eu+1,2*em+1)}}invalidateTiles(R){if(!R.length)return;let eh=this.options,{debug:eu}=eh,em=1/0,e_=-1/0,eg=1/0,ev=-1/0;for(let eh of R)em=Math.min(em,eh.minX),e_=Math.max(e_,eh.maxX),eg=Math.min(eg,eh.minY),ev=Math.max(ev,eh.maxY);let ex=eh.buffer/eh.extent,eb=new Set;for(let eh in this.tiles){let ew=this.tiles[eh],eT=1<<ew.z,eS=(ew.x-ex)/eT,eP=(ew.x+1+ex)/eT,eI=(ew.y-ex)/eT,eM=(ew.y+1+ex)/eT;if(e_<eS||em>=eP||ev<eI||eg>=eM)continue;let eE=!1;for(let eh of R)if(eh.maxX>=eS&&eh.minX<eP&&eh.maxY>=eI&&eh.minY<eM){eE=!0;break}if(eE){if(eu){eu>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",ew.z,ew.x,ew.y,ew.numFeatures,ew.numPoints,ew.numSimplified);let R=`z${ew.z}`;this.stats[R]=(this.stats[R]||0)-1,this.total--}delete this.tiles[eh],eb.add(eh)}}eb.size&&(this.tileCoords=this.tileCoords.filter(R=>!eb.has(R.id)))}};function ih(R,eh,eu){return 32*((1<<R)*eu+eh)+R}let i9={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,
5cluster:!1,clusterOptions:i6,debug:0},rs=ao([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ru}=rs,rm=ao([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:r_}=rm,rg=Math.cos(Math.PI/180*37.5);let ph=class ph{constructor(R){for(let eh of(this.zoom=R.zoom,this.overscaling=R.overscaling,this.layers=R.layers,this.layerIds=this.layers.map(R=>R.id),this.index=R.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers))this.gradients[eh.id]={};this.layoutVertexArray=new Wo,this.layoutVertexArray2=new Ko,this.indexArray=new sa,this.programConfigurations=new $a(R.layers,R.zoom),this.segments=new ua,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id)}populate(R,eh,eu){this.hasDependencies=ql("line",this.layers,eh)||this.hasLineDasharray(this.layers);let em=this.layers[0].layout.get("line-sort-key"),e_=!em.isConstant(),eg=[];for(let{feature:eh,id:ev,index:ex,sourceLayerIndex:eb}of R){let R=this.layers[0]._featureFilter.needGeometry,ew=Ga(eh,R);if(!this.layers[0]._featureFilter.filter(new Cs(this.zoom),ew,eu))continue;let eT=e_?em.evaluate(ew,{},eu):void 0,eS={id:ev,properties:eh.properties,type:eh.type,sourceLayerIndex:eb,index:ex,geometry:R?ew.geometry:qa(eh),patterns:{},dashes:{},sortKey:eT};eg.push(eS)}for(let em of(e_&&eg.sort((R,eh)=>R.sortKey-eh.sortKey),eg)){let{geometry:e_,index:eg,sourceLayerIndex:ev}=em;this.hasDependencies?(ql("line",this.layers,eh)?Gl("line",this.layers,em,{zoom:this.zoom},eh):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,em,this.zoom,eh),this.patternFeatures.push(em)):this.addFeature(em,e_,eg,eu,{},{},eh.subdivisionGranularity),eh.featureIndex.insert(R[eg].feature,e_,eg,ev,this.index)}}update(R,eh,eu,em){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(R,eh,this.stateDependentLayers,{imagePositions:eu,dashPositions:em})}addFeatures(R,eh,eu,em){for(let e_ of this.patternFeatures)this.addFeature(e_,e_.geometry,e_.index,eh,eu,em,R.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(R){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=R.createVertexBuffer(this.layoutVertexArray2,r_)),this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,ru),this.indexBuffer=R.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(R),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(R){if(R.properties&&Object.hasOwn(R.properties,i8)&&Object.hasOwn(R.properties,i7))return{start:+R.properties[i8],end:+R.properties[i7]}}addFeature(R,eh,eu,em,e_,eg,ev){let ex=this.layers[0].layout,eb=ex.get("line-join").evaluate(R,{}),ew=ex.get("line-cap").evaluate(R,{}),eT=ex.get("line-miter-limit").evaluate(R,{}),eS=ex.get("line-round-limit").evaluate(R,{});for(let eu of(this.lineClips=this.lineFeatureClips(R),eh))this.addLine(eu,R,eb,ew,eT,eS,em,ev);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,R,eu,{imagePositions:e_,dashPositions:eg,canonical:em})}addLine(R,eh,eu,em,e_,eg,ev,ex){let eb,ew,eT,eS,eP;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,R=Su(R,ev?ex.line.getGranularityForZoomLevel(ev.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let eh=0;eh<R.length-1;eh++)this.totalDistance+=R[eh].dist(R[eh+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let eI="Polygon"===Cu.types[eh.type],eM=R.length;for(;eM>=2&&R[eM-1].equals(R[eM-2]);)eM--;let eE=0;for(;eE<eM-1&&R[eE].equals(R[eE+1]);)eE++;if(eM<(eI?3:2))return;"bevel"===eu&&(e_=1.05);let eC=this.overscaling<=16?122880/(512*this.overscaling):0,eA=this.segments.prepareSegment(10*eM,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,eI&&(eb=R[eM-2],eP=R[eE].sub(eb)._unit()._perp());for(let eh=eE;eh<eM;eh++){if((eT=eh===eM-1?eI?R[eE+1]:void 0:R[eh+1])&&R[eh].equals(eT))continue;eP&&(eS=eP),eb&&(ew=eb),eb=R[eh],eP=eT?eT.sub(eb)._unit()._perp():eS;let ev=(eS=eS||eP).add(eP);0===ev.x&&0===ev.y||ev._unit();let ex=eS.x*eP.x+eS.y*eP.y,ez=ev.x*eP.x+ev.y*eP.y,eD=0!==ez?1/ez:1/0,ek=2*Math.sqrt(2-2*ez),eR=ez<rg&&ew&&eT,eL=eS.x*eP.y-eS.y*eP.x>0;if(eR&&eh>eE){let R=eb.dist(ew);if(R>2*eC){let eh=eb.sub(eb.sub(ew)._mult(eC/R)._round());this.updateDistance(ew,eh),this.addCurrentVertex(eh,eS,0,0,eA),ew=eh}}let eF=ew&&eT,eB=eF?eu:eI?"butt":em;if(eF&&"round"===eB&&(eD<eg?eB="miter":eD<=2&&(eB="fakeround")),"miter"
5===eB&&eD>e_&&(eB="bevel"),"bevel"===eB&&(eD>2&&(eB="flipbevel"),eD<e_&&(eB="miter")),ew&&this.updateDistance(ew,eb),"miter"===eB)ev._mult(eD),this.addCurrentVertex(eb,ev,0,0,eA);else if("flipbevel"===eB){if(eD>100)ev=eP.mult(-1);else{let R=eD*eS.add(eP).mag()/eS.sub(eP).mag();ev._perp()._mult(R*(eL?-1:1))}this.addCurrentVertex(eb,ev,0,0,eA),this.addCurrentVertex(eb,ev.mult(-1),0,0,eA)}else if("bevel"===eB||"fakeround"===eB){let R=-Math.sqrt(eD*eD-1),eh=eL?R:0,eu=eL?0:R;if(ew&&this.addCurrentVertex(eb,eS,eh,eu,eA),"fakeround"===eB){let R=Math.round(180*ek/Math.PI/20);for(let eh=1;eh<R;eh++){let eu=eh/R;if(.5!==eu){let R=eu-.5;eu+=eu*R*(eu-1)*((1.0904+ex*(ex*(3.55645-1.43519*ex)-3.2452))*R*R+(.848013+ex*(.215638*ex-1.06021)))}let em=eP.sub(eS)._mult(eu)._add(eS)._unit()._mult(eL?-1:1);this.addHalfVertex(eb,em.x,em.y,!1,eL,0,eA)}}eT&&this.addCurrentVertex(eb,eP,-eh,-eu,eA)}else if("butt"===eB)this.addCurrentVertex(eb,ev,0,0,eA);else if("square"===eB){let R=ew?1:-1;this.addCurrentVertex(eb,ev,R,R,eA)}else"round"===eB&&(ew&&(this.addCurrentVertex(eb,eS,0,0,eA),this.addCurrentVertex(eb,eS,1,1,eA,!0)),eT&&(this.addCurrentVertex(eb,eP,-1,-1,eA,!0),this.addCurrentVertex(eb,eP,0,0,eA)));if(eR&&eh<eM-1){let R=eb.dist(eT);if(R>2*eC){let eh=eb.add(eT.sub(eb)._mult(eC/R)._round());this.updateDistance(eb,eh),this.addCurrentVertex(eh,eP,0,0,eA),eb=eh}}}}addCurrentVertex(R,eh,eu,em,e_,eg=!1){let ev=eh.y*em-eh.x,ex=-eh.y-eh.x*em;this.addHalfVertex(R,eh.x+eh.y*eu,eh.y-eh.x*eu,eg,!1,eu,e_),this.addHalfVertex(R,ev,ex,eg,!0,-em,e_),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(R,eh,eu,em,e_,eg))}addHalfVertex({x:R,y:eh},eu,em,e_,eg,ev,ex){let eb=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);this.layoutVertexArray.emplaceBack((R<<1)+(e_?1:0),(eh<<1)+(eg?1:0),Math.round(63*eu)+128,Math.round(63*em)+128,1+(0===ev?0:ev<0?-1:1)|(63&eb)<<2,eb>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let ew=ex.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,ew,this.e2),ex.primitiveLength++),eg?this.e2=ew:this.e1=ew}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(R,eh){this.distance+=R.dist(eh),this.updateScaledDistance()}hasLineDasharray(R){for(let eh of R){let R=eh.paint.get("line-dasharray");if(R&&!R.isConstant())return!0}return!1}addLineDashDependencies(R,eh,eu,em){for(let e_ of R){let R=e_.paint.get("line-dasharray");if(!R||"constant"===R.value.kind)continue;let eg="round"===e_.layout.get("line-cap").evaluate(eh,{}),ev={dasharray:R.value.evaluate({zoom:eu-1},eh,{}),round:eg},ex={dasharray:R.value.evaluate({zoom:eu},eh,{}),round:eg},eb={dasharray:R.value.evaluate({zoom:eu+1},eh,{}),round:eg},ew=`${ev.dasharray.join(",")},${ev.round}`,eT=`${ex.dasharray.join(",")},${ex.round}`,eS=`${eb.dasharray.join(",")},${eb.round}`;em.dashDependencies[ew]=ev,em.dashDependencies[eT]=ex,em.dashDependencies[eS]=eb,eh.dashes[e_.id]={min:ew,mid:eT,max:eS}}}};ds("LineBucket",ph,{omit:["layers","patternFeatures"]});var ry={get paint(){return eE=eE||new Ks({"line-opacity":new Ys(t_.paint_line["line-opacity"]),"line-color":new Ys(t_.paint_line["line-color"]),"line-translate":new Xs(t_.paint_line["line-translate"]),"line-translate-anchor":new Xs(t_.paint_line["line-translate-anchor"]),"line-width":new Ys(t_.paint_line["line-width"]),"line-gap-width":new Ys(t_.paint_line["line-gap-width"]),"line-offset":new Ys(t_.paint_line["line-offset"]),"line-blur":new Ys(t_.paint_line["line-blur"]),"line-dasharray":new Zs(t_.paint_line["line-dasharray"]),"line-pattern":new Zs(t_.paint_line["line-pattern"]),"line-gradient":new Ws(t_.paint_line["line-gradient"])})},get layout(){return eM=eM||new Ks({"line-cap":new Ys(t_.layout_line["line-cap"]),"line-join":new Ys(t_.layout_line["line-join"]),"line-miter-limit":new Ys(t_.layout_line["line-miter-limit"]),"line-round-limit":new Ys(t_.layout_line["line-round-limit"]),"line-sort-key":new Ys(t_.layout_line["line-sort-key"])})}};let mh=class mh extends Ys{possiblyEvaluate(R,eh){return eh=new Cs(Math.floor(eh.zoom),{now:eh.now,fadeDuration:eh.fadeDuration,zoomHistory:eh.zoomHistory,transition:eh.transition}),super.possiblyEvaluate(R,eh)}evaluate(R,eh,eu,em){return eh=$({},eh,{zoom:Math.floor(eh.zoom)}),super.evaluate(R,eh,eu,em)}};let xh=class xh extends to{constructor(R,eh){super(R,ry,eh),this.gradientVersion=0,eC||((eC=new mh(ry.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(R){if("line-gradient"===R){let R=this.gradientExpression();this.stepInterpolant=void 0!==R._styleExpression&&R._styleExpression.expression instanceof cn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(R,eh){super.recalculate(R,eh),this.paint._values["line-floorwidth"]=eC.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,R)}createBucket(R){return new ph(R)}queryRadius(R){var eh,eu;let em=(eh=ol("line-width",this,R),(eu=ol("line-gap-width",this,R))>0?eu+2*eh:eh),e_=ol("line-offset",this,R);
5return em/2+Math.abs(e_)+al(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:R,feature:eh,featureState:eu,geometry:em,transform:e_,pixelsToTileUnits:eg}){var ev,ex;let eb=ll(R,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-e_.bearingInRadians,eg),ew=eg/2*(ev=this.paint.get("line-width").evaluate(eh,eu),(ex=this.paint.get("line-gap-width").evaluate(eh,eu))>0?ex+2*ev:ev),eT=this.paint.get("line-offset").evaluate(eh,eu);return eT&&(em=function(R,eh){let eu=[];for(let em of R){let R=function(R){let eh=[];for(let eu=0;eu<R.length;eu++){let em=R[eu],e_=eh.at(-1);(0===eu||e_&&!em.equals(e_))&&eh.push(em)}return eh}(em),e_=[];for(let eu=0;eu<R.length;eu++){let em=R[eu],eg=R[eu-1],ev=R[eu+1],ex=0===eu?new n(0,0):em.sub(eg)._unit()._perp(),eb=eu===R.length-1?new n(0,0):ev.sub(em)._unit()._perp(),ew=ex._add(eb)._unit(),eT=ew.x*eb.x+ew.y*eb.y;0!==eT&&ew._mult(1/eT),e_.push(ew._mult(eh)._add(em))}eu.push(e_)}return eu}(em,eT*eg)),function(R,eh,eu){for(let em of eh){if(R.length>=3){for(let eh of em)if(il(R,eh))return!0}if(function(R,eh,eu){if(R.length>1){if(Qa(R,eh))return!0;for(let em of eh)if(el(em,R,eu))return!0}for(let em of R)if(el(em,eh,eu))return!0;return!1}(R,em,eu))return!0}return!1}(eb,em,ew)}isTileClipped(){return!0}};let rv=ao([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rx=ao([{name:"a_projected_pos",components:3,type:"Float32"}],4);ao([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let rb=ao([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ao([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let rw=ao([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),rT=ao([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);ao([{name:"triangle",components:3,type:"Uint16"}]),ao([{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"}]),ao([{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"}]),ao([{type:"Float32",name:"offsetX"}]),ao([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ao([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let rS={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},rP={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},rI={40:!0};function Ph(R,eh,eu,em,e_,eg){if("fontStack"in eh){let em=eu[eh.fontStack],eg=null==em?void 0:em[R];return eg?eg.metrics.advance*eh.scale+e_:0}{let R=em[eh.imageName];return R?R.displaySize[0]*eh.scale*24/eg+e_:0}}function Dh(R,eh,eu,em){let e_=Math.pow(R-eh,2);return em?R<eh?e_/2:2*e_:e_+Math.abs(eu)*eu}function Bh(R,eh,eu,em,e_,eg){let ev=null,ex=Dh(eh,eu,e_,eg);for(let R of em){let em=Dh(eh-R.x,eu,e_,eg)+R.badness;em<=ex&&(ev=R,ex=em)}return{index:R,x:eh,priorBreak:ev,badness:ex}}let Vh=class Vh{constructor(R="",eh=[],eu=[]){this.text=R,this.sections=eh,this.sectionIndex=eu,this.imageSectionID=null}static fromFeature(R,eh){let eu=new Vh;for(let em of R.sections)em.image?eu.addImageSection(em):eu.addTextSection(em,eh);return eu}length(){return[...this.text].length}getSection(R){return this.sections[this.sectionIndex[R]]}getSectionIndex(R){return this.sectionIndex[R]}verticalizePunctuation(){this.text=function(R){let eh="",eu={premature:!0,value:void 0},em=R[Symbol.iterator](),e_=em.next(),eg=R[Symbol.iterator]();eg.next();let ev=eg.next();for(;!e_.done;)eh+=!ev.done&&Ts(ev.value.codePointAt(0))&&!rS[ev.value]||!eu.premature&&Ts(eu.value.codePointAt(0))&&!rS[eu.value]||!rS[e_.value]?e_.value:rS[e_.value],eu={value:e_.value,premature:!1},e_=em.next(),ev=eg.next();return eh}(this.text)}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){let R=this.text.match(/^\s*/),eh=R?R[0].length:0,eu=this.text.match(/\S\s*$/),em=eu?eu[0].length-1:0;this.text=this.text.substring(eh,this.text.length-em),this.sectionIndex=this.sectionIndex.slice(eh,this.sectionIndex.length-em)}substring(R,eh){let eu=[...this.text].slice(R,eh).join(""),em=this.sectionIndex.slice(R,eh);return new Vh(eu,this.sections,em)}toCodeUnitIndex(R){return[...this.text].slice(0,R).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((R,eh)=>Math.max(R,this.sections[eh].scale),0)}getMaxImageSize(R){let eh=0,eu=0;for(let em=0;em<this.length();em++){let e_=this.getSection(em);if("imageName"in e_){let em=R[e_.imageName];if(!em)continue;let eg=em.displaySize;eh=Math.max(eh,eg[0]),eu=Math.max(eu,eg[1])}}return{maxImageWidth:eh,maxImageHeight:eu}}addTextSection(R,eh){this.text+=R.text,this.sections.push({scale:R.scale||1,verticalAlign:R.verticalAlign||"bottom",fontStack:R.fontStack||eh});let eu=this.sections.length-1;this.sectionIndex.push(...[...R.text].map(()=>eu))}addImageSection(R){let eh=R.image?R.image.name:"";if(0===eh.length)return void G("Can't add FormattedSection with an empty image.");let eu=this.getNextImageSectionCharCode();eu?(this.text+=String.fromCharCode(eu),this.sections.push({scale:1,verticalAlign:R.verticalAlign||"bottom",imageName:eh}),this.sectionIndex.push(this.sections.length-1)):G("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(R,eh,eu,em,e_){let eg=[],ev=this.determineAverageLineWidth(R,eh,eu,em,e_),ex=this.hasZeroWidthSpaces(),eb=0,ew=0,eT=this.text[Symbol.iterator](),eS=eT.next(),eP=this.text[Symbol.iterator]();eP.next();let eI=eP.next(),eM=this.text[Symbol.iterator]();eM.next(),eM.next();let eE=eM.next();for(;!eS.done;){let eh=this.getSection(ew),eC=eS.value.codePointAt(0);if(Ss(eC)||(eb+=Ph(eC,eh,eu,em,R,e_)),!eI.done){let R=/[\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(eC)),eu=eI.value.codePointAt(0);
5(rP[eC]||R||"imageName"in eh||!eE.done&&rI[eu])&&eg.push(Bh(ew+1,eb,ev,eg,function(R,eh,eu){let em=0;return 10===R&&(em-=1e4),eu&&(em+=150),40!==R&&65288!==R||(em+=50),41!==eh&&65289!==eh||(em+=50),em}(eC,eu,R&&ex),!1))}ew++,eS=eT.next(),eI=eP.next(),eE=eM.next()}return function Ch(R){return R?Ch(R.priorBreak).concat(R.index):[]}(Bh(this.length(),eb,ev,eg,0,!0))}determineAverageLineWidth(R,eh,eu,em,e_){let eg=0,ev=0;for(let eh of this.text){let ex=this.getSection(ev);eg+=Ph(eh.codePointAt(0),ex,eu,em,R,e_),ev++}return eg/Math.max(1,Math.ceil(eg/eh))}};let rM="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let Rh=class Rh{constructor(R=new Uint8Array(16)){this.buf=ArrayBuffer.isView(R)?R:new Uint8Array(R),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(R,eh,eu=this.length){for(;this.pos<eu;){let eu=this.readVarint(),em=eu>>3,e_=this.pos;this.type=7&eu,R(em,eh,this),this.pos===e_&&this.skip(eu)}return eh}readMessage(R,eh){return this.readFields(R,eh,this.readVarint()+this.pos)}readFixed32(){let R=this.dataView.getUint32(this.pos,!0);return this.pos+=4,R}readSFixed32(){let R=this.dataView.getInt32(this.pos,!0);return this.pos+=4,R}readFixed64(){let R=this.dataView.getUint32(this.pos,!0)+4294967296*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,R}readSFixed64(){let R=this.dataView.getUint32(this.pos,!0)+4294967296*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,R}readFloat(){let R=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,R}readDouble(){let R=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,R}readVarint(R){let eh,eu;let em=this.buf;return eh=127&(eu=em[this.pos++]),eu<128?eh:(eh|=(127&(eu=em[this.pos++]))<<7,eu<128?eh:(eh|=(127&(eu=em[this.pos++]))<<14,eu<128?eh:(eh|=(127&(eu=em[this.pos++]))<<21,eu<128?eh:function(R,eh,eu){let em,e_;let eg=eu.buf;if(em=(112&(e_=eg[eu.pos++]))>>4,e_<128||(em|=(127&(e_=eg[eu.pos++]))<<3,e_<128)||(em|=(127&(e_=eg[eu.pos++]))<<10,e_<128)||(em|=(127&(e_=eg[eu.pos++]))<<17,e_<128)||(em|=(127&(e_=eg[eu.pos++]))<<24,e_<128)||(em|=(1&(e_=eg[eu.pos++]))<<31,e_<128)){var ev,ex;return ev=R,ex=em,eh?4294967296*ex+(ev>>>0):4294967296*(ex>>>0)+(ev>>>0)}throw Error("Expected varint not more than 10 bytes")}(eh|=(15&(eu=em[this.pos]))<<28,R,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let R=this.readVarint();return R%2==1?-((R+1)/2):R/2}readBoolean(){return!!this.readVarint()}readString(){let R=this.readVarint()+this.pos,eh=this.pos;return this.pos=R,R-eh>=12&&rM?rM.decode(this.buf.subarray(eh,R)):function(R,eh,eu){let em="",e_=eh;for(;e_<eu;){let eh=R[e_],eg,ev,ex,eb=null,ew=eh>239?4:eh>223?3:eh>191?2:1;if(e_+ew>eu)break;1===ew?eh<128&&(eb=eh):2===ew?128==(192&(eg=R[e_+1]))&&(eb=(31&eh)<<6|63&eg)<=127&&(eb=null):3===ew?(eg=R[e_+1],ev=R[e_+2],128==(192&eg)&&128==(192&ev)&&((eb=(15&eh)<<12|(63&eg)<<6|63&ev)<=2047||eb>=55296&&eb<=57343)&&(eb=null)):4===ew&&(eg=R[e_+1],ev=R[e_+2],ex=R[e_+3],128==(192&eg)&&128==(192&ev)&&128==(192&ex)&&((eb=(15&eh)<<18|(63&eg)<<12|(63&ev)<<6|63&ex)<=65535||eb>=1114112)&&(eb=null)),null===eb?(eb=65533,ew=1):eb>65535&&(eb-=65536,em+=String.fromCharCode(eb>>>10&1023|55296),eb=56320|1023&eb),em+=String.fromCharCode(eb),e_+=ew}return em}(this.buf,eh,R)}readBytes(){let R=this.readVarint()+this.pos,eh=this.buf.subarray(this.pos,R);return this.pos=R,eh}readPackedVarint(R=[],eh){let eu=this.readPackedEnd();for(;this.pos<eu;)R.push(this.readVarint(eh));return R}readPackedSVarint(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readSVarint());return R}readPackedBoolean(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readBoolean());return R}readPackedFloat(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readFloat());return R}readPackedDouble(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readDouble());return R}readPackedFixed32(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readFixed32());return R}readPackedSFixed32(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readSFixed32());return R}readPackedFixed64(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readFixed64());return R}readPackedSFixed64(R=[]){let eh=this.readPackedEnd();for(;this.pos<eh;)R.push(this.readSFixed64());return R}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(R){let eh=7&R;
5if(0===eh)for(;this.buf[this.pos++]>127;);else if(2===eh)this.pos=this.readVarint()+this.pos;else if(5===eh)this.pos+=4;else{if(1!==eh)throw Error(`Unimplemented type: ${eh}`);this.pos+=8}}writeTag(R,eh){this.writeVarint(R<<3|eh)}realloc(R){let eh=this.length||16;for(;eh<this.pos+R;)eh*=2;if(eh!==this.length){let R=new Uint8Array(eh);R.set(this.buf),this.buf=R,this.dataView=new DataView(R.buffer),this.length=eh}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(R){this.realloc(4),this.dataView.setInt32(this.pos,R,!0),this.pos+=4}writeSFixed32(R){this.realloc(4),this.dataView.setInt32(this.pos,R,!0),this.pos+=4}writeFixed64(R){this.realloc(8),this.dataView.setInt32(this.pos,-1&R,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*R),!0),this.pos+=8}writeSFixed64(R){this.realloc(8),this.dataView.setInt32(this.pos,-1&R,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*R),!0),this.pos+=8}writeVarint(R){(R=+R||0)>268435455||R<0?function(R,eh){var eu;let em,e_;if(R>=0?(em=R%4294967296|0,e_=R/4294967296|0):(em=~(-R%4294967296),e_=~(-R/4294967296),4294967295^em?em=em+1|0:(em=0,e_=e_+1|0)),R>=18446744073709552e3||R<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");eh.realloc(10),eu=em,eh.buf[eh.pos++]=127&eu|128,eu>>>=7,eh.buf[eh.pos++]=127&eu|128,eu>>>=7,eh.buf[eh.pos++]=127&eu|128,eu>>>=7,eh.buf[eh.pos++]=127&eu|128,eh.buf[eh.pos]=127&(eu>>>=7),function(R,eh){let eu=(7&R)<<4;eh.buf[eh.pos++]|=eu|((R>>>=3)?128:0),R&&(eh.buf[eh.pos++]=127&R|((R>>>=7)?128:0),R&&(eh.buf[eh.pos++]=127&R|((R>>>=7)?128:0),R&&(eh.buf[eh.pos++]=127&R|((R>>>=7)?128:0),R&&(eh.buf[eh.pos++]=127&R|((R>>>=7)?128:0),R&&(eh.buf[eh.pos++]=127&R)))))}(e_,eh)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))}writeSVarint(R){this.writeVarint(R<0?-(2*R)-1:2*R)}writeBoolean(R){this.writeVarint(+R)}writeString(R){R=String(R),this.realloc(4*R.length),this.pos++;let eh=this.pos;this.pos=function(R,eh,eu){for(let em,e_,eg=0;eg<eh.length;eg++){if((em=eh.charCodeAt(eg))>55295&&em<57344){if(!e_){em>56319||eg+1===eh.length?(R[eu++]=239,R[eu++]=191,R[eu++]=189):e_=em;continue}if(em<56320){R[eu++]=239,R[eu++]=191,R[eu++]=189,e_=em;continue}em=e_-55296<<10|em-56320|65536,e_=null}else e_&&(R[eu++]=239,R[eu++]=191,R[eu++]=189,e_=null);em<128?R[eu++]=em:(em<2048?R[eu++]=em>>6|192:(em<65536?R[eu++]=em>>12|224:(R[eu++]=em>>18|240,R[eu++]=em>>12&63|128),R[eu++]=em>>6&63|128),R[eu++]=63&em|128)}return eu}(this.buf,R,this.pos);let eu=this.pos-eh;eu>=128&&Uh(eh,eu,this),this.pos=eh-1,this.writeVarint(eu),this.pos+=eu}writeFloat(R){this.realloc(4),this.dataView.setFloat32(this.pos,R,!0),this.pos+=4}writeDouble(R){this.realloc(8),this.dataView.setFloat64(this.pos,R,!0),this.pos+=8}writeBytes(R){let eh=R.length;this.writeVarint(eh),this.realloc(eh);for(let eu=0;eu<eh;eu++)this.buf[this.pos++]=R[eu]}writeRawMessage(R,eh){this.pos++;let eu=this.pos;R(eh,this);let em=this.pos-eu;em>=128&&Uh(eu,em,this),this.pos=eu-1,this.writeVarint(em),this.pos+=em}writeMessage(R,eh,eu){this.writeTag(R,2),this.writeRawMessage(eh,eu)}writePackedVarint(R,eh){eh.length&&this.writeMessage(R,jh,eh)}writePackedSVarint(R,eh){eh.length&&this.writeMessage(R,qh,eh)}writePackedBoolean(R,eh){eh.length&&this.writeMessage(R,Yh,eh)}writePackedFloat(R,eh){eh.length&&this.writeMessage(R,Gh,eh)}writePackedDouble(R,eh){eh.length&&this.writeMessage(R,Xh,eh)}writePackedFixed32(R,eh){eh.length&&this.writeMessage(R,Zh,eh)}writePackedSFixed32(R,eh){eh.length&&this.writeMessage(R,Hh,eh)}writePackedFixed64(R,eh){eh.length&&this.writeMessage(R,Wh,eh)}writePackedSFixed64(R,eh){eh.length&&this.writeMessage(R,Kh,eh)}writeBytesField(R,eh){this.writeTag(R,2),this.writeBytes(eh)}writeFixed32Field(R,eh){this.writeTag(R,5),this.writeFixed32(eh)}writeSFixed32Field(R,eh){this.writeTag(R,5),this.writeSFixed32(eh)}
5writeFixed64Field(R,eh){this.writeTag(R,1),this.writeFixed64(eh)}writeSFixed64Field(R,eh){this.writeTag(R,1),this.writeSFixed64(eh)}writeVarintField(R,eh){this.writeTag(R,0),this.writeVarint(eh)}writeSVarintField(R,eh){this.writeTag(R,0),this.writeSVarint(eh)}writeStringField(R,eh){this.writeTag(R,2),this.writeString(eh)}writeFloatField(R,eh){this.writeTag(R,5),this.writeFloat(eh)}writeDoubleField(R,eh){this.writeTag(R,1),this.writeDouble(eh)}writeBooleanField(R,eh){this.writeVarintField(R,+eh)}};function Uh(R,eh,eu){let em=eh<=16383?1:eh<=2097151?2:eh<=268435455?3:Math.floor(Math.log(eh)/(7*Math.LN2));eu.realloc(em);for(let eh=eu.pos-1;eh>=R;eh--)eu.buf[eh+em]=eu.buf[eh]}function jh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeVarint(R[eu])}function qh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeSVarint(R[eu])}function Gh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeFloat(R[eu])}function Xh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeDouble(R[eu])}function Yh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeBoolean(R[eu])}function Zh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeFixed32(R[eu])}function Hh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeSFixed32(R[eu])}function Wh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeFixed64(R[eu])}function Kh(R,eh){for(let eu=0;eu<R.length;eu++)eh.writeSFixed64(R[eu])}function Jh(R,eh,eu){1===R&&eu.readMessage(Qh,eh)}function Qh(R,eh,eu){if(3===R){let{id:R,bitmap:em,width:e_,height:eg,left:ev,top:ex,advance:eb}=eu.readMessage(tp,{});eh.push({id:R,bitmap:new kl({width:e_+6,height:eg+6},em),metrics:{width:e_,height:eg,left:ev,top:ex,advance:eb}})}}function tp(R,eh,eu){1===R?eh.id=eu.readVarint():2===R?eh.bitmap=eu.readBytes():3===R?eh.width=eu.readVarint():4===R?eh.height=eu.readVarint():5===R?eh.left=eu.readSVarint():6===R?eh.top=eu.readSVarint():7===R&&(eh.advance=eu.readVarint())}function ep(R){let eh=0,eu=0;for(let em of R)eh+=em.w*em.h,eu=Math.max(eu,em.w);R.sort((R,eh)=>eh.h-R.h);let em=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(eh/.95)),eu),h:1/0}],e_=0,eg=0;for(let eh of R)for(let R=em.length-1;R>=0;R--){let eu=em[R];if(!(eh.w>eu.w||eh.h>eu.h)){if(eh.x=eu.x,eh.y=eu.y,eg=Math.max(eg,eh.y+eh.h),e_=Math.max(e_,eh.x+eh.w),eh.w===eu.w&&eh.h===eu.h){let eh=em.pop();eh&&R<em.length&&(em[R]=eh)}else eh.h===eu.h?(eu.x+=eh.w,eu.w-=eh.w):(eh.w===eu.w||em.push({x:eu.x+eh.w,y:eu.y,w:eu.w-eh.w,h:eh.h}),eu.y+=eh.h,eu.h-=eh.h);break}}return{w:e_,h:eg,fill:eh/(e_*eg)||0}}let np=class np{constructor(R,{pixelRatio:eh,version:eu,stretchX:em,stretchY:e_,content:eg,textFitWidth:ev,textFitHeight:ex}){this.paddedRect=R,this.pixelRatio=eh,this.stretchX=em,this.stretchY=e_,this.content=eg,this.version=eu,this.textFitWidth=ev,this.textFitHeight=ex}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]}};let rp=class rp{constructor(R,eh){let eu={},em={};this.haveRenderCallbacks=[];let e_=[];this.addImages(R,eu,e_),this.addImages(eh,em,e_);let{w:eg,h:ev}=ep(e_),ex=new Il({width:eg||1,height:ev||1});for(let eh in R){let em=R[eh],e_=eu[eh].paddedRect;Il.copy(em.data,ex,{x:0,y:0},{x:e_.x+1,y:e_.y+1},em.data)}for(let R in eh){let eu=eh[R],e_=em[R].paddedRect,eg=e_.x+1,ev=e_.y+1,eb=eu.data.width,ew=eu.data.height;Il.copy(eu.data,ex,{x:0,y:0},{x:eg,y:ev},eu.data),Il.copy(eu.data,ex,{x:0,y:ew-1},{x:eg,y:ev-1},{width:eb,height:1}),Il.copy(eu.data,ex,{x:0,y:0},{x:eg,y:ev+ew},{width:eb,height:1}),Il.copy(eu.data,ex,{x:eb-1,y:0},{x:eg-1,y:ev},{width:1,height:ew}),Il.copy(eu.data,ex,{x:0,y:0},{x:eg+eb,y:ev},{width:1,height:ew})}this.image=ex,this.iconPositions=eu,this.patternPositions=em}addImages(R,eh,eu){for(let em in R){let e_=R[em],eg={x:0,y:0,w:e_.data.width+2,h:e_.data.height+2};eu.push(eg),eh[em]=new np(eg,e_),e_.hasRenderCallback&&this.haveRenderCallbacks.push(em)}}patchUpdatedImages(R,eh){for(let eu in R.dispatchRenderCallbacks(this.haveRenderCallbacks),R.updatedImages)this.patchUpdatedImage(this.iconPositions[eu],R.getImage(eu),eh),this.patchUpdatedImage(this.patternPositions[eu],R.getImage(eu),eh)}patchUpdatedImage(R,eh,eu){if(!R||!eh||R.version===eh.version)return;R.version=eh.version;let[em,e_]=R.tl;eu.update(eh.data,void 0,{x:em,y:e_})}};
5function sp(eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE){let eC;let eA=Vh.fromFeature(eh,eg);eP===R.ax.vertical&&eA.verticalizePunctuation();let ez=eA.determineLineBreaks(eT,ev,eu,e_,eM),{processBidirectionalText:eD,processStyledBidirectionalText:ek}=iE;if(eD&&1===eA.sections.length){eC=[],ez=ez.map(R=>eA.toCodeUnitIndex(R));let R=eD(eA.toString(),ez);for(let eh of R){let R=[...eh].map(()=>0);eC.push(new Vh(eh,eA.sections,R))}}else if(ek){eC=[],ez=ez.map(R=>eA.toCodeUnitIndex(R));let R=0,eh=[];for(let eu of eA.text)eh.push(...Array(eu.length).fill(eA.sectionIndex[R])),R++;let eu=ek(eA.text,eh,ez);for(let R of eu){let eh=[],eu="";for(let em of R[0])eh.push(R[1][eu.length]),eu+=em;eC.push(new Vh(R[0],eA.sections,eh))}}else eC=function(R,eh){let eu=[],em=0;for(let e_ of eh)eu.push(R.substring(em,e_)),em=e_;return em<R.length()&&eu.push(R.substring(em,R.length())),eu}(eA,ez);let eR=[],eL={positionedLines:eR,text:eA.toString(),top:eS[1],bottom:eS[1],left:eS[0],right:eS[0],writingMode:eP,iconsInText:!1,verticalizable:!1};return function(eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI=0,eM=0,eE=0,eC=0,eA="right"===eb?1:"left"===eb?0:.5,ez=24/eP,eD=0;for(let ex of eg){ex.trim();let eg=ex.getMaxScale(),eb={positionedGlyphs:[],lineOffset:0};eh.positionedLines[eD]=eb;let eP=eb.positionedGlyphs,ek=0;if(!ex.length()){eM+=ev,++eD;continue}let eR=function(R,eh,eu){let em=24*eh.getMaxScale(),{maxImageWidth:e_,maxImageHeight:eg}=eh.getMaxImageSize(R);return{verticalLineContentWidth:Math.max(em,e_*eu),horizontalLineContentHeight:Math.max(em,eg*eu)}}(e_,ex,ez),eL=0;for(let ev of ex.text){let eb;let eE=ex.getSection(eL),eC=ev.codePointAt(0),eA=!(ew===R.ax.horizontal||!eS&&!_s(eC)||eS&&(Ss(eC)||/\p{sc=Arab}/u.test(String.fromCodePoint(eC)))),eD={glyph:eC,imageName:null,x:eI,y:eM+-17,vertical:eA,scale:1,fontStack:"",sectionIndex:ex.getSectionIndex(eL),metrics:null,rect:null};if("fontStack"in eE){if(!(eb=function(R,eh,eu,em,e_,eg){let ev;let ex=eg[R.fontStack],eb=function(R,eh,eu,em){if(null==R?void 0:R.rect)return R;let e_=eh[eu.fontStack],eg=null==e_?void 0:e_[em];return eg?{rect:null,metrics:eg.metrics}:null}(null==ex?void 0:ex[eh],e_,R,eh);if(null===eb)return null;if(eu)ev=em.verticalLineContentWidth-24*R.scale;else{let eh=lp(R.verticalAlign);ev=(em.horizontalLineContentHeight-24*R.scale)*eh}return{rect:eb.rect,metrics:eb.metrics,baselineOffset:ev}}(eE,eC,eA,eR,eu,em)))continue;eD.fontStack=eE.fontStack}else{if(eh.iconsInText=!0,eE.scale*=ez,!(eb=function(R,eh,eu,em,e_){let eg;let ev=e_[R.imageName];if(!ev)return null;let ex=ev.paddedRect,eb=ev.displaySize,ew={width:eb[0],height:eb[1],left:1,top:-3,advance:eh?eb[1]:eb[0]};if(eh)eg=em.verticalLineContentWidth-eb[1]*R.scale;else{let eh=lp(R.verticalAlign);eg=(em.horizontalLineContentHeight-eb[1]*R.scale)*eh}return{rect:ex,metrics:ew,baselineOffset:eg,imageOffset:(eh?eb[0]:eb[1])*R.scale-24*eu}}(eE,eA,eg,eR,e_)))continue;ek=Math.max(ek,eb.imageOffset),eD.imageName=eE.imageName}let{rect:eF,metrics:eB,baselineOffset:eO}=eb;eD.y+=eO,eD.scale=eE.scale,eD.metrics=eB,eD.rect=eF,eP.push(eD),eA?(eh.verticalizable=!0,eI+=("imageName"in eE?eB.advance:24)*eE.scale+eT):eI+=eB.advance*eE.scale+eT,eL++}0!==eP.length&&(eE=Math.max(eI-eT,eE),function(R,eh,eu,em){if(0===em)return;let e_=R[eu],eg=(R[eu].x+e_.metrics.advance*e_.scale)*em;for(let eh=0;eh<=eu;eh++)R[eh].x-=eg}(eP,0,eP.length-1,eA)),eI=0,eb.lineOffset=Math.max(ek,(eg-1)*24);let eF=ev*eg+ek;eM+=eF,eC=Math.max(eF,eC),++eD}let{horizontalAlign:ek,verticalAlign:eR}=op(ex);(function(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=(eh-eu)*e_,eT=0;for(let eh of(eT=eg!==ev?-ex*em- -17:-em*eb*ev+.5*ev,R))for(let R of eh.positionedGlyphs)R.x+=ew,R.y+=eT})(eh.positionedLines,eA,ek,eR,eE,eC,ev,eM,eg.length),eh.top+=-eR*eM,eh.bottom=eh.top+eM,eh.left+=-ek*eE,eh.right=eh.left+eE}(eL,eu,em,e_,eC,ex,eb,ew,eP,eT,eI,eE),!function(R){for(let eh of R)if(0!==eh.positionedGlyphs.length)return!1;return!0}(eR)&&eL}function op(R){let eh=.5,eu=.5;switch(R){case"right":case"top-right":case"bottom-right":eh=1;break;case"left":case"top-left":case"bottom-left":eh=0}switch(R){case"bottom":case"bottom-right":case"bottom-left":eu=1;break;case"top":case"top-right":case"top-left":eu=0}return{horizontalAlign:eh,verticalAlign:eu}}function lp(R){switch(R){case"top":return 0;case"center":return .5;default:return 1}}function dp(R){var eh,eu;let em=R.left,e_=R.top,eg=R.right-em,ev=R.bottom-e_,ex=null!==(eh=R.image.textFitWidth)&&void 0!==eh?eh:"stretchOrShrink",eb=null!==(eu=R.image.textFitHeight)&&void 0!==eu?eu:"stretchOrShrink",ew=(R.image.content[2]-R.image.content[0])/(R.image.content[3]-R.image.content[1]);if("proportional"===eb){if("stretchOnly"===ex&&eg/ev<ew||"proportional"===ex){let R=Math.ceil(ev*ew);em*=R/eg,eg=R}}else if("proportional"===ex&&"stretchOnly"===eb&&0!==ew&&eg/ev>ew){let R=Math.ceil(eg/ew);e_*=R/ev,ev=R}return{x1:em,y1:e_,x2:em+eg,y2:e_+ev}}function yp(R,eh,eu,em,e_,eg){let ev,ex,eb,ew,eT;let eS=R.image;if(eS.content){let R=eS.content,eh=eS.pixelRatio||1;ev=[R[0]/eh,R[1]/eh,eS.displaySize[0]-R[2]/eh,eS.displaySize[1]-R[3]/eh]}let eP=eh.left*eg,eI=eh.right*eg;"width"===eu||"both"===eu?(eT=e_[0]+eP-em[3],eb=e_[0]+eI+em[1]):eb=(eT=e_[0]+(eP+eI-eS.displaySize[0])/2)+eS.displaySize[0];let eM=eh.top*eg,eE=eh.bottom*eg;return"height"===eu||"both"===eu?(ex=e_[1]+eM-em[0],ew=e_[1]+eE+em[2]):ew=(ex=e_[1]+(eM+eE-eS.displaySize[1])/2)+eS.displaySize[1],{image:eS,top:ex,right:eb,bottom:ew,left:eT,collisionPadding:ev}}function xp(R,eh){let{expression:eu}=eh;if("constant"===eu.kind)return{kind:"constant",layoutSize:eu.evaluate(new Cs(R+1))};if("source"===eu.kind)return{kind:"source"};{let{zoomStops:eh,interpolationType:em}=eu,e_=0;for(;e_<eh.length&&eh[e_]<=R;)e_++;let eg=e_=Math.max(0,e_-1);for(;eg<eh.length&&eh[eg]<R+1;)eg++;eg=Math.min(eh.length-1,eg);let ev=eh[e_],ex=eh[eg];return"composite"===eu.kind?{kind:"composite",minZoom:ev,maxZoom:ex,interpolationType:em}:{kind:"camera",minZoom:ev,maxZoom:ex,minSize:eu.evaluate(new Cs(ev)),maxSize:eu.evaluate(new Cs(ex)),interpolationType:em}}}function vp(R,eh,eu){let em="never",e_=R.get(eh);return e_?em=e_:R.get(eu)&&(em="always"),em}ds("ImagePosition",np),ds("ImageAtlas",rp),R.ax=void 0,(eZ=R.ax||(R.ax={}))[eZ.none=0]="none",eZ[eZ.horizontal=1]="horizontal",eZ[eZ.vertical=2]="vertical",eZ[eZ.horizontalOnly=3]="horizontalOnly";let rE=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function wp(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI=ex?Math.min(32640,Math.round(ex[0])):0,eM=ex?Math.min(32640,Math.round(ex[1])):0;R.emplaceBack(eh,eu,Math.round(32*em),Math.round(32*e_),eg,ev,(eI<<1)+(eb?1:0),eM,16*ew,16*eT,256*eS,256*eP)}function _p(R,eh,eu){R.emplaceBack(eh.x,eh.y,eu),R.emplaceBack(eh.x,eh.y,eu),R.emplaceBack(eh.x,eh.y,eu),R.emplaceBack(eh.x,eh.y,eu)}let Ap=class Ap{constructor(R){this.layoutVertexArray=new ta,this.indexArray=new sa,this.programConfigurations=R,this.segments=new ua,this.dynamicLayoutVertexArray=new ea,this.opacityVertexArray=new na,this.hasVisibleVertices=!1,this.placedSymbolArray=new Lo}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(R,eh,eu,em){this.isEmpty()||(eu&&(this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,rv.members),this.indexBuffer=R.createIndexBuffer(this.indexArray,eh),this.dynamicLayoutVertexBuffer=R.createVertexBuffer(this.dynamicLayoutVertexArray,rx.members,!0),this.opacityVertexBuffer=R.createVertexBuffer(this.opacityVertexArray,rE,!0),this.opacityVertexBuffer.itemSize=1),(eu||em)&&this.programConfigurations.upload(R))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};ds("SymbolBuffers",Ap);let Mp=class Mp{constructor(R,eh,eu){this.layoutVertexArray=new R,this.layoutAttributes=eh,this.indexArray=new eu,this.segments=new ua,this.collisionVertexArray=new ia}upload(R){this.layoutVertexBuffer=R.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=R.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=R.createVertexBuffer(this.collisionVertexArray,rb.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};ds("CollisionBuffers",Mp);let kp=class kp{constructor(eh){this.collisionBoxArray=eh.collisionBoxArray,this.zoom=eh.zoom,this.overscaling=eh.overscaling,this.layers=eh.layers,this.layerIds=this.layers.map(R=>R.id),this.index=eh.index,this.pixelRatio=eh.pixelRatio,this.sourceLayerIndex=eh.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let eu=this.layers[0]._unevaluatedLayout._values;this.textSizeData=xp(this.zoom,eu["text-size"]),this.iconSizeData=xp(this.zoom,eu["icon-size"]);let em=this.layers[0].layout,e_=em.get("symbol-sort-key"),eg=em.get("symbol-z-order");this.canOverlap="never"!==vp(em,"text-overlap","text-allow-overlap")||"never"!==vp(em,"icon-overlap","icon-allow-overlap")||em.get("text-ignore-placement")||em.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==eg&&!e_.isConstant(),this.sortFeaturesByY=("viewport-y"===eg||"auto"===eg&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===em.get("symbol-placement")&&(this.writingModes=em.get("text-writing-mode").map(eh=>R.ax[eh])),this.stateDependentLayerIds=this.layers.filter(R=>R.isStateDependent()).map(R=>R.id),this.sourceID=eh.sourceID}createArrays(){this.text=new Ap(new $a(this.layers,this.zoom,R=>R.startsWith("text"))),this.icon=new Ap(new $a(this.layers,this.zoom,R=>R.startsWith("icon"))),this.glyphOffsetArray=new Ro,this.lineVertexArray=new No,this.symbolInstances=new $o,this.textAnchorOffsets=new jo}calculateGlyphDependencies(R,eh,eu,em,e_){for(let eg of R)if(eh[eg.codePointAt(0)]=!0,(eu||em)&&e_){let R=rS[eg];R&&(eh[R.codePointAt(0)]=!0)}}populate(eh,eu,em){var e_;let eg=this.layers[0],ev=eg.layout,ex=ev.get("text-font"),eb=ev.get("text-field"),ew=ev.get("icon-image"),eT=("constant"!==eb.value.kind||eb.value.value instanceof ze&&!eb.value.value.isEmpty()||eb.value.value.toString().length>0)&&("constant"!==ex.value.kind||ex.value.value.length>0),eS="constant"!==ew.value.kind||!!ew.value.value||Object.keys(ew.parameters).length>0,eP=ev.get("symbol-sort-key");if(this.features=[],!eT&&!eS)return;let eI=eu.iconDependencies,eM=eu.glyphDependencies,eE=eu.availableImages,eC=new Cs(this.zoom);for(let{feature:eu,id:eb,index:ew,sourceLayerIndex:eA}of eh){let eh,ez;let eD=eg._featureFilter.needGeometry,ek=Ga(eu,eD);if(!eg._featureFilter.filter(eC,ek,em))continue;if(eD||(ek.geometry=qa(eu)),eT){let R=eg.getValueAndResolveTokens("text-field",ek,em,eE),eu=ze.factory(R),e_=this.hasRTLText=this.hasRTLText||function(R){for(let eh of R.sections)if(function(R){for(let eh of R)if(Ps(eh.codePointAt(0)))return!0;return!1}(eh.text))return!0;return!1}(eu);(!e_||"unavailable"===iE.getRTLTextPluginStatus()||e_&&iE.isParsed())&&(eh=function(R,eh,eu){for(let em of R.sections)em.text=function(R,eh,eu){let em=eh.layout.get("text-transform").evaluate(eu,{});return"uppercase"===em?R=R.toLocaleUpperCase():"lowercase"===em&&(R=R.toLocaleLowerCase()),iE.applyArabicShaping&&(R=iE.applyArabicShaping(R)),R}(em.text,eh,eu);return R}(eu,eg,ek))}if(eS){let R=eg.getValueAndResolveTokens("icon-image",ek,em,eE);ez=R instanceof Re?R:Re.fromString(R)}if(!eh&&!ez)continue;let eR=this.sortFeaturesByKey?eP.evaluate(ek,{},em):void 0;if(this.features.push({id:eb,text:eh,icon:ez,index:ew,sourceLayerIndex:eA,geometry:ek.geometry,properties:eu.properties,type:Cu.types[eu.type],sortKey:eR}),ez&&(eI[ez.name]=!0),eh){let eu=ex.evaluate(ek,{},em).join(","),eg="viewport"!==ev.get("text-rotation-alignment")&&"point"!==ev.get("symbol-placement");for(let em of(this.allowVerticalPlacement=null===(e_=this.writingModes)||void 0===e_?void 0:e_.includes(R.ax.vertical),eh.sections))if(em.image)eI[em.image.name]=!0;else{let R=As(eh.toString()),e_=em.fontStack||eu,ev=eM[e_]=eM[e_]||{};this.calculateGlyphDependencies(em.text,ev,eg,this.allowVerticalPlacement,R)}}}"line"===ev.get("symbol-placement")&&(this.features=function(R){let eh={},eu={},em=[],e_=0;function s(eh){em.push(R[eh]),e_++}function o(R,eh,e_){let eg=eu[R];return delete eu[R],eu[eh]=eg,em[eg].geometry[0].pop(),em[eg].geometry[0]=em[eg].geometry[0].concat(e_[0]),eg}function a(R,eu,e_){let eg=eh[eu];return delete eh[eu],eh[R]=eg,em[eg].geometry[0].shift(),em[eg].geometry[0]=e_[0].concat(em[eg].geometry[0]),eg}function l(R,eh,eu){let em=eu?eh[0][eh[0].length-1]:eh[0][0];return`${R}:${em.x}:${em.y}`}for(let eg=0;eg<R.length;eg++){let ev=R[eg],ex=ev.geometry,eb=ev.text?ev.text.toString():null;if(!eb){s(eg);continue}let ew=l(eb,ex),eT=l(eb,ex,!0);if(ew in eu&&eT in eh&&eu[ew]!==eh[eT]){let R=a(ew,eT,ex),e_=o(ew,eT,em[R].geometry);delete eh[ew],delete eu[eT],eu[l(eb,em[e_].geometry,!0)]=e_,em[R].geometry=null}else ew in eu?o(ew,eT,ex):eT in eh?a(ew,eT,ex):(s(eg),eh[ew]=e_-1,eu[eT]=e_-1)}return em.filter(R=>R.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((R,eh)=>R.sortKey-eh.sortKey)}update(R,eh,eu){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(R,eh,this.layers,{imagePositions:eu}),this.icon.programConfigurations.updatePaintArrays(R,eh,this.layers,{imagePositions:eu}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(R){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(R),this.iconCollisionBox.upload(R)),this.text.upload(R,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(R,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(R,eh){let eu=this.lineVertexArray.length;if(void 0!==R.segment){let eu=R.dist(eh[R.segment+1]),em=R.dist(eh[R.segment]),e_={};for(let em=R.segment+1;em<eh.length;em++)e_[em]={x:eh[em].x,y:eh[em].y,tileUnitDistanceFromAnchor:eu},em<eh.length-1&&(eu+=eh[em+1].dist(eh[em]));for(let eu=R.segment||0;eu>=0;eu--)e_[eu]={x:eh[eu].x,y:eh[eu].y,tileUnitDistanceFromAnchor:em},eu>0&&(em+=eh[eu-1].dist(eh[eu]));for(let R=0;R<eh.length;R++){let eh=e_[R];this.lineVertexArray.emplaceBack(eh.x,eh.y,eh.tileUnitDistanceFromAnchor)}}return{lineStartIndex:eu,lineLength:this.lineVertexArray.length-eu}}addSymbols(eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI=eh.indexArray,eM=eh.layoutVertexArray,eE=eh.segments.prepareSegment(4*eu.length,eM,eI,this.canOverlap?ev.sortKey:void 0),eC=this.glyphOffsetArray.length,eA=eE.vertexLength,ez=this.allowVerticalPlacement&&ex===R.ax.vertical?Math.PI/2:0,eD=ev.text&&ev.text.sections;for(let R=0;R<eu.length;R++){let{tl:e_,tr:eg,bl:ex,br:ew,tex:eT,pixelOffsetTL:eS,pixelOffsetBR:eC,minFontScaleX:eA,minFontScaleY:ek,glyphOffset:eR,isSDF:eL,sectionIndex:eF}=eu[R],eB=eE.vertexLength,eO=eR[1];wp(eM,eb.x,eb.y,e_.x,eO+e_.y,eT.x,eT.y,em,eL,eS.x,eS.y,eA,ek),wp(eM,eb.x,eb.y,eg.x,eO+eg.y,eT.x+eT.w,eT.y,em,eL,eC.x,eS.y,eA,ek),wp(eM,eb.x,eb.y,ex.x,eO+ex.y,eT.x,eT.y+eT.h,em,eL,eS.x,eC.y,eA,ek),wp(eM,eb.x,eb.y,ew.x,eO+ew.y,eT.x+eT.w,eT.y+eT.h,em,eL,eC.x,eC.y,eA,ek),_p(eh.dynamicLayoutVertexArray,eb,ez),eI.emplaceBack(eB,eB+2,eB+1),eI.emplaceBack(eB+1,eB+2,eB+3),eE.vertexLength+=4,eE.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(eR[0]),R!==eu.length-1&&eF===eu[R+1].sectionIndex||eh.programConfigurations.populatePaintArrays(eM.length,ev,ev.index,{imagePositions:{},canonical:eP,formattedSection:null==eD?void 0:eD[eF]})}eh.placedSymbolArray.emplaceBack(eb.x,eb.y,eC,this.glyphOffsetArray.length-eC,eA,ew,eT,eb.segment,em?em[0]:0,em?em[1]:0,e_[0],e_[1],ex,0,!1,0,eS)}_addCollisionDebugVertex(R,eh,eu,em,e_,eg){return eh.emplaceBack(0,0),R.emplaceBack(eu.x,eu.y,em,e_,Math.round(eg.x),Math.round(eg.y))}addCollisionDebugVertices(R,eh,eu,em,e_,eg,ev){let ex=e_.segments.prepareSegment(4,e_.layoutVertexArray,e_.indexArray),eb=ex.vertexL
vendor: 4,124 bytes, line 5
5ength,ew=e_.layoutVertexArray,eT=e_.collisionVertexArray,eS=ev.anchorX,eP=ev.anchorY;this._addCollisionDebugVertex(ew,eT,eg,eS,eP,new n(R,eh)),this._addCollisionDebugVertex(ew,eT,eg,eS,eP,new n(eu,eh)),this._addCollisionDebugVertex(ew,eT,eg,eS,eP,new n(eu,em)),this._addCollisionDebugVertex(ew,eT,eg,eS,eP,new n(R,em)),ex.vertexLength+=4;let eI=e_.indexArray;eI.emplaceBack(eb,eb+1),eI.emplaceBack(eb+1,eb+2),eI.emplaceBack(eb+2,eb+3),eI.emplaceBack(eb+3,eb),ex.primitiveLength+=4}addDebugCollisionBoxes(R,eh,eu,em){for(let e_=R;e_<eh;e_++){let R=this.collisionBoxArray.get(e_);this.addCollisionDebugVertices(R.x1,R.y1,R.x2,R.y2,em?this.textCollisionBox:this.iconCollisionBox,R.anchorPoint,eu)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Mp(ra,rw.members,oa),this.iconCollisionBox=new Mp(ra,rw.members,oa);for(let R=0;R<this.symbolInstances.length;R++){let eh=this.symbolInstances.get(R);this.addDebugCollisionBoxes(eh.textBoxStartIndex,eh.textBoxEndIndex,eh,!0),this.addDebugCollisionBoxes(eh.verticalTextBoxStartIndex,eh.verticalTextBoxEndIndex,eh,!0),this.addDebugCollisionBoxes(eh.iconBoxStartIndex,eh.iconBoxEndIndex,eh,!1),this.addDebugCollisionBoxes(eh.verticalIconBoxStartIndex,eh.verticalIconBoxEndIndex,eh,!1)}}_deserializeCollisionBoxesForSymbol(R,eh,eu,em,e_,eg,ev,ex,eb){let ew={};for(let em=eh;em<eu;em++){let eh=R.get(em);ew.textBox={x1:eh.x1,y1:eh.y1,x2:eh.x2,y2:eh.y2,anchorPointX:eh.anchorPointX,anchorPointY:eh.anchorPointY},ew.textFeatureIndex=eh.featureIndex;break}for(let eh=em;eh<e_;eh++){let eu=R.get(eh);ew.verticalTextBox={x1:eu.x1,y1:eu.y1,x2:eu.x2,y2:eu.y2,anchorPointX:eu.anchorPointX,anchorPointY:eu.anchorPointY},ew.verticalTextFeatureIndex=eu.featureIndex;break}for(let eh=eg;eh<ev;eh++){let eu=R.get(eh);ew.iconBox={x1:eu.x1,y1:eu.y1,x2:eu.x2,y2:eu.y2,anchorPointX:eu.anchorPointX,anchorPointY:eu.anchorPointY},ew.iconFeatureIndex=eu.featureIndex;break}for(let eh=ex;eh<eb;eh++){let eu=R.get(eh);ew.verticalIconBox={x1:eu.x1,y1:eu.y1,x2:eu.x2,y2:eu.y2,anchorPointX:eu.anchorPointX,anchorPointY:eu.anchorPointY},ew.verticalIconFeatureIndex=eu.featureIndex;break}return ew}deserializeCollisionBoxes(R){this.collisionArrays=[];for(let eh=0;eh<this.symbolInstances.length;eh++){let eu=this.symbolInstances.get(eh);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(R,eu.textBoxStartIndex,eu.textBoxEndIndex,eu.verticalTextBoxStartIndex,eu.verticalTextBoxEndIndex,eu.iconBoxStartIndex,eu.iconBoxEndIndex,eu.verticalIconBoxStartIndex,eu.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(R,eh){let eu=R.placedSymbolArray.get(eh),em=eu.vertexStartIndex+4*eu.numGlyphs;for(let eh=eu.vertexStartIndex;eh<em;eh+=4)R.indexArray.emplaceBack(eh,eh+2,eh+1),R.indexArray.emplaceBack(eh+1,eh+2,eh+3)}getSortedSymbolIndexes(R){if(this.sortedAngle===R&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let eh=Math.sin(R),eu=Math.cos(R),em=[],e_=[],eg=[];for(let R=0;R<this.symbolInstances.length;++R){eg.push(R);let ev=this.symbolInstances.get(R);em.push(0|Math.round(eh*ev.anchorX+eu*ev.anchorY)),e_.push(ev.featureIndex)}return eg.sort((R,eh)=>em[R]-em[eh]||e_[eh]-e_[R]),eg}addToSortKeyRanges(R,eh){let eu=this.sortKeyRanges[this.sortKeyRanges.length-1];(null==eu?void 0:eu.sortKey)===eh?eu.symbolInstanceEnd=R+1:this.sortKeyRanges.push({sortKey:eh,symbolInstanceStart:R,symbolInstanceEnd:R+1})}sortFeatures(R){if(this.sortFeaturesByY&&this.sortedAngle!==R&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let eh of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(R),this.sortedAngle=R,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexe
5s)){let R=this.symbolInstances.get(eh);this.featureSortOrder.push(R.featureIndex);let eu=[R.rightJustifiedTextSymbolIndex,R.centerJustifiedTextSymbolIndex,R.leftJustifiedTextSymbolIndex];for(let R=0;R<eu.length;R++){let eh=eu[R];eh>=0&&eu.indexOf(eh)===R&&this.addIndicesForPlacedSymbol(this.text,eh)}R.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,R.verticalPlacedTextSymbolIndex),R.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,R.placedIconSymbolIndex),R.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,R.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};ds("SymbolBucket",kp,{omit:["layers","collisionBoxArray","features","compareText"]}),kp.MAX_GLYPHS=65535,kp.addDynamicAttributes=_p;var rC={get paint(){return ez=ez||new Ks({"icon-opacity":new Ys(t_.paint_symbol["icon-opacity"]),"icon-color":new Ys(t_.paint_symbol["icon-color"]),"icon-halo-color":new Ys(t_.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ys(t_.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ys(t_.paint_symbol["icon-halo-blur"]),"icon-translate":new Xs(t_.paint_symbol["icon-translate"]),"icon-translate-anchor":new Xs(t_.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ys(t_.paint_symbol["text-opacity"]),"text-color":new Ys(t_.paint_symbol["text-color"],{runtimeType:tT,getOverride:R=>R.textColor,hasOverride:R=>!!R.textColor}),"text-halo-color":new Ys(t_.paint_symbol["text-halo-color"]),"text-halo-width":new Ys(t_.paint_symbol["text-halo-width"]),"text-halo-blur":new Ys(t_.paint_symbol["text-halo-blur"]),"text-translate":new Xs(t_.paint_symbol["text-translate"]),"text-translate-anchor":new Xs(t_.paint_symbol["text-translate-anchor"])})},get layout(){return eA=eA||new Ks({"symbol-placement":new Xs(t_.layout_symbol["symbol-placement"]),"symbol-spacing":new Xs(t_.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Xs(t_.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ys(t_.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Xs(t_.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Xs(t_.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Xs(t_.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Xs(t_.layout_symbol["icon-ignore-placement"]),"icon-optional":new Xs(t_.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Xs(t_.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ys(t_.layout_symbol["icon-size"]),"icon-text-fit":new Xs(t_.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Xs(t_.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ys(t_.layout_symbol["icon-image"]),"icon-rotate":new Ys(t_.layout_symbol["icon-rotate"]),"icon-padding":new Ys(t_.layout_symbol["icon-padding"]),"icon-keep-upright":new Xs(t_.layout_symbol["icon-keep-upright"]),"icon-offset":new Ys(t_.layout_symbol["icon-offset"]),"icon-anchor":new Ys(t_.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Xs(t_.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Xs(t_.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Xs(t_.layout_symbol["text-rotation-alignment"]),"text-field":new Ys(t_.layout_symbol["text-field"]),"text-font":new Ys(t_.layout_symbol["text-font"]),"text-size":new Ys(t_.layout_symbol["text-size"]),"text-max-width":new Ys(t_.layout_symbol["text-max-width"]),"text-line-height":new Xs(t_.layout_symbol["text-line-height"]),"text-letter-spacing":new Ys(t_.layout_symbol["text-letter-spacing"]),"text-justify":new Ys(t_.layout_symbol["text-justify"]),"text-radial-offset":new Ys(t_.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Xs(t_.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ys(t_.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ys(t_.layout_symbol["text-anchor"]),"text-max-angle":new Xs(t_.layout_symbol["text-max-angle"]),"text-writing-mode":new Xs(t_.layout_symbol["text-writing-mode"]),"text-rotate":new Ys(t_.layout_symbol["text-rotate"]),"text-padding":new Xs(t_.layout_symbol["text-padding"]),"text-keep-upright":new Xs(t_.layout_symbol["text-keep-upright"]),"text-transform":new Ys(t_.layout_symbol["text-transform"]),"text-offset":new Ys(t_.layout_symbol["text-offset"]),"text-allow-overlap":new Xs(t_.layout_symbol["text-allow-overlap"]),"text-overlap":new Xs(t_.layout_symbol["text-overlap"]),"text-ignore-placement":new Xs(t_.layout_symbol["text-ignore-placement"]),"text-optional":new Xs(t_.layout_symbol["text-optional"])})}};let Fp=class Fp{constructor(R){if(void 0===R.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=R.property.overrides?R.property.overrides.runtimeType:tv,this.defaultValue=R}evaluate(R){if(R.formattedSection){let eh=this.defaultValue.property.overrides;if(null==eh?void 0:eh.hasOverride(R.formattedSection))return eh.getOverride(R.formattedSection)}return R.feature&&R.featureState?this.defaultValue.evaluate(R.feature,R.featureState):this.defaultValue.property.specification.default}eachChild(R){this.defaultValue.isConstant()||R(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}};ds("FormatSectionOverride",Fp,{omit:["defaultValue"]});let Pp=class Pp extends to{constructor(R,eh){super(R,rC,eh)}
5recalculate(R,eh){if(super.recalculate(R,eh),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let R=this.layout.get("text-writing-mode");if(R){let eh=[];for(let eu of R)eh.includes(eu)||eh.push(eu);this.layout._values["text-writing-mode"]=eh}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(R,eh,eu,em){var e_;let eg=this.layout.get(R).evaluate(eh,{},eu,em),ev=this._unevaluatedLayout._values[R];return ev.isDataDriven()||ii(ev.value)||!eg?eg:(e_=eh.properties,eg.replace(/{([^{}]+)}/g,(R,eh)=>e_&&eh in e_?String(e_[eh]):""))}createBucket(R){return new kp(R)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let R of rC.paint.overridableProperties){if(!Pp.hasPaintOverride(this.layout,R))continue;let eh=this.paint.get(R),eu=new Fp(eh),em=new ri(eu,eh.property.specification),e_=null;e_="constant"===eh.value.kind||"source"===eh.value.kind?new oi("source",em):new ai("composite",em,eh.value.zoomStops),this.paint._values[R]=new qs(eh.property,e_,eh.parameters)}}_handleOverridablePaintPropertyUpdate(R,eh,eu){return!(!this.layout||eh.isDataDriven()||eu.isDataDriven())&&Pp.hasPaintOverride(this.layout,R)}static hasPaintOverride(R,eh){let eu=R.get("text-field"),em=rC.paint.properties[eh],e_=!1,s=R=>{var eh;for(let eu of R)if(null===(eh=em.overrides)||void 0===eh?void 0:eh.hasOverride(eu))return void(e_=!0)};if("constant"===eu.value.kind&&eu.value.value instanceof ze)s(eu.value.value.sections);else if("source"===eu.value.kind||"composite"===eu.value.kind){let t=R=>{e_||(R instanceof Xe&&qe(R.value)===tE?s(R.value.sections):R instanceof Pn?s(R.sections):R.eachChild(t))},R=eu.value;R._styleExpression&&t(R._styleExpression.expression)}return e_}};var rA={get paint(){return eD=eD||new Ks({"background-color":new Xs(t_.paint_background["background-color"]),"background-pattern":new Hs(t_.paint_background["background-pattern"]),"background-opacity":new Xs(t_.paint_background["background-opacity"])})}};let Bp=class Bp extends to{constructor(R,eh){super(R,rA,eh)}};let Cp=class Cp extends to{constructor(R,eh){super(R,{},eh),this.onAdd=R=>{this.implementation.onAdd&&this.implementation.onAdd(R,R.painter.context.gl)},this.onRemove=R=>{this.implementation.onRemove&&this.implementation.onRemove(R,R.painter.context.gl)},this.implementation=R}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};let Vp=class Vp{constructor(R){this._methodToThrottle=R,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var R;this._triggered||(this._triggered=!0,null===(R=this._channel)||void 0===R||R.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};let rz={once:!0};let $p=class $p{constructor(R,eh){if(isNaN(R)||isNaN(eh))throw Error(`Invalid LngLat object: (${R}, ${eh})`);if(this.lng=+R,this.lat=+eh,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new $p(O(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(R){let eh=Math.PI/180,eu=this.lat*eh,em=R.lat*eh,e_=Math.sin(eu)*Math.sin(em)+Math.cos(eu)*Math.cos(em)*Math.cos((R.lng-this.lng)*eh);return 6371008.8*Math.acos(Math.min(e_,1))}static convert(R){if(R instanceof $p)return R;if(Array.isArray(R)&&(2===R.length||3===R.length))return new $p(Number(R[0]),Number(R[1]));if(!Array.isArray(R)&&"object"==typeof R&&null!==R)return new $p(Number("lng"in R?R.lng:R.lon),Number(R.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};let rD=2*Math.PI*6371008.8;function Np(R){return rD*Math.cos(R*Math.PI/180)}function Up(R){return(180+R)/360}function jp(R){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+R*Math.PI/360)))/360}function Gp(R){return 360*R-180}function Xp(R){return 360/Math.PI*Math.atan(Math.exp((180-360*R)*Math.PI/180)
5)-90}function Yp(R,eh){return R*Np(Xp(eh))}let Zp=class Zp{constructor(R,eh,eu=0){this.x=+R,this.y=+eh,this.z=+eu}static fromLngLat(R,eh=0){let eu=$p.convert(R);return new Zp(Up(eu.lng),jp(eu.lat),eh/Np(eu.lat))}toLngLat(){return new $p(Gp(this.x),Xp(this.y))}toAltitude(){return Yp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/rD*(1/Math.cos(Xp(this.y)*Math.PI/180))}};function Hp(R,eh,eu){var em=2*Math.PI*6378137/256/Math.pow(2,eu);return[R*em-2*Math.PI*6378137/2,eh*em-2*Math.PI*6378137/2]}let Wp=class Wp{constructor(R,eh,eu){if(R<0||R>25||eu<0||eu>=Math.pow(2,R)||eh<0||eh>=Math.pow(2,R))throw Error(`x=${eh}, y=${eu}, z=${R} outside of bounds. 0<=x<${Math.pow(2,R)}, 0<=y<${Math.pow(2,R)} 0<=z<=25 `);this.z=R,this.x=eh,this.y=eu,this.key=Qp(0,R,R,eh,eu)}equals(R){return this.z===R.z&&this.x===R.x&&this.y===R.y}url(R,eh,eu){var em,e_,eg,ev,ex;let eb=(e_=this.y,eg=this.z,ev=Hp(256*(em=this.x),256*(e_=Math.pow(2,eg)-e_-1),eg),ex=Hp(256*(em+1),256*(e_+1),eg),ev[0]+","+ev[1]+","+ex[0]+","+ex[1]),ew=function(R,eh,eu){let em="";for(let e_=R;e_>0;e_--){let R=1<<e_-1;em+=(eh&R?1:0)+(eu&R?2:0)}return em}(this.z,this.x,this.y);return R[(this.x+this.y)%R.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===eu?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,eh>1?"@2x":"").replace(/{quadkey}/g,ew).replace(/{bbox-epsg-3857}/g,eb)}isChildOf(R){let eh=this.z-R.z;return eh>0&&R.x===this.x>>eh&&R.y===this.y>>eh}getTilePoint(R){let eh=Math.pow(2,this.z);return new n((R.x*eh-this.x)*8192,(R.y*eh-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}};let Kp=class Kp{constructor(R,eh){this.wrap=R,this.canonical=eh,this.key=Qp(R,eh.z,eh.z,eh.x,eh.y)}};let Jp=class Jp{constructor(R,eh,eu,em,e_){if(this.terrainRttPosMatrix32f=null,R<eu)throw Error(`overscaledZ should be >= z; overscaledZ = ${R}; z = ${eu}`);this.overscaledZ=R,this.wrap=eh,this.canonical=new Wp(eu,+em,+e_),this.key=Qp(eh,R,eu,em,e_)}clone(){return new Jp(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(R){return this.overscaledZ===R.overscaledZ&&this.wrap===R.wrap&&this.canonical.equals(R.canonical)}scaledTo(R){if(R>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${R}; overscaledZ = ${this.overscaledZ}`);let eh=this.canonical.z-R;return R>this.canonical.z?new Jp(R,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Jp(R,this.wrap,R,this.canonical.x>>eh,this.canonical.y>>eh)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(R,eh){if(R>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${R}; overscaledZ = ${this.overscaledZ}`);let eu=this.canonical.z-R;return R>this.canonical.z?Qp(this.wrap*+eh,R,this.canonical.z,this.canonical.x,this.canonical.y):Qp(this.wrap*+eh,R,R,this.canonical.x>>eu,this.canonical.y>>eu)}isChildOf(R){if(R.wrap!==this.wrap||this.overscaledZ-R.overscaledZ<=0)return!1;if(0===R.overscaledZ)return this.overscaledZ>0;let eh=this.canonical.z-R.canonical.z;return!(eh<0)&&R.canonical.x===this.canonical.x>>eh&&R.canonical.y===this.canonical.y>>eh}children(R){if(this.overscaledZ>=R)return[new Jp(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let eh=this.canonical.z+1,eu=2*this.canonical.x,em=2*this.canonical.y;return[new Jp(eh,this.wrap,eh,eu,em),new Jp(eh,this.wrap,eh,eu+1,em),new Jp(eh,this.wrap,eh,eu,em+1),new Jp(eh,this.wrap,eh,eu+1,em+1)]}isLessThan(R){return this.wrap<R.wrap||!(this.wrap>R.wrap)&&(this.overscaledZ<R.overscaledZ||!(this.overscaledZ>R.overscaledZ)&&(this.canonical.x<R.canonical.x||!(this.canonical.x>R.canonical.x)&&this.canonical.y<R.canonical.y))}wrapped(){return new Jp(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(R){return new Jp(this.overscaledZ,R,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Kp(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(R){return this.canonical.getTilePoint(new Zp(R.x-this.wrap,R.y))}normalizeCoordinates(R,eh,eu=8192){if(R>=0&&R<eu&&eh>=0&&eh<eu)return{tileID:this,x:R,y:eh};let em=Math.floor(R/eu),e_=Math.floor(eh/eu),eg=this.canonical.z,ev=1<<eg,ex=this.canonical.y+e_;if(ex<0||ex>=ev)return null;let eb=this.canonical.x+em,ew=this.wrap;return eb<0?(ew-=Math.ceil(-eb/ev),eb=(eb%ev+ev)%ev):eb>=ev&&(ew+=Math.floor(eb/ev),eb%=ev),{tileID:new Jp(this.overscaledZ,ew,eg,eb,ex),x:R-em*eu,y:eh-e_*eu}}};
5function Qp(R,eh,eu,em,e_){(R*=2)<0&&(R=-1*R-1);let eg=1<<eu;return(eg*eg*R+eg*e_+em).toString(36)+eu.toString(36)+eh.toString(36)}ds("CanonicalTileID",Wp),ds("OverscaledTileID",Jp,{omit:["terrainRttPosMatrix32f"]});let tf=class tf{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(R){return this.minX=Math.min(this.minX,R.x),this.minY=Math.min(this.minY,R.y),this.maxX=Math.max(this.maxX,R.x),this.maxY=Math.max(this.maxY,R.y),this}expandBy(R){return this.minX-=R,this.minY-=R,this.maxX+=R,this.maxY+=R,(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(R){return this.expandBy(-R)}map(R){let eh=new tf;return eh.extend(R(new n(this.minX,this.minY))),eh.extend(R(new n(this.maxX,this.minY))),eh.extend(R(new n(this.minX,this.maxY))),eh.extend(R(new n(this.maxX,this.maxY))),eh}static fromPoints(R){let eh=new tf;for(let eu of R)eh.extend(eu);return eh}contains(R){return R.x>=this.minX&&R.x<=this.maxX&&R.y>=this.minY&&R.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(R){return!this.empty()&&!R.empty()&&R.minX>=this.minX&&R.maxX<=this.maxX&&R.minY>=this.minY&&R.maxY<=this.maxY}intersects(R){return!this.empty()&&!R.empty()&&R.minX<=this.maxX&&R.maxX>=this.minX&&R.minY<=this.maxY&&R.maxY>=this.minY}};let ef=class ef{constructor(R){this._stringToNumber={},this._numberToString=[];for(let eh=0;eh<R.length;eh++){let eu=R[eh];this._stringToNumber[eu]=eh,this._numberToString[eh]=eu}}encode(R){return this._stringToNumber[R]}decode(R){if(R>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${R} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[R]}};let nf=class nf{constructor(R,eh,eu,em,e_){this.type="Feature",this._vectorTileFeature=R,this._x=eu,this._y=em,this._z=eh,this.properties=R.properties,this.id=e_}projectPoint(R,eh,eu,em){return[360*(R.x+eh)/em-180,360/Math.PI*Math.atan(Math.exp((1-2*(R.y+eu)/em)*Math.PI))-90]}projectLine(R,eh,eu,em){return R.map(R=>this.projectPoint(R,eh,eu,em))}get geometry(){if(this._geometry)return this._geometry;let R=this._vectorTileFeature,eh=R.extent*Math.pow(2,this._z),eu=R.extent*this._x,em=R.extent*this._y,e_=R.loadGeometry();switch(R.type){case 1:{let R=[];for(let eh of e_)R.push(eh[0]);let eg=this.projectLine(R,eu,em,eh);this._geometry=1===R.length?{type:"Point",coordinates:eg[0]}:{type:"MultiPoint",coordinates:eg};break}case 2:{let R=e_.map(R=>this.projectLine(R,eu,em,eh));this._geometry=1===R.length?{type:"LineString",coordinates:R[0]}:{type:"MultiLineString",coordinates:R};break}case 3:{let R=Lu(e_),eg=[];for(let e_ of R)eg.push(e_.map(R=>this.projectLine(R,eu,em,eh)));this._geometry=1===eg.length?{type:"Polygon",coordinates:eg[0]}:{type:"MultiPolygon",coordinates:eg};break}default:throw Error(`unknown feature type: ${R.type}`)}return this._geometry}set geometry(R){this._geometry=R}toJSON(){let R={geometry:this.geometry};for(let eh in this)"_geometry"!==eh&&"_vectorTileFeature"!==eh&&"_x"!==eh&&"_y"!==eh&&"_z"!==eh&&(R[eh]=this[eh]);return R}};let rf=class rf{constructor(R,eh,eu){this._name=R,this.dataBuffer=eh,"number"==typeof eu?this._size=eu:(this.nullabilityBuffer=eu,this._size=eu.size())}getValue(R){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(R)?null:this.getValueFromBuffer(R)}has(R){return this.nullabilityBuffer?.get(R)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}};let sf=class sf extends rf{};let of=class of extends sf{getValueFromBuffer(R){return this.dataBuffer[R]}};let af=class af extends sf{getValueFromBuffer(R){return this.dataBuffer[R]}};let lf=class lf extends rf{constructor(R,eh,eu,em){super(R,eh,em),this.delta=eu}};let uf=class uf extends lf{constructor(R,eh,eu,em){super(R,Int32Array.of(eh),eu,em)}getValueFromBuffer(R){return this.dataBuffer[0]+R*this.delta}};let cf=class cf extends rf{constructor(R,eh,eu,em){super(R,em?Int32Array.of(eh):Uint32Array.of(eh),eu)}getValueFromBuffer(R){return this.dataBuffer[0]}};let hf=class hf{constructor(R,eh,eu,em,e_=4096){this._name=R,this._geometryVector=eh,this._idVector=eu,this._propertyVectors=em,this._extent=e_}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(R){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(R=>[R.name,R]))),this.propertyVectorsMap.get(R)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let R=[],eh=this.geometryVector.getGeometries();for(let eu=0;eu<this.numFeatures;eu++){let em;if(this.idVector){let R=this.idVector.getValue(eu);em=this.containsMaxSafeIntegerValues(this.idVector)&&null!==R?Number(R):R}let e_={coordinates:eh[eu],type:this.geometryVector.geometryType(eu)},eg={};
5for(let R of this.propertyVectors){if(!R)continue;let eh=R.name,em=R.getValue(eu);null!==em&&(eg[eh]=em)}R.push({id:em,geometry:e_,properties:eg})}return R}containsMaxSafeIntegerValues(R){return R instanceof of||R instanceof cf||R instanceof uf||R instanceof af}};let pf=class pf{constructor(R){this.value=R}get(){return this.value}set(R){this.value=R}increment(){return this.value++}add(R){this.value+=R}};(eR=eq||(eq={})).NONE="NONE",eR.DELTA="DELTA",eR.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",eR.RLE="RLE",eR.MORTON="MORTON",eR.PDE="PDE",(eL=eW||(eW={})).NONE="NONE",eL.FAST_PFOR="FAST_PFOR",eL.VARINT="VARINT",eL.ALP="ALP";let rk=new Uint32Array(33);rk[0]=0;for(let R=1;R<=32;R++)rk[R]=32===R?4294967295:4294967295>>>32-R;let rR=function(){var R;if(!Number.isFinite(65536))return 65536;let eh=(R=Math.floor(65536))-R%256;return 0===eh?256:eh}(),rL=3*rR/256+rR|0;function _f(){let R=new Uint8Array(rL);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:R,byteContainerI32:new Int32Array(R.buffer,R.byteOffset,R.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Ef(R,eh,eu){let em=new Uint32Array(eu),e_=0,eg=eh.get();for(let eh=0;eh<em.length;eh++){let eh=R[eg++],eu=127&eh;eh<128||(eu|=(127&(eh=R[eg++]))<<7,eh<128||(eu|=(127&(eh=R[eg++]))<<14,eh<128||(eu|=(127&(eh=R[eg++]))<<21,eh<128||(eu|=(15&(eh=R[eg++]))<<28)))),em[e_++]=eu}return eh.set(eg),em}function Tf(R,eh,eu){let em=new BigUint64Array(eu);for(let eu=0;eu<em.length;eu++)em[eu]=function(R,eh){let eu=0n,em=0,e_=eh.get();for(;e_<R.length;){let eh=R[e_++];if(eu|=BigInt(127&eh)<<BigInt(em),!(128&eh))break;if((em+=7)>=64)throw Error("Varint too long")}return eh.set(e_),eu}(R,eh);return em}function Df(R){return R>>>1^-(1&R)}function zf(R){return R>>1n^-(1n&R)}function Bf(R){return R%2==1?-((R+1)/2):R/2}function Cf(R,eh,eu){if(void 0===eu){eu=0;for(let em=0;em<eh;em++)eu+=R[em]}let em=new Uint32Array(eu),e_=0;for(let eu=0;eu<eh;eu++){let eg=R[eu];em.fill(R[eu+eh],e_,e_+eg),e_+=eg}return em}function Vf(R,eh,eu){if(void 0===eu){eu=0;for(let em=0;em<eh;em++)eu+=Number(R[em])}let em=new BigUint64Array(eu),e_=0;for(let eu=0;eu<eh;eu++){let eg=Number(R[eu]);em.fill(R[eu+eh],e_,e_+eg),e_+=eg}return em}function Lf(R,eh,eu){let em=new Float64Array(eu),e_=0;for(let eu=0;eu<eh;eu++){let eg=R[eu];em.fill(R[eu+eh],e_,e_+eg),e_+=eg}return em}function Of(R){let eh=new Int32Array(R.length);eh[0]=Df(R[0]);let eu=R.length/4*4,em=1;if(eu>=4)for(;em<eu-4;em+=4){let eu=R[em+1],e_=R[em+2],eg=R[em+3];eh[em]=Df(R[em])+eh[em-1],eh[em+1]=Df(eu)+eh[em],eh[em+2]=Df(e_)+eh[em+1],eh[em+3]=Df(eg)+eh[em+2]}for(;em!==R.length;++em)eh[em]=Df(R[em])+eh[em-1];return eh}function $f(R){let eh=new BigInt64Array(R.length);eh[0]=zf(R[0]);let eu=R.length/4*4,em=1;if(eu>=4)for(;em<eu-4;em+=4){let eu=R[em+1],e_=R[em+2],eg=R[em+3];eh[em]=zf(R[em])+eh[em-1],eh[em+1]=zf(eu)+eh[em],eh[em+2]=zf(e_)+eh[em+1],eh[em+3]=zf(eg)+eh[em+2]}for(;em!==eh.length;++em)eh[em]=zf(R[em])+eh[em-1];return eh}function Rf(R){let eh=R.length/4*4,eu=1;if(eh>=4)for(let em=R[0];eu<eh-4;eu+=4)em=R[eu]+=em,em=R[eu+1]+=em,em=R[eu+2]+=em,em=R[eu+3]+=em;for(;eu!==R.length;)R[eu]+=R[eu-1],++eu}function Hf(R,eh){let eu=function(R,eh){let eu=R[eh.get()],em=Object.values(eX)[eu>>4],e_=null;switch(em){case eX.DATA:e_={dictionaryType:Object.values(eH)[15&eu]};break;case eX.OFFSET:e_={offsetType:Object.values(eY)[15&eu]};break;case eX.LENGTH:e_={lengthType:Object.values(eJ)[15&eu]}}eh.increment();let eg=R[eh.get()],ev=Object.values(eq)[eg>>5],ex=Object.values(eq)[eg>>2&7],eb=Object.values(eW)[3&eg];eh.increment();let ew=Ef(R,eh,2),eT=ew[0];return{physicalStreamType:em,logicalStreamType:e_,logicalLevelTechnique1:ev,logicalLevelTechnique2:ex,physicalLevelTechnique:eb,numValues:eT,byteLength:ew[1],decompressedCount:eT}}(R,eh);return eu.logicalLevelTechnique1===eq.MORTON?function(R,eh,eu){let em=Ef(eh,eu,2);return{physicalStreamType:R.physicalStreamType,logicalStreamType:R.logicalStreamType,logicalLevelTechnique1:R.logicalLevelTechnique1,logicalLevelTechnique2:R.logicalLevelTechnique2,physicalLevelTechnique:R.physicalLevelTechnique,numValues:R.numValues,byteLength:R.byteLength,decompressedCount:R.decompressedCount,numBits:em[0],coordinateShift:em[1]}}(eu,R,eh):eq.RLE!==eu.logicalLevelTechnique1&&eq.RLE!==eu.logicalLevelTechnique2||eW.NONE===eu.physicalLevelTechnique?eu:function(R,eh,eu){let em=Ef(eh,eu,2);return{physicalStreamType:R.physicalStreamType,logicalStreamType:R.logicalStreamType,logicalLevelTechnique1:R.logicalLevelTechnique1,logicalLevelTechnique2:R.logicalLevelTechnique2,physicalLevelTechnique:R.physicalLevelTechnique,numValues:R.numValues,byteLength:R.byteLength,decompressedCount:em[1],runs:em[0],numRleValues:em[1]}}(eu,R,eh)}(eF=eX||(eX={})).PRESENT="PRESENT",eF.DATA="DATA",eF.OFFSET="OFFSET",eF.LENGTH="LENGTH",(eB=eH||(eH={})).NONE="NONE",eB.SINGLE="SINGLE",eB.SHARED="SHARED",eB.VERTEX="VERTEX",eB.MORTON="MORTON",eB.FSST="FSST",(eO=eY||(eY={})).VERTEX="VERTEX",eO.INDEX="INDEX",eO.STRING="STRING",eO.KEY="KEY",(eV=eJ||(eJ={})).VAR_BINARY="VAR_BINARY",eV.GEOMETRIES="GEOMETRIES",eV.PARTS="PARTS",eV.RINGS="RINGS",eV.TRIANGLES="TRIANGLES",eV.SYMBOL="SYMBOL",eV.DICTIONARY="DICTIONARY",(ej=eK||(eK={}))[ej.FLAT=0]="FLAT",ej[ej.CONST=1]="CONST",ej[ej.SEQUENCE=2]="SEQUENCE",ej[ej.DICTIONARY=3]="DICTIONARY",ej[ej.FSST_DICTIONARY=4]="FSST_DICTIONARY";let Wf=class Wf{constructor(R,eh){this.values=R,this._size=eh}get(R){return 1==(this.values[Math.floor(R/8)]>>R%8&1)}set(R,eh){let eu=Math.floor(R/8);this.values[eu]=this.values[eu]|(eh?1:0)<<R%8}getInt(R){return this.values[Math.floor(R/8)]>>R%8&1}size(){return this._size}getBuffer(){return this.values}};function Kf(R,eh,eu){if(!eh)return R;let em=eh.size(),e_=new R.constructor(em),eg=0;for(let ev=0;ev<em;ev++)e_[ev]=eh.get(ev)?R[eg++]:eu;return e_}function Jf(R,eh,eu,em,e_){return function(R,eh,eu,em){let e_;switch(eh.logicalLevelTechnique1){case eq.DELTA:if(eh.logicalLevelTechnique2===eq.RLE){if(!em)return function(R,eh,eu){let em=new Int32Array(eu),e_=0,eg=0;for(let eu=0;eu<eh;eu++){let ev=R[eu],ex=Df(R[eu+eh]);for(let R=0;R<ev;R++)eg+=ex,em[e_++]=eg}return em}(R,eh.runs,eh.numRleValues);e_=Of(R=Cf(R,eh.runs,eh.numRleValues))}else e_=Of(R);break;case eq.RLE:e_=function(R,eh,eu){if(void 0===eu){eu=0;for(let em=0;em<eh;em++)eu+=R[em]}let em=new Int32Array(eu),e_=0;for(let eu=0;eu<eh;eu++){let eg=R[eu],ev=R[eu+eh];ev=Df(ev),em.fill(ev,e_,e_+eg),e_+=eg}return em}(R,eh.runs,eh.numRleValues);break;case eq.MORTON:Rf(R),e_=new Int32Array(R);break;case eq.COMPONENTWISE_DELTA:e_=function(R){if(R.length<2)return new Int32Array(R);let eh=new Int32Array(R.length);eh[0]=Df(R[0]),eh[1]=Df(R[1]);let eu=R.length/4*4,em=2;if(eu>=4)for(;em<eu-4;em+=4){let eu=R[em+1],e_=R[em+2],eg=R[em+3];eh[em]=Df(R[em])+eh[em-2],eh[em+1]=Df(eu)+eh[em-1],eh[em+2]=Df(e_)+eh[em],eh[em+3]=Df(eg)+eh[em+1]}for(;em!==R.length;em+=2)eh[em]=Df(R[em])+eh[em-2],eh[em+1]=Df(R[em+1])+eh[em-1];return eh}(R);break;case eq.NONE:e_=function(R){let eh=new Int32Array(R.length);for(let eu=0;eu<R.length;eu++)eh[eu]=Df(R[eu]);return eh}(R);break;default:throw Error(`The specified Logical level technique is not supported: ${eh.logicalLevelTechnique1}`)}return em?Kf(e_,em,0):e_}(ed(R,eh,eu),eu,0,e_)}function Qf(R,eh,eu,em,e_){return function(R,eh,eu,em){let e_;switch(eh.logicalLevelTechnique1){case eq.DELTA:e_=function(R){let eh=new Uint32Array(R.length);eh[0]=Df(R[0])>>>0;for(let eu=1;eu<R.length;eu++)eh[eu]=eh[eu-1]+Df(R[eu])>>>0;return eh}(eh.logicalLevelTechnique2===eq.RLE?Cf(R,eh.runs,eh.numRleValues):R);break;case eq.RLE:e_=Cf(R,eh.runs,eh.numRleValues);break;case eq.MORTON:Rf(R),e_=R;break;case eq.COMPONENTWISE_DELTA:e_=function(R){if(R.length<2)return new Uint32Array(R);let eh=new Uint32Array(R.length);eh[0]=Df(R[0])>>>0,eh[1]=Df(R[1])>>>0;for(let eu=2;eu<R.length;eu+=2)eh[eu]=eh[eu-2]+Df(R[eu])>>>0,eh[eu+1]=eh[eu-1]+Df(R[eu+1])>>>0;return eh}(R);break;case eq.NONE:e_=R;break;default:throw Error(`The specified Logical level technique is not supported: ${eh.logicalLevelTechnique1}`)}return em?Kf(e_,em,0):e_}(ed(R,eh,eu),eu,0,e_)}function td(R,eh,eu){return function(R,eh){if(eh.logicalLevelTechnique1===eq.DELTA&&eh.logicalLevelTechnique2===eq.NONE)return function(R){let eh=new Int32Array(R.length+1);eh[0]=0,eh[1]=Df(R[0]);let eu=eh[1];for(let em=2;em!==eh.length;++em)eu+=Df(R[em-1]),eh[em]=eh[em-1]+eu;return new Uint32Array(eh)}(R);if(eh.logicalLevelTechnique1===eq.RLE&&eh.logicalLevelTechnique2===eq.NONE)return function(R,eh,eu){let em=new Uint32Array(eu+1);em[0]=0;let e_=1,eg=em[0];for(let eu=0;eu<eh;eu++){let ev=R[eu],ex=R[eu+eh];for(let R=e_;R<e_+ev;R++)em[R]=ex+eg,eg=em[R];e_+=ev}return em}(R,eh.runs,eh.numRleValues);if(eh.logicalLevelTechnique1===eq.NONE&&eh.logicalLevelTechnique2===eq.NONE){!function(R){let eh=0;for(let eu=0;eu<R.length;eu++)R[eu]+=eh,eh=R[eu]}(R);let eu=new Uint32Array(eh.numValues+1);return eu[0]=0,eu.set(R,1),eu}if(eh.logicalLevelTechnique1===eq.DELTA&&eh.logicalLevelTechnique2===eq.RLE){let eu=function(R,eh,eu){let em=new Int32Array(eu+1);em[0]=0;let e_=1,eg=em[0];for(let eu=0;eu<eh;eu++){let ev=R[eu],ex=R[eu+eh];ex=Df(ex);for(let R=e_;R<e_+ev;R++)em[R]=ex+eg,eg=em[R];e_+=ev}return em}(R,eh.runs,eh.numRleValues);return Rf(eu),new Uint32Array(eu)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(ed(R,eh,eu),eu)}function ed(R,eh,eu){let em=eu.physicalLevelTechnique;switch(em){case eW.FAST_PFOR:var e_;return function(R,eh,eu,em,e_){let eg=em.get();
vendor: 22,994 bytes, line 5
5if(3&eu)throw Error(`FastPFOR: invalid encodedByteLength=${eu} at offset=${eg} (encodedBytes.length=${R.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let ev=eu>>>2,ex=function(R,eh){if(eh<=R.encodedWords.length)return R.encodedWords;let eu=new Uint32Array(Math.max(16,2*eh));return R.encodedWords=eu,eu}(e_,ev);!function(R,eh,eu,em){if(eh<0||eu<0||eh+eu>R.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${eh}, byteLength=${eu}, bytes.length=${R.length})`);let e_=Math.floor(eu/4),eg=eu%4!=0,ev=eg?e_+1:e_;if(em.length<ev)throw RangeError(`decodeBigEndianInt32sInto: out.length=${em.length} < ${ev}`);if(e_>0){let eu=R.byteOffset+eh;if(3&eu)for(let eu=0;eu<e_;eu++){let e_=eh+4*eu;em[eu]=R[e_]<<24|R[e_+1]<<16|R[e_+2]<<8|R[e_+3]}else{let eh=new Uint32Array(R.buffer,eu,e_);for(let R=0;R<e_;R++)em[R]=0|function(R){let eh=R>>>0;return((255&eh)<<24|(65280&eh)<<8|eh>>>8&65280|eh>>>24&255)>>>0}(eh[R])}}if(eg){let eg=eh+4*e_,ev=eu-4*e_,ex=0;for(let eh=0;eh<ev;eh++)ex|=R[eg+eh]<<24-8*eh;em[e_]=0|ex}}(R,eg,eu,ex);let eb=function(R,eh,eu){let em=0,e_=0,eg=new Uint32Array(eh),ev=eu??_f();if(R.length>0){let eh=0|R[em];if(em=em+1|0,255&eh)throw Error(`FastPFOR decode: invalid alignedLength=${eh} (expected multiple of 256)`);if(e_+eh>eg.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${e_}, alignedLength=${eh}, out.length=${eg.length})`);em=function(R,eh,eu,em,e_,eg){let ev=em+(e_-e_%256),ex=em,eb=eu;for(;ex!==ev;){let eu=Math.min(rR,ev-ex);eb=function(R,eh,eu,em,e_,eg){let ev=0|eu,ex=0|R[ev];if(ex<=0||ev+ex>R.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${ex} at pageStart=${ev} (expected > 0 and pageStart+whereMeta < encoded.length=${R.length})`);let eb=ev+1|0,ew=ev+ex|0,eT=R[ew]>>>0,eS=eT+3>>>2,eP=ew+1,eI=eP+eS;if(eI>=R.length)throw Error(`FastPFOR decode: invalid byteSize=${eT} (metaInts=${eS}, pageStart=${ev}, packedEnd=${ew}, byteContainerStart=${eP}) causes bitmapPos=${eI} out of bounds (encoded.length=${R.length})`);let eM=function(R,eh,eu,em){em.byteContainer.length<eu&&(em.byteContainer=new Uint8Array(2*eu),em.byteContainerI32=void 0);let e_=em.byteContainer,eg=eu>>>2;if(3&e_.byteOffset)for(let eu=0;eu<eg;eu=eu+1|0){let em=0|R[eh+eu|0],eg=eu<<2;e_[eg]=255&em,e_[eg+1|0]=em>>>8&255,e_[eg+2|0]=em>>>16&255,e_[eg+3|0]=em>>>24&255}else{let eu=em.byteContainerI32;(!eu||eu.buffer!==e_.buffer||eu.byteOffset!==e_.byteOffset||eu.length<eg)&&(eu=em.byteContainerI32=new Int32Array(e_.buffer,e_.byteOffset,e_.byteLength>>>2)),eu.set(R.subarray(eh,eh+eg))}let ev=3&eu;if(ev>0){let eu=0|R[eh+eg|0],em=eg<<2;for(let R=0;R<ev;R=R+1|0)e_[em+R|0]=eu>>>(R<<3)&255}return e_}(R,eP,eT,eg),eE=function(R,eh,eu){let em=0|R[eh++],e_=eu.dataToBePacked;for(let ev=2;ev<=32;ev=ev+1|0){var eg;if(!(em>>>ev-1&1))continue;if(eh>=R.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${ev}, streamWordIndex=${eh}, needWords=1, availableWords=${R.length-eh}, encodedWords=${R.length})`);let ex=R[eh++]>>>0,eb=(eg=ex+31)-eg%32,ew=ex*ev+31>>>5;if(eh+ew>R.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${ev}, size=${ex}, streamWordIndex=${eh}, needWords=${ew}, availableWords=${R.length-eh}, encodedWords=${R.length})`);let eT=e_[ev];(!eT||eT.length<eb)&&(eT=e_[ev]=new Uint32Array(eb));let eS=0;for(;eS<ex;eS=eS+32|0)(function(R,eh,eu,em,e_){switch(e_){case 2:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0;eu[e_++]=eg>>>0&3,eu[e_++]=eg>>>2&3,eu[e_++]=eg>>>4&3,eu[e_++]=eg>>>6&3,eu[e_++]=eg>>>8&3,eu[e_++]=eg>>>10&3,eu[e_++]=eg>>>12&3,eu[e_++]=eg>>>14&3,eu[e_++]=eg>>>16&3,eu[e_++]=eg>>>18&3,eu[e_++]=eg>>>20&3,eu[e_++]=eg>>>22&3,eu[e_++]=eg>>>24&3,eu[e_++]=eg>>>26&3,eu[e_++]=eg>>>28&3,eu[e_++]=eg>>>30&3,eu[e_++]=ev>>>0&3,eu[e_++]=ev>>>2&3,eu[e_++]=ev>>>4&3,eu[e_++]=ev>>>6&3,eu[e_++]=ev>>>8&3,eu[e_++]=ev>>>10&3,eu[e_++]=ev>>>12&3,eu[e_++]=ev>>>14&3,eu[e_++]=ev>>>16&3,eu[e_++]=ev>>>18&3,eu[e_++]=ev>>>20&3,eu[e_++]=ev>>>22&3,eu[e_++]=ev>>>24&3,eu[e_++]=ev>>>26&3,eu[e_++]=ev>>>28&3,eu[e_]=ev>>>30&3}(R,eh,eu,em);case 3:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0;eu[e_++]=eg>>>0&7,eu[e_++]=eg>>>3&7,eu[e_++]=eg>>>6&7,eu[e_++]=eg>>>9&7,eu[e_++]=eg>>>12&7,eu[e_++]=eg>>>15&7,eu[e_++]=eg>>>18&7,eu[e_++]=eg>>>21&7,eu[e_++]=eg>>>24&7,eu[e_++]=eg>>>27&7,eu[e_++]=7&(eg>>>30|(1&ev)<<2),eu[e_++]=ev>>>1&7,eu[e_++]=ev>>>4&7,eu[e_++]=ev>>>7&7,eu[e_++]=ev>>>10&7,eu[e_++]=ev>>>13&7,eu[e_++]=ev>>>16&7,eu[e_++]=ev>>>19&7,eu[e_++]=ev>>>22&7,eu[e_++]=ev>>>25&7,eu[e_++]=ev>>>28&7,eu[e_++]=7&(ev>>>31|(3&ex)<<1),eu[e_++]=ex>>>2&7,eu[e_++]=ex>>>5&7,eu[e_++]=ex>>>8&7,eu[e_++]=ex>>>11&7,eu[e_++]=ex>>>14&7,eu[e_++]=ex>>>17&7,eu[e_++]=ex>>>20&7,eu[e_++]=ex>>>23&7,eu[e_++]=ex>>>26&7,eu[e_]=ex>>>29&7}(R,eh,eu,em);case 4:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0;eu[e_++]=eg>>>0&15,eu[e_++]=eg>>>4&15,eu[e_++]=eg>>>8&15,eu[e_++]=eg>>>12&15,eu[e_++]=eg>>>16&15,eu[e_++]=eg>>>20&15,eu[e_++]=eg>>>24&15,eu[e_++]=eg>>>28&15,eu[e_++]=ev>>>0&15,eu[e_++]=ev>>>4&15,eu[e_++]=ev>>>8&15,eu[e_++]=ev>>>12&15,eu[e_++]=ev>>>16&15,eu[e_++]=ev>>>20&15,eu[e_++]=ev>>>24&15,eu[e_++]=ev>>>28&15,eu[e_++]=ex>>>0&15,eu[e_++]=ex>>>4&15,eu[e_++]=ex>>>8&15,eu[e_++]=ex>>>12&15,eu[e_++]=ex>>>16&15,eu[e_++]=ex>>>20&15,eu[e_++]=ex>>>24&15,eu[e_++]=ex>>>28&15,eu[e_++]=eb>>>0&15,eu[e_++]=eb>>>4&15,eu[e_++]=eb>>>8&15,eu[e_++]=eb>>>12&15,eu[e_++]=eb>>>16&15,eu[e_++]=eb>>>20&15,eu[e_++]=eb>>>24&15,eu[e_]=eb>>>28&15}(R,eh,eu,em);case 5:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0;eu[e_++]=eg>>>0&31,eu[e_++]=eg>>>5&31,eu[e_++]=eg>>>10&31,eu[e_++]=eg>>>15&31,eu[e_++]=eg>>>20&31,eu[e_++]=eg>>>25&31,eu[e_++]=31&(eg>>>30|(7&ev)<<2),eu[e_++]=ev>>>3&31,eu[e_++]=ev>>>8&31,eu[e_++]=ev>>>13&31,eu[e_++]=ev>>>18&31,eu[e_++]=ev>>>23&31,eu[e_++]=31&(ev>>>28|(1&ex)<<4),eu[e_++]=ex>>>1&31,eu[e_++]=ex>>>6&31,eu[e_++]=ex>>>11&31,eu[e_++]=ex>>>16&31,eu[e_++]=ex>>>21&31,eu[e_++]=ex>>>26&31,eu[e_++]=31&(ex>>>31|(15&eb)<<1),eu[e_++]=eb>>>4&31,eu[e_++]=eb>>>9&31,eu[e_++]=eb>>>14&31,eu[e_++]=eb>>>19&31,eu[e_++]=eb>>>24&31,eu[e_++]=31&(eb>>>29|(3&ew)<<3),eu[e_++]=ew>>>2&31,eu[e_++]=ew>>>7&31,eu[e_++]=ew>>>12&31,eu[e_++]=ew>>>17&31,eu[e_++]=ew>>>22&31,eu[e_]=ew>>>27&31}(R,eh,eu,em);case 6:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0;eu[e_++]=eg>>>0&63,eu[e_++]=eg>>>6&63,eu[e_++]=eg>>>12&63,eu[e_++]=eg>>>18&63,eu[e_++]=eg>>>24&63,eu[e_++]=63&(eg>>>30|(15&ev)<<2),eu[e_++]=ev>>>4&63,eu[e_++]=ev>>>10&63,eu[e_++]=ev>>>16&63,eu[e_++]=ev>>>22&63,eu[e_++]=63&(ev>>>28|(3&ex)<<4),eu[e_++]=ex>>>2&63,eu[e_++]=ex>>>8&63,eu[e_++]=ex>>>14&63,eu[e_++]=ex>>>20&63,eu[e_++]=ex>>>26&63,eu[e_++]=eb>>>0&63,eu[e_++]=eb>>>6&63,eu[e_++]=eb>>>12&63,eu[e_++]=eb>>>18&63,eu[e_++]=eb>>>24&63,eu[e_++]=63&(eb>>>30|(15&ew)<<2),eu[e_++]=ew>>>4&63,eu[e_++]=ew>>>10&63,eu[e_++]=ew>>>16&63,eu[e_++]=ew>>>22&63,eu[e_++]=63&(ew>>>28|(3&eT)<<4),eu[e_++]=eT>>>2&63,eu[e_++]=eT>>>8&63,eu[e_++]=eT>>>14&63,eu[e_++]=eT>>>20&63,eu[e_]=eT>>>26&63}(R,eh,eu,em);case 7:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0;eu[e_++]=eg>>>0&127,eu[e_++]=eg>>>7&127,eu[e_++]=eg>>>14&127,eu[e_++]=eg>>>21&127,eu[e_++]=127&(eg>>>28|(7&ev)<<4),eu[e_++]=ev>>>3&127,eu[e_++]=ev>>>10&127,eu[e_++]=ev>>>17&127,eu[e_++]=ev>>>24&127,eu[e_++]=127&(ev>>>31|(63&ex)<<1),eu[e_++]=ex>>>6&127,eu[e_++]=ex>>>13&127,eu[e_++]=ex>>>20&127,eu[e_++]=127&(ex>>>27|(3&eb)<<5),eu[e_++]=eb>>>2&127,eu[e_++]=eb>>>9&127,eu[e_++]=eb>>>16&127,eu[e_++]=eb>>>23&127,eu[e_++]=127&(eb>>>30|(31&ew)<<2),eu[e_++]=ew>>>5&127,eu[e_++]=ew>>>12&127,eu[e_++]=ew>>>19&127,eu[e_++]=127&(ew>>>26|(1&eT)<<6),eu[e_++]=eT>>>1&127,eu[e_++]=eT>>>8&127,eu[e_++]=eT>>>15&127,eu[e_++]=eT>>>22&127,eu[e_++]=127&(eT>>>29|(15&eS)<<3),eu[e_++]=eS>>>4&127,eu[e_++]=eS>>>11&127,eu[e_++]=eS>>>18&127,eu[e_]=eS>>>25&127}(R,eh,eu,em);case 8:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0;eu[e_++]=eg>>>0&255,eu[e_++]=eg>>>8&255,eu[e_++]=eg>>>16&255,eu[e_++]=eg>>>24&255,eu[e_++]=ev>>>0&255,eu[e_++]=ev>>>8&255,eu[e_++]=ev>>>16&255,eu[e_++]=ev>>>24&255,eu[e_++]=ex>>>0&255,eu[e_++]=ex>>>8&255,eu[e_++]=ex>>>16&255,eu[e_++]=ex>>>24&255,eu[e_++]=eb>>>0&255,eu[e_++]=eb>>>8&255,eu[e_++]=eb>>>16&255,eu[e_++]=eb>>>24&255,eu[e_++]=ew>>>0&255,eu[e_++]=ew>>>8&255,eu[e_++]=ew>>>16&255,eu[e_++]=ew>>>24&255,eu[e_++]=eT>>>0&255,eu[e_++]=eT>>>8&255,eu[e_++]=eT>>>16&255,eu[e_++]=eT>>>24&255,eu[e_++]=eS>>>0&255,eu[e_++]=eS>>>8&255,eu[e_++]=eS>>>16&255,eu[e_++]=eS>>>24&255,eu[e_++]=eP>>>0&255,eu[e_++]=eP>>>8&255,eu[e_++]=eP>>>16&255,eu[e_]=eP>>>24&255}(R,eh,eu,em);case 9:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0,eI=R[eh+8]>>>0;eu[e_++]=eg>>>0&511,eu[e_++]=eg>>>9&511,eu[e_++]=eg>>>18&511,eu[e_++]=511&(eg>>>27|(15&ev)<<5),eu[e_++]=ev>>>4&511,eu[e_++]=ev>>>13&511,eu[e_++]=ev>>>22&511,eu[e_++]=511&(ev>>>31|(255&ex)<<1),eu[e_++]=ex>>>8&511,eu[e_++]=ex>>>17&511,eu[e_++]=511&(ex>>>26|(7&eb)<<6),eu[e_++]=eb>>>3&511,eu[e_++]=eb>>>12&511,eu[e_++]=eb>>>21&511,eu[e_++]=511&(eb>>>30|(127&ew)<<2),eu[e_++]=ew>>>7&511,eu[e_++]=ew>>>16&511,eu[e_++]=511&(ew>>>25|(3&eT)<<7),eu[e_++]=eT>>>2&511,eu[e_++]=eT>>>11&511,eu[e_++]=eT>>>20&511,eu[e_++]=511&(eT>>>29|(63&eS)<<3),eu[e_++]=eS>>>6&511,eu[e_++]=eS>>>15&511,eu[e_++]=511&(eS>>>24|(1&eP)<<8),eu[e_++]=eP>>>1&511,eu[e_++]=eP>>>10&511,eu[e_++]=eP>>>19&511,eu[e_++]=511&(eP>>>28|(31&eI)<<4),eu[e_++]=eI>>>5&511,eu[e_++]=eI>>>14&511,eu[e_]=eI>>>23&511}(R,eh,eu,em);case 10:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0,eI=R[eh+8]>>>0,eM=R[eh+9]>>>0;eu[e_++]=eg>>>0&1023,eu[e_++]=eg>>>10&1023,eu[e_++]=eg>>>20&1023,eu[e_++]=1023&(eg>>>30|(255&ev)<<2),eu[e_++]=ev>>>8&1023,eu[e_++]=ev>>>18&1023,eu[e_++]=1023&(ev>>>28|(63&ex)<<4),eu[e_++]=ex>>>6&1023,eu[e_++]=ex>>>16&1023,eu[e_++]=1023&(ex>>>26|(15&eb)<<6),eu[e_++]=eb>>>4&1023,eu[e_++]=eb>>>14&1023,eu[e_++]=1023&(eb>>>24|(3&ew)<<8),eu[e_++]=ew>>>2&1023,eu[e_++]=ew>>>12&1023,eu[e_++]=ew>>>22&1023,eu[e_++]=eT>>>0&1023,eu[e_++]=eT>>>10&1023,eu[e_++]=eT>>>20&1023,eu[e_++]=1023&(eT>>>30|(255&eS)<<2),eu[e_++]=eS>>>8&1023,eu[e_++]=eS>>>18&1023,eu[e_++]=1023&(eS>>>28|(63&eP)<<4),eu[e_++]=eP>>>6&1023,eu[e_++]=eP>>>16&1023,eu[e_++]=1023&(eP>>>26|(15&eI)<<6),eu[e_++]=eI>>>4&1023,eu[e_++]=eI>>>14&1023,eu[e_++]=1023&(eI>>>24|(3&eM)<<8),eu[e_++]=eM>>>2&1023,eu[e_++]=eM>>>12&1023,eu[e_]=eM>>>22&1023}(R,eh,eu,em);case 11:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0,eI=R[eh+8]>>>0,eM=R[eh+9]>>>0,eE=R[eh+10]>>>0;eu[e_++]=eg>>>0&2047,eu[e_++]=eg>>>11&2047,eu[e_++]=2047&(eg>>>22|(1&ev)<<10),eu[e_++]=ev>>>1&2047,eu[e_++]=ev>>>12&2047,eu[e_++]=2047&(ev>>>23|(3&ex)<<9),eu[e_++]=ex>>>2&2047,eu[e_++]=ex>>>13&2047,eu[e_++]=2047&(ex>>>24|(7&eb)<<8),eu[e_++]=eb>>>3&2047,eu[e_++]=eb>>>14&2047,eu[e_++]=2047&(eb>>>25|(15&ew)<<7),eu[e_++]=ew>>>4&2047,eu[e_++]=ew>>>15&2047,eu[e_++]=2047&(ew>>>26|(31&eT)<<6),eu[e_++]=eT>>>5&2047,eu[e_++]=eT>>>16&2047,eu[e_++]=2047&(eT>>>27|(63&eS)<<5),eu[e_++]=eS>>>6&2047,eu[e_++]=eS>>>17&2047,eu[e_++]=2047&(eS>>>28|(127&eP)<<4),eu[e_++]=eP>>>7&2047,eu[e_++]=eP>>>18&2047,eu[e_++]=2047&(eP>>>29|(255&eI)<<3),eu[e_++]=eI>>>8&2047,eu[e_++]=eI>>>19&2047,eu[e_++]=2047&(eI>>>30|(511&eM)<<2),eu[e_++]=eM>>>9&2047,eu[e_++]=eM>>>20&2047,eu[e_++]=2047&(eM>>>31|(1023&eE)<<1),eu[e_++]=eE>>>10&2047,eu[e_]=eE>>>21&2047}(R,eh,eu,em);case 12:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0,eI=R[eh+8]>>>0,eM=R[eh+9]>>>0,eE=R[eh+10]>>>0,eC=R[eh+11]>>>0;eu[e_++]=eg>>>0&4095,eu[e_++]=eg>>>12&4095,eu[e_++]=4095&(eg>>>24|(15&ev)<<8),eu[e_++]=ev>>>4&4095,eu[e_++]=ev>>>16&4095,eu[e_++]=4095&(ev>>>28|(255&ex)<<4),eu[e_++]=ex>>>8&4095,eu[e_++]=ex>>>20&4095,eu[e_++]=eb>>>0&4095,eu[e_++]=eb>>>12&4095,eu[e_++]=4095&(eb>>>24|(15&ew)<<8),eu[e_++]=ew>>>4&4095,eu[e_++]=ew>>>16&4095,eu[e_++]=4095&(ew>>>28|(255&eT)<<4),eu[e_++]=eT>>>8&4095,eu[e_++]=eT>>>20&4095,eu[e_++]=eS>>>0&4095,eu[e_++]=eS>>>12&4095,eu[e_++]=4095&(eS>>>24|(15&eP)<<8),eu[e_++]=eP>>>4&4095,eu[e_++]=eP>>>16&4095,eu[e_++]=4095&(eP>>>28|(255&eI)<<4),eu[e_++]=eI>>>8&4095,eu[e_++]=eI>>>20&4095,eu[e_++]=eM>>>0&4095,eu[e_++]=eM>>>12&4095,eu[e_++]=4095&(eM>>>24|(15&eE)<<8),eu[e_++]=eE>>>4&4095,eu[e_++]=eE>>>16&4095,eu[e_++]=4095&(eE>>>28|(255&eC)<<4),eu[e_++]=eC>>>8&4095,eu[e_]=eC>>>20&4095}(R,eh,eu,em);case 16:return void function(R,eh,eu,em){let e_=em,eg=R[eh]>>>0,ev=R[eh+1]>>>0,ex=R[eh+2]>>>0,eb=R[eh+3]>>>0,ew=R[eh+4]>>>0,eT=R[eh+5]>>>0,eS=R[eh+6]>>>0,eP=R[eh+7]>>>0,eI=R[eh+8]>>>0,eM=R[eh+9]>>>0,eE=R[eh+10]>>>0,eC=R[eh+11]>>>0,eA=R[eh+12]>>>0,ez=R[eh+13]>>>0,eD=R[eh+14]>>>0,ek=R[eh+15]>>>0;eu[e_++]=eg>>>0&65535,eu[e_++]=eg>>>16&65535,eu[e_++]=ev>>>0&65535,eu[e_++]=ev>>>16&65535,eu[e_++]=ex>>>0&65535,eu[e_++]=ex>>>16&65535,eu[e_++]=eb>>>0&65535,eu[e_++]=eb>>>16&65535,eu[e_++]=ew>>>0&65535,eu[e_++]=ew>>>16&65535,eu[e_++]=eT>>>0&65535,eu[e_++]=eT>>>16&65535,eu[e_++]=eS>>>0&65535,eu[e_++]=eS>>>16&65535,eu[e_++]=eP>>>0&65535,eu[e_++]=eP>>>16&65535,eu[e_++]=eI>>>0&65535,eu[e_++]=eI>>>16&65535,eu[e_++]=eM>>>0&65535,eu[e_++]=eM>>>16&65535,eu[e_++]=eE>>>0&65535,eu[e_++]=eE>>>16&65535,eu[e_++]=eC>>>0&65535,eu[e_++]=eC>>>16&65535,eu[e_++]=eA>>>0&65535,eu[e_++]=eA>>>16&65535,eu[e_++]=ez>>>0&65535,eu[e_++]=ez>>>16&65535,eu[e_++]=eD>>>0&65535,eu[e_++]=eD>>>16&65535,eu[e_++]=ek>>>0&65535,eu[e_]=ek>>>16&65535}(R,eh,eu,em);case 32:for(let e_=0;e_<32;e_=e_+1|0)eu[em+e_|0]=0|R[eh+e_|0];return}let eg=rk[e_]>>>0,ev=eh,ex=0,eb=R[ev]>>>0;for(let eh=0;eh<32;eh++)if(ex+e_<=32)eu[em+eh]=eb>>>ex&eg,32===(ex+=e_)&&(ex=0,ev++,31!==eh&&(eb=R[ev]>>>0));else{let ew=32-ex,eT=eb>>>ex;eb=R[++ev]>>>0,eu[em+eh]=(eT|(eb&rk[e_-ew]>>>0)<<ew)&eg,ex=e_-ew}})(R,eh,eT,eS,ev),eh=eh+ev|0;eh=eh-((eS-ex|0)*ev>>>5)|0,eu.exceptionSizes[ev]=ex}return eh}(R,eI,eg);return eg.dataPointers.fill(0),function(R,eh,eu,em,e_,eg,ev,ex,eb,ew){let eT=0|eu,eS=0;for(let eh=0;eh<ev;eh=eh+1|0){let eu=function(R,eh,eu,em){if(eu+2>eh)throw Error(`FastPFOR decode: byteContainer underflow at block=${em} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${eu}, byteSize=${eh})`);let e_=R[eu++],eg=R[eu++];if(e_>32)throw Error(`FastPFOR decode: invalid bitWidth=${e_} at block=${em} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:e_,exceptionCount:eg,bytePosIn:eu}}(ex,eb,eS,eh);eS=eu.bytePosIn;let em=eu.bitWidth,ev=eu.exceptionCount,eP=eg+256*eh|0;switch(em){case 0:e_.fill(0,eP,eP+256);break;case 32:for(let eh=0;eh<256;eh=eh+1|0)e_[eP+eh|0]=0|R[eT+eh|0];eT=eT+256|0;break;default:eT=function(R,eh,eu,em,e_){switch(e_){case 1:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0;eu[e_++]=eh>>>0&1,eu[e_++]=eh>>>1&1,eu[e_++]=eh>>>2&1,eu[e_++]=eh>>>3&1,eu[e_++]=eh>>>4&1,eu[e_++]=eh>>>5&1,eu[e_++]=eh>>>6&1,eu[e_++]=eh>>>7&1,eu[e_++]=eh>>>8&1,eu[e_++]=eh>>>9&1,eu[e_++]=eh>>>10&1,eu[e_++]=eh>>>11&1,eu[e_++]=eh>>>12&1,eu[e_++]=eh>>>13&1,eu[e_++]=eh>>>14&1,eu[e_++]=eh>>>15&1,eu[e_++]=eh>>>16&1,eu[e_++]=eh>>>17&1,eu[e_++]=eh>>>18&1,eu[e_++]=eh>>>19&1,eu[e_++]=eh>>>20&1,eu[e_++]=eh>>>21&1,eu[e_++]=eh>>>22&1,eu[e_++]=eh>>>23&1,eu[e_++]=eh>>>24&1,eu[e_++]=eh>>>25&1,eu[e_++]=eh>>>26&1,eu[e_++]=eh>>>27&1,eu[e_++]=eh>>>28&1,eu[e_++]=eh>>>29&1,eu[e_++]=eh>>>30&1,eu[e_++]=eh>>>31&1}}(R,eh,eu,em);break;case 2:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0;eu[e_++]=eh>>>0&3,eu[e_++]=eh>>>2&3,eu[e_++]=eh>>>4&3,eu[e_++]=eh>>>6&3,eu[e_++]=eh>>>8&3,eu[e_++]=eh>>>10&3,eu[e_++]=eh>>>12&3,eu[e_++]=eh>>>14&3,eu[e_++]=eh>>>16&3,eu[e_++]=eh>>>18&3,eu[e_++]=eh>>>20&3,eu[e_++]=eh>>>22&3,eu[e_++]=eh>>>24&3,eu[e_++]=eh>>>26&3,eu[e_++]=eh>>>28&3,eu[e_++]=eh>>>30&3,eu[e_++]=em>>>0&3,eu[e_++]=em>>>2&3,eu[e_++]=em>>>4&3,eu[e_++]=em>>>6&3,eu[e_++]=em>>>8&3,eu[e_++]=em>>>10&3,eu[e_++]=em>>>12&3,eu[e_++]=em>>>14&3,eu[e_++]=em>>>16&3,eu[e_++]=em>>>18&3,eu[e_++]=em>>>20&3,eu[e_++]=em>>>22&3,eu[e_++]=em>>>24&3,eu[e_++]=em>>>26&3,eu[e_++]=em>>>28&3,eu[e_++]=em>>>30&3}}(R,eh,eu,em);break;case 3:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0;eu[e_++]=eh>>>0&7,eu[e_++]=eh>>>3&7,eu[e_++]=eh>>>6&7,eu[e_++]=eh>>>9&7,eu[e_++]=eh>>>12&7,eu[e_++]=eh>>>15&7,eu[e_++]=eh>>>18&7,eu[e_++]=eh>>>21&7,eu[e_++]=eh>>>24&7,eu[e_++]=eh>>>27&7,eu[e_++]=7&(eh>>>30|(1&em)<<2),eu[e_++]=em>>>1&7,eu[e_++]=em>>>4&7,eu[e_++]=em>>>7&7,eu[e_++]=em>>>10&7,eu[e_++]=em>>>13&7,eu[e_++]=em>>>16&7,eu[e_++]=em>>>19&7,eu[e_++]=em>>>22&7,eu[e_++]=em>>>25&7,eu[e_++]=em>>>28&7,eu[e_++]=7&(em>>>31|(3&ev)<<1),eu[e_++]=ev>>>2&7,eu[e_++]=ev>>>5&7,eu[e_++]=ev>>>8&7,eu[e_++]=ev>>>11&7,eu[e_++]=ev>>>14&7,eu[e_++]=ev>>>17&7,eu[e_++]=ev>>>20&7,eu[e_++]=ev>>>23&7,eu[e_++]=ev>>>26&7,eu[e_++]=ev>>>29&7}}(R,eh,eu,em);break;case 4:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0,ex=R[eg++]>>>0;eu[e_++]=eh>>>0&15,eu[e_++]=eh>>>4&15,eu[e_++]=eh>>>8&15,eu[e_++]=eh>>>12&15,eu[e_++]=eh>>>16&15,eu[e_++]=eh>>>20&15,eu[e_++]=eh>>>24&15,eu[e_++]=eh>>>28&15,eu[e_++]=em>>>0&15,eu[e_++]=em>>>4&15,eu[e_++]=em>>>8&15,eu[e_++]=em>>>12&15,eu[e_++]=em>>>16&15,eu[e_++]=em>>>20&15,eu[e_++]=em>>>24&15,eu[e_++]=em>>>28&15,eu[e_++]=ev>>>0&15,eu[e_++]=ev>>>4&15,eu[e_++]=ev>>>8&15,eu[e_++]=ev>>>12&15,eu[e_++]=ev>>>16&15,eu[e_++]=ev>>>20&15,eu[e_++]=ev>>>24&15,eu[e_++]=ev>>>28&15,eu[e_++]=ex>>>0&15,eu[e_++]=ex>>>4&15,eu[e_++]=ex>>>8&15,eu[e_++]=ex>>>12&15,eu[e_++]=ex>>>16&15,eu[e_++]=ex>>>20&15,eu[e_++]=ex>>>24&15,eu[e_++]=ex>>>28&15}}(R,eh,eu,em);break;case 5:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0,ex=R[eg++]>>>0,eb=R[eg++]>>>0;eu[e_++]=eh>>>0&31,eu[e_++]=eh>>>5&31,eu[e_++]=eh>>>10&31,eu[e_++]=eh>>>15&31,eu[e_++]=eh>>>20&31,eu[e_++]=eh>>>25&31,eu[e_++]=31&(eh>>>30|(7&em)<<2),eu[e_++]=em>>>3&31,eu[e_++]=em>>>8&31,eu[e_++]=em>>>13&31,eu[e_++]=em>>>18&31,eu[e_++]=em>>>23&31,eu[e_++]=31&(em>>>28|(1&ev)<<4),eu[e_++]=ev>>>1&31,eu[e_++]=ev>>>6&31,eu[e_++]=ev>>>11&31,eu[e_++]=ev>>>16&31,eu[e_++]=ev>>>21&31,eu[e_++]=ev>>>26&31,eu[e_++]=31&(ev>>>31|(15&ex)<<1),eu[e_++]=ex>>>4&31,eu[e_++]=ex>>>9&31,eu[e_++]=ex>>>14&31,eu[e_++]=ex>>>19&31,eu[e_++]=ex>>>24&31,eu[e_++]=31&(ex>>>29|(3&eb)<<3),eu[e_++]=eb>>>2&31,eu[e_++]=eb>>>7&31,eu[e_++]=eb>>>12&31,eu[e_++]=eb>>>17&31,eu[e_++]=eb>>>22&31,eu[e_++]=eb>>>27&31}}(R,eh,eu,em);break;case 6:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0,ex=R[eg++]>>>0,eb=R[eg++]>>>0,ew=R[eg++]>>>0;eu[e_++]=eh>>>0&63,eu[e_++]=eh>>>6&63,eu[e_++]=eh>>>12&63,eu[e_++]=eh>>>18&63,eu[e_++]=eh>>>24&63,eu[e_++]=63&(eh>>>30|(15&em)<<2),eu[e_++]=em>>>4&63,eu[e_++]=em>>>10&63,eu[e_++]=em>>>16&63,eu[e_++]=em>>>22&63,eu[e_++]=63&(em>>>28|(3&ev)<<4),eu[e_++]=ev>>>2&63,eu[e_++]=ev>>>8&63,eu[e_++]=ev>>>14&63,eu[e_++]=ev>>>20&63,eu[e_++]=ev>>>26&63,eu[e_++]=ex>>>0&63,eu[e_++]=ex>>>6&63,eu[e_++]=ex>>>12&63,eu[e_++]=ex>>>18&63,eu[e_++]=ex>>>24&63,eu[e_++]=63&(ex>>>30|(15&eb)<<2),eu[e_++]=eb>>>4&63,eu[e_++]=eb>>>10&63,eu[e_++]=eb>>>16&63,eu[e_++]=eb>>>22&63,eu[e_++]=63&(eb>>>28|(3&ew)<<4),eu[e_++]=ew>>>2&63,eu[e_++]=ew>>>8&63,eu[e_++]=ew>>>14&63,eu[e_++]=ew>>>20&63,eu[e_++]=ew>>>26&63}}(R,eh,eu,em);break;case 7:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0,ex=R[eg++]>>>0,eb=R[eg++]>>>0,ew=R[eg++]>>>0,eT=R[eg++]>>>0;eu[e_++]=eh>>>0&127,eu[e_++]=eh>>>7&127,eu[e_++]=eh>>>14&127,eu[e_++]=eh>>>21&127,eu[e_++]=127&(eh>>>28|(7&em)<<4),eu[e_++]=em>>>3&127,eu[e_++]=em>>>10&127,eu[e_++]=em>>>17&127,eu[e_++]=em>>>24&127,eu[e_++]=127&(em>>>31|(63&ev)<<1),eu[e_++]=ev>>>6&127,eu[e_++]=ev>>>13&127,eu[e_++]=ev>>>20&127,eu[e_++]=127&(ev>>>27|(3&ex)<<5),eu[e_++]=ex>>>2&127,eu[e_++]=ex>>>9&127,eu[e_++]=ex>>>16&127,eu[e_++]=ex>>>23&127,eu[e_++]=127&(ex>>>30|(31&eb)<<2),eu[e_++]=eb>>>5&127,eu[e_++]=eb>>>12&127,eu[e_++]=eb>>>19&127,eu[e_++]=127&(eb>>>26|(1&ew)<<6),eu[e_++]=ew>>>1&127,eu[e_++]=ew>>>8&127,eu[e_++]=ew>>>15&127,eu[e_++]=ew>>>22&127,eu[e_++]=127&(ew>>>29|(15&eT)<<3),eu[e_++]=eT>>>4&127,eu[e_++]=eT>>>11&127,eu[e_++]=eT>>>18&127,eu[e_++]=eT>>>25&127}}(R,eh,eu,em);break;case 8:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<8;eh++){let eh=R[eg++]>>>0,em=R[eg++]>>>0,ev=R[eg++]>>>0,ex=R[eg++]>>>0,eb=R[eg++]>>>0,ew=R[eg++]>>>0,eT=R[eg++]>>>0,eS=R[eg++]>>>0;eu[e_++]=eh>>>0&255,eu[e_++]=eh>>>8&255,eu[e_++]=eh>>>16&255,eu[e_++]=eh>>>24&255,eu[e_++]=em>>>0&255,eu[e_++]=em>>>8&255,eu[e_++]=em>>>16&255,eu[e_++]=em>>>24&255,eu[e_++]=ev>>>0&255,eu[e_++]=ev>>>8&255,eu[e_++]=ev>>>16&255,eu[e_++]=ev>>>24&255,eu[e_++]=ex>>>0&255,eu[e_++]=ex>>>8&255,eu[e_++]=ex>>>16&255,eu[e_++]=ex>>>24&255,eu[e_++]=eb>>>0&255,eu[e_++]=eb>>>8&255,eu[e_++]=eb>>>16&255,eu[e_++]=eb>>>24&255,eu[e_++]=ew>>>0&255,eu[e_++]=ew>>>8&255,eu[e_++]=ew>>>16&255,eu[e_++]=ew>>>24&255,eu[e_++]=eT>>>0&255,eu[e_++]=eT>>>8&255,eu[e_++]=eT>>>16&255,eu[e_++]=eT>>>24&255,eu[e_++]=eS>>>0&255,eu[e_++]=eS>>>8&255,eu[e_++]=eS>>>16&255,eu[e_++]=eS>>>24&255}}(R,eh,eu,em);break;case 16:!function(R,eh,eu,em){let e_=em,eg=eh;for(let eh=0;eh<128;eh++){let eh=R[eg++]>>>0;eu[e_++]=65535&eh,eu[e_++]=eh>>>16&65535}}(R,eh,eu,em);break;default:!function(R,eh,eu,em,e_){let eg=rk[e_]>>>0,ev=eh,ex=0,eb=R[ev]>>>0,ew=em;for(let eh=0;eh<8;eh++){for(let eh=0;eh<32;eh++)if(ex+e_<=32)eu[ew+eh]=eb>>>ex&eg,32===(ex+=e_)&&(ex=0,ev++,31!==eh&&(eb=R[ev]>>>0));else{let em=32-ex,eT=eb>>>ex;eb=R[++ev]>>>0;let eS=e_-em;eu[ew+eh]=(eT|(eb&-1>>>32-eS>>>0)<<em)&eg,ex=eS}ew+=32,ex=0,eh<7&&(eb=R[ev]>>>0)}}(R,eh,eu,em,e_)}return eh+(e_<<3)|0}(R,eT,e_,eP,em)}ev>0&&(eS=function(R,eh,eu,em,e_,eg,ev,ex,eb){let{maxBits:ew,exceptionBitWidth:eT,bytePosIn:eS}=function(R,eh,eu,em,e_,eg){if(eu+1>eh)throw Error(`FastPFOR decode: exception header underflow at block=${eg} (need 1 byte for maxBits, bytePos=${eu}, byteSize=${eh})`);let ev=R[eu++];if(ev<em||ev>32)throw Error(`FastPFOR decode: invalid maxBits=${ev} at block=${eg} (bitWidth=${em}, expected ${em}..32)`);let ex=ev-em|0;if(ex<1||ex>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${ex} at block=${eg} (bitWidth=${em}, maxBits=${ev})`);if(eu+e_>eh)throw Error(`FastPFOR decode: exception positions underflow at block=${eg} (need=${e_}, have=${eh-eu})`);return{maxBits:ev,exceptionBitWidth:ex,bytePosIn:eu}}(e_,eg,ev,eu,em,eb);
5if(ev=eS,1===eT){let eg=1<<eu;for(let eu=0;eu<em;eu=eu+1|0)R[e_[ev++]+eh|0]|=eg;return ev}let eP=ex.dataToBePacked[eT];if(!eP)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${eT} (bitWidth=${eu}, maxBits=${ew}) at block ${eb}`);let eI=ex.dataPointers,eM=0|eI[eT],eE=0|ex.exceptionSizes[eT];if(eM+em>eE)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${eT} (ptr=${eM}, need ${em}, size=${eE}) at block ${eb}`);for(let eg=0;eg<em;eg=eg+1|0){let em=e_[ev++],eg=0|eP[eM++];R[em+eh|0]|=eg<<eu}return eI[eT]=eM,ev}(e_,eP,em,ev,ex,eb,eS,ew,eh))}if(eT!==em)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${eh}, packedStart=${eu}, consumedPackedEnd=${eT}, expectedPackedEnd=${em}, packedWords=${em-eu}, encoded.length=${R.length})`)}(R,ev,eb,ew,eh,0|em,e_/256|0,eM,eT,eg),eE}(R,eh,eb,ex,eu,eg),ex=ex+eu|0}return eb}(R,eg,em,e_,eh,ev),e_=e_+eh|0}return function(R,eh,eu,em,e_,eg){if(0===eg)return;let ev=0,ex=eh,eb=eh+eu,ew=e_,eT=e_+eg,eS=0,eP=0;for(;ex<eb&&ew<eT;){let eh=R[ex]>>>ev&255;if(ev+=8,ex+=ev>>>5,ev&=31,eS|=(127&eh)<<eP,128&eh)em[ew++]=0|eS,eS=0,eP=0;else if((eP+=7)>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${eP}, partial=${eS}, decoded=${ew-e_}/${eg}, inPos=${ex}, inEnd=${eb})`)}if(ew!==eT)throw Error(`FastPFOR VByte: truncated stream (decoded=${ew-e_}, expected=${eg}, consumedWords=${ex-eh}/${eu}, vbyteStart=${eh}, vbyteEnd=${eb})`)}(R,em,R.length-em|0,eg,e_,eh-e_|0),eg}(ex.subarray(0,ev),eh,e_.decoderWorkspace);return em.add(eu),eb}(R,eu.numValues,e_=eu.byteLength,eh,function(R=16){if(R<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${R}`);return{encodedWords:new Uint32Array(Math.max(16,0|R)),decoderWorkspace:_f()}}(e_>>>2));case eW.VARINT:return Ef(R,eh,eu.numValues);case eW.NONE:{let em=eh.get();eh.add(eu.byteLength);let e_=R.subarray(em,eh.get());return new Uint32Array(e_)}default:throw Error(`Specified physicalLevelTechnique ${em} is not supported (yet).`)}}function nd(R,eh,eu){let em=ed(R,eh,eu);return 1===em.length?em[0]:em[1]}function rd(R,eh,eu){return function(R){if(2===R.length){let eh=Df(R[1]);return[eh,eh]}return[Df(R[2]),Df(R[3])]}(ed(R,eh,eu))}function id(R,eh,eu){return function(R){if(2===R.length){let eh=zf(R[1]);return[eh,eh]}return[zf(R[2]),zf(R[3])]}(Tf(R,eh,eu.numValues))}function sd(R,eh,eu,em){return function(R,eh,eu){let em;switch(eh.logicalLevelTechnique1){case eq.DELTA:em=function(R){let eh=new BigUint64Array(R.length);eh[0]=BigInt.asUintN(64,zf(R[0]));for(let eu=1;eu<R.length;eu++)eh[eu]=BigInt.asUintN(64,eh[eu-1]+zf(R[eu]));return eh}(eh.logicalLevelTechnique2===eq.RLE?Vf(R,eh.runs,eh.numRleValues):R);break;case eq.RLE:em=Vf(R,eh.runs,eh.numRleValues);break;case eq.NONE:em=R;break;default:throw Error(`The specified Logical level technique is not supported: ${eh.logicalLevelTechnique1}`)}return eu?Kf(em,eu,0n):em}(Tf(R,eh,eu.numValues),eu,em)}function od(R,eh,eu){let em=Tf(R,eh,eu.numValues);return 1===em.length?em[0]:em[1]}function ad(R,eh,eu,em,e_="int32"){let eg=R.logicalLevelTechnique1;if(eg===eq.RLE)return 1===R.runs?eK.CONST:eK.FLAT;if(eg!==eq.DELTA||R.logicalLevelTechnique2!==eq.RLE)return 1===R.numValues?eK.CONST:eK.FLAT;let ev=eh instanceof Wf?eh.size():eh;if(R.numRleValues!==ev)return eK.FLAT;if(1===R.runs)return eK.SEQUENCE;if(2!==R.runs)return 1===R.numValues?eK.CONST:eK.FLAT;let ex=em.get();if(R.physicalLevelTechnique===eW.VARINT)return!function(R,eh,eu){let em=new pf(eh.get());if("int64"===eu){let eh=Tf(R,em,4);
5return 2n===eh[2]&&2n===eh[3]}let e_=Ef(R,em,4);return 2===e_[2]&&2===e_[3]}(eu,em,e_)?1===R.numValues?eK.CONST:eK.FLAT:eK.SEQUENCE;let eb=em.get(),ew=new Int32Array(eu.buffer,eu.byteOffset+eb,4);return em.set(ex),2===ew[2]&&2===ew[3]?eK.SEQUENCE:1===R.numValues?eK.CONST:eK.FLAT}let ld=class ld extends sf{getValueFromBuffer(R){return this.dataBuffer[R]}};let ud=class ud extends lf{constructor(R,eh,eu,em){super(R,BigInt64Array.of(eh),eu,em)}getValueFromBuffer(R){return this.dataBuffer[0]+BigInt(R)*this.delta}};function cd(R,eh,eu){return{x:hd(R,eh)-eu,y:hd(R>>1,eh)-eu}}function hd(R,eh){let eu=0;for(let em=0;em<eh;em++)eu|=(R&1<<2*em)>>em;return eu}function pd(R,eh,eu,em,e_,eg,ev){return R===e1.MORTON?function(R,eh,eu,em,e_,eg){let ev=Array(e_?em+1:em);for(let e_=0;e_<em;e_++){let em=cd(R[eh[eu+e_]],eg.numBits,eg.coordinateShift);ev[e_]=new n(em.x,em.y)}return e_&&(ev[ev.length-1]=ev[0]),ev}(eh,eu,em,e_,eg,ev):function(R,eh,eu,em,e_){let eg=Array(e_?em+1:em);for(let e_=0;e_<2*em;e_+=2){let em=2*eh[eu+e_/2];eg[e_/2]=new n(R[em],R[em+1])}return e_&&(eg[eg.length-1]=eg[0]),eg}(eh,eu,em,e_,eg)}function fd(R,eh,eu,em){let e_=Array(em?eu+1:eu);for(let em=0;em<2*eu;em+=2)e_[em/2]=new n(R[eh+em],R[eh+em+1]);return em&&(e_[e_.length-1]=e_[0]),e_}(eN=eQ||(eQ={}))[eN.POINT=0]="POINT",eN[eN.LINESTRING=1]="LINESTRING",eN[eN.POLYGON=2]="POLYGON",eN[eN.MULTIPOINT=3]="MULTIPOINT",eN[eN.MULTILINESTRING=4]="MULTILINESTRING",eN[eN.MULTIPOLYGON=5]="MULTIPOLYGON",(eU=e0||(e0={}))[eU.POINT=0]="POINT",eU[eU.LINESTRING=1]="LINESTRING",eU[eU.POLYGON=2]="POLYGON",(eG=e1||(e1={}))[eG.MORTON=0]="MORTON",eG[eG.VEC_2=1]="VEC_2",eG[eG.VEC_3=2]="VEC_3";let dd=class dd{constructor(R,eh,eu,em,e_){this._vertexBufferType=R,this._topologyVector=eh,this._vertexOffsets=eu,this._vertexBuffer=em,this._mortonSettings=e_}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(R){let eh=this.vertexOffsets?2*this.vertexOffsets[R]:2*R;return[this.vertexBuffer[eh],this.vertexBuffer[eh+1]]}getVertex(R){if(this.vertexOffsets&&this.mortonSettings){let eh=cd(this.vertexBuffer[this.vertexOffsets[R]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[eh.x,eh.y]}let eh=this.vertexOffsets?2*this.vertexOffsets[R]:2*R;return[this.vertexBuffer[eh],this.vertexBuffer[eh+1]]}getGeometries(){return function(R){let eh=Array(R.numGeometries),eu=1,em=1,e_=1,eg=0,ev=0,ex=0,eb=R.mortonSettings,ew=R.topologyVector,eT=ew.geometryOffsets,eS=ew.partOffsets,eP=ew.ringOffsets,eI=R.vertexOffsets,eM=!eI||0===eI.length,eE=R.containsPolygonGeometry(),eC=R.vertexBuffer;for(let ew=0;ew<R.numGeometries;ew++)switch(R.geometryType(ew)){case eQ.POINT:{let ew,eE;if(eM)ew=eC[ev++],eE=eC[ev++];else if(R.vertexBufferType===e1.MORTON){let R=cd(eC[eI[ex++]],eb.numBits,eb.coordinateShift);ew=R.x,eE=R.y}else{let R=2*eI[ex++];ew=eC[R],eE=eC[R+1]}eh[eg++]=[[new n(ew,eE)]],eT&&e_++,eS&&eu++,eP&&em++}break;case eQ.MULTIPOINT:{let R=eT[e_]-eT[e_-1];e_++;let eb=Array(R);if(eM)for(let eh=0;eh<R;eh++){let R=eC[ev++],eu=eC[ev++];eb[eh]=new n(R,eu)}else for(let eh=0;eh<R;eh++){let R=2*eI[ex++];eb[eh]=new n(eC[R],eC[R+1])}eh[eg++]=eb.map(R=>[R]),eu+=R,em+=R}break;case eQ.LINESTRING:{let ew,eA;eE?(ew=eP[em]-eP[em-1],em++):ew=eS[eu]-eS[eu-1],eu++,eM?(eA=fd(eC,ev,ew,!1),ev+=2*ew):(eA=pd(R.vertexBufferType,eC,eI,ex,ew,!1,eb),ex+=ew),eh[eg++]=[eA],eT&&e_++}break;case eQ.POLYGON:{let ew=eS[eu]-eS[eu-1];eu++;let eE=Array(ew-1),eA,ez=eP[em]-eP[em-1];if(em++,eM){eA=fd(eC,ev,ez,!0),ev+=2*ez;for(let R=0;R<eE.length;R++)ez=eP[em]-eP[em-1],em++,eE[R]=fd(eC,ev,ez,!0),ev+=2*ez}else{eA=pd(R.vertexBufferType,eC,eI,ex,ez,!0,eb),ex+=ez;for(let eh=0;eh<eE.length;eh++)ez=eP[em]-eP[em-1],em++,eE[eh]=pd(R.vertexBufferType,eC,eI,ex,ez,!0,eb),ex+=ez}eh[eg++]=[eA].concat(eE),eT&&e_++}break;case eQ.MULTILINESTRING:{let ew=eT[e_]-eT[e_-1];e_++;let eA=Array(ew);for(let eh=0;eh<ew;eh++){let e_;if(eE?(e_=eP[em]-eP[em-1],em++):e_=eS[eu]-eS[eu-1],eu++,eM)eA[eh]=fd(eC,ev,e_,!1),ev+=2*e_;else{let eu=pd(R.vertexBufferType,eC,eI,ex,e_,!1,eb);eA[eh]=eu,ex+=e_}}eh[eg++]=eA}break;case eQ.MULTIPOLYGON:{let ew=eT[e_]-eT[e_-1];e_++;let eE=Array(ew);for(let eh=0;eh<ew;eh++){let e_;let eg=eS[eu]-eS[eu-1];eu++;let ew=Array(eg-1),eT=eP[em]-eP[em-1];em++,eM?(e_=fd(eC,ev,eT,!0),ev+=2*eT):(e_=pd(R.vertexBufferType,eC,eI,ex,eT,!0,eb),ex+=eT);for(let eh=0;eh<ew.length;eh++){let eu=eP[em]-eP[em-1];
5em++,eM?(ew[eh]=fd(eC,ev,eu,!0),ev+=2*eu):(ew[eh]=pd(R.vertexBufferType,eC,eI,ex,eu,!0,eb),ex+=eu)}eE[eh]=[e_].concat(ew)}eh[eg++]=eE.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return eh}(this)}get mortonSettings(){return this._mortonSettings}};let yd=class yd extends dd{constructor(R,eh,eu,em,e_,eg,ev){super(eu,em,e_,eg,ev),this._numGeometries=R,this._geometryType=eh}geometryType(R){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===eQ.POLYGON||this._geometryType===eQ.MULTIPOLYGON}containsSingleGeometryType(){return!0}};let md=class md extends dd{constructor(R,eh,eu,em,e_,eg){super(R,eu,em,e_,eg),this._geometryTypes=eh}geometryType(R){return this._geometryTypes[R]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let R=0;R<this.numGeometries;R++)if(this.geometryType(R)===eQ.POLYGON||this.geometryType(R)===eQ.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}};let gd=class gd{constructor(R,eh,eu,em){this._triangleOffsets=R,this._indexBuffer=eh,this._vertexBuffer=eu,this._topologyVector=em}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 Error("Cannot convert GpuVector to coordinates without topology information");let R=Array(this.numGeometries),eh=this._topologyVector,eu=eh.partOffsets,em=eh.ringOffsets,e_=eh.geometryOffsets,eg=0,ev=1,ex=1,eb=1;for(let eh=0;eh<this.numGeometries;eh++)switch(this.geometryType(eh)){case eQ.POLYGON:{let ew=eu[ev]-eu[ev-1];ev++;let eT=[];for(let R=0;R<ew;R++){let R=em[ex]-em[ex-1];ex++;let eh=[];for(let eu=0;eu<R;eu++){let R=this._vertexBuffer[eg++],eu=this._vertexBuffer[eg++];eh.push(new n(R,eu))}eh.length>0&&eh.push(eh[0]),eT.push(eh)}R[eh]=eT,e_&&eb++}break;case eQ.MULTIPOLYGON:{let ew=e_[eb]-e_[eb-1];eb++;let eT=[];for(let R=0;R<ew;R++){let R=eu[ev]-eu[ev-1];ev++;for(let eh=0;eh<R;eh++){let R=em[ex]-em[ex-1];ex++;let eh=[];for(let eu=0;eu<R;eu++){let R=this._vertexBuffer[eg++],eu=this._vertexBuffer[eg++];eh.push(new n(R,eu))}eh.length>0&&eh.push(eh[0]),eT.push(eh)}}R[eh]=eT}}return R}[Symbol.iterator](){return null}};let vd=class vd extends gd{constructor(R,eh,eu,em,e_,eg){super(eu,em,e_,eg),this._numGeometries=R,this._geometryType=eh}geometryType(R){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};let wd=class wd extends gd{constructor(R,eh,eu,em,e_){super(eh,eu,em,e_),this._geometryTypes=R}geometryType(R){return this._geometryTypes[R]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Sd(R,eh,eu){let em=new Uint32Array(R.length+1),e_=0;em[0]=e_;let eg=0;for(let ev=0;ev<R.length;ev++)e_=em[ev+1]=e_+(R[ev]>eu?eh[eg++]:1);return em}function Ad(R,eh,eu,em){let e_=new Uint32Array(eh[eh.length-1]+1),eg=0;e_[0]=eg;let ev=1,ex=0;for(let eb=0;eb<R.length;eb++){let ew=R[eb],eT=eh[eb+1]-eh[eb];if(5===ew||2===ew||em&&(4===ew||1===ew))for(let R=0;R<eT;R++)eg=e_[ev++]=eg+eu[ex++];else for(let R=0;R<eT;R++)e_[ev++]=++eg}return e_}let Md=class Md extends rf{constructor(R,eh,eu){super(R,eh.getBuffer(),eu),this.dataVector=eh}getValueFromBuffer(R){return this.dataVector.get(R)}};let kd=class kd extends sf{getValueFromBuffer(R){return this.dataBuffer[R]}};let Id=class Id extends rf{constructor(R,eh,eu,em){super(R,em?BigInt64Array.of(eh):BigUint64Array.of(eh),eu)}getValueFromBuffer(R){return this.dataBuffer[0]}};function Ed(R,eh,eu,em,e_){let eg=function(R,eh,eu,em){let e_=new Uint8Array(eh),eg=0,ev=em.get()+eu;for(;eg<eh&&!(em.get()>=ev);){let eu=R[em.increment()];if(eu<=127){let ev=eu+3,ex=R[em.increment()],eb=Math.min(eg+ev,eh);e_.fill(ex,eg,eb),eg=eb}else{let ev=256-eu;for(let eu=0;eu<ev&&eg<eh;eu++)e_[eg++]=R[em.increment()]}}return em.set(ev),e_}(R,Math.ceil(eh/8),eu,em);return e_?function(R,eh,eu){if(!eu)return R;let em=eu.size(),e_=new Wf(R,eh),eg=new Wf(new Uint8Array(Math.ceil(em/8)),em),ev=0;for(let R=0;R<em;R++){let eh=!!eu.get(R)&&e_.get(ev++);eg.set(R,eh)}return eg.getBuffer()}(eg,eh,e_):eg}let rF=new TextDecoder;function Fd(R,eh,eu){return eu-eh>=12?rF.decode(R.subarray(eh,eu)):function(R,eh,eu){let em="",e_=eh;for(;e_<eu;){let eh=R[e_],eg,ev,ex,eb=null,ew=eh>239?4:eh>223?3:eh>191?2:1;if(e_+ew>eu)break;1===ew?eh<128&&(eb=eh):2===ew?128==(192&(eg=R[e_+1]))&&(eb=(31&eh)<<6|63&eg)<=127&&(eb=null):3===ew?(eg=R[e_+1],ev=R[e_+2],128==(192&eg)&&128==(192&ev)&&((eb=(15&eh)<<12|(63&eg)<<6|63&ev)<=2047||eb>
5=55296&&eb<=57343)&&(eb=null)):4===ew&&(eg=R[e_+1],ev=R[e_+2],ex=R[e_+3],128==(192&eg)&&128==(192&ev)&&128==(192&ex)&&((eb=(15&eh)<<18|(63&eg)<<12|(63&ev)<<6|63&ex)<=65535||eb>=1114112)&&(eb=null)),null===eb?(eb=65533,ew=1):eb>65535&&(eb-=65536,em+=String.fromCharCode(eb>>>10&1023|55296),eb=56320|1023&eb),em+=String.fromCharCode(eb),e_+=ew}return em}(R,eh,eu)}let Pd=class Pd extends rf{constructor(R,eh,eu,em){super(R,eu,em),this.offsetBuffer=eh}};let Dd=class Dd extends Pd{constructor(R,eh,eu,em){super(R,eh,eu,em??eh.length-1)}getValueFromBuffer(R){return Fd(this.dataBuffer,this.offsetBuffer[R],this.offsetBuffer[R+1])}};let zd=class zd extends Pd{constructor(R,eh,eu,em,e_){super(R,eu,em,e_??eh.length),this.indexBuffer=eh,this.indexBuffer=eh}getValueFromBuffer(R){let eh=this.indexBuffer[R];return Fd(this.dataBuffer,this.offsetBuffer[eh],this.offsetBuffer[eh+1])}};let Bd=class Bd extends Pd{constructor(R,eh,eu,em,e_,eg,ev){super(R,eu,em,ev),this.indexBuffer=eh,this.symbolOffsetBuffer=e_,this.symbolTableBuffer=eg}getValueFromBuffer(R){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(R,eh,eu){let em=[],e_=Array(eh.length).fill(0);for(let R=1;R<eh.length;R++)e_[R]=e_[R-1]+eh[R-1];for(let eg=0;eg<eu.length;eg++)if(255===eu[eg])em.push(eu[++eg]);else{let ev=eh[eu[eg]],ex=e_[eu[eg]];for(let eh=0;eh<ev;eh++)em.push(R[ex+eh])}return new Uint8Array(em)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let eh=this.indexBuffer[R];return Fd(this.decodedDictionary,this.offsetBuffer[eh],this.offsetBuffer[eh+1])}offsetToLengthBuffer(R){let eh=new Uint32Array(R.length-1),eu=R[0];for(let em=1;em<R.length;em++){let e_=R[em];eh[em-1]=e_-eu,eu=e_}return eh}};function Vd(R){return R instanceof Wf}function Ld(R){switch(R){case 0:case 1:case 2:case 3:{let eh={};eh.nullable=!!(1&R),eh.columnScope=0;let eu={type:"logicalType",logicalType:0};return eu.longID=!!(2&R),eh.scalarType=eu,eh.type="scalarType",eh}case 4:{let R={nullable:!1,columnScope:0};return R.type="complexType",R.complexType={type:"physicalType",physicalType:0},R}case 30:{let R={nullable:!1,columnScope:0};return R.type="complexType",R.complexType={type:"physicalType",physicalType:1},R}default:return function(R){let eh;switch(R){case 10:case 11:eh=0;break;case 12:case 13:eh=1;break;case 14:case 15:eh=2;break;case 16:case 17:eh=3;break;case 18:case 19:eh=4;break;case 20:case 21:eh=5;break;case 22:case 23:eh=6;break;case 24:case 25:eh=7;break;case 26:case 27:eh=8;break;case 28:case 29:eh=9;break;default:return null}let eu={};eu.nullable=!!(1&R),eu.columnScope=0;let em={type:"physicalType"};return em.physicalType=eh,eu.type="scalarType",eu.scalarType=em,eu}(R)}}let rB=new TextDecoder;function jd(R,eh){let eu=Ef(R,eh,1)[0];if(0===eu)return"";let em=eh.get(),e_=R.subarray(em,em+eu);return eh.add(eu),rB.decode(e_)}let Zd=class Zd{constructor(R,eh){var eu;switch(this._featureData=R,this.properties=this._featureData.properties||{},null===(eu=this._featureData.geometry)||void 0===eu?void 0:eu.type){case eQ.POINT:case eQ.MULTIPOINT:this.type=1;break;case eQ.LINESTRING:case eQ.MULTILINESTRING:this.type=2;break;case eQ.POLYGON:case eQ.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=eh,this.id=Number(this._featureData.id)}loadGeometry(){let R=[];for(let eh of this._featureData.geometry.coordinates){let eu=[];for(let R of eh)eu.push(new n(R.x,R.y));R.push(eu)}return R}};let Hd=class Hd{constructor(R){this.features=[],this.featureTable=R,this.name=R.name,this.extent=R.extent,this.version=2,this.features=R.getFeatures(),this.length=this.features.length}feature(R){return new Zd(this.features[R],this.extent)}};let Wd=class Wd{constructor(R){this.layers={};let eh=function(R,eh,eu=!0){let em=new pf(0),e_=[];for(;em.get()<R.length;){let eh=Ef(R,em,1)[0]>>>0,ev=em.get()+eh;if(ev>R.length)throw Error(`Block overruns tile: ${ev} > ${R.length}`);if(1!=Ef(R,em,1)[0]>>>0){em.set(ev);continue}let[ex,eb]=function(R,eh){let eu={featureTables:[]},em={};em.name=jd(R,eh);let e_=Ef(R,eh,1)[0]>>>0,eg=Ef(R,eh,1)[0]>>>0;em.columns=Array(eg);for(let eu=0;eu<eg;eu++)em.columns[eu]=function(R,eh){let eu=Ef(R,eh,1)[0]>>>0,em=Ld(eu);
5if(!em)throw Error(`Unsupported column type code ${eu}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(eu>=10?em.name=jd(R,eh):eu>=0&&eu<=3?em.name="id":4===eu&&(em.name="geometry"),30===eu){let eu=Ef(R,eh,1)[0]>>>0,e_=em.complexType;e_.children=Array(eu);for(let em=0;em<eu;em++)e_.children[em]=function qd(R,eh){let eu=Ef(R,eh,1)[0]>>>0;if(eu<10||eu>30)throw Error(`Unsupported field type code ${eu}. Supported: 10-29(scalars), 30(STRUCT)`);let em=Ld(eu);if(eu>=10&&(em.name=jd(R,eh)),30===eu){let eu=Ef(R,eh,1)[0]>>>0;em.complexType.children=Array(eu);for(let e_=0;e_<eu;e_++)em.complexType.children[e_]=qd(R,eh)}return{name:em.name,nullable:em.nullable,scalarField:em.scalarType,complexField:em.complexType,type:"scalarType"===em.type?"scalarField":"complexField"}}(R,eh)}return em}(R,eh);return eu.featureTables.push(em),[eu,e_]}(R,em),ew=ex.featureTables[0],eT=null,eS=null,eP=[],eI=0;for(let eh of ew.columns){let e_=eh.name;if("scalarType"===eh.type&&"logicalType"===eh.scalarType?.type&&0===eh.scalarType.logicalType){let eg=null;if(eh.nullable){let eh=Hf(R,em),eu=em.get(),e_=Ed(R,eh.numValues,eh.byteLength,em);em.set(eu+eh.byteLength),eg=new Wf(e_,eh.numValues)}let ev=Hf(R,em);eI=eg?eg.size():ev.decompressedCount,eT=function(R,eh,eu,em,e_,eg,ev=!1){let ex=eh.scalarType;if(!ex||"logicalType"!==ex.type||0!==ex.logicalType)throw Error(`ID column must be a logical ID scalar type: ${em}`);let eb=ex.longID?6:4,ew="number"==typeof eg?void 0:eg,eT=ad(e_,eg,R,eu,6===eb?"int64":"int32");if(4===eb)switch(eT){case eK.FLAT:{let eh=Qf(R,eu,e_,0,ew);return new of(em,eh,eg)}case eK.SEQUENCE:{let eh=rd(R,eu,e_);return new uf(em,eh[0],eh[1],e_.numRleValues)}case eK.CONST:{let eh=nd(R,eu,e_);return new cf(em,eh,eg,!1)}}switch(eT){case eK.FLAT:{if(ev){let eh=function(R,eh,eu){let em=function(R,eh,eu){let em=new Float64Array(eu);for(let e_=0;e_<eu;e_++)em[e_]=function(R,eh){let eu,em;return em=R[eh.get()],eh.increment(),eu=127&em,em<128?eu:(em=R[eh.get()],eh.increment(),eu|=(127&em)<<7,em<128?eu:(em=R[eh.get()],eh.increment(),eu|=(127&em)<<14,em<128?eu:(em=R[eh.get()],eh.increment(),eu|=(127&em)<<21,em<128?eu:function(R,eh,eu){let em,e_;if(e_=eh[eu.get()],eu.increment(),em=(112&e_)>>4,e_<128||(e_=eh[eu.get()],eu.increment(),em|=(127&e_)<<3,e_<128)||(e_=eh[eu.get()],eu.increment(),em|=(127&e_)<<10,e_<128)||(e_=eh[eu.get()],eu.increment(),em|=(127&e_)<<17,e_<128)||(e_=eh[eu.get()],eu.increment(),em|=(127&e_)<<24,e_<128)||(e_=eh[eu.get()],eu.increment(),em|=(1&e_)<<31,e_<128))return 4294967296*em+(R>>>0);throw Error("Expected varint not more than 10 bytes")}(eu|=(15&(em=R[eh.get()]))<<28,R,eh))))}(R,eh);return em}(R,eh,eu.numValues);return function(R,eh){switch(eh.logicalLevelTechnique1){case eq.DELTA:return eh.logicalLevelTechnique2===eq.RLE&&(R=Lf(R,eh.runs,eh.numRleValues)),function(R){R[0]=Bf(R[0]);let eh=R.length/4*4,eu=1;if(eh>=4)for(;eu<eh-4;eu+=4){let eh=R[eu+1],em=R[eu+2],e_=R[eu+3];R[eu]=Bf(R[eu])+R[eu-1],R[eu+1]=Bf(eh)+R[eu],R[eu+2]=Bf(em)+R[eu+1],R[eu+3]=Bf(e_)+R[eu+2]}for(;eu!==R.length;++eu)R[eu]=Bf(R[eu])+R[eu-1]}(R),R;case eq.RLE:return Lf(R,eh.runs,eh.numRleValues);case eq.NONE:return R;default:throw Error(`The specified Logical level technique is not supported: ${eh.logicalLevelTechnique1}`)}}(em,eu)}(R,eu,e_);return new af(em,eh,eg)}let eh=sd(R,eu,e_,ew);return new ld(em,eh,eg)}case eK.SEQUENCE:{let eh=id(R,eu,e_);return new ud(em,eh[0],eh[1],e_.numRleValues)}case eK.CONST:{let eh=od(R,eu,e_);return new Id(em,eh,eg,!1)}}throw Error("Vector type not supported for id column.")}(R,eh,em,e_,ev,eg??eI,eu)}else if("complexType"===eh.type&&"physicalType"===eh.complexType?.type&&0===eh.complexType.physicalType){let eh=Ef(R,em,1)[0];if(0===eI){let eh=em.get();eI=Hf(R,em).decompressedCount,em.set(eh)}eS=function(R,eh,eu,em,e_){var eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek,eR,eL,eF,eB,eO,eV,ej,eN,eU,eG,e$,eZ;let eq,eW,eQ,e0,e2,e3,e5,e4,e6,e8,e7;let e9=Hf(R,eu);if(ad(e9,em,R,eu)===eK.CONST){let e_,eD,ek,eR;let eL=nd(R,eu,e9);for(let em=0;em<eh-1;em++){let eh=Hf(R,eu);switch(eh.physicalStreamType){case eX.LENGTH:switch(eh.logicalStreamType.lengthType){case eJ.GEOMETRIES:e_=td(R,eu,eh);break;case eJ.PARTS:eD=td(R,eu,eh);break;case eJ.RINGS:ek=td(R,eu,eh);break;case eJ.TRIANGLES:eR=td(R,eu,eh)}break;case eX.OFFSET:switch(eh.logicalStreamType.offsetType){case eY.VERTEX:eq=Qf(R,eu,eh);break;case eY.INDEX:e0=Qf(R,eu,eh)}break;case eX.DATA:eH.VERTEX===eh.logicalStreamType.dictionaryType?eW=Jf(R,eu,eh):(eQ={numBits:eh.numBits,coordinateShift:eh.coordinateShift},eW=Qf(R,eu,eh))}}return e0?void 0!==e_||void 0!==eD?(eg=eR,ev=e0,ex=eW,eb={geometryOffsets:e_,partOffsets:eD,ringOffsets:ek},new vd(em,eL,eg,ev,ex,eb)):(ew=eR,eT=e0,eS=eW,new vd(em,eL,ew,eT,eS,void 0)):void 0===eQ?(eP={geometryOffsets:e_,partOffsets:eD,ringOffsets:ek},eI=eq,eM=eW,new yd(em,eL,e1.VEC_2,eP,eI,eM)):(eE={geometryOffsets:e_,partOffsets:eD,ringOffsets:ek},eC=eq,eA=eW,ez=eQ,new yd(em,eL,e1.MORTON,eE,eC,eA,ez))}let tl=Qf(R,eu,e9);for(let em=0;em<eh-1;em++){let eh=Hf(R,eu);switch(eh.physicalStreamType){case eX.LENGTH:switch(eh.logicalStreamType.lengthType){case eJ.GEOMETRIES:e2=Qf(R,eu,eh);break;case eJ.PARTS:e3=Qf(R,eu,eh);break;case eJ.RINGS:e5=Qf(R,eu,eh);break;case eJ.TRIANGLES:e4=td(R,eu,eh)}break;case eX.OFFSET:switch(eh.logicalStreamType.offsetType){case eY.VERTEX:eq=Qf(R,eu,eh);break;case eY.INDEX:e0=Qf(R,eu,eh)}break;case eX.DATA:eH.VERTEX===eh.logicalStreamType.dictionaryType?eW=Jf(R,eu,eh):(eQ={numBits:eh.numBits,coordinateShift:eh.coordinateShift},eW=Qf(R,eu,eh))}}return e2?(e6=Sd(tl,e2,2),e3&&e5?(e8=Ad(tl,e6,e3,!1),e7=function(R,eh,eu,em){let e_=new Uint32Array(eu[eu.length-1]+1),eg=0;e_[0]=eg;let ev=1,ex=1,eb=0;for(let ew=0;ew<R.length;ew++){let eT=R[ew],eS=eh[ew+1]-eh[ew];if(0!==eT&&3!==eT)for(let R=0;R<eS;R++){let R=eu[ev]-eu[ev-1];ev++;for(let eh=0;eh<R;eh++)eg=e_[ex++]=eg+em[eb++]}else for(let R=0;R<eS;R++)e_[ex++]=++eg,ev++}return e_}(tl,e6,e8,e5)):e3&&(e8=function(R,eh,eu){let em=new Uint32Array(eh[eh.length-1]+1),e_=0;em[0]=e_;let eg=1,ev=0;for(let ex=0;ex<R.length;ex++){let eb=R[ex],ew=eh[ex+1]-eh[ex];if(4===eb||1===eb)for(let R=0;R<ew;R++)e_=em[eg++]=e_+eu[ev++];else for(let R=0;R<ew;R++)em[eg++]=++e_}return em}(tl,e6,e3))):e3&&e5?(e8=Sd(tl,e3,1),e7=Ad(tl,e8,e5,!0)):e3&&(e8=Sd(tl,e3,0)),e0&&!e8?(eD=e4,ek=e0,eR=eW,new wd(tl,eD,ek,eR,void 0)):e0?(eL=e4,eF=e0,eB=eW,eO={geometryOffsets:e6,partOffsets:e8,ringOffsets:e7},new wd(tl,eL,eF,eB,eO)):void 0===eQ?(eV={geometryOffsets:e6,partOffsets:e8,ringOffsets:e7},ej=eq,eN=eW,new md(e1.VEC_2,tl,eV,ej,eN)):(eU={geometryOffsets:e6,partOffsets:e8,ringOffsets:e7},eG=eq,e$=eW,eZ=eQ,new md(e1.MORTON,tl,eU,eG,e$,eZ))}(R,eh,em,eI)}else{var eg;let eu=!function(R){if("scalarType"===R.type){let eh=R.scalarType;if("physicalType"===eh.type)switch(eh.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case
56:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===eh.type)return!1}else if("complexType"===R.type){let eh=R.complexType;if("physicalType"===eh.type)switch(eh.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",R),!1}(eh)?1:Ef(R,em,1)[0];if(0===eu)continue;let e_=(eg=eI,"scalarType"===eh.type?function(R,eh,eu,em,e_,eg){let ev=null;if(0===R)return null;if(eg.nullable){let R=Hf(eh,eu),em=R.numValues,e_=eu.get(),eg=Ed(eh,em,R.byteLength,eu);eu.set(e_+R.byteLength),ev=new Wf(eg,R.numValues)}let ex=ev??em;switch(e_.physicalType){case 4:case 3:return function(R,eh,eu,em,e_){let eg=Hf(R,eh),ev=ad(eg,e_,R,eh),ex=3===em.physicalType;if(ev===eK.FLAT){let em=Vd(e_)?e_:void 0,ev=ex?Jf(R,eh,eg,0,em):Qf(R,eh,eg,0,em);return new of(eu.name,ev,e_)}if(ev===eK.SEQUENCE){let em=rd(R,eh,eg);return new uf(eu.name,em[0],em[1],eg.numRleValues)}let eb=ex?function(R,eh,eu){let em=ed(R,eh,eu);return 1===em.length?Df(em[0]):Df(em[1])}(R,eh,eg):nd(R,eh,eg);return new cf(eu.name,eb,e_,ex)}(eh,eu,eg,e_,ex);case 9:return function(R,eh,eu,em,e_){var eg,ev,ex,eb,ew,eT,eS,eP,eI,eM;let eE=null,eC=null,eA=null,ez=null,eD=null,ek=e_??null,eR=null,eL=null;for(let R=0;R<em;R++){let R=Hf(eh,eu);switch(R.physicalStreamType){case eX.PRESENT:{let em=Ed(eh,R.numValues,R.byteLength,eu),eg=new Wf(em,R.numValues);ek=e_??eg;break}case eX.OFFSET:eC=Qf(eh,eu,R,0,ek);break;case eX.LENGTH:{let em=td(eh,eu,R);eJ.DICTIONARY===R.logicalStreamType.lengthType?eE=em:eJ.SYMBOL===R.logicalStreamType.lengthType?ez=em:eR=em;break}case eX.DATA:{let em=eh.subarray(eu.get(),eu.get()+R.byteLength);eu.add(R.byteLength);let e_=R.logicalStreamType.dictionaryType;eH.FSST===e_?eD=em:eH.SINGLE===e_||eH.SHARED===e_?eA=em:eH.NONE===e_&&(eL=em)}}}return eg=eD,ev=eC,ex=eE,eb=eA,ew=ez,eT=ek,(eg?new Bd(R,ev,ex,eb,ew,eg,eT):null)??(eS=eA,eP=eC,eI=eE,eM=ek,eS?eM?new zd(R,eP,eI,eS,eM):new zd(R,eP,eI,eS):null)??function(R,eh,eu,em,e_){if(!eh||!eu)return null;if(em)return e_?new zd(R,em,eh,eu,e_):new zd(R,em,eh,eu);if(e_&&e_.size()!==eh.length-1){let em=new Uint32Array(e_.size()),eg=0;for(let R=0;R<e_.size();R++)em[R]=e_.get(R)?eg++:0;return new zd(R,em,eh,eu,e_)}return e_?new Dd(R,eh,eu,e_):new Dd(R,eh,eu)}(R,eR,eL,eC,ek)}(eg.name,eh,eu,eg.nullable?R-1:R,ev);case 0:return function(R,eh,eu,em,e_){let eg=Hf(R,eh),ev=eg.numValues,ex=eh.get(),eb=Vd(e_)?e_:void 0,ew=Ed(R,ev,eg.byteLength,eh,eb);eh.set(ex+eg.byteLength);let eT=new Wf(ew,ev);return new Md(eu.name,eT,e_)}(eh,eu,eg,0,ex);case 6:case 5:return function(R,eh,eu,em,e_){let eg=Hf(R,eh),ev=ad(eg,em,R,eh,"int64"),ex=5===e_.physicalType;if(ev===eK.FLAT){let e_=Vd(em)?em:void 0,ev=ex?function(R,eh,eu){let em;switch(eh.logicalLevelTechnique1){case eq.DELTA:if(eh.logicalLevelTechnique2===eq.RLE){if(!eu)return function(R,eh,eu){let em=new BigInt64Array(eu),e_=0,eg=0n;for(let eu=0;eu<eh;eu++){let ev=Number(R[eu]),ex=zf(R[eu+eh]);for(let R=0;R<ev;R++)eg+=ex,em[e_++]=eg}return em}(R,eh.runs,eh.numRleValues);em=$f(R=Vf(R,eh.runs,eh.numRleValues))}else em=$f(R);break;case eq.RLE:em=function(R,eh,eu){if(void 0===eu){eu=0;for(let em=0;em<eh;em++)eu+=Number(R[em])}let em=new BigInt64Array(eu),e_=0;for(let eu=0;eu<eh;eu++){let eg=Number(R[eu]),ev=R[eu+eh];ev=zf(ev),em.fill(ev,e_,e_+eg),e_+=eg}return em}(R,eh.runs,eh.numRleValues);break;case eq.NONE:em=function(R){let eh=new BigInt64Array(R.length);for(let eu=0;eu<R.length;eu++)eh[eu]=zf(R[eu]);return eh}(R);break;default:throw Error(`The specified Logical level technique is not supported: ${eh.logicalLevelTechnique1}`)}return eu?Kf(em,eu,0n):em}(Tf(R,eh,eg.numValues),eg,e_):sd(R,eh,eg,e_);return new ld(eu.name,ev,em)}if(ev===eK.SEQUENCE){let em=id(R,eh,eg);return new ud(eu.name,em[0],em[1],eg.numRleValues)}let eb=ex?function(R,eh,eu){let em=Tf(R,eh,eu.numValues);return 1===em.length?zf(em[0]):zf(em[1])}(R,eh,eg):od(R,eh,eg);return new Id(eu.name,eb,em,ex)}(eh,eu,eg,ex,e_);case 7:return function(R,eh,eu,em){let e_=Hf(R,eh),eg=Vd(em)?em:void 0,ev=function(R,eh,eu,em){let e_=eh.get(),eg=e_+eu*Float32Array.BYTES_PER_ELEMENT,ev=new Uint8Array(R.subarray(e_,eg)).buffer,ex=new Float32Array(ev);return eh.set(eg),em?Kf(ex,em,0):ex}(R,eh,e_.numValues,eg);return new kd(eu.name,ev,em)}(eh,eu,eg,ex);case 8:return function(R,eh,eu,em){let e_=Hf(R,eh),eg=Vd(em)?em:void 0,ev=function(R,eh,eu,em){let e_=eh.get(),eg=e_+eu*Float64Array.BYTES_PER_ELEMENT,ev=new Uint8Array(R.subarray(e_,eg)).buffer,ex=new Float64Array(ev);return eh.set(eg),em?Kf(ex,em,0):ex}(R,eh,e_.numValues,eg);return new af(eu.name,ev,em)}(eh,eu,eg,ex);default:throw Error(`The specified data type for the field is currently not supported: ${e_}`)}}(eu,R,em,eg,eh.scalarType,eh):0===eu?null:function(R,eh,eu,em){let e_=null,eg=null,ev=null,ex=null,eb=!1;for(;!eb;){let eu=Hf(R,eh);switch(eu.physicalStreamType){case eX.LENGTH:eJ.DICTIONARY===eu.logicalStreamType.lengthType?e_=td(R,eh,eu):ev=td(R,eh,eu);break;case eX.DATA:eH.SINGLE===eu.logicalStreamType.dictionaryType||eH.SHARED===eu.logicalStreamType.dictionaryType?(eg=
5R.subarray(eh.get(),eh.get()+eu.byteLength),eb=!0):ex=R.subarray(eh.get(),eh.get()+eu.byteLength),eh.add(eu.byteLength)}}let ew=eu.complexType.children,eT=[],eS=0;for(let eb of ew){let ew=Ef(R,eh,1)[0];if(0===ew)continue;let eP=eb.name?`${eu.name}${eb.name}`:eu.name;if(2!==ew||"scalarField"!==eb.type||9!==eb.scalarField.physicalType)throw Error("Currently only optional string fields are implemented for a struct.");let eI=Hf(R,eh),eM=Ed(R,eI.numValues,eI.byteLength,eh),eE=Hf(R,eh),eC=Qf(R,eh,eE,0,eE.decompressedCount!==em?new Wf(eM,eI.numValues):void 0);eT[eS++]=ex?new Bd(eP,eC,e_,eg,ev,ex,new Wf(eM,eI.numValues)):new zd(eP,eC,e_,eg,new Wf(eM,eI.numValues))}return eT}(R,em,eh,eg));if(e_){if(Array.isArray(e_))for(let R of e_)eP.push(R);else eP.push(e_)}}}let eM=new hf(ew.name,eS,eT,eP,eb);e_.push(eM),em.set(ev)}return e_}(new Uint8Array(R));this.layers=eh.reduce((R,eh)=>Object.assign(Object.assign({},R),{[eh.name]:new Hd(eh)}),{})}};let Kd=class Kd{constructor(R,eh){this.feature=R,this.type=R.type,this.properties=R.tags?R.tags:{},this.extent=eh,"id"in R&&("string"==typeof R.id?this.id=parseInt(R.id,10):"number"!=typeof R.id||isNaN(R.id)||(this.id=R.id))}loadGeometry(){let R=[],eh=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(let eu of eh){let eh=[];for(let R of eu)eh.push(new n(R[0],R[1]));R.push(eh)}return R}};let rO="_geojsonTileLayer";function ty(R,eh){if(!R.feature)return;let eu=R.feature;void 0!==eu.id&&eh.writeVarintField(1,eu.id),eh.writeMessage(2,ey,R),eh.writeVarintField(3,eu.type),eh.writeMessage(4,iy,eu)}function ey(R,eh){for(let eu in R.feature?.properties){let em=R.feature.properties[eu],e_=R.keycache[eu];if(null==em)continue;void 0===e_&&(R.keys.push(eu),e_=R.keys.length-1,R.keycache[eu]=e_),eh.writeVarint(e_),"string"!=typeof em&&"boolean"!=typeof em&&"number"!=typeof em&&(em=R.jsonPrefix+JSON.stringify(em));let eg=typeof em+":"+em,ev=R.valuecache[eg];void 0===ev&&(R.values.push(em),ev=R.values.length-1,R.valuecache[eg]=ev),eh.writeVarint(ev)}}function iy(R,eh){let eu=R.loadGeometry(),em=R.type,e_=0,eg=0;for(let ev of eu){let eu=1;1===em&&(eu=ev.length),eh.writeVarint((eu<<3)+1);let ex=3===em?ev.length-1:ev.length;for(let R=0;R<ex;R++){1===R&&1!==em&&eh.writeVarint((ex-1<<3)+2);let eu=ev[R].x-e_,eb=ev[R].y-eg;eh.writeVarint(eu<<1^eu>>31),eh.writeVarint(eb<<1^eb>>31),e_+=eu,eg+=eb}3===R.type&&eh.writeVarint(15)}}function sy(R,eh){let eu=typeof R;"string"===eu?eh.writeStringField(1,R):"boolean"===eu?eh.writeBooleanField(7,R):"number"===eu&&(R%1!=0?eh.writeDoubleField(3,R):R<0?eh.writeSVarintField(6,R):eh.writeVarintField(5,R))}let oy=class oy{constructor(R,eh){this.tileID=R,this.x=R.canonical.x,this.y=R.canonical.y,this.z=R.canonical.z,this.grid=new ps(8192,16,0),this.grid3D=new ps(8192,16,0),this.featureIndexArray=new Go,this.promoteId=eh}insert(R,eh,eu,em,e_,eg){let ev=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(eu,em,e_);let ex=eg?this.grid3D:this.grid;for(let R of eh){let eh=[1/0,1/0,-1/0,-1/0];for(let eu of R)eh[0]=Math.min(eh[0],eu.x),eh[1]=Math.min(eh[1],eu.y),eh[2]=Math.max(eh[2],eu.x),eh[3]=Math.max(eh[3],eu.y);eh[0]<8192&&eh[1]<8192&&eh[2]>=0&&eh[3]>=0&&ex.insert(ev,eh[0],eh[1],eh[2],eh[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Nu(new Rh(this.rawTileData)).layers:new Wd(this.rawTileData).layers,this.sourceLayerCoder=new ef(this.vtLayers?Object.keys(this.vtLayers).sort():[rO])),this.vtLayers}query(R,eh,eu,em){let e_;this.loadVTLayers();let eg=R.params,ev=8192/R.tileSize/R.scale,ex=yi(eg.filter,eg.globalState),eb=R.queryGeometry,ew=R.queryPadding*ev,eT=tf.fromPoints(eb),eS=this.grid.query(eT.minX-ew,eT.minY-ew,eT.maxX+ew,eT.maxY+ew),eP=tf.fromPoints(R.cameraQueryGeometry).expandBy(ew),eI=this.grid3D.query(eP.minX,eP.minY,eP.maxX,eP.maxY,(eh,eu,em,e_)=>(function(R,eh,eu,em,e_){for(let eg of R)if(eh<=eg.x&&eu<=eg.y&&em>=eg.x&&e_>=eg.y)return!0;let eg=[new n(eh,eu),new n(eh,e_),new n(em,e_),new n(em,eu)];if(R.length>2){for(let eh of eg)if(il(R,eh))return!0}for(let eh=0;eh<R.length-1;eh++)if(function(R,eh,eu){let em=eu[0],e_=eu[2];if(R.x<em.x&&eh.x<em.x||R.x>e_.x&&eh.x>e_.x||R.y<em.y&&eh.y<em.y||R.y>e_.y&&eh.y>e_.y)return!1;let eg=X(R,eh,eu[0]);return eg!==X(R,eh,eu[1])||eg!==X(R,eh,eu[2])||eg!==X(R,eh,eu[3])}(R[eh],R[eh+1],eg))return!0;return!1})(R.cameraQueryGeometry,eh-ew,eu-ew,em+ew,e_+ew));for(let R of eI)eS.push(R);eS.sort(ly);let eM={};for(let ew of eS){if(ew===e_)continue;e_=ew;let eT=this.featureIndexArray.get(ew),eS=null;
5this.loadMatchingFeature(eM,eT.bucketIndex,eT.sourceLayerIndex,eT.featureIndex,ex,eg.layers,eg.availableImages,eh,eu,em,(eh,eu,em)=>(eS||(eS=qa(eh)),eu.queryIntersectsFeature({queryGeometry:eb,feature:eh,featureState:em,geometry:eS,zoom:this.z,transform:R.transform,pixelsToTileUnits:ev,pixelPosMatrix:R.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:R.getElevation})))}return eM}loadMatchingFeature(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT){let eS=this.bucketLayerIDs[eh];if(eg&&!eS.some(R=>eg.has(R)))return;let eP=this.sourceLayerCoder.decode(eu),eI=this.vtLayers[eP].feature(em);if(e_.needGeometry){let R=Ga(eI,!0);if(!e_.filter(new Cs(this.tileID.overscaledZ),R,this.tileID.canonical))return}else if(!e_.filter(new Cs(this.tileID.overscaledZ),eI))return;let eM=this.getId(eI,eP);for(let eh of eS){if(eg&&!eg.has(eh))continue;let eu=ex[eh];if(!eu)continue;let e_={};eM&&ew&&(e_=ew.getState(eu.sourceLayer||rO,eM));let eS=$({},eb[eh]);eS.paint=ay(eS.paint,eu.paint,eI,e_,ev),eS.layout=ay(eS.layout,eu.layout,eI,e_,ev);let eP=!eT||eT(eI,eu,e_);if(!eP)continue;let eE=new nf(eI,this.z,this.x,this.y,eM);eE.layer=eS;let eC=R[eh];void 0===eC&&(eC=R[eh]=[]),eC.push({featureIndex:em,feature:eE,intersectionZ:eP})}}lookupSymbolFeatures(R,eh,eu,em,e_,eg,ev,ex){let eb={};this.loadVTLayers();let ew=yi(e_.filterSpec,e_.globalState);for(let e_ of R)this.loadMatchingFeature(eb,eu,em,e_,ew,eg,ev,ex,eh);return eb}hasLayer(R){for(let eh of this.bucketLayerIDs)for(let eu of eh)if(R===eu)return!0;return!1}getId(R,eh){var eu;let em=R.id;return this.promoteId&&("boolean"==typeof(em=R.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[eh]])&&(em=Number(em)),void 0===em&&(null===(eu=R.properties)||void 0===eu?void 0:eu.cluster)&&this.promoteId&&(em=Number(R.properties.cluster_id))),em}};function ay(R,eh,eu,em,e_){return N(R,(R,eg)=>{let ev=eh instanceof Gs?eh.get(eg):null;return(null==ev?void 0:ev.evaluate)?ev.evaluate(eu,em,e_):ev})}function ly(R,eh){return eh-R}function uy(R,eh,eu,em,e_){let eg=[];for(let ev of R){let R;for(let ex=0;ex<ev.length-1;ex++){let eb=ev[ex],ew=ev[ex+1];eb.x<eh&&ew.x<eh||(eb.x<eh?eb=new n(eh,eb.y+(eh-eb.x)/(ew.x-eb.x)*(ew.y-eb.y))._round():ew.x<eh&&(ew=new n(eh,eb.y+(eh-eb.x)/(ew.x-eb.x)*(ew.y-eb.y))._round()),eb.y<eu&&ew.y<eu||(eb.y<eu?eb=new n(eb.x+(eu-eb.y)/(ew.y-eb.y)*(ew.x-eb.x),eu)._round():ew.y<eu&&(ew=new n(eb.x+(eu-eb.y)/(ew.y-eb.y)*(ew.x-eb.x),eu)._round()),eb.x>=em&&ew.x>=em||(eb.x>=em?eb=new n(em,eb.y+(em-eb.x)/(ew.x-eb.x)*(ew.y-eb.y))._round():ew.x>=em&&(ew=new n(em,eb.y+(em-eb.x)/(ew.x-eb.x)*(ew.y-eb.y))._round()),eb.y>=e_&&ew.y>=e_||(eb.y>=e_?eb=new n(eb.x+(e_-eb.y)/(ew.y-eb.y)*(ew.x-eb.x),e_)._round():ew.y>=e_&&(ew=new n(eb.x+(e_-eb.y)/(ew.y-eb.y)*(ew.x-eb.x),e_)._round()),R&&eb.equals(R[R.length-1])||(R=[eb],eg.push(R)),R.push(ew)))))}}return eg}function cy(R,eh,eu,em,e_){switch(eh){case 1:return function(R,eh,eu,em){let e_=[];for(let eg of R)for(let R of eg){let eg=0===em?R.x:R.y;eg>=eh&&eg<=eu&&e_.push([R])}return e_}(R,eu,em,e_);case 2:return py(R,eu,em,e_,!1);case 3:return py(R,eu,em,e_,!0)}return[]}function py(R,eh,eu,em,e_){let eg=[];for(let ev of R){let R=function(R,eh,eu,em,e_){let eg=0===em?fy:dy,ev=[],ex=[];for(let eb=0;eb<R.length-1;eb++){let ew=R[eb],eT=R[eb+1],eS=0===em?ew.x:ew.y,eP=0===em?eT.x:eT.y,eI=!1;eS<eh?eP>eh&&ev.push(eg(ew,eT,eh)):eS>eu?eP<eu&&ev.push(eg(ew,eT,eu)):ev.push(ew),eP<eh&&eS>=eh&&(ev.push(eg(ew,eT,eh)),eI=!0),eP>eu&&eS<=eu&&(ev.push(eg(ew,eT,eu)),eI=!0),!e_&&eI&&(ex.push(ev),ev=[])}let eb=R.length-1,ew=0===em?R[eb].x:R[eb].y;return ew>=eh&&ew<=eu&&ev.push(R[eb]),e_&&ev.length>0&&!ev[0].equals(ev[ev.length-1])&&ev.push(new n(ev[0].x,ev[0].y)),ev.length>0&&ex.push(ev),ex}(ev,eh,eu,em,e_);R.length>0&&eg.push(...R)}return eg}function fy(R,eh,eu){return new n(eu,R.y+(eu-R.x)/(eh.x-R.x)*(eh.y-R.y))}function dy(R,eh,eu){return new n(R.x+(eu-R.y)/(eh.y-R.y)*(eh.x-R.x),eu)}ds("FeatureIndex",oy,{omit:["rawTileData","sourceLayerCoder"]});let yy=class yy extends n{constructor(R,eh,eu,em){super(R,eh),this.angle=eu,void 0!==em&&(this.segment=em)}clone(){return new yy(this.x,this.y,this.angle,this.segment)}};function my(R,eh,eu,em,e_){if(void 0===eh.segment||0===eu)return!0;let eg=eh,ev=eh.segment+1,ex=0;for(;ex>-eu/2;){if(--ev<0)return!1;ex-=R[ev].dist(eg),eg=R[ev]}ex+=R[ev].dist(R[ev+1]),ev++;let eb=[],ew=0;for(;ex<eu/2;){let eh=R[ev],eu=R[ev+1];if(!eu)return!1;let eg=R[ev-1].angleTo(eh)-eh.angleTo(eu);for(eg=Math.abs((eg+3*Math.PI)%(2*Math.PI)-Math.PI),eb.push({distance:ex,angleDelta:eg}),ew+=eg;ex-eb[0].distance>em;)ew-=eb.shift().angleDelta;if(ew>e_)return!1;ev++,ex+=eh.dist(eu)}return!0}function gy(R){let eh=0;for(let eu=0;eu<R.length-1;eu++)eh+=R[eu].dist(R[eu+1]);return eh}function vy(R,eh){return Math.max(R?R.right-R.left:0,eh?eh.right-eh.left:0)}function Sy(R,eh,eu,em){let e_=[],eg=R.image,ev=eg.pixelRatio,ex=eg.paddedRect.w-2,eb=eg.paddedRect.h-2,ew={x1:R.left,y1:R.top,x2:R.right,y2:R.bottom},eT=eg.stretchX||[[0,ex]],eS=eg.stretchY||[[0,eb]],f=(R,eh)=>R+eh[1]-eh[0],eP=eT.reduce(f,0),eI=eS.reduce(f,0),eM=ex-eP,eE=eb-eI,eC=0,eA=eP,ez=0,eD=eI,ek=0,eR=eM,eL=0,eF=eE;if(eg.content&&em){let eh=eg.content,eu=eh[2]-eh[0],em=eh[3]-eh[1];(eg.textFitWidth||eg.textFitHeight)&&(ew=dp(R)),eC=Ay(eT,0,eh[0]),ez=Ay(eS,0,eh[1]),eA=Ay(eT,eh[0],eh[2]),eD=Ay(eS,eh[1],eh[3]),ek=eh[0]-eC,eL=eh[1]-ez,eR=eu-eA,eF=em-eD}let eB=ew.x1,eO=ew.y1,eV=ew.x2-eB,ej=ew.y2-eO,F=(R,em,e_,ex)=>{var eb,ew,eT,eS,eM,eE,eN,eU;let eG=(R.stretch-eC)/eA*eV+eB,e$=(ew=R.fixed-ek,ew-eR*R.stretch/eP),eZ=(em.stretch-ez)/eD*ej+eO,eq=(eS=em.fixed-eL,eS-eF*em.stretch/eI),eW=(e_.stretch-eC)/eA*eV+eB,eX=(eE=e_.fixed-ek,eE-eR*e_.stretch/eP),eH=(ex.stretch-ez)/eD*ej+eO,eY=(eU=ex.fixed-eL,eU-eF*ex.stretch/eI),eJ=new n(eG,eZ),eK=new n(eW,eZ),eQ=new n(eW,eH),e0=new n(eG,eH),e1=new n(e$/ev,eq/ev),e2=new n(eX/ev,eY/ev),e3=eh*Math.PI/180;if(e3){let R=Math.sin(e3),eh=Math.cos(e3),eu=[eh,-R,R,eh];eJ._matMult(eu),eK._matMult(eu),e0._matMult(eu),eQ._matMult(eu)}let e5=R.stretch+R.fixed,e4=em.stretch+em.fixed;return{tl:eJ,tr:eK,bl:e0,br:eQ,tex:{x:eg.paddedRect.x+1+e5,y:eg.paddedRect.y+1+e4,w:e_.stretch+e_.fixed-e5,h:ex.stretch+ex.fixed-e4},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:e1,pixelOffsetBR:e2,minFontScaleX:eR/ev/eV,minFontScaleY:eF/ev/ej,isSDF:eu}};if(em&&(eg.stretchX||eg.stretchY)){let R=My(eT,eM,eP),eh=My(eS,eE,eI);for(let eu=0;eu<R.length-1;eu++){let em=R[eu],eg=R[eu+1];for(let R=0;R<eh.length-1;R++)e_.push(F(em,eh[R],eg,eh[R+1]))}}else e_.push(F({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:ex+1},{fixed:0,stretch:eb+1}));return e_}function Ay(R,eh,eu){let em=0;for(let e_ of R)em+=Math.max(eh,Math.min(eu,e_[1]))-Math.max(eh,Math.min(eu,e_[0]));return em}function My(R,eh,eu){let em=[{fixed:-1,stretch:0}];for(let[eh,eu]of R){let R=em[em.length-1];em.push({fixed:eh-R.stretch,stretch:R.stretch}),em.push({fixed:eh-R.stretch,stretch:R.stretch+(eu-eh)})}return em.push({fixed:eh+1,stretch:eu}),em}ds("Anchor",yy);let Ey=class Ey{constructor(R,eh,eu,em,e_,eg,ev,ex,eb,ew){var eT;if(this.boxStartIndex=R.length,eb){let R=eg.top,eh=eg.bottom,eu=eg.collisionPadding;eu&&(R-=eu[1],eh+=eu[3]);let em=eh-R;em>0&&(em=Math.max(10,em),this.circleDiameter=em)}else{let eb=(null===(eT=eg.image)||void 0===eT?void 0:eT.content)&&(eg.image.textFitWidth||eg.image.textFitHeight)?dp(eg):{x1:eg.left,y1:eg.top,x2:eg.right,y2:eg.bottom};eb.y1=eb.y1*ev-ex[0],eb.y2=eb.y2*ev+ex[2],eb.x1=eb.x1*ev-ex[3],eb.x2=eb.x2*ev+ex[1];let eS=eg.collisionPadding;if(eS&&(eb.x1-=eS[0]*ev,eb.y1-=eS[1]*ev,eb.x2+=eS[2]*ev,eb.y2+=eS[3]*ev),ew){let R=new n(eb.x1,eb.y1),eh=new n(eb.x2,eb.y1),eu=new n(eb.x1,eb.y2),em=new n(eb.x2,eb.y2),e_=ew*Math.PI/180;R._rotate(e_),eh._rotate(e_),eu._rotate(e_),em._rotate(e_),eb.x1=Math.min(R.x,eh.x,eu.x,em.x),eb.x2=Math.max(R.x,eh.x,eu.x,em.x),eb.y1=Math.min(R.y,eh.y,eu.y,em.y),eb.y2=Math.max(R.y,eh.y,eu.y,em.y)}R.emplaceBack(eh.x,eh.y,eb.x1,eb.y1,eb.x2,eb.y2,eu,em,e_)}this.boxEndIndex=R.length}};let Ty=class Ty{constructor(R=[],eh=(R,eh)=>R<eh?-1:R>eh?1:0){if(this.data=R,this.length=this.data.length,this.compare=eh,this.length>0)for(let R=(this.length>>1)-1;R>=0;R--)this._down(R)}push(R){this.data.push(R),this._up(this.length++)}pop(){if(0===this.length)return;let R=this.data[0],eh=this.data.pop();return--this.length>0&&(this.data[0]=eh,this._down(0)),R}peek(){return this.data[0]}_up(R){let{data:eh,compare:eu}=this,em=eh[R];for(;R>0;){let e_=R-1>>1,eg=eh[e_];if(eu(em,eg)>=0)break;eh[R]=eg,R=e_}eh[R]=em}_down(R){let{data:eh,compare:eu}=this,em=this.length>>1,e_=eh[R];for(;R<em;){let em=1+(R<<1),eg=em+1;if(eg<this.length&&0>eu(eh[eg],eh[em])&&(em=eg),eu(eh[em],e_)>=0)break;eh[R]=eh[em],R=em}eh[R]=e_}};function Py(R,eh){return eh.max-R.max}let Dy=class Dy{constructor(R,eh,eu,em){this.p=new n(R,eh),this.h=eu,this.d=function(R,eh){let eu=!1,em=1/0;for(let e_ of eh)for(let eh=0,eg=e_.length,ev=eg-1;eh<eg;ev=eh++){let eg=e_[eh],ex=e_[ev];eg.y>R.y!=ex.y>R.y&&R.x<(ex.x-eg.x)*(R.y-eg.y)/(ex.y-eg.y)+eg.x&&(eu=!eu),em=Math.min(em,nl(R,eg,ex))}return(eu?1:-1)*Math.sqrt(em)}(this.p,em),this.max=this.d+this.h*Math.SQRT2}};R.aN=void 0,(e2=R.aN||(R.aN={}))[e2.center=1]="center",e2[e2.left=2]="left",e2[e2.right=3]="right",e2[e2.top=4]="top",e2[e2.bottom=5]="bottom",e2[e2["top-left"]=6]="top-left",e2[e2["top-right"]=7]="top-right",e2[e2["bottom-left"]=8]="bottom-left",e2[e2["bottom-right"]=9]="bottom-right";let rV=Number.POSITIVE_INFINITY;function Cy(R,eh){return eh[1]!==rV?function(R,eh,eu){let em=0,e_=0;
5switch(eh=Math.abs(eh),eu=Math.abs(eu),R){case"top-right":case"top-left":case"top":e_=eu-7;break;case"bottom-right":case"bottom-left":case"bottom":e_=7-eu}switch(R){case"top-right":case"bottom-right":case"right":em=-eh;break;case"top-left":case"bottom-left":case"left":em=eh}return[em,e_]}(R,eh[0],eh[1]):function(R,eh){let eu=0,em=0;eh<0&&(eh=0);let e_=eh/Math.SQRT2;switch(R){case"top-right":case"top-left":em=e_-7;break;case"bottom-right":case"bottom-left":em=7-e_;break;case"bottom":em=7-eh;break;case"top":em=eh-7}switch(R){case"top-right":case"bottom-right":eu=-e_;break;case"top-left":case"bottom-left":eu=e_;break;case"left":eu=eh;break;case"right":eu=-eh}return[eu,em]}(R,eh[0])}function Vy(R,eh,eu){var em;let e_=R.layout,eg=null===(em=e_.get("text-variable-anchor-offset"))||void 0===em?void 0:em.evaluate(eh,{},eu);if(eg){let R=eg.values,eh=[];for(let eu=0;eu<R.length;eu+=2){let em=eh[eu]=R[eu],e_=R[eu+1].map(R=>24*R);em.startsWith("top")?e_[1]-=7:em.startsWith("bottom")&&(e_[1]+=7),eh[eu+1]=e_}return new $e(eh)}let ev=e_.get("text-variable-anchor");if(ev){let em;em=void 0!==R._unevaluatedLayout.getValue("text-radial-offset")?[24*e_.get("text-radial-offset").evaluate(eh,{},eu),rV]:e_.get("text-offset").evaluate(eh,{},eu).map(R=>24*R);let eg=[];for(let R of ev)eg.push(R,Cy(R,em));return new $e(eg)}return null}function Ly(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 $y(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM){let eE=function(R,eh,eu,em,e_,eg,ev,ex){let eb=em.layout.get("text-rotate").evaluate(eg,{})*Math.PI/180,ew=[];for(let R of eh.positionedLines)for(let em of R.positionedGlyphs){if(!em.rect)continue;let eg=em.rect||{},eT=4,eS=!0,eP=1,eI=0,eM=(e_||ex)&&em.vertical,eE=em.metrics.advance*em.scale/2;if(ex&&eh.verticalizable&&(eI=R.lineOffset/2-(em.imageName?-(24-em.metrics.width*em.scale)/2:(em.scale-1)*24)),em.imageName){let R=ev[em.imageName];eS=R.sdf,eT=1/(eP=R.pixelRatio)}let eC=e_?[em.x+eE,em.y]:[0,0],eA=e_?[0,0]:[em.x+eE+eu[0],em.y+eu[1]-eI],ez=[0,0];eM&&(ez=eA,eA=[0,0]);let eD=em.metrics.isDoubleResolution?2:1,ek=(em.metrics.left-eT)*em.scale-eE+eA[0],eR=(-em.metrics.top-eT)*em.scale+eA[1],eL=ek+eg.w/eD*em.scale/eP,eF=eR+eg.h/eD*em.scale/eP,eB=new n(ek,eR),eO=new n(eL,eR),eV=new n(ek,eF),ej=new n(eL,eF);if(eM){let R=new n(-eE,eE- -17),eh=-Math.PI/2,eu=12-eE,e_=new n(22-eu,-(em.imageName?eu:0)),eg=new n(...ez);eB._rotateAround(eh,R)._add(e_)._add(eg),eO._rotateAround(eh,R)._add(e_)._add(eg),eV._rotateAround(eh,R)._add(e_)._add(eg),ej._rotateAround(eh,R)._add(e_)._add(eg)}if(eb){let R=Math.sin(eb),eh=Math.cos(eb),eu=[eh,-R,R,eh];eB._matMult(eu),eO._matMult(eu),eV._matMult(eu),ej._matMult(eu)}let eN=new n(0,0),eU=new n(0,0);ew.push({tl:eB,tr:eO,bl:eV,br:ej,tex:eg,writingMode:eh.writingMode,glyphOffset:eC,sectionIndex:em.sectionIndex,isSDF:eS,pixelOffsetTL:eN,pixelOffsetBR:eU,minFontScaleX:0,minFontScaleY:0})}return ew}(0,eu,ex,e_,eg,ev,em,R.allowVerticalPlacement),eC=R.textSizeData,eA=null;for(let eu of("source"===eC.kind?(eA=[128*e_.layout.get("text-size").evaluate(ev,{})])[0]>32640&&G(`${R.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===eC.kind&&((eA=[128*eI.compositeTextSizes[0].evaluate(ev,{},eM),128*eI.compositeTextSizes[1].evaluate(ev,{},eM)])[0]>32640||eA[1]>32640)&&G(`${R.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),R.addSymbols(R.text,eE,eA,ex,eg,ev,ew,eh,eb.lineStartIndex,eb.lineLength,eP,eM),eT))eS[eu]=R.text.placedSymbolArray.length-1;return 4*eE.length}function Ry(R){for(let eh in R)return R[eh];return null}R.$=at,R.A=e5,R.B=iC,R.C=hs,R.D=Xs,R.E=bt,R.F=Qi,R.G=function([R,eh,eu]){return eh+=90,{x:R*Math.cos(eh*=Math.PI/180)*Math.sin(eu*=Math.PI/180),y:R*Math.sin(eh)*Math.sin(eu),z:R*Math.cos(eu)}},R.H=t1,R.I=np,R.J=Cs,R.K=iw,R.L=function(R){if(null==e7){let eh=R.navigator?R.navigator.userAgent:null;e7=!!R.safari||!(!eh||!(/\b(iPad|iPhone|iPod)\b/.test(eh)||eh.match("Safari")&&!eh.match("Chrome")))}return e7},R.M=tm,R.N=class{constructor(R,eh){this.target=R,this.mapId=eh,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Vp(()=>this.process()),this.subscription=tt(this.target,"message",R=>this.receive(R),!1),this.globalScope=Y(self)?R:window}registerMessageHandler(R,eh){this.messageHandlers[R]=eh}unregisterMessageHandler(R){delete this.messageHandlers[R]}sendAsync(R,eh){return new Promise((eu,em)=>{let e_=Math.round(1e18*Math.random()).toString(36).substring(0,10),eg=eh?tt(eh.signal,"abort",()=>{null==eg||eg.unsubscribe(),delete this.resolveRejects[e_];let eh={id:e_,type:"<cancel>",origin:location.origin,targetMapId:R.targetMapId,sourceMapId:this.mapId};this.target.postMessage(eh)},rz):null;this.resolveRejects[e_]={resolve:R=>{null==eg||eg.unsubscribe(),eu(R)},reject:R=>{null==eg||eg.unsubscribe(),em(R)}};let ev=[],ex=Object.assign(Object.assign({},R),{id:e_,sourceMapId:this.mapId,origin:location.origin,data:xs(R.data,ev)});this.target.postMessage(ex,{transfer:ev})})}receive(R){let eh=R.data,eu=eh.id,em=["file://","resource://android","null"],e_=[eh.origin,location.origin],eg=eh.origin===location.origin,ev=e_.some(R=>em.includes(R));if((eg||ev)&&(!eh.targetMapId||this.mapId===eh.targetMapId)){if("<cancel>"===eh.type){delete this.tasks[eu];let R=this.abortControllers[eu];return delete this.abortControllers[eu],void(R&&R.abort())}if(Y(self)||eh.mustQueue)return this.tasks[eu]=eh,this.taskQueue.push(eu),void this.invoker.trigger();this.processTask(eu,eh)}}process(){if(0===this.taskQueue.length)return;let R=this.taskQueue.shift(),eh=this.tasks[R];delete this.tasks[R],this.taskQueue.length>0&&this.invoker.trigger(),eh&&this.processTask(R,eh)}processTask(R,eh){return e(this,void 0,void 0,function*(){if("<response>"===eh.type){let eu=this.resolveRejects[R];if(delete this.resolveRejects[R],!eu)return;return void(eh.error?eu.reject(P(vs(eh.error))):eu.resolve(vs(eh.data)))}if(!this.messageHandlers[eh.type])return void this.completeTask(R,Error(`Could not find a registered handler for ${eh.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let eu=vs(eh.data),em=new AbortController;this.abortControllers[R]=em;try{let e_=yield this.messageHandlers[eh.type](eh.sourceMapId,eu,em);this.completeTask(R,null,e_)}catch(eh){this.completeTask(R,P(eh))}})}completeTask(R,eh,eu){let em=[];delete this.abortControllers[R];let e_={id:R,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:eh?xs(eh):null,data:xs(eu,em)};this.target.postMessage(e_,{transfer:em})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},R.O=function(){var R=new e5(16);return e5!=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},R.P=n,R.Q=function(R,eh,eu){var em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE=eu[0],eC=eu[1],eA=eu[2];return eh===R?(R[12]=eh[0]*eE+eh[4]*eC+eh[8]*eA+eh[12],R[13]=eh[1]*eE+eh[5]*eC+eh[9]*eA+eh[13],R[14]=eh[2]*eE+eh[6]*eC+eh[10]*eA+eh[14],R[15]=eh[3]*eE+eh[7]*eC+eh[11]*eA+eh[15]):(e_=eh[1],eg=eh[2],ev=eh[3],ex=eh[4],eb=eh[5],ew=eh[6],eT=eh[7],eS=eh[8],eP=eh[9],eI=eh[10],eM=eh[11],R[0]=em=eh[0],R[1]=e_,R[2]=eg,R[3]=ev,R[4]=ex,R[5]=eb,R[6]=ew,R[7]=eT,R[8]=eS,R[9]=eP,R[10]=eI,R[11]=eM,R[12]=em*eE+ex*eC+eS*eA+eh[12],R[13]=e_*eE+eb*eC+eP*eA+eh[13],R[14]=eg*eE+ew*eC+eI*eA+eh[14],R[15]=ev*eE+eT*eC+eM*eA+eh[15]),R},R.R=Il,R.S=function(R,eh,eu){var em=eu[0],e_=eu[1],eg=eu[2];return R[0]=eh[0]*em,R[1]=eh[1]*em,R[2]=eh[2]*em,R[3]=eh[3]*em,R[4]=eh[4]*e_,R[5]=eh[5]*e_,R[6]=eh[6]*e_,R[7]=eh[7]*e_,R[8]=eh[8]*eg,R[9]=eh[9]*eg,R[10]=eh[10]*eg,R[11]=eh[11]*eg,R[12]=eh[12],R[13]=eh[13],R[14]=eh[14],R[15]=eh[15],R},R.T=Ol,R.U=function(R,eh,eu){var em=eh[0],e_=eh[1],eg=eh[2],ev=eh[3],ex=eh[4],eb=eh[5],ew=eh[6],eT=eh[7],eS=eh[8],eP=eh[9],eI=eh[10],eM=eh[11],eE=eh[12],eC=eh[13],eA=eh[14],ez=eh[15],eD=eu[0],ek=eu[1],eR=eu[2],eL=eu[3];return R[0]=eD*em+ek*ex+eR*eS+eL*eE,R[1]=eD*e_+ek*eb+eR*eP+eL*eC,R[2]=eD*eg+ek*ew+eR*eI+eL*eA,R[3]=eD*ev+ek*eT+eR*eM+eL*ez,R[4]=(eD=eu[4])*em+(ek=eu[5])*ex+(eR=eu[6])*eS+(eL=eu[7])*eE,R[5]=eD*e_+ek*eb+eR*eP+eL*eC,R[6]=eD*eg+ek*ew+eR*eI+eL*eA,R[7]=eD*ev+ek*eT+eR*eM+eL*ez,R[8]=(eD=eu[8])*em+(ek=eu[9])*ex+(eR=eu[10])*eS+(eL=eu[11])*eE,R[9]=eD*e_+ek*eb+eR*eP+eL*eC,R[10]=eD*eg+ek*ew+eR*eI+eL*eA,R[11]=eD*ev+ek*eT+eR*eM+eL*ez,R[12]=(eD=eu[12])*em+(ek=eu[13])*ex+(eR=eu[14])*eS+(eL=eu[15])*eE,R[13]=eD*e_+ek*eb+eR*eP+eL*eC,R[14]=eD*eg+ek*ew+eR*eI+eL*eA,R[15]=eD*ev+ek*eT+eR*eM+eL*ez,R},R.V=function(R,eh){let eu={};for(let em of eh)em in R&&(eu[em]=R[em]);return eu},R.W=$p,R.X=O,R.Y=jp,R.Z=Up,R._=e,R.a=ot,R.a$=v,R.a0=c,R.a1=h,R.a2=K,R.a3=Jp,R.a4=Gp,R.a5=Xp,R.a6=8192,R.a7=Zp,R.a8=tf,R.a9=25,R.aA=I,R.aB=function(R){var eh=R[0],eu=R[1];return Math.sqrt(eh*eh+eu*eu)},R.aC=function(R){return R[0]=0,R[1]=0,R},R.aD=function(R,eh,eu){return R[0]=eh[0]*eu,R[1]=eh[1]*eu,R},R.aE=_p,R.aF=A,R.aG=function(R,eh,eu,em){let e_=eh.y-R.y,eg=eh.x-R.x,ev=em.y-eu.y,ex=em.x-eu.x,eb=ev*eg-ex*e_;if(0===eb)return null;let ew=(ex*(R.y-eu.y)-ev*(R.x-eu.x))/eb;return new n(R.x+ew*eg,R.y+ew*e_)},R.aH=uy,R.aI=Ha,R.aJ=function(R){let eh=1/0,eu=1/0,em=-1/0,e_=-1/0;for(let eg of R)eh=Math.min(eh,eg.x),eu=Math.min(eu,eg.y),em=Math.max(em,eg.x),e_=Math.max(e_,eg.y);return[eh,eu,em,e_]},R.aK=24,R.aL=F,R.aM=function(R,eh,eu,em,e_=!1){if(!eu[0]&&!eu[1])return[0,0];let eg=e_?"map"===em?-R.bearingInRadians:0:"viewport"===em?R.bearingInRadians:0;if(eg){let R=Math.sin(eg),eh=Math.cos(eg);eu=[eu[0]*eh-eu[1]*R,eu[0]*R+eu[1]*eh]}return[e_?eu[0]:F(eh,eu[0],R.zoom),e_?eu[1]:F(eh,eu[1],R.zoom)]},R.aO=vp,R.aP=Ly,R.aQ=op,R.aR=R=>"symbol"===R.type,R.aS=ec,R.aT=ao,R.aU=xu,R.aV=Xo,R.aW=ua,R.aX=sa,R.aY=nt,R.aZ=Yp,R.a_=b,R.aa=Wp,R.ab=R=>{let eh=window.document.createElement("video");return eh.muted=!0,new Promise(eu=>{for(let em of(eh.onloadstart=()=>{eu(eh)},R)){let R=window.document.createElement("source");yt(em)||(eh.crossOrigin="Anonymous"),R.src=em,eh.appendChild(R)}})},R.ac=zt,R.ad=function(){return e6++},R.ae=Co,R.af=kp,R.ag=rO,R.ah=yi,R.ai=Ga,R.aj=nf,R.ak=function(R){let eh={};if(R.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(R,eu,em,e_)=>{let eg=em||e_;return eh[eu]=!eg||eg.toLowerCase(),""}),eh["max-age"]){let R=parseInt(eh["max-age"],10);isNaN(R)?delete eh["max-age"]:eh["max-age"]=R}return eh}
5,R.al=L,R.am=85.051129,R.an=et,R.ao=function(R){return Math.pow(2,R)},R.ap=y,R.aq=function(R,eh){return R/Np(eh)},R.ar=function(R){return Math.log(R)/Math.LN2},R.as=function(R){var eh=R[0],eu=R[1];return eh*eh+eu*eu},R.at=function(R){if(!R.length)return new Set;let eh=Math.max(...R.map(R=>R.canonical.z)),eu=1/0,em=-1/0,e_=1/0,eg=-1/0,ev=[];for(let ex of R){let{x:R,y:eb,z:ew}=ex.canonical,eT=Math.pow(2,eh-ew),eS=R*eT,eP=eb*eT;ev.push({id:ex,x:eS,y:eP}),eS<eu&&(eu=eS),eS>em&&(em=eS),eP<e_&&(e_=eP),eP>eg&&(eg=eP)}let ex=new Set;for(let R of ev)R.x!==eu&&R.x!==em&&R.y!==e_&&R.y!==eg||ex.add(R.id);return ex},R.au=function(R,eh){let eu=Math.abs(2*R.wrap)-+(R.wrap<0),em=Math.abs(2*eh.wrap)-+(eh.wrap<0);return R.overscaledZ-eh.overscaledZ||em-eu||eh.canonical.y-R.canonical.y||eh.canonical.x-R.canonical.x},R.av=class{constructor(R,eh){this.max=R,this.onRemove=eh,this.reset()}reset(){for(let R in this.data)for(let eh of this.data[R])eh.timeout&&clearTimeout(eh.timeout),this.onRemove(eh.value);return this.data={},this.order=[],this}add(R,eh,eu){let em=R.wrapped().key;void 0===this.data[em]&&(this.data[em]=[]);let e_={value:eh,timeout:void 0};if(void 0!==eu&&(e_.timeout=setTimeout(()=>{this.remove(R,e_)},eu)),this.data[em].push(e_),this.order.push(em),this.order.length>this.max){let R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}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){let eh=this.data[R].shift();return eh.timeout&&clearTimeout(eh.timeout),0===this.data[R].length&&delete this.data[R],this.order.splice(this.order.indexOf(R),1),eh.value}getByKey(R){let eh=this.data[R];return eh?eh[0].value:null}get(R){return this.has(R)?this.data[R.wrapped().key][0].value:null}remove(R,eh){if(!this.has(R))return this;let eu=R.wrapped().key,em=void 0===eh?0:this.data[eu].indexOf(eh),e_=this.data[eu][em];return this.data[eu].splice(em,1),e_.timeout&&clearTimeout(e_.timeout),0===this.data[eu].length&&delete this.data[eu],this.onRemove(e_.value),this.order.splice(this.order.indexOf(eu),1),this}setMaxSize(R){for(this.max=R;this.order.length>this.max;){let R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}return this}filter(R){let eh=[];for(let eu in this.data)for(let em of this.data[eu])R(em.value)||eh.push(em);for(let R of eh)this.remove(R.value.tileID,R)}},R.aw=function(R,eh){let eu=0,em=0;if("constant"===R.kind)em=R.layoutSize;else if("source"!==R.kind){let{interpolationType:e_,minZoom:eg,maxZoom:ev}=R,ex=e_?L(mn.interpolationFactor(e_,eh,eg,ev),0,1):0;"camera"===R.kind?em=t1.number(R.minSize,R.maxSize,ex):eu=ex}return{uSizeT:eu,uSize:em}},R.ay=function(R,{uSize:eh,uSizeT:eu},{lowerSize:em,upperSize:e_}){return"source"===R.kind?em/128:"composite"===R.kind?t1.number(em/128,e_/128,eu):eh},R.az=function(R,eh){var eu=eh[0],em=eh[1],e_=eh[2],eg=eh[3],ev=eh[4],ex=eh[5],eb=eh[6],ew=eh[7],eT=eh[8],eS=eh[9],eP=eh[10],eI=eh[11],eM=eh[12],eE=eh[13],eC=eh[14],eA=eh[15],ez=eu*ex-em*ev,eD=eu*eb-e_*ev,ek=eu*ew-eg*ev,eR=em*eb-e_*ex,eL=em*ew-eg*ex,eF=e_*ew-eg*eb,eB=eT*eE-eS*eM,eO=eT*eC-eP*eM,eV=eT*eA-eI*eM,ej=eS*eC-eP*eE,eN=eS*eA-eI*eE,eU=eP*eA-eI*eC,eG=ez*eU-eD*eN+ek*ej+eR*eV-eL*eO+eF*eB;return eG?(R[0]=(ex*eU-eb*eN+ew*ej)*(eG=1/eG),R[1]=(e_*eN-em*eU-eg*ej)*eG,R[2]=(eE*eF-eC*eL+eA*eR)*eG,R[3]=(eP*eL-eS*eF-eI*eR)*eG,R[4]=(eb*eV-ev*eU-ew*eO)*eG,R[5]=(eu*eU-e_*eV+eg*eO)*eG,R[6]=(eC*ek-eM*eF-eA*eD)*eG,R[7]=(eT*eF-eP*ek+eI*eD)*eG,R[8]=(ev*eN-ex*eV+ew*eB)*eG,R[9]=(em*eV-eu*eN-eg*eB)*eG,R[10]=(eM*eL-eE*ek+eA*ez)*eG,R[11]=(eS*ek-eT*eL-eI*ez)*eG,R[12]=(ex*eO-ev*ej-eb*eB)*eG,R[13]=(eu*ej-em*eO+e_*eB)*eG,R[14]=(eE*eD-eM*eR-eC
5*ez)*eG,R[15]=(eT*eR-eS*eD+eP*ez)*eG,R):null},R.b=H,R.b$=Ea,R.b0=function(R){var eh=new e5(3);return eh[0]=R[0],eh[1]=R[1],eh[2]=R[2],eh},R.b1=function(R,eh,eu){return R[0]=eh[0]-eu[0],R[1]=eh[1]-eu[1],R[2]=eh[2]-eu[2],R},R.b2=function(R,eh){var eu=eh[0],em=eh[1],e_=eh[2],eg=eu*eu+em*em+e_*e_;return eg>0&&(eg=1/Math.sqrt(eg)),R[0]=eh[0]*eg,R[1]=eh[1]*eg,R[2]=eh[2]*eg,R},R.b3=w,R.b4=function(R,eh){return R[0]*eh[0]+R[1]*eh[1]+R[2]*eh[2]},R.b5=function(R,eh,eu){return R[0]=eh[0]*eu[0],R[1]=eh[1]*eu[1],R[2]=eh[2]*eu[2],R[3]=eh[3]*eu[3],R},R.b6=g,R.b7=function(R,eh,eu){let em=eh[0]*eu[0]+eh[1]*eu[1]+eh[2]*eu[2];return 0===em?null:(-(R[0]*eu[0]+R[1]*eu[1]+R[2]*eu[2])-eu[3])/em},R.b8=g,R.b9=function(R,eh,eu){return R[0]=eh[0]*eu,R[1]=eh[1]*eu,R[2]=eh[2]*eu,R[3]=eh[3]*eu,R},R.bA=k,R.bB=function(R,eh,eu){var em=eu[0],e_=eu[1],eg=eu[2],ev=eu[3],ex=eh[0],eb=eh[1],ew=eh[2],eT=e_*ew-eg*eb,eS=eg*ex-em*ew,eP=em*eb-e_*ex;return R[0]=ex+ev*(eT+=eT)+e_*(eP+=eP)-eg*(eS+=eS),R[1]=eb+ev*eS+eg*eT-em*eP,R[2]=ew+ev*eP+em*eS-e_*eT,R},R.bC=function(R,eh,eu){var em,e_,eg,ev,ex,eb,ew;let eT=(em=[R[0],R[1],R[2],eh[0],eh[1],eh[2],eu[0],eu[1],eu[2]])[0]*((ew=em[8])*(eg=em[4])-(ev=em[5])*(eb=em[7]))+em[1]*(-ew*(e_=em[3])+ev*(ex=em[6]))+em[2]*(eb*e_-eg*ex);if(0===eT)return null;let eS=w([],[eh[0],eh[1],eh[2]],[eu[0],eu[1],eu[2]]),eP=w([],[eu[0],eu[1],eu[2]],[R[0],R[1],R[2]]),eI=w([],[R[0],R[1],R[2]],[eh[0],eh[1],eh[2]]),eM=b([],eS,-R[3]);return v(eM,eM,b([],eP,-eh[3])),v(eM,eM,b([],eI,-eu[3])),b(eM,eM,1/eT),eM},R.bD=6371008.8,R.bE=function(){return new Float64Array(4)},R.bF=function(R,eh,eu,em){var e_=[],eg=[];return e_[0]=eh[0]-eu[0],e_[1]=eh[1]-eu[1],e_[2]=eh[2]-eu[2],eg[0]=e_[0]*Math.cos(em)-e_[1]*Math.sin(em),eg[1]=e_[0]*Math.sin(em)+e_[1]*Math.cos(em),eg[2]=e_[2],R[0]=eg[0]+eu[0],R[1]=eg[1]+eu[1],R[2]=eg[2]+eu[2],R},R.bG=function(R,eh,eu,em){var e_=[],eg=[];return e_[0]=eh[0]-eu[0],e_[1]=eh[1]-eu[1],e_[2]=eh[2]-eu[2],eg[0]=e_[0],eg[1]=e_[1]*Math.cos(em)-e_[2]*Math.sin(em),eg[2]=e_[1]*Math.sin(em)+e_[2]*Math.cos(em),R[0]=eg[0]+eu[0],R[1]=eg[1]+eu[1],R[2]=eg[2]+eu[2],R},R.bH=function(R,eh,eu,em){var e_=[],eg=[];return e_[0]=eh[0]-eu[0],e_[1]=eh[1]-eu[1],e_[2]=eh[2]-eu[2],eg[0]=e_[2]*Math.sin(em)+e_[0]*Math.cos(em),eg[1]=e_[1],eg[2]=e_[2]*Math.cos(em)-e_[0]*Math.sin(em),R[0]=eg[0]+eu[0],R[1]=eg[1]+eu[1],R[2]=eg[2]+eu[2],R},R.bI=function(R,eh,eu){var em=Math.sin(eu),e_=Math.cos(eu),eg=eh[0],ev=eh[1],ex=eh[2],eb=eh[3],ew=eh[8],eT=eh[9],eS=eh[10],eP=eh[11];return eh!==R&&(R[4]=eh[4],R[5]=eh[5],R[6]=eh[6],R[7]=eh[7],R[12]=eh[12],R[13]=eh[13],R[14]=eh[14],R[15]=eh[15]),R[0]=eg*e_-ew*em,R[1]=ev*e_-eT*em,R[2]=ex*e_-eS*em,R[3]=eb*e_-eP*em,R[8]=eg*em+ew*e_,R[9]=ev*em+eT*e_,R[10]=ex*em+eS*e_,R[11]=eb*em+eP*e_,R},R.bJ=function(R,eh){let eu=D(R,360),em=D(eh,360),e_=em-eu,eg=em>eu?e_-360:e_+360;return Math.abs(e_)<Math.abs(eg)?e_:eg},R.bK=function(R){return R[0]=0,R[1]=0,R[2]=0,R},R.bL=function(R,eh,eu,em){let e_=Math.sqrt(R*R+eh*eh),eg=Math.sqrt(eu*eu+em*em);R/=e_,eh/=e_,eu/=eg,em/=eg;let ev=Math.acos(R*eu+eh*em);return-eh*eu+R*em>0?ev:-ev},R.bM=function(R,eh){let eu=D(R,2*Math.PI),em=D(eh,2*Math.PI);return Math.min(Math.abs(eu-em),Math.abs(eu-em+2*Math.PI),Math.abs(eu-em-2*Math.PI))},R.bN=function(){let R={},eh=t_.$version;for(let eu in t_.$root){let em=t_.$root[eu];if(em.required){let e_=null;null!=(e_="version"===eu?eh:"array"===em.type?[]:{})&&(R[eu]=e_)}}return R},R.bO=ft,R.bP=bs,R.bQ=function t(R,eh){if(Array.isArray(R)){if(!Array.isArray(eh)||R.length!==eh.length)return!1;for(let eu=0;eu<R.length;eu++)if(!t(R[eu],eh[eu]))return!1;return!0}if("object"==typeof R&&null!==R&&null!==eh){if("object"!=typeof eh||Object.keys(R).length!==Object.keys(eh).length)return!1;for(let eu in R)if(!t(R[eu],eh[eu]))return!1;return!0}return R===eh},R.bR=lt,R.bS=function(R){R=R.slice();let eh=Object.create(null);for(let eu=0;eu<R.length;eu++)eh[R[eu].id]=R[eu];for(let eu=0;eu<R.length;eu++)"ref"in R[eu]&&(R[eu]=function(R,eh){let eu={};for(let eh in R)"ref"!==eh&&(eu[eh]=R[eh]);return tg.forEach(R=>{R in eh&&(eu[R]=eh[R])}),eu}(R[eu],eh[R[eu].ref]));return R},R.bT=function(R,eh){if("custom"===R.type)return new Cp(R,eh);switch(R.type){case"background":return new Bp(R,eh);case"circle":return new vl(R,eh);case"color-relief":return new Nl(R,eh);case"fill":return new Pu(R,eh);case"fill-extrusion":return new Ku(R,eh);case"heatmap":return new Pl(R,eh);case"hillshade":return new Bl(R,eh);case"line":return new xh(R,eh);case"raster":return new ro(R,eh);case"symbol":return new Pp(R,eh)}},R.bU=R=>"raster"===R.type,R.bV=j,R.bW=function(R,eh){if(!R)return[{command:"setStyle",args:[eh]}];let eu=[];try{if(!At(R.version,eh.version))return[{command:"setStyle",args:[eh]}];At(R.center,eh.center)||eu.push({command:"setCenter",args:[eh.center]}),At(R.state,eh.state)||eu.push({command:"setGlobalState",args:[eh.state]}),At(R.centerAltitude,eh.centerAltitude)||eu.push({command:"setCenterAltitude",args:[eh.centerAltitude]}),At(R.zoom,eh.zoom)||eu.push({command:"setZoom",args:[eh.zoom]}),At(R.bearing,eh.bearing)||eu.push({command:"setBearing",args:[eh.bearing]}),At(R.pitch,eh.pitch)||eu.push({command:"setPitch",args:[eh.pitch]}),At(R.roll,eh.roll)||eu.push({command:"setRoll",args:[eh.roll]}),At(R.sprite,eh.sprite)||eu.push({command:"setSprite",args:[eh.sprite]}),At(R.glyphs,eh.glyphs)||eu.push({command:"setGlyphs",args:[eh.glyphs]}),At(R.transition,eh.transition)||eu.push({command:"setTransition",args:[eh.transition]}),At(R.light,eh.light)||eu.push({command:"setLight",args:[eh.light]}),At(R.terrain,eh.terrain)||eu.push({command:"setTerrain",args:[eh.terrain]}),At(R.sky,eh.sky)||eu.push({command:"setSky",args:[eh.sky]}),At(R.projection,eh.projection)||eu.push({command:"setProjection",args:[eh.projection]});let em={},e_=[];!function(R,eh,eu,em){let e_;
5for(e_ in eh=eh||{},R=R||{})Object.prototype.hasOwnProperty.call(R,e_)&&(Object.prototype.hasOwnProperty.call(eh,e_)||It(e_,eu,em));for(e_ in eh){var eg,ev;Object.prototype.hasOwnProperty.call(eh,e_)&&(Object.prototype.hasOwnProperty.call(R,e_)?At(R[e_],eh[e_])||("geojson"===R[e_].type&&"geojson"===eh[e_].type&&function(R,eh,eu){let em;for(em in R[eu])if(Object.prototype.hasOwnProperty.call(R[eu],em)&&"data"!==em&&!At(R[eu][em],eh[eu][em]))return!1;for(em in eh[eu])if(Object.prototype.hasOwnProperty.call(eh[eu],em)&&"data"!==em&&!At(R[eu][em],eh[eu][em]))return!1;return!0}(R,eh,e_)?Mt(eu,{command:"setGeoJSONSourceData",args:[e_,eh[e_].data]}):(eg=e_,ev=eh,It(eg,eu,em),kt(eg,ev,eu))):kt(e_,eh,eu))}}(R.sources,eh.sources,e_,em);let eg=[];R.layers&&R.layers.forEach(R=>{"source"in R&&em[R.source]?eu.push({command:"removeLayer",args:[R.id]}):eg.push(R)}),eu=eu.concat(e_),function(R,eh,eu){let em,e_,eg,ev,ex;eh=eh||[];let eb=(R=R||[]).map(Pt),ew=eh.map(Pt),eT=R.reduce(Dt,{}),eS=eh.reduce(Dt,{}),eP=eb.slice(),eI=Object.create(null);for(let R=0,eh=0;R<eb.length;R++)em=eb[R],Object.prototype.hasOwnProperty.call(eS,em)?eh++:(Mt(eu,{command:"removeLayer",args:[em]}),eP.splice(eP.indexOf(em,eh),1));for(let R=0,eh=0;R<ew.length;R++)em=ew[ew.length-1-R],eP[eP.length-1-R]!==em&&(Object.prototype.hasOwnProperty.call(eT,em)?(Mt(eu,{command:"removeLayer",args:[em]}),eP.splice(eP.lastIndexOf(em,eP.length-eh),1)):eh++,ev=eP[eP.length-R],Mt(eu,{command:"addLayer",args:[eS[em],ev]}),eP.splice(eP.length-R,0,em),eI[em]=!0);for(let R=0;R<ew.length;R++)if(e_=eT[em=ew[R]],eg=eS[em],!eI[em]&&!At(e_,eg)){if(At(e_.source,eg.source)&&At(e_["source-layer"],eg["source-layer"])&&At(e_.type,eg.type)){for(ex in Ft(e_.layout,eg.layout,eu,em,null,"setLayoutProperty"),Ft(e_.paint,eg.paint,eu,em,null,"setPaintProperty"),At(e_.filter,eg.filter)||Mt(eu,{command:"setFilter",args:[em,eg.filter]}),At(e_.minzoom,eg.minzoom)&&At(e_.maxzoom,eg.maxzoom)||Mt(eu,{command:"setLayerZoomRange",args:[em,eg.minzoom,eg.maxzoom]}),e_)Object.prototype.hasOwnProperty.call(e_,ex)&&"layout"!==ex&&"paint"!==ex&&"filter"!==ex&&"metadata"!==ex&&"minzoom"!==ex&&"maxzoom"!==ex&&(0===ex.indexOf("paint.")?Ft(e_[ex],eg[ex],eu,em,ex.slice(6),"setPaintProperty"):At(e_[ex],eg[ex])||Mt(eu,{command:"setLayerProperty",args:[em,ex,eg[ex]]}));for(ex in eg)Object.prototype.hasOwnProperty.call(eg,ex)&&!Object.prototype.hasOwnProperty.call(e_,ex)&&"layout"!==ex&&"paint"!==ex&&"filter"!==ex&&"metadata"!==ex&&"minzoom"!==ex&&"maxzoom"!==ex&&(0===ex.indexOf("paint.")?Ft(e_[ex],eg[ex],eu,em,ex.slice(6),"setPaintProperty"):At(e_[ex],eg[ex])||Mt(eu,{command:"setLayerProperty",args:[em,ex,eg[ex]]}))}else Mt(eu,{command:"removeLayer",args:[em]}),ev=eP[eP.lastIndexOf(em)+1],Mt(eu,{command:"addLayer",args:[eg,ev]})}}(eg,eh.layers,eu)}catch(R){console.warn("Unable to compute style diff:",R),eu=[{command:"setStyle",args:[eh]}]}return eu},R.bX=function(R){let eh=[],eu=R.id;return void 0===eu&&eh.push({message:`layers.${eu}: missing required property "id"`}),void 0===R.render&&eh.push({message:`layers.${eu}: missing required method "render"`}),R.renderingMode&&"2d"!==R.renderingMode&&"3d"!==R.renderingMode&&eh.push({message:`layers.${eu}: property "renderingMode" must be either "2d" or "3d"`}),eh},R.bY=N,R.bZ=U,R.b_=class extends Ma{constructor(R,eh){super(R,eh),this.current=0}set(R){this.current!==R&&(this.current=R,this.gl.uniform1i(this.location,R))}},R.ba=function(R,eh){return R[0]*eh[0]+R[1]*eh[1]+R[2]*eh[2]+R[3]},R.bb=Kp,R.bc=Qp,R.bd=function(R,eh,eu,em,e_){var eg=1/Math.tan(eh/2);if(R[0]=eg/eu,R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=eg,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[11]=-1,R[12]=0,R[13]=0,R[15]=0,null!=e_&&e_!==1/0){var ev=1/(em-e_);R[10]=(e_+em)*ev,R[14]=2*e_*em*ev}else R[10]=-1,R[14]=-2*em;return R},R.be=function(R){var eh=new e5(16);return eh[0]=R[0],eh[1]=R[1],eh[2]=R[2],eh[3]=R[3],eh[4]=R[4],eh[5]=R[5],eh[6]=R[6],eh[7]=R[7],eh[8]=R[8],eh[9]=R[9],eh[10]=R[10],eh[11]=R[11],eh[12]=R[12],eh[13]=R[13],eh[14]=R[14],eh[15]=R[15],eh},R.bf=function(R,eh,eu){var em=Math.sin(eu),e_=Math.cos(eu),eg=eh[0],ev=eh[1],ex=eh[2],eb=eh[3],ew=eh[4],eT=eh[5],eS=eh[6],eP=eh[7];return eh!==R&&(R[8]=eh[8],R[9]=eh[9],R[10]=eh[10],R[11]=eh[11],R[12]=eh[12],R[13]=eh[13],R[14]=eh[14],R[15]=eh[15]),R[0]=eg*e_+ew*em,R[1]=ev*e_+eT*em,R[2]=ex*e_+eS*em,R[3]=eb*e_+eP*em,R[4]=ew*e_-eg*em,R[5]=eT*e_-ev*em,R[6]=eS*e_-ex*em,R[7]=eP*e_-eb*em,R},R.bg=function(R,eh,eu){var em=Math.sin(eu),e_=Math.cos(eu),eg=eh[4],ev=eh[5],ex=eh[6],eb=eh[7],ew=eh[8],eT=eh[9],eS=eh[10],eP=eh[11];return eh!==R&&(R[0]=eh[0],R[1]=eh[1],R[2]=eh[2],R[3]=eh[3],R[12]=eh[12],R[13]=eh[13],R[14]=eh[14],R[15]=eh[15]),R[4]=eg*e_+ew*em,R[5]=ev*e_+eT*em,R[6]=ex*e_+eS*em,R[7]=eb*e_+eP*em,R[8]=ew*e_-eg*em,R[9]=eT*e_-ev*em,R[10]=eS*e_-ex*em,R[11]=eP*e_-eb*em,R},R.bh=function(){let R=new Float32Array(16);return y(R),R},R.bi=function(){let R=new Float64Array(16);return y(R),R},R.bj=function(){return new Float64Array(16)},R.bk=function(R,eh,eu){let em=new Float64Array(4);return k(em,R,eh-90,eu),em},R.bl=function(R,eh,eu,em){var e_,eg,ev,ex,eb,ew=eh[0],eT=eh[1],eS=eh[2],eP=eh[3],eI=eu[0],eM=eu[1],eE=eu[2],eC=eu[3];return(eg=ew*eI+eT*eM+eS*eE+eP*eC)<0&&(eg=-eg,eI=-eI,eM=-eM,eE=-eE,eC=-eC),1-eg>1e-6?(ev=Math.sin(e_=Math.acos(eg)),ex=Math.sin((1-em)*e_)/ev,eb=Math.sin(em*e_)/ev):(ex=1-em,eb=em),R[0]=ex*ew+eb*eI,R[1]=ex*eT+eb*eM,R[2]=ex*eS+eb*eE,R[3]=ex*eP+eb*eC,R},R.bm=function(R){var eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC;let eA,ez;let eD=new Float64Array(9);
5eb=(eh=R[0])*(eg=eh+eh),ew=(eu=R[1])*eg,eS=(em=R[2])*eg,eP=em*(ev=eu+eu),eM=(e_=R[3])*eg,eE=e_*ev,eC=e_*(ex=em+em),eD[0]=1-(eT=eu*ev)-(eI=em*ex),eD[3]=ew-eC,eD[6]=eS+eE,eD[1]=ew+eC,eD[4]=1-eb-eI,eD[7]=eP-eM,eD[2]=eS-eE,eD[5]=eP+eM,eD[8]=1-eb-eT;let ek=nt(-Math.asin(L(eD[2],-1,1)));return .001>Math.hypot(eD[5],eD[8])?(eA=0,ez=-nt(Math.atan2(eD[3],eD[4]))):(eA=nt(0===eD[5]&&0===eD[8]?0:Math.atan2(eD[5],eD[8])),ez=nt(0===eD[1]&&0===eD[0]?0:Math.atan2(eD[1],eD[0]))),{roll:eA,pitch:ek+90,bearing:ez}},R.bn=function(R,eh){return R.roll==eh.roll&&R.pitch==eh.pitch&&R.bearing==eh.bearing},R.bo=Te,R.bp=ka,R.bq=-32768,R.br=32767,R.bs=gu,R.bt=z,R.bu=B,R.bv=Ne,R.bw=function(R,eh,eu,em,e_){return z(em,e_,L((R-eh)/(eu-eh),0,1))},R.bx=function(R,eh,eu,em){return R[0]=eh[0]+eu[0]*em,R[1]=eh[1]+eu[1]*em,R[2]=eh[2]+eu[2]*em,R},R.by=D,R.bz=function(){return new Float64Array(3)},R.c=tc,R.c$=si,R.c0=class extends Ma{constructor(R,eh){super(R,eh),this.current=iZ}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 eh=1;eh<16;eh++)if(R[eh]!==this.current[eh]){this.current=R,this.gl.uniformMatrix4fv(this.location,!1,R);break}}},R.c1=Ia,R.c2=class extends Ma{constructor(R,eh){super(R,eh),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]))}},R.c3=class extends Ma{constructor(R,eh){super(R,eh),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]))}},R.c4=d,R.c5=function(R,eh){var eu=Math.sin(eh),em=Math.cos(eh);return R[0]=em,R[1]=eu,R[2]=0,R[3]=-eu,R[4]=em,R[5]=0,R[6]=0,R[7]=0,R[8]=1,R},R.c6=function(R,eh,eu){var em=eh[0],e_=eh[1],eg=eh[2];return R[0]=em*eu[0]+e_*eu[3]+eg*eu[6],R[1]=em*eu[1]+e_*eu[4]+eg*eu[7],R[2]=em*eu[2]+e_*eu[5]+eg*eu[8],R},R.c7=function(R,eh,eu,em,e_,eg,ev){var ex=1/(eh-eu),eb=1/(em-e_),ew=1/(eg-ev);return R[0]=-2*ex,R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=-2*eb,R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[10]=2*ew,R[11]=0,R[12]=(eh+eu)*ex,R[13]=(e_+em)*eb,R[14]=(ev+eg)*ew,R[15]=1,R},R.c8=class extends Ma{constructor(R,eh){super(R,eh),this.current=[]}set(R){if(R!=this.current){this.current=R;let eh=new Float32Array(4*R.length);for(let eu=0;eu<R.length;eu++)eh[4*eu]=R[eu].r,eh[4*eu+1]=R[eu].g,eh[4*eu+2]=R[eu].b,eh[4*eu+3]=R[eu].a;this.gl.uniform4fv(this.location,eh)}}},R.c9=class extends Ma{constructor(R,eh){super(R,eh),this.current=[]}set(R){if(R!=this.current){this.current=R;let eh=new Float32Array(R);this.gl.uniform1fv(this.location,eh)}}},R.cA=function(R,eh){return tl[eh]&&"touches"in R},R.cB=function(R){return tl[R]||th[R]},R.cC=function(R,eh,eu){var em=eh[0],e_=eh[1];return R[0]=eu[0]*em+eu[4]*e_+eu[12],R[1]=eu[1]*em+eu[5]*e_+eu[13],R},R.cD=function(R,eh){let{x:eu,y:em}=Zp.fromLngLat(eh);return!(R<0||R>25||em<0||em>=1||eu<0||eu>=1)},R.cE=function(R,eh){return R[0]=eh[0],R[1]=0,R[2]=0,R[3]=0,R[4]=0,R[5]=eh[1],R[6]=0,R[7]=0,R[8]=0,R[9]=0,R[10]=eh[2],R[11]=0,R[12]=0,R[13]=0,R[14]=0,R[15]=1,R},R.cF=class extends co{},R.cG=pt,R.cH=function(R,eh){tc.REGISTERED_PROTOCOLS[R]=eh},R.cI=function(R){delete tc.REGISTERED_PROTOCOLS[R]},R.cJ=function(R,eh){let eu={};for(let em=0;em<R.length;em++){let e_=eh&&eh[R[em].id]||function(R){let eh="";for(let eu of tg)eh+=`/${function Si(R){let eh=typeof R;if("number"===eh||"boolean"===eh||"string"===eh||null==R)return JSON.stringify(R);if(Array.isArray(R)){let eh="[";for(let eu of R)eh+=`${Si(eu)},`;return`${eh}]`}let eu=Object.keys(R).sort(),em="{";for(let eh=0;eh<eu.length;eh++)em+=`${JSON.stringify(eu[eh])}:${Si(R[eu[eh]])},`;return`${em}}`}(R[eu])}`;return eh}(R[em]);eh&&(eh[R[em].id]=e_);let eg=eu[e_];eg||(eg=eu[e_]=[]),eg.push(R[em])}let em=[];for(let R in eu)em.push(eu[R]);return em},R.cK=ds,R.cL=ef,R.cM=oy,R.cN=rp,R.cO=function(eh){var eu,em;eh.bucket.createArrays(),eh.bucket.tilePixelRatio=8192/(512*eh.bucket.overscaling),eh.bucket.compareText={},eh.bucket.iconsNeedLinear=!1;let e_=eh.bucket.layers[0],eg=e_.layout,ev=e_._unevaluatedLayout._values,ex={layoutIconSize:ev["icon-size"].possiblyEvaluate(new Cs(eh.bucket.zoom+1),eh.canonical),layoutTextSize:ev["text-size"].possiblyEvaluate(new Cs(eh.bucket.zoom+1),eh.canonical),textMaxSize:ev["text-size"].possiblyEvaluate(new Cs(18))};
5if("composite"===eh.bucket.textSizeData.kind){let{minZoom:R,maxZoom:eu}=eh.bucket.textSizeData;ex.compositeTextSizes=[ev["text-size"].possiblyEvaluate(new Cs(R),eh.canonical),ev["text-size"].possiblyEvaluate(new Cs(eu),eh.canonical)]}if("composite"===eh.bucket.iconSizeData.kind){let{minZoom:R,maxZoom:eu}=eh.bucket.iconSizeData;ex.compositeIconSizes=[ev["icon-size"].possiblyEvaluate(new Cs(R),eh.canonical),ev["icon-size"].possiblyEvaluate(new Cs(eu),eh.canonical)]}let eb=24*eg.get("text-line-height"),ew="viewport"!==eg.get("text-rotation-alignment")&&"point"!==eg.get("symbol-placement"),eT=eg.get("text-keep-upright"),eS=eg.get("text-size");for(let ev of eh.bucket.features){let eP=eg.get("text-font").evaluate(ev,{},eh.canonical).join(","),eI=eS.evaluate(ev,{},eh.canonical),eM=ex.layoutTextSize.evaluate(ev,{},eh.canonical),eE=ex.layoutIconSize.evaluate(ev,{},eh.canonical),eC={horizontal:{},vertical:void 0},eA=ev.text,ez,eD=[0,0];if(eA){let eu=eA.toString(),em=24*eg.get("text-letter-spacing").evaluate(ev,{},eh.canonical),ex=!function(R){for(let eu of R){var eh;if(eh=eu.codePointAt(0),iI.test(String.fromCodePoint(eh)))return!1}return!0}(eu)?0:em,eS=eg.get("text-anchor").evaluate(ev,{},eh.canonical),eE=Vy(e_,ev,eh.canonical);if(!eE){let R=eg.get("text-radial-offset").evaluate(ev,{},eh.canonical);eD=R?Cy(eS,[24*R,rV]):eg.get("text-offset").evaluate(ev,{},eh.canonical).map(R=>24*R)}let ez=ew?"center":eg.get("text-justify").evaluate(ev,{},eh.canonical),ek="point"===eg.get("symbol-placement")?24*eg.get("text-max-width").evaluate(ev,{},eh.canonical):1/0,w=()=>{eh.bucket.allowVerticalPlacement&&As(eu)&&(eC.vertical=sp(eA,eh.glyphMap,eh.glyphPositions,eh.imagePositions,eP,ek,eb,eS,"left",ex,eD,R.ax.vertical,!0,eM,eI))};if(!ew&&eE){let eu=new Set;if("auto"===ez)for(let R=0;R<eE.values.length;R+=2)eu.add(Ly(eE.values[R]));else eu.add(ez);let em=!1;for(let e_ of eu)if(!eC.horizontal[e_]){if(em)eC.horizontal[e_]=eC.horizontal[0];else{let eu=sp(eA,eh.glyphMap,eh.glyphPositions,eh.imagePositions,eP,ek,eb,"center",e_,ex,eD,R.ax.horizontal,!1,eM,eI);eu&&(eC.horizontal[e_]=eu,em=1===eu.positionedLines.length)}}w()}else{"auto"===ez&&(ez=Ly(eS));let em=sp(eA,eh.glyphMap,eh.glyphPositions,eh.imagePositions,eP,ek,eb,eS,ez,ex,eD,R.ax.horizontal,!1,eM,eI);em&&(eC.horizontal[ez]=em),w(),As(eu)&&ew&&eT&&(eC.vertical=sp(eA,eh.glyphMap,eh.glyphPositions,eh.imagePositions,eP,ek,eb,eS,ez,ex,eD,R.ax.vertical,!1,eM,eI))}}let ek=!1;if(null===(eu=ev.icon)||void 0===eu?void 0:eu.name){let R=eh.imageMap[ev.icon.name];R&&(ez=function(R,eh,eu){let{horizontalAlign:em,verticalAlign:e_}=op(eu),eg=eh[0]-R.displaySize[0]*em,ev=eh[1]-R.displaySize[1]*e_;return{image:R,top:ev,bottom:ev+R.displaySize[1],left:eg,right:eg+R.displaySize[0]}}(eh.imagePositions[ev.icon.name],eg.get("icon-offset").evaluate(ev,{},eh.canonical),eg.get("icon-anchor").evaluate(ev,{},eh.canonical)),ek=!!R.sdf,void 0===eh.bucket.sdfIcons?eh.bucket.sdfIcons=ek:eh.bucket.sdfIcons!==ek&&G("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==eh.bucket.pixelRatio||0!==eg.get("icon-rotate").constantOr(1))&&(eh.bucket.iconsNeedLinear=!0))}let eR=Ry(eC.horizontal)||eC.vertical;(em=eh.bucket).iconsInText||(em.iconsInText=!!eR&&eR.iconsInText),(eR||ez)&&function(eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI,eM=ev.textMaxSize.evaluate(eu,{});void 0===eM&&(eM=ex);let eE=eh.layers[0].layout,eC=eE.get("icon-offset").evaluate(eu,{},eS),eA=Ry(em.horizontal),ez=ex/24,eD=eh.tilePixelRatio*ez,ek=eh.tilePixelRatio*eM/24,eR=eh.tilePixelRatio*eb,eL=eh.tilePixelRatio*eE.get("symbol-spacing"),eF=eE.get("text-padding")*eh.tilePixelRatio,eB=function(R,eh,eu,em=1){let e_=R.get("icon-padding").evaluate(eh,{},eu),eg=null==e_?void 0:e_.values;return[eg[0]*em,eg[1]*em,eg[2]*em,eg[3]*em]}(eE,eu,eS,eh.tilePixelRatio),eO=eE.get("text-max-angle")/180*Math.PI,eV="viewport"!==eE.get("text-rotation-alignment")&&"point"!==eE.get("symbol-placement"),ej="map"===eE.get("icon-rotation-alignment")&&"point"!==eE.get("symbol-placement"),eN=eE.get("symbol-placement"),eU=eL/2,eG=eE.get("icon-text-fit");e_&&"none"!==eG&&(eh.allowVerticalPlacement&&em.vertical&&(eI=yp(e_,em.vertical,eG,eE.get("icon-text-fit-padding"),eC,ez)),eA&&(e_=yp(e_,eA,eG,eE.get("icon-text-fit-padding"),eC,ez)));let e$=eS?eP.line.getGranularityForZoomLevel(eS.z):1,z=(eb,eP)=>{eP.x<0||eP.x>=8192||eP.y<0||eP.y>=8192||function(eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek,eR,eL,eF,eB,eO){let eV=eh.addToLineVertexArray(eu,em),ej,eN,eU,eG,e$=0,eZ=0,eq=0,eW=0,eX=-1,eH=-1,eY={},eJ=i$("");
5if(eh.allowVerticalPlacement&&e_.vertical){let R=eb.layout.get("text-rotate").evaluate(eR,{},eB)+90;eU=new Ey(ew,eu,eT,eS,eP,e_.vertical,eI,eM,eE,R),ex&&(eG=new Ey(ew,eu,eT,eS,eP,ex,eA,ez,eE,R))}if(eg){let em=eb.layout.get("icon-rotate").evaluate(eR,{}),e_="none"!==eb.layout.get("icon-text-fit"),ev=Sy(eg,em,eF,e_),eI=ex?Sy(ex,em,eF,e_):void 0;eN=new Ey(ew,eu,eT,eS,eP,eg,eA,ez,!1,em),e$=4*ev.length;let eM=eh.iconSizeData,eE=null;"source"===eM.kind?(eE=[128*eb.layout.get("icon-size").evaluate(eR,{})])[0]>32640&&G(`${eh.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===eM.kind&&((eE=[128*eL.compositeIconSizes[0].evaluate(eR,{},eB),128*eL.compositeIconSizes[1].evaluate(eR,{},eB)])[0]>32640||eE[1]>32640)&&G(`${eh.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),eh.addSymbols(eh.icon,ev,eE,ek,eD,eR,R.ax.none,eu,eV.lineStartIndex,eV.lineLength,-1,eB),eX=eh.icon.placedSymbolArray.length-1,eI&&(eZ=4*eI.length,eh.addSymbols(eh.icon,eI,eE,ek,eD,eR,R.ax.vertical,eu,eV.lineStartIndex,eV.lineLength,-1,eB),eH=eh.icon.placedSymbolArray.length-1)}let eK=Object.keys(e_.horizontal);for(let em of eK){let eg=e_.horizontal[em];if(!ej){eJ=i$(eg.text);let R=eb.layout.get("text-rotate").evaluate(eR,{},eB);ej=new Ey(ew,eu,eT,eS,eP,eg,eI,eM,eE,R)}let ex=1===eg.positionedLines.length;if(eq+=$y(eh,eu,eg,ev,eb,eE,eR,eC,eV,e_.vertical?R.ax.horizontal:R.ax.horizontalOnly,ex?eK:[em],eY,eX,eL,eB),ex)break}e_.vertical&&(eW+=$y(eh,eu,e_.vertical,ev,eb,eE,eR,eC,eV,R.ax.vertical,["vertical"],eY,eH,eL,eB));let eQ=ej?ej.boxStartIndex:eh.collisionBoxArray.length,e0=ej?ej.boxEndIndex:eh.collisionBoxArray.length,e1=eU?eU.boxStartIndex:eh.collisionBoxArray.length,e2=eU?eU.boxEndIndex:eh.collisionBoxArray.length,e3=eN?eN.boxStartIndex:eh.collisionBoxArray.length,e5=eN?eN.boxEndIndex:eh.collisionBoxArray.length,e4=eG?eG.boxStartIndex:eh.collisionBoxArray.length,e6=eG?eG.boxEndIndex:eh.collisionBoxArray.length,e8=-1,W=(R,eh)=>(null==R?void 0:R.circleDiameter)?Math.max(R.circleDiameter,eh):eh;e8=W(ej,e8),e8=W(eU,e8),e8=W(eN,e8),e8=W(eG,e8);let e7=e8>-1?1:0;e7&&(e8*=eO/24),eh.glyphOffsetArray.length>=kp.MAX_GLYPHS&&G("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==eR.sortKey&&eh.addToSortKeyRanges(eh.symbolInstances.length,eR.sortKey);let e9=Vy(eb,eR,eB),[tl,th]=function(eh,eu){let em=eh.length,e_=null==eu?void 0:eu.values;if((null==e_?void 0:e_.length)>0)for(let eu=0;eu<e_.length;eu+=2){let em=e_[eu+1];eh.emplaceBack(R.aN[e_[eu]],em[0],em[1])}return[em,eh.length]}(eh.textAnchorOffsets,e9);eh.symbolInstances.emplaceBack(eu.x,eu.y,eY.right>=0?eY.right:-1,eY.center>=0?eY.center:-1,eY.left>=0?eY.left:-1,eY.vertical||-1,eX,eH,eJ,eQ,e0,e1,e2,e3,e5,e4,e6,eT,eq,eW,e$,eZ,e7,0,eI,e8,tl,th)}(eh,eP,eb,em,e_,eg,eI,eh.layers[0],eh.collisionBoxArray,eu.index,eu.sourceLayerIndex,eh.index,eD,[eF,eF,eF,eF],eV,ew,eR,eB,ej,eC,eu,ev,eT,eS,ex)};if("line"===eN)for(let R of uy(eu.geometry,0,0,8192,8192)){let eu=Su(R,e$),eg=function(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=em?.6*eg*ev:0,eT=vy(em,e_),eS=eT*ev,eP=0===R[0].x||R[0].x===eb||0===R[0].y||R[0].y===eb;return eh-eS<eh/4&&(eh=eS+eh/4),function _y(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=eg/2,eT=gy(R),eS=0,eP=eh-eu,eI=[];for(let eh=0;eh<R.length-1;eh++){let ev=R[eh],ex=R[eh+1],eM=ev.dist(ex),eE=ex.angleTo(ev);for(;eP+eu<eS+eM;){eP+=eu;let eC=(eP-eS)/eM,eA=t1.number(ev.x,ex.x,eC),ez=t1.number(ev.y,ex.y,eC);if(eA>=0&&eA<eb&&ez>=0&&ez<eb&&eP-ew>=0&&eP+ew<=eT){let eu=new yy(eA,ez,eE,eh);eu._round(),em&&!my(R,eu,eg,em,e_)||eI.push(eu)}}eS+=eM}return ex||eI.length||ev||(eI=_y(R,eS/2,eu,em,e_,eg,ev,!0,eb)),eI}(R,eP?eh/2*ex%eh:(eT/2+2*eg)*ev*ex%eh,eh,ew,eu,eS,eP,!1,eb)}(eu,eL,eO,em.vertical||eA,e_,24,ek,eh.overscaling,8192);for(let R of eg)eA&&function(R,eh,eu,em){let e_=R.compareText;if(eh in e_){let R=e_[eh];for(let eh=R.length-1;eh>=0;eh--)if(em.dist(R[eh])<eu)return!0}else e_[eh]=[];return e_[eh].push(em),!1}(eh,eA.text,eU,R)||z(eu,R)}else if("line-center"===eN){for(let R of eu.geometry)if(R.length>1){let eh=Su(R,e$),eu=function(R,eh,eu,em,e_,eg){let ev=eu?.6*24*eg:0,ex=vy(eu,em)*eg,eb=0,ew=gy(R)/2;for(let eu=0;eu<R.length-1;eu++){let em=R[eu],e_=R[eu+1],eg=em.dist(e_);if(eb+eg>ew){let eT=(ew-eb)/eg,eS=t1.number(em.x,e_.x,eT),eP=t1.number(em.y,e_.y,eT),eI=new yy(eS,eP,e_.angleTo(em),eu);
5return eI._round(),!ev||my(R,eI,ex,ev,eh)?eI:void 0}eb+=eg}}(eh,eO,em.vertical||eA,e_,0,ek);eu&&z(eh,eu)}}else if("Polygon"===eu.type)for(let R of rr(eu.geometry,0)){let eh=function(R,eh=1){let eu=tf.fromPoints(R[0]),em=Math.min(eu.width(),eu.height()),e_=em/2,eg=new Ty([],Py),{minX:ev,minY:ex,maxX:eb,maxY:ew}=eu;if(0===em)return new n(ev,ex);for(let eh=ev;eh<eb;eh+=em)for(let eu=ex;eu<ew;eu+=em)eg.push(new Dy(eh+e_,eu+e_,e_,R));let eT=function(R){let eh=0,eu=0,em=0,e_=R[0];for(let R=0,eg=e_.length,ev=eg-1;R<eg;ev=R++){let eg=e_[R],ex=e_[ev],eb=eg.x*ex.y-ex.x*eg.y;eu+=(eg.x+ex.x)*eb,em+=(eg.y+ex.y)*eb,eh+=3*eb}return new Dy(eu/eh,em/eh,0,R)}(R),eS=eT;for(;eg.length;){let eu=eg.pop();(eu.d>eS.d||!eS.d)&&(eS=eu),eu.max-eS.d<=eh||(e_=eu.h/2,eg.push(new Dy(eu.p.x-e_,eu.p.y-e_,e_,R)),eg.push(new Dy(eu.p.x+e_,eu.p.y-e_,e_,R)),eg.push(new Dy(eu.p.x-e_,eu.p.y+e_,e_,R)),eg.push(new Dy(eu.p.x+e_,eu.p.y+e_,e_,R)))}return eT.d>0&&eS.d-eT.d<=eh?eT.p:eS.p}(R,16);z(Su(R[0],e$,!0),new yy(eh.x,eh.y,0))}else if("LineString"===eu.type)for(let R of eu.geometry){let eh=Su(R,e$);z(eh,new yy(eh[0].x,eh[0].y,0))}else if("Point"===eu.type)for(let R of eu.geometry)for(let eh of R)z([eh],new yy(eh.x,eh.y,0))}(eh.bucket,ev,eC,ez,eh.imageMap,ex,eM,eE,eD,ek,eh.canonical,eh.subdivisionGranularity)}eh.showCollisionBoxes&&eh.bucket.generateCollisionDebugBuffers()},R.cP=Iu,R.cQ=Gu,R.cR=ph,R.cS=function(R,eh=""){let eu=new Rh;return function(R,eh,eu=""){for(let em in R.layers)eh.writeMessage(3,(R,eh)=>(function(R,eh,eu=""){eh.writeVarintField(15,R.version||1),eh.writeStringField(1,R.name||""),eh.writeVarintField(5,R.extent||4096);let em={jsonPrefix:eu,keys:[],values:[],keycache:{},valuecache:{}};for(let eu=0;eu<R.length;eu++)em.feature=R.feature(eu),eh.writeMessage(2,ty,em);let e_=em.keys;for(let R of e_)eh.writeStringField(3,R);let eg=em.values;for(let R of eg)eh.writeMessage(4,sy,R)})(R,eh,eu),R.layers[em])}(R,eu,eh),eu.finish()},R.cT=function(R,eh,eu,em,e_,eg){let ev=cy(R,eh,eu,e_,0);return cy(ev,eh,em,eg,1)},R.cU=class{constructor(R){this.maxEntries=R,this.map=new Map}get(R){let eh=this.map.get(R);return void 0!==eh&&(this.map.delete(R),this.map.set(R,eh)),eh}set(R,eh){if(this.map.has(R))this.map.delete(R);else if(this.map.size>=this.maxEntries){let R=this.map.keys().next().value;this.map.delete(R)}this.map.set(R,eh)}clear(){this.map.clear()}},R.cV=Nu,R.cW=Rh,R.cX=Wd,R.cY=function(R,eh,eu,eg,ev){return e(this,void 0,void 0,function*(){if(h())try{return yield K(R,eh,eu,eg,ev)}catch(R){}return function(R,eh,eu,eg,ev){let ex=R.width,eb=R.height;em&&e_||(e_=(em=new OffscreenCanvas(ex,eb)).getContext("2d",{willReadFrequently:!0})),em.width=ex,em.height=eb,e_.drawImage(R,0,0,ex,eb);let ew=e_.getImageData(eh,eu,eg,ev);return e_.clearRect(0,0,ex,eb),ew.data}(R,eh,eu,eg,ev)})},R.cZ=$l,R.c_=class{constructor(R,eh){this.layers={[rO]:this},this.name=rO,this.version=eh?eh.version:1,this.extent=eh?eh.extent:4096,this.length=R.length,this.features=R}feature(R){return new Kd(this.features[R],this.extent)}},R.ca=class extends So{},R.cb=rT,R.cc=class extends Mo{},R.cd=iH,R.ce=function(R){return R<=1?1:Math.pow(2,Math.ceil(Math.log(R)/Math.LN2))},R.cf=Tl,R.cg=function(R,eh,eu){var em=eh[0],e_=eh[1],eg=eh[2],ev=eu[3]*em+eu[7]*e_+eu[11]*eg+eu[15];return R[0]=(eu[0]*em+eu[4]*e_+eu[8]*eg+eu[12])/(ev=ev||1),R[1]=(eu[1]*em+eu[5]*e_+eu[9]*eg+eu[13])/ev,R[2]=(eu[2]*em+eu[6]*e_+eu[10]*eg+eu[14])/ev,R},R.ch=class extends ho{},R.ci=class extends Do{},R.cj=function(R,eh){return R[0]===eh[0]&&R[1]===eh[1]&&R[2]===eh[2]&&R[3]===eh[3]&&R[4]===eh[4]&&R[5]===eh[5]&&R[6]===eh[6]&&R[7]===eh[7]&&R[8]===eh[8]&&R[9]===eh[9]&&R[10]===eh[10]&&R[11]===eh[11]&&R[12]===eh[12]&&R[13]===eh[13]&&R[14]===eh[14]&&R[15]===eh[15]},R.ck=function(R,eh){var eu=R[0],em=R[1],e_=R[2],eg=R[3],ev=R[4],ex=R[5],eb=R[6],ew=R[7],eT=R[8],eS=R[9],eP=R[10],eI=R[11],eM=R[12],eE=R[13],eC=R[14],eA=R[15],ez=eh[0],eD=eh[1],ek=eh[2],eR=eh[3],eL=eh[4],eF=eh[5],eB=eh[6],eO=eh[7],eV=eh[8],ej=eh[9],eN=eh[10],eU=eh[11],eG=eh[12],e$=eh[13],eZ=eh[14],eq=eh[15];return Math.abs(eu-ez)<=1e-6*Math.max(1,Math.abs(eu),Math.abs(ez))&&Math.abs(em-eD)<=1e-6*Math.max(1,Math.abs(em),Math.abs(eD))&&Math.abs(e_-ek)<=1e-6*Math.max(1,Math.abs(e_),Math.abs(ek))&&Math.abs(eg-eR)<=1e-6*Math.max(1,Math.abs(eg),Math.abs(eR))&&Math.abs(ev-eL)<=1e-6*Math.max(1,Math.abs(ev),Math.abs(eL))&&Math.abs(ex-eF)<=1e-6*Math.max(1,Math.abs(ex),Math.abs(eF))&&Math.abs(eb-eB)<=1e-6*Math.max(1,Math.abs(eb),Math.abs(eB))&&Math.abs(ew-eO)<=1e-6*Math.max(1,Math.abs(ew),Math.abs(eO))&&Math.abs(eT-eV)<=1e-6*Math.max(1,Math.abs(eT),Math.abs(eV))&&Math.abs(eS-ej)<=1e-6*Math.max(1,Math.abs(eS),Math.abs(ej))&&Math.abs(eP-eN)<=1e-6*Math.max(1,Math.abs(eP),Math.abs(eN))&&Math.abs(eI-eU)<=1e-6*Math.max(1,Math.abs(eI),Math.abs(eU))&&Math.abs(eM-eG)<=1e-6*Math.max(1,Math.abs(eM),Math.abs(eG))&&Math.abs(eE-e$)<=1e-6*Math.max(1,Math.abs(eE),Math.abs(e$))&&Math.abs(eC-eZ)<=1e-6*Math.max(1,Math.abs(eC),Math.abs(eZ))&&Math.abs(eA-eq)<=1e-6*Math.max(1,Math.abs(eA),Math.abs(eq))},R.cl=function(R,eh){return R[0]=eh[0],R[1]=eh[1],R[2]=eh[2],R[3]=eh[3],R[4]=eh[4],R[5]=eh[5],R[6]=eh[6],R[7]=eh[7],R[8]=eh[8],R[9]=eh[9],R[10]=eh[10],R[11]=eh[11],R[12]=eh[12],R[13]=eh[13],R[14]=eh[14],R[15]=eh[15],R},R.cm=R=>"circle"===R.type,R.cn=R=>"heatmap"===R.type,R.co=R=>"line"===R.type,R.cp=R=>"fill"===R.type,R.cq=R=>"fill-extrusion"===R.type,R.cr=R=>"hillshade"===R.type,R.cs=R=>"color-relief"===R.type,R.ct=R=>"background"===R.type,R.cu=R=>"custom"===R.type,R.cv=C,R.cw=function(R,eh,eu){if(eh<=0)return R;let em=1/eh;return void 0===eu||1e-10>Math.abs(eu)?Math.round(R*em)/em:(eu>0?Math.ceil(R*em-1e-9):Math.floor(R*em+1e-10))/em},R.cx=function(R,eh,eu){let em=E(eh.x-eu.x,eh.y-eu.y),e_=E(R.x-eu.x,R.y-eu.y);return nt(Math.atan2(em[0]*e_[1]-em[1]*e_[0],em[0]*e_[0]+em[1]*e_[1]))},R.cy=e4,R.cz=function(R,eh){var eu;if(!th[eh])return!1;let em=null==R?void 0:R.target,e_=(null===(eu=null==em?void 0:em.ownerDocument)||void 0===eu?void 0:eu.defaultView)||window;return R instanceof e_.MouseEvent||R instanceof e_.WheelEvent},R.d=P,R.d0=class{constructor(R,eh){let eu=(eh=this.options=Object.assign({},i9,eh)).debug;
5if(eu&&console.time("preprocess data"),eh.maxZoom<0||eh.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(eh.promoteId&&eh.generateId)throw Error("promoteId and generateId cannot be used together.");let em=pc(R,eh);eu&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",eh.indexMaxZoom,eh.indexMaxPoints),console.time("generate tiles")),em=Lc(em,eh),eh.updateable&&(this.source=em),this.initializeIndex(em,eh)}initializeIndex(R,eh){this.tileIndex=eh.cluster?new qc(eh.clusterOptions):new rh(eh),R.length&&this.tileIndex.initialize(R)}getTile(R,eh,eu){return eh=+eh,eu=+eu,(R=+R)<0||R>24?null:this.tileIndex.getTile(R,eh,eu)}updateData(R,eh){let eu=this.options;if(!eu.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:em,source:e_}=function(R,eh,eu){let em=eh?{removeAll:eh.removeAll,remove:new Set(eh.remove||[]),add:new Map(eh.add?.map(R=>[eu.promoteId?R.properties[eu.promoteId]:R.id,R])),update:new Map(eh.update?.map(R=>[R.id,R]))}:{remove:new Set,add:new Map,update:new Map},e_=[];if(em.removeAll&&(e_=R,R=[]),em.remove.size||em.add.size){let eh=[];for(let eu of R)(em.remove.has(eu.id)||em.add.has(eu.id))&&eh.push(eu);if(eh.length){e_.push(...eh);let eu=new Set(eh.map(R=>R.id));R=R.filter(R=>!eu.has(R.id))}if(em.add.size){let eh=pc({type:"FeatureCollection",features:Array.from(em.add.values())},eu);eh=Lc(eh,eu),e_.push(...eh),R.push(...eh)}}if(em.update.size){let eh=new Map,eg=[];for(let eu of R)em.update.has(eu.id)?eh.set(eu.id,[...eh.get(eu.id)||[],eu]):eg.push(eu);for(let[R,ev]of em.update){let em=eh.get(R);if(!em||0===em.length)continue;let ex=function(R,eh,eu){let em=!!eh.newGeometry,e_=eh.removeAllProperties||eh.removeProperties?.length>0||eh.addOrUpdateProperties?.length>0;if(em){let em=R[0];return Lc(pc({type:"FeatureCollection",features:[{type:"Feature",id:em.id,geometry:eh.newGeometry,properties:e_?Uc(em.tags,eh):em.tags}]},eu),eu)}if(e_){let eu=[];for(let em of R){let R={...em};R.tags=Uc(R.tags,eh),eu.push(R)}return eu}return R}(em,ev,eu);e_.push(...em,...ex),eg.push(...ex)}R=eg}return{affected:e_,source:R}}(this.source,R,eu);eh&&({affected:em,source:e_}=this.filterUpdate(e_,em,eh)),em.length&&(this.source=e_,this.tileIndex.updateIndex(e_,em,eu))}filterUpdate(R,eh,eu){let em=new Set;for(let e_ of R)null!=e_.id&&(eu(xc(e_))||(eh.push(e_),em.add(e_.id)));return{affected:eh,source:R=R.filter(R=>!em.has(R.id))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map(R=>xc(R))}}updateClusterOptions(R,eh){let eu=this.options.cluster;this.options.cluster=R,this.options.clusterOptions=eh,eu!=R?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(R){return this.tileIndex.getClusterExpansionZoom(R)}getClusterChildren(R){return this.tileIndex.getChildren(R)}getClusterLeaves(R,eh,eu){return this.tileIndex.getLeaves(R,eh,eu)}},R.d1=iE,R.e=$,R.f=yt,R.g=ct,R.h=R=>e(void 0,void 0,void 0,function*(){if(0===R.byteLength)return createImageBitmap(new ImageData(1,1));let eh=new Blob([new Uint8Array(R)],{type:"image/png"});try{return createImageBitmap(eh)}catch(R){throw Error(`Could not load image because of ${P(R).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),R.i=Y,R.j=R=>new Promise((eh,eu)=>{let em=new Image;em.onload=()=>{eh(em),URL.revokeObjectURL(em.src),em.onload=null,window.requestAnimationFrame(()=>em.src=e9)},em.onerror=()=>eu(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let e_=new Blob([new Uint8Array(R)],{type:"image/png"});em.src=R.byteLength?URL.createObjectURL(e_):e9}),R.k=(R,eh)=>dt($(R,{type:"json"}),eh),R.l=vt,R.m=dt,R.n=xt,R.o=(R,eh)=>dt($(R,{type:"arrayBuffer"}),eh),R.p=ep,R.q=function(R){return new Rh(R).readFields(Jh,[])},R.r=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))},R.s=tt,R.t=kl,R.u=Ks,R.v=t_,R.w=G,R.x=t_,R.y=Rs,R.z=ib}),define("worker",["./shared"],function(R){let t=class t{constructor(R,eh){this.keyCache={},R&&this.replace(R,eh)}replace(R,eh){this._layerConfigs={},this._layers={},this.update(R,[],eh)}update(eh,eu,em){for(let eu of eh){this._layerConfigs[eu.id]=eu;let eh=this._layers[eu.id]=R.bT(eu,em);eh._featureFilter=R.ah(eh.filter,em),this.keyCache[eu.id]&&delete this.keyCache[eu.id]}for(let R of eu)delete this.keyCache[R],delete this._layerConfigs[R],delete this._layers[R];this.familiesBySource={};let e_=R.cJ(Object.values(this._layerConfigs),this.keyCache);for(let eh of e_){let eu=eh.map(R=>this._layers[R.id]),em=eu[0];if(em.isHidden())continue;let e_=em.source||"",eg=this.familiesBySource[e_];eg||(eg=this.familiesBySource[e_]={});let ev=em.sourceLayer||R.ag,ex=eg[ev];ex||(ex=eg[ev]=[]),ex.push(eu)}}};let i=class i{constructor(eh){let eu={},em=[];for(let R in eh){let e_=eh[R],eg=eu[R]={};for(let R in e_){let eh=e_[+R];if(!eh||0===eh.bitmap.width||0===eh.bitmap.height)continue;let eu={x:0,y:0,w:eh.bitmap.width+2,h:eh.bitmap.height+2};em.push(eu),eg[R]={rect:eu,metrics:eh.metrics}}}let{w:e_,h:eg}=R.p(em),ev=new R.t({width:e_||1,height:eg||1});for(let em in eh){let e_=eh[em];for(let eh in e_){let eg=e_[+eh];if(!eg||0===eg.bitmap.width||0===eg.bitmap.height)continue;let ex=eu[em][eh].rect;R.t.copy(eg.bitmap,ev,{x:0,y:0},{x:ex.x+1,y:ex.y+1},eg.bitmap)}}this.image=ev,this.positions=eu}};R.cK("GlyphAtlas",i);let s=class s{constructor(eh){this.tileID=new R.a3(eh.tileID.overscaledZ,eh.tileID.wrap,eh.tileID.canonical.z,eh.tileID.canonical.x,eh.tileID.canonical.y),this.uid=eh.uid,this.zoom=eh.zoom,this.pixelRatio=eh.pixelRatio,this.tileSize=eh.tileSize,this.source=eh.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=eh.showCollisionBoxes,this.collectResourceTiming=!!eh.collectResourceTiming,this.returnDependencies=!!eh.returnDependencies,this.promoteId=eh.promoteId,this.inFlightDependencies=[]}parse(eh,eu,em,e_,eg){return R._(this,void 0,void 0,function*(){this.status="parsing",this.data=eh,this.collisionBoxArray=new R.ae;let ev=new R.cL(Object.keys(eh.layers).sort()),ex=new R.cM(this.tileID,this.promoteId);ex.bucketLayerIDs=[];let eb={},ew={featureIndex:ex,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:em,subdivisionGranularity:eg},eT=eu.familiesBySource[this.source];for(let eu in eT){let e_=eh.layers[eu];if(!e_)continue;1===e_.version&&R.w(`Vector tile source "${this.source}" layer "${eu}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let eg=ev.encode(eu),eS=[];for(let R=0;R<e_.length;R++){let eh=e_.feature(R),em=ex.getId(eh,eu);eS.push({feature:eh,id:em,index:R,sourceLayerIndex:eg})}for(let eh of eT[eu]){let eu=eh[0];eu.source!==this.source&&R.w(`layer.source = ${eu.source} does not equal this.source = ${this.source}`),eu.isHidden(this.zoom,!0)||(r(eh,this.zoom,em),(eb[eu.id]=eu.createBucket({index:ex.bucketLayerIDs.length,layers:eh,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:eg,sourceID:this.source})).populate(eS,ew,this.tileID.canonical),ex.bucketLayerIDs.push(eh.map(R=>R.id)))}}let eS=R.bY(ew.glyphDependencies,R=>Object.keys(R).map(Number));for(let R of this.inFlightDependencies)null==R||R.abort();this.inFlightDependencies=[];let eP=Promise.resolve({});if(Object.keys(eS).length){let R=new AbortController;this.inFlightDependencies.push(R),eP=e_.sendAsync({type:"GG",data:{stacks:eS,source:this.source,tileID:this.tileID,type:"glyphs"}},R)}
5let eI=Object.keys(ew.iconDependencies),eM=Promise.resolve({});if(eI.length){let R=new AbortController;this.inFlightDependencies.push(R),eM=e_.sendAsync({type:"GI",data:{icons:eI,source:this.source,tileID:this.tileID,type:"icons"}},R)}let eE=Object.keys(ew.patternDependencies),eC=Promise.resolve({});if(eE.length){let R=new AbortController;this.inFlightDependencies.push(R),eC=e_.sendAsync({type:"GI",data:{icons:eE,source:this.source,tileID:this.tileID,type:"patterns"}},R)}let eA=ew.dashDependencies,ez=Promise.resolve({});if(Object.keys(eA).length){let R=new AbortController;this.inFlightDependencies.push(R),ez=e_.sendAsync({type:"GDA",data:{dashes:eA}},R)}let[eD,ek,eR,eL]=yield Promise.all([eP,eM,eC,ez]),eF=new i(eD),eB=new R.cN(ek,eR);for(let eh in eb){let eu=eb[eh];eu instanceof R.af?(r(eu.layers,this.zoom,em),R.cO({bucket:eu,glyphMap:eD,glyphPositions:eF.positions,imageMap:ek,imagePositions:eB.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:ew.subdivisionGranularity})):eu.hasDependencies&&(eu instanceof R.cP||eu instanceof R.cQ||eu instanceof R.cR)&&(r(eu.layers,this.zoom,em),eu.addFeatures(ew,this.tileID.canonical,eB.patternPositions,eL))}return this.status="done",{buckets:Object.values(eb).filter(R=>!R.isEmpty()),featureIndex:ex,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:eF.image,imageAtlas:eB,dashPositions:eL,glyphMap:this.returnDependencies?eD:null,iconMap:this.returnDependencies?ek:null,glyphPositions:this.returnDependencies?eF.positions:null}})}};function r(eh,eu,em){let e_=new R.J(eu);for(let R of eh)R.recalculate(e_,em)}let o=class o{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(R,eh){this.loading[R]=eh}finishLoading(R){delete this.loading[R]}abort(R){let eh=this.loading[R];(null==eh?void 0:eh.abort)&&(eh.abort.abort(),delete this.loading[R])}setParsing(R,eh){this.parsing[R]=eh}consumeParsing(R){let eh=this.parsing[R];if(eh)return delete this.parsing[R],eh}clearParsing(R){delete this.parsing[R]}markLoaded(R,eh){this.loaded[R]=eh}getLoaded(R){let eh=this.loaded[R];if(eh)return eh}removeLoaded(R){delete this.loaded[R]}clearLoaded(){this.loaded={}}};let n=class n{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 0===R.length&&(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}};let a=class a{constructor(R,eh,eu,em,e_){this.type=R,this.properties=eu||{},this.extent=e_,this.pointsArray=eh,this.id=em}loadGeometry(){return this.pointsArray.map(eh=>eh.map(eh=>new R.P(eh.x,eh.y)))}};let l=class l{constructor(R,eh,eu){this.version=2,this._myFeatures=R,this.name=eh,this.length=R.length,this.extent=eu}feature(R){return this._myFeatures[R]}};let c=class c{constructor(){this.layers={}}addLayer(R){this.layers[R.name]=R}};function h(eh){let eu=R.cS(eh);return 0===eu.byteOffset&&eu.byteLength===eu.buffer.byteLength||(eu=new Uint8Array(eu)),{vectorTile:eh,rawData:eu.buffer}}let u=class u{constructor(eh,eu,em){this.actor=eh,this.layerIndex=eu,this.availableImages=em,this.tileState=new o,this.overzoomedTileResultCache=new R.cU(1e3)}loadVectorTile(eh,eu){try{return{vectorTile:"mlt"!==eh.encoding?new R.cV(new R.cW(eu)):new R.cX(eu),rawData:eu}}catch(eg){let em=new Uint8Array(eu),e_=`Unable to parse the tile at ${eh.request.url}, `;throw Error(e_+=31===em[0]&&139===em[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${R.d(eg).message}`)}}loadTile(eh){return R._(this,void 0,void 0,function*(){let{uid:eu,overzoomParameters:em}=eh;em&&(eh.request=em.overzoomRequest);let e_=this._startRequestTiming(eh),eg=new s(eh);this.tileState.startLoading(eu,eg);let ev=new AbortController;eg.abort=ev;try{let ex=yield R.o(eh.request,ev);if(eh.etag&&eh.etag===ex.etag)return this.tileState.finishLoading(eu),this._getEtagUnmodifiedResult(ex,e_);let eb=this.loadVectorTile(eh,ex.data);if(this.tileState.finishLoading(eu),!eb)return null;let{vectorTile:ew,rawData:eT}=eb;em&&({vectorTile:ew,rawData:eT}=this._getOverzoomTile(eh,ew));let eS=this._getExpiryData(ex),eP=this._finishRequestTiming(e_);eg.vectorTile=ew,this.tileState.markLoaded(eu,eg);let eI={rawData:eT,cacheControl:eS,resourceTiming:eP};this.tileState.setParsing(eu,eI);try{return yield this._parseWorkerTile(eg,eh,eI)}finally{this.tileState.clearParsing(eu)}}catch(R){throw this.tileState.finishLoading(eu),eg.status="done",this.tileState.markLoaded(eu,eg),R}
5})}_getEtagUnmodifiedResult(eh,eu){let em=this._getExpiryData(eh),e_=this._finishRequestTiming(eu);return R.e({etagUnmodified:!0},em,e_)}_parseWorkerTile(eh,eu,em){return R._(this,void 0,void 0,function*(){let e_=yield eh.parse(eh.vectorTile,this.layerIndex,this.availableImages,this.actor,eu.subdivisionGranularity);if(em){let{rawData:eh,cacheControl:eg,resourceTiming:ev}=em;e_=R.e({rawTileData:eh.slice(0),encoding:eu.encoding},e_,eg,ev)}return e_})}_getExpiryData({expires:R,cacheControl:eh,etag:eu}){let em={};return R&&(em.expires=R),eh&&(em.cacheControl=eh),eu&&(em.etag=eu),em}_startRequestTiming(R){var eh;if(null===(eh=R.request)||void 0===eh?void 0:eh.collectResourceTiming)return new n(R.request.url)}_finishRequestTiming(R){let eh=null==R?void 0:R.finish();return eh?{resourceTiming:JSON.parse(JSON.stringify(eh))}:{}}_getOverzoomTile(eh,eu){var em;let{tileID:e_,source:eg,overzoomParameters:ev}=eh,{maxZoomTileID:ex}=ev,eb=`${ex.key}_${e_.key}_${null===(em=eh.request)||void 0===em?void 0:em.url}`,ew=this.overzoomedTileResultCache.get(eb);if(ew)return ew;let eT=new c,eS=this.layerIndex.familiesBySource[eg];for(let eh in eS){let em=eu.layers[eh];if(!em)continue;let eg=function(eh,eu,em){let{extent:e_}=eh,eg=Math.pow(2,em.z-eu.z),ev=(em.x-eu.x*eg)*e_,ex=(em.y-eu.y*eg)*e_,eb=[];for(let eu=0;eu<eh.length;eu++){let em=eh.feature(eu),ew=em.loadGeometry();for(let R of ew)for(let eh of R)eh.x=eh.x*eg-ev,eh.y=eh.y*eg-ex;0!==(ew=R.cT(ew,em.type,-128,-128,e_+128,e_+128)).length&&eb.push(new a(em.type,ew,em.properties,em.id,e_))}return new l(eb,eh.name,e_)}(em,ex,e_.canonical);eg.length>0&&eT.addLayer(eg)}let eP=h(eT);return this.overzoomedTileResultCache.set(eb,eP),eP}reloadTile(eh){return R._(this,void 0,void 0,function*(){let R=eh.uid,eu=this.tileState.getLoaded(R);if(!eu)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(eu.showCollisionBoxes=eh.showCollisionBoxes,"parsing"===eu.status){let em=this.tileState.consumeParsing(R);return yield this._parseWorkerTile(eu,eh,em)}if("done"===eu.status&&eu.vectorTile)return yield this._parseWorkerTile(eu,eh)})}abortTile(eh){return R._(this,void 0,void 0,function*(){this.tileState.abort(eh.uid)})}removeTile(eh){return R._(this,void 0,void 0,function*(){this.tileState.removeLoaded(eh.uid)})}};let g=class g{constructor(){this.loaded={}}loadTile(eh){return R._(this,void 0,void 0,function*(){let{uid:eu,encoding:em,rawImageData:e_,redFactor:eg,greenFactor:ev,blueFactor:ex,baseShift:eb}=eh,ew=e_.width+2,eT=e_.height+2,eS=R.b(e_)?new R.R({width:ew,height:eT},(yield R.cY(e_,-1,-1,ew,eT))):e_,eP=new R.cZ(eu,eS,em,eg,ev,ex,eb);return this.loaded=this.loaded||{},this.loaded[eu]=eP,eP})}removeTile(R){let eh=this.loaded,eu=R.uid;(null==eh?void 0:eh[eu])&&delete eh[eu]}};let p=class p{constructor(R,eh,eu,em=f){this.actor=R,this.layerIndex=eh,this.availableImages=eu,this.tileState=new o,this._createGeoJSONIndex=em}loadVectorTile(eh){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:eu,x:em,y:e_}=eh.tileID.canonical,eg=this._geoJSONIndex.getTile(eu,em,e_);return eg?h(new R.c_(eg.features,{version:2,extent:R.a6})):null}loadTile(eh){return R._(this,void 0,void 0,function*(){let{uid:R}=eh,eu=new s(eh);eu.abort=new AbortController;try{let em=this.loadVectorTile(eh);if(!em)return null;let{vectorTile:e_,rawData:eg}=em;eu.vectorTile=e_,this.tileState.markLoaded(R,eu);let ev={rawData:eg};this.tileState.setParsing(R,ev);try{return yield this._parseWorkerTile(eu,eh,ev)}finally{this.tileState.clearParsing(R)}}catch(eh){throw eu.status="done",this.tileState.markLoaded(R,eu),eh}})}_reloadLoadedTile(eh){return R._(this,void 0,void 0,function*(){let R=eh.uid,eu=this.tileState.getLoaded(R);if(!eu)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(eu.showCollisionBoxes=eh.showCollisionBoxes,"parsing"===eu.status){let em=this.tileState.consumeParsing(R);return yield this._parseWorkerTile(eu,eh,em)}if("done"===eu.status&&eu.vectorTile)return yield this._parseWorkerTile(eu,eh)})}_parseWorkerTile(eh,eu,em){return R._(this,void 0,void 0,function*(){let e_=yield eh.parse(eh.vectorTile,this.layerIndex,this.availableImages,this.actor,eu.subdivisionGranularity);if(em){let{rawData:eh}=em;e_=R.e({rawTileData:eh.slice(0),encoding:"mvt"},e_)}return e_})}abortTile(eh){return R._(this,void 0,void 0,function*(){this.tileState.abort(eh.uid)})}removeTile(eh){return R._(this,void 0,void 0,function*(){this.tileState.removeLoaded(eh.uid)})}loadData(eh){return R._(this,void 0,void 0,function*(){var eu;
5null===(eu=this._pendingRequest)||void 0===eu||eu.abort();let em=this._startRequestTiming(eh);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(eh,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let R={};return eh.request&&(R.data=eh.data),this._finishRequestTiming(em,eh,R),R}catch(eh){if(delete this._pendingRequest,!R.$(eh))throw eh;return{abandoned:!0}}})}_startRequestTiming(R){var eh;if(null===(eh=R.request)||void 0===eh?void 0:eh.collectResourceTiming)return new n(R.request.url)}_finishRequestTiming(R,eh,eu){let em=null==R?void 0:R.finish();em&&(eu.resourceTiming={[eh.source]:JSON.parse(JSON.stringify(em))})}reloadTile(R){return this.tileState.getLoaded(R.uid)?this._reloadLoadedTile(R):this.loadTile(R)}loadAndProcessGeoJSON(eh,eu){return R._(this,void 0,void 0,function*(){var em;if(eh.request&&(eh.data=(yield R.k(eh.request,eu)).data),eh.data)return eh.data=this._filterGeoJSON(eh.data,eh.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(eh.data,eh));if(eh.dataDiff)return null!==(em=this._geoJSONIndex)&&void 0!==em||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},eh)),void this._geoJSONIndex.updateData(eh.dataDiff,this._getFilterPredicate(eh.filter));if(eh.updateCluster&&this._geoJSONIndex.updateClusterOptions(eh.geojsonVtOptions.cluster,y(eh)),null==this._geoJSONIndex)throw Error(`Input data given to '${eh.source}' is not a valid GeoJSON object.`)})}_filterGeoJSON(R,eh){if("FeatureCollection"!==R.type)return R;let eu=this._getFilterPredicate(eh);return eu?{type:"FeatureCollection",features:R.features.filter(R=>eu(R))}:R}_getFilterPredicate(eh){if("boolean"!=typeof eh&&!(null==eh?void 0:eh.length))return;let eu=R.c$(eh,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===eu.result)throw Error(eu.value.map(R=>`${R.key}: ${R.message}`).join(", "));return R=>eu.value.evaluate({zoom:0},R)}removeSource(eh){return R._(this,void 0,void 0,function*(){var R;null===(R=this._pendingRequest)||void 0===R||R.abort()})}getClusterExpansionZoom(R){return this._geoJSONIndex.getClusterExpansionZoom(R.clusterId)}getClusterChildren(R){return this._geoJSONIndex.getClusterChildren(R.clusterId)}getClusterLeaves(R){return this._geoJSONIndex.getClusterLeaves(R.clusterId,R.limit,R.offset)}};function f(eh,eu){let em=R.e(eu.geojsonVtOptions||{},{updateable:!0,clusterOptions:y(eu)});return new R.d0(eh,em)}function y({geojsonVtOptions:eh,clusterProperties:eu}){if(!eu||!eh.clusterOptions)return eh.clusterOptions;let em={},e_={},eg={accumulated:null,zoom:0},ev={properties:null},ex=Object.keys(eu);for(let eh of ex){let[eg,ev]=eu[eh],ex=R.c$(ev),eb=R.c$("string"==typeof eg?[eg,["accumulated"],["get",eh]]:eg);em[eh]=ex.value,e_[eh]=eb.value}return eh.clusterOptions.map=R=>{ev.properties=R;let eh={};for(let R of ex)eh[R]=em[R].evaluate(eg,ev);return eh},eh.clusterOptions.reduce=(R,eh)=>{for(let eu of(ev.properties=eh,ex))eg.accumulated=R[eu],R[eu]=e_[eu].evaluate(eg,ev)},eh.clusterOptions}let v=class v{constructor(eh){this.self=eh,this.actor=new R.N(eh),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(R,eh)=>{if(this.externalWorkerSourceTypes[R])throw Error(`Worker source with name "${R}" already registered.`);this.externalWorkerSourceTypes[R]=eh},this.self.addProtocol=R.cH,this.self.removeProtocol=R.cI,this.self.registerRTLTextPlugin=eh=>{R.d1.setMethods(eh)},this.self.makeRequest=R.m,this.actor.registerMessageHandler("LDT",(R,eh)=>this._getDEMWorkerSource(R,eh.source).loadTile(eh)),this.actor.registerMessageHandler("RDT",(eh,eu)=>R._(this,void 0,void 0,function*(){this._getDEMWorkerSource(eh,eu.source).removeTile(eu)})),this.actor.registerMessageHandler("GCEZ",(eh,eu)=>R._(this,void 0,void 0,function*(){return this._getWorkerSource(eh,eu.type,eu.source).getClusterExpansionZoom(eu)})),this.actor.registerMessageHandler("GCC",(eh,eu)=>R._(this,void 0,void 0,function*(){return this._getWorkerSource(eh,eu.type,eu.source).getClusterChildren(eu)})),this.actor.registerMessageHandler("GCL",(eh,eu)=>R._(this,void 0,void 0,function*(){return this._getWorkerSource(eh,eu.type,eu.source).getClusterLeaves(eu)})),this.actor.registerMessageHandler("LD",(R,eh)=>this._getWorkerSource(R,eh.type,eh.source).loadData(eh)),this.actor.registerMessageHandler("LT",(R,eh)=>this._getWorkerSource(R,eh.type,eh.source).loadTile(eh)),this.actor.registerMessageHandler("RT",(R,eh)=>this._getWorkerSource(R,eh.type,eh.source).reloadTile(eh)),this.actor.registerMessageHandler("AT",(R,eh)=>this._getWorkerSource(R,eh.type,eh.source).abortTile(eh)),this.actor.registerMessageHandler("RMT",(R,eh)=>this._getWorkerSource(R,eh.type,eh.source).removeTile(eh)),this.actor.registerMessageHandler("RS",(eh,eu)=>R._(this,void 0,void 0,function*(){var R,em;if(!(null===(em=null===(R=this.workerSources[eh])||void 0===R?void 0:R[eu.type])||void 0===em?void 0:em[eu.source]))return;let e_=this.workerSources[eh][eu.type][eu.source];delete this.workerSources[eh][eu.type][eu.source],void 0!==e_.removeSource&&e_.removeSource(eu)})),this.actor.registerMessageHandler("RM",eh=>R._(this,void 0,void 0,function*(){delete this.layerIndexes[eh],delete this.availableImages[eh],delete this.workerSources[eh],delete this.demWorkerSources[eh],this.globalStates.delete(eh)})),this.actor.registerMessageHandler("SR",(eh,eu)=>R._(this,void 0,void 0,function*(){this.referrer=eu})),this.actor.registerMessageHandler("SRPS",(R,eh)=>this._syncRTLPluginState(R,eh)),this.actor.registerMessageHandler("IS",(eh,eu)=>R._(this,void 0,void 0,function*(){this.self.importScripts(eu)})),this.actor.registerMessageHandler("SI",(R,eh)=>this._setImages(R,eh)),this.actor.registerMessageHandler("UL",(eh,eu)=>R._(this,void 0,void 0,function*(){this._getLayerIndex(eh).update(eu.layers,eu.removedIds,this._getGlobalState(eh))})),this.actor.registerMessageHandler("UGS",(eh,eu)=>R._(this,void 0,void 0,function*(){let R=this._getGlobalState(eh);for(let eh in eu)R[eh]=eu[eh]})),this.actor.registerMessageHandler("SL",(eh,eu)=>R._(this,void 0,void 0,function*(){this._getLayerIndex(eh).replace(eu,this._getGlobalState(eh))}))}_getGlobalState(R){let eh=this.globalStates.get(R);return eh||(eh={},this.globalStates.set(R,eh)),eh}_setImages(eh,eu){return R._(this,void 0,void 0,function*(){for(let R in this.availableImages[eh]=eu,this.workerSources[eh]){let em=this.workerSources[eh][R];for(let R in em)em[R].availableImages=eu}})}_syncRTLPluginState(eh,eu){return R._(this,void 0,void 0,function*(){return yield R.d1.syncState(eu,this.self.importScripts)})}_getAvailableImages(R){let eh=this.availableImages[R];return eh||(eh=[]),eh}_getLayerIndex(R){let eh=this.layerIndexes[R];return eh||(eh=this.layerIndexes[R]=new t),eh}_getWorkerSource(R,eh,eu){if(this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][eh]||(this.workerSources[R][eh]={}),!this.workerSources[R][eh][eu]){let em={sendAsync:(eh,eu)=>(eh.targetMapId=R,this.actor.sendAsync(eh,eu))};switch(eh){case"vector":this.workerSources[R][eh][eu]=new u(em,this._getLayerIndex(R),this._getAvailableImages(R));break;case"geojson":this.workerSources[R][eh][eu]=new p(em,this._getLayerIndex(R),this._getAvailableImages(R));break;default:this.workerSources[R][eh][eu]=new this.externalWorkerSourceTypes[eh](em,this._getLayerIndex(R),this._getAvailableImages(R))}}return this.workerSources[R][eh][eu]}_getDEMWorkerSource(R,eh){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][eh]||(this.demWorkerSources[R][eh]=new g),this.demWorkerSources[R][eh]}};return R.i(self)&&(self.worker=new v(self)),v}),define("index",["exports","./shared"],function(R,eh){let eu,em,e_,eg,ev,ex,eb,ew;var eT,eS,eP,eI,eM,eE,eC="5.23.0";function o(){var R=new eh.A(4);return eh.A!=Float32Array&&(R[1]=0,R[2]=0),R[0]=1,R[3]=1,R}let eA={frame(R,eu,em,e_){let eg=e_||window,ev=eg.requestAnimationFrame(R=>{ex(),eu(R)}),{unsubscribe:ex}=eh.s(R.signal,"abort",()=>{ex(),eg.cancelAnimationFrame(ev),em(new eh.a(R.signal.reason))},!1)},frameAsync(R,eh){return new Promise((eu,em)=>{this.frame(R,eu,em,eh)})},getImageData(R,eh=0){return this.getImageCanvasContext(R).getImageData(-eh,-eh,R.width+2*eh,R.height+2*eh)},getImageCanvasContext(R){let eh=window.document.createElement("canvas"),eu=eh.getContext("2d",{willReadFrequently:!0});if(!eu)throw Error("failed to create canvas 2d context");return eh.width=R.width,eh.height=R.height,eu.drawImage(R,0,0,R.width,R.height),eu},resolveURL:R=>(eu||(eu=document.createElement("a")),eu.href=R,eu.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==e_?e_:!!matchMedia&&(null==em&&(em=matchMedia("(prefers-reduced-motion: reduce)")),em.matches)},set prefersReducedMotion(e){e_=e}},ez=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(R){this._frozenAt=R}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return ez.getCurrentTime()}let d=class d{static create(R,eh,eu){let em=window.document.createElement(R);return void 0!==eh&&(em.className=eh),eu&&eu.appendChild(em),em}static createNS(R,eh){return window.document.createElementNS(R,eh)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]="none")}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(R){R.preventDefault(),R.stopPropagation(),window.removeEventListener("click",d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",d.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",d.suppressClickInternal,!0)},0)}static getScale(R){let eh=R.getBoundingClientRect();return{x:eh.width/R.offsetWidth||1,y:eh.height/R.offsetHeight||1,boundingClientRect:eh}}static getPoint(R,eu,em){let e_=eu.boundingClientRect;return new eh.P((em.clientX-e_.left)/eu.x-R.clientLeft,(em.clientY-e_.top)/eu.y-R.clientTop)}static mousePos(R,eh){let eu=d.getScale(R);return d.getPoint(R,eu,eh)}static touchPos(R,eh){let eu=[],em=d.getScale(R);for(let e_ of eh)eu.push(d.getPoint(R,em,e_));return eu}static sanitize(R){let eh=(new DOMParser).parseFromString(R,"text/html").body||document.createElement("body"),eu=eh.querySelectorAll("script");for(let R of eu)R.remove();return d.clean(eh),eh.innerHTML}static isPossiblyDangerous(R,eh){let eu=eh.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(R)||!eu.includes("javascript:")&&!eu.includes("data:"))||!!R.startsWith("on")||void 0}static clean(R){let eh=R.children;for(let R of eh)d.removeAttributes(R),d.clean(R)}static removeAttributes(R){for(let{name:eh,value:eu}of R.attributes)d.isPossiblyDangerous(eh,eu)&&R.removeAttribute(eh)}};d.docStyle="undefined"!=typeof window&&(null===(eP=window.document)||void 0===eP?void 0:eP.documentElement.style),d.selectProp=!d.docStyle||"userSelect"in d.docStyle?"userSelect":"webkitUserSelect",function(R){let eu,em,e_,eg;R.resetRequestQueue=()=>{eu=[],em=0,e_=0,eg={}},R.addThrottleControl=R=>{let eh=e_++;return eg[eh]=R,eh},R.removeThrottleControl=R=>{delete eg[R],n()},R.getImage=(R,em,e_=!0)=>new Promise((eg,ev)=>{R.headers||(R.headers={}),R.headers.accept="image/webp,*/*",eh.e(R,{type:"image"}),eu.push({abortController:em,requestParameters:R,supportImageRefresh:e_,state:"queued",onError:R=>{ev(R)},onSuccess:R=>{eg(R)}}),n()});let s=R=>eh._(this,void 0,void 0,function*(){var eu;R.state="running";let{requestParameters:e_,supportImageRefresh:eg,onError:ev,onSuccess:ex,abortController:eb}=R,ew=!1===eg&&!eh.i(self)&&!eh.g(e_.url)&&(!e_.headers||Object.keys(e_.headers).reduce((R,eh)=>R&&"accept"===eh,!0));em++;let eT=ew?l(e_,eb):eh.m(e_,eb);try{let em=yield eT;delete R.abortController,R.state="completed",em.data instanceof HTMLImageElement||eh.b(em.data)?ex(em):em.data&&ex({data:yield(eu=em.data,"function"==typeof createImageBitmap?eh.h(eu):eh.j(eu)),cacheControl:em.cacheControl,expires:em.expires})}catch(eu){delete R.abortController,ev(eh.d(eu))}finally{em--,n()}}),n=()=>{let R=(()=>{for(let R of Object.keys(eg))if(eg[R]())return!0;return!1})()?eh.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:eh.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let eh=em;eh<R&&eu.length>0;eh++){let R=eu.shift();R.abortController.signal.aborted?eh--:s(R)}},l=(R,eu)=>new Promise((em,e_)=>{let eg=new Image,ev=R.url,ex=R.credentials;ex&&"include"===ex?eg.crossOrigin="use-credentials":(ex&&"same-origin"===ex||!eh.f(ev))&&(eg.crossOrigin="anonymous"),eu.signal.addEventListener("abort",()=>{eg.src="",e_(new eh.a(eu.signal.reason))}),eg.fetchPriority="high",eg.onload=()=>{eg.onerror=eg.onload=null,em({data:eg})},eg.onerror=()=>{eg.onerror=eg.onload=null,eu.signal.aborted||e_(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."))},eg.src=ev})}(eI||(eI={})),eI.resetRequestQueue();let _=class _{constructor(R){this._transformRequestFn=null!=R?R:null}transformRequest(R,eh){return this._transformRequestFn&&this._transformRequestFn(R,eh)||{url:R}}setTransformRequest(R){this._transformRequestFn=R}};function p(R){let eh=[];if("string"==typeof R)eh.push({id:"default",url:R});else if(R&&R.length>0){let eu=[];for(let{id:em,url:e_}of R){let R=`${em}${e_}`;eu.includes(R)||(eu.push(R),eh.push({id:em,url:e_}))}}return eh}function m(R,eh,eu){try{let em=new URL(R);return em.pathname+=`${eh}${eu}`,em.toString()}catch(eh){throw Error(`Invalid sprite URL "${R}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}let g=class g extends eh.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new eh.R({width:1,height:1}),this.dirty=!0}destroy(){for(let R of(this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null),Object.keys(this.images)))this.removeImage(R);this.patterns={},this.atlasImage=new eh.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}
5setLoaded(R){if(this.loaded!==R&&(this.loaded=R,R)){for(let{ids:R,promiseResolve:eh}of this.requestors)eh(this._getImagesForIds(R));this.requestors=[]}}getImage(R){let eu=this.images[R];if(eu&&!eu.data&&eu.spriteData){let R=eu.spriteData;eu.data=new eh.R({width:R.width,height:R.height},R.context.getImageData(R.x,R.y,R.width,R.height).data),eu.spriteData=null}return eu}addImage(R,eh){if(this.images[R])throw Error(`Image id ${R} already exist, use updateImage instead`);this._validate(R,eh)&&(this.images[R]=eh)}_validate(R,eu){let em=!0,e_=eu.data||eu.spriteData;return this._validateStretch(eu.stretchX,null==e_?void 0:e_.width)||(this.fire(new eh.l(Error(`Image "${R}" has invalid "stretchX" value`))),em=!1),this._validateStretch(eu.stretchY,null==e_?void 0:e_.height)||(this.fire(new eh.l(Error(`Image "${R}" has invalid "stretchY" value`))),em=!1),this._validateContent(eu.content,eu)||(this.fire(new eh.l(Error(`Image "${R}" has invalid "content" value`))),em=!1),em}_validateStretch(R,eh){if(!R)return!0;let eu=0;for(let em of R){if(em[0]<eu||em[1]<em[0]||eh<em[1])return!1;eu=em[1]}return!0}_validateContent(R,eh){if(!R)return!0;if(4!==R.length)return!1;let eu=eh.spriteData,em=(null==eu?void 0:eu.width)||eh.data.width,e_=(null==eu?void 0:eu.height)||eh.data.height;return!(R[0]<0||em<R[0]||R[1]<0||e_<R[1]||R[2]<0||em<R[2]||R[3]<0||e_<R[3]||R[2]<R[0]||!(R[3]>=R[1]))}updateImage(R,eh,eu=!0){let em=this.getImage(R);if(eu&&(em.data.width!==eh.data.width||em.data.height!==eh.data.height))throw Error(`size mismatch between old image (${em.data.width}x${em.data.height}) and new image (${eh.data.width}x${eh.data.height}).`);eh.version=em.version+1,this.images[R]=eh,this.updatedImages[R]=!0}removeImage(R){var eh;let eu=this.images[R];delete this.images[R],delete this.patterns[R],(null===(eh=eu.userImage)||void 0===eh?void 0:eh.onRemove)&&eu.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(R){return new Promise((eh,eu)=>{let em=!0;if(!this.isLoaded())for(let eh of R)this.images[eh]||(em=!1);this.isLoaded()||em?eh(this._getImagesForIds(R)):this.requestors.push({ids:R,promiseResolve:eh})})}_getImagesForIds(R){var eu;let em={};for(let e_ of R){let R=this.getImage(e_);R||(this.fire(new eh.n("styleimagemissing",{id:e_})),R=this.getImage(e_)),R?em[e_]={data:R.data.clone(),pixelRatio:R.pixelRatio,sdf:R.sdf,ver
5sion:R.version,stretchX:R.stretchX,stretchY:R.stretchY,content:R.content,textFitWidth:R.textFitWidth,textFitHeight:R.textFitHeight,hasRenderCallback:!!(null===(eu=R.userImage)||void 0===eu?void 0:eu.render)}:eh.w(`Image "${e_}" 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 em}getPixelSize(){let{width:R,height:eh}=this.atlasImage;return{width:R,height:eh}}getPattern(R){let eu=this.patterns[R],em=this.getImage(R);if(!em)return null;if(eu&&eu.position.version===em.version)return eu.position;if(eu)eu.position.version=em.version;else{let eu={w:em.data.width+2,h:em.data.height+2,x:0,y:0},e_=new eh.I(eu,em);this.patterns[R]={bin:eu,position:e_}}return this._updatePatternAtlas(),this.patterns[R].position}bind(R){let eu=R.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new eh.T(R,this.atlasImage,eu.RGBA),this.atlasTexture.bind(eu.LINEAR,eu.CLAMP_TO_EDGE)}_updatePatternAtlas(){let R=[];for(let eh in this.patterns)R.push(this.patterns[eh].bin);let{w:eu,h:em}=eh.p(R),e_=this.atlasImage;for(let R in e_.resize({width:eu||1,height:em||1}),this.patterns){let{bin:eu}=this.patterns[R],em=eu.x+1,eg=eu.y+1,ev=this.getImage(R).data,ex=ev.width,eb=ev.height;eh.R.copy(ev,e_,{x:0,y:0},{x:em,y:eg},{width:ex,height:eb}),eh.R.copy(ev,e_,{x:0,y:eb-1},{x:em,y:eg-1},{width:ex,height:1}),eh.R.copy(ev,e_,{x:0,y:0},{x:em,y:eg+eb},{width:ex,height:1}),eh.R.copy(ev,e_,{x:ex-1,y:0},{x:em-1,y:eg},{width:1,height:eb}),eh.R.copy(ev,e_,{x:0,y:0},{x:em+ex,y:eg},{width:1,height:eb})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(R){for(let eu of R){if(this.callbackDispatchedThisFrame[eu])continue;this.callbackDispatchedThisFrame[eu]=!0;let R=this.getImage(eu);R||eh.w(`Image with ID: "${eu}" was not found`),function(R){let{userImage:eh}=R;return!(!(null==eh?void 0:eh.render)||!eh.render()||(R.data.replace(new Uint8Array(eh.data.buffer)),0))}(R)&&this.updateImage(eu,R)}}cloneImages(){let R={};for(let eh in this.images){let eu=this.images[eh];R[eh]=Object.assign(Object.assign({},eu),{data:eu.data?eu.data.clone():null})}return R}};function x(R,eh,eu,em,e_,eg,ev,ex,eb){for(let ew=eh;ew<eh+em;ew++)b(R,eu*eg+ew,eg,e_,ev,ex,eb);for(let ew=eu;ew<eu+e_;ew++)b(R,ew*eg+eh,1,em,ev,ex,eb)}function b(R,eh,eu,em,e_,eg,ev){eg[0]=0,ev[0]=-1e20,ev[1]=1e20,e_[0]=R[eh];for(let ex=1,eb=0,ew=0;ex<em;ex++){e_[ex]=R[eh+ex*eu];let em=ex*ex;do{let R=eg[eb];ew=(e_[ex]-e_[R]+em-R*R)/(ex-R)/2}while(ew<=ev[eb]&&--eb>-1);eg[++eb]=ex,ev[eb]=ew,ev[eb+1]=1e20}for(let ex=0,eb=0;ex<em;ex++){for(;ev[eb+1]<ex;)eb++;let em=eg[eb],ew=ex-em;R[eh+ex*eu]=e_[em]+ew*ew}}let eD=eh.v.layout_symbol["text-font"].default.join(",");let w=class w{constructor(R,eh,eu){this.requestManager=R,this.localIdeographFontFamily=eh,this.entries={},this.lang=eu}setURL(R){this.url=R}getGlyphs(R){return eh._(this,void 0,void 0,function*(){let eh=[];for(let eu in R)for(let em of R[eu])eh.push(this._getAndCacheGlyphsPromise(eu,em));let eu=yield Promise.all(eh),em={};for(let{stack:R,id:eh,glyph:e_}of eu)em[R]||(em[R]={}),em[R][eh]=e_&&{id:e_.id,bitmap:e_.bitmap.clone(),metrics:e_.metrics};return em})}_getAndCacheGlyphsPromise(R,eu){return eh._(this,void 0,void 0,function*(){let eh=this.entries[R];eh||(eh=this.entries[R]={glyphs:{},requests:{},ranges:{}});let em=eh.glyphs[eu];return void 0!==em?{stack:R,id:eu,glyph:em}:!this.url||this._charUsesLocalIdeographFontFamily(eu)?(em=eh.glyphs[eu]=this._drawGlyph(eh,R,eu),{stack:R,id:eu,glyph:em}):yield this._downloadAndCacheRangePromise(R,eu)})}_downloadAndCacheRangePromise(R,eu){return eh._(this,void 0,void 0,function*(){let em=this.entries[R],e_=Math.floor(eu/256);if(em.ranges[e_])return{stack:R,id:eu,glyph:null};em.requests[e_]||(em.requests[e_]=w.loadGlyphRange(R,e_,this.url,this.requestManager));try{let eh=yield em.requests[e_];for(let R in eh)em.glyphs[+R]=eh[+R];return em.ranges[e_]=!0,{stack:R,id:eu,glyph:eh[eu]||null}}catch(ev){let eg=em.glyphs[eu]=this._drawGlyph(em,R,eu);return this._warnOnMissingGlyphRange(eg,e_,eu,eh.d(ev)),{stack:R,id:eu,glyph:eg}}})}_warnOnMissingGlyphRange(R,eu,em,e_){let eg=256*eu,ev=eg+255,ex=em.toString(16).padStart(4,"0").toUpperCase();eh.w(`Unable to load glyph range ${eu}, ${eg}-${ev}. Rendering codepoint U+${ex} locally instead. ${e_}`)}_charUsesLocalIdeographFontFamily(R){return!!this.localIdeographFontFamily&&eh.r(R)}_drawGlyph(R,eu,em){let e_=eu===eD&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(em),eg=e_?"ideographTinySDF":"tinySDF";R[eg]||(R[eg]=this._createTinySDF(e_?this.localIdeographFontFamily:eu));let ev=R[eg].draw(String.fromCodePoint(em)),ex=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(em));return{id:em,bitmap:new eh.t({width:ev.width||60,height:ev.height||60},ev.data),metrics:{width:ex?0:ev.glyphWidth/2||24,height:ev.glyphHeight/2||24,left:ev.glyphLeft/2+.5||0,top:ev.glyphTop/2-27.5||-8,advance:ex?0:ev.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(R){let eh=R?R.split(","):[];eh.push("sans-serif");let eu=eh.map(R=>/[-\w]+/.test(R)?R:`'${CSS.escape(R)}'`).join(",");return new w.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:eu,fontWeight:this._fontWeight(eh[0]),fontStyle:this._fontStyle(eh[0]),lang:this.lang})}_fontStyle(R){return/italic/i.test(R)?"italic":/oblique/i.test(R)?"oblique":"normal"}_fontWeight(R){let eh;for(let[eu,em]of Object.entries({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}))RegExp(`\\b${eu}\\b`,"i").test(R)&&(eh=`${em}`);return eh}destroy(){for(let R in this.entries){let eh=this.entries[R];eh.tinySDF&&(eh.tinySDF=null),eh.ideographTinySDF&&(eh.ideographTinySDF=null),eh.glyphs={},eh.requests={},eh.ranges={}}this.entries={}}};w.loadGlyphRange=function(R,eu,em,e_){return eh._(this,void 0,void 0,function*(){let eg=256*eu,ev=eg+255,ex=yield e_.transformRequest(em.replace("{fontstack}",R).replace("{range}",`${eg}-${ev}`),"Glyphs"),eb=yield eh.o(ex,new AbortController);if(!(null==eb?void 0:eb.data))throw Error(`Could not load glyph range. range: ${eu}, ${eg}-${ev}`);let ew={};for(let R of eh.q(eb.data))ew[R.id]=R;return ew})}
5,w.TinySDF=class{constructor({fontSize:R=24,buffer:eh=3,radius:eu=8,cutoff:em=.25,fontFamily:e_="sans-serif",fontWeight:eg="normal",fontStyle:ev="normal",lang:ex=null}={}){this.buffer=eh,this.cutoff=em,this.radius=eu,this.lang=ex;let eb=this.size=R+4*eh,ew=this._createCanvas(eb),eT=this.ctx=ew.getContext("2d",{willReadFrequently:!0});eT.font=`${ev} ${eg} ${R}px ${e_}`,eT.textBaseline="alphabetic",eT.textAlign="left",eT.fillStyle="black",this.gridOuter=new Float64Array(eb*eb),this.gridInner=new Float64Array(eb*eb),this.f=new Float64Array(eb),this.z=new Float64Array(eb+1),this.v=new Uint16Array(eb)}_createCanvas(R){let eh=document.createElement("canvas");return eh.width=eh.height=R,eh}draw(R){let{width:eh,actualBoundingBoxAscent:eu,actualBoundingBoxDescent:em,actualBoundingBoxLeft:e_,actualBoundingBoxRight:eg}=this.ctx.measureText(R),ev=Math.ceil(eu),ex=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(eg-e_))),eb=Math.min(this.size-this.buffer,ev+Math.ceil(em)),ew=ex+2*this.buffer,eT=eb+2*this.buffer,eS=Math.max(ew*eT,0),eP=new Uint8ClampedArray(eS),eI={data:eP,width:ew,height:eT,glyphWidth:ex,glyphHeight:eb,glyphTop:ev,glyphLeft:0,glyphAdvance:eh};if(0===ex||0===eb)return eI;let{ctx:eM,buffer:eE,gridInner:eC,gridOuter:eA}=this;this.lang&&(eM.lang=this.lang),eM.clearRect(eE,eE,ex,eb),eM.fillText(R,eE,eE+ev);let ez=eM.getImageData(eE,eE,ex,eb);eA.fill(1e20,0,eS),eC.fill(0,0,eS);for(let R=0;R<eb;R++)for(let eh=0;eh<ex;eh++){let eu=ez.data[4*(R*ex+eh)+3]/255;if(0===eu)continue;let em=(R+eE)*ew+eh+eE;if(1===eu)eA[em]=0,eC[em]=1e20;else{let R=.5-eu;eA[em]=R>0?R*R:0,eC[em]=R<0?R*R:0}}x(eA,0,0,ew,eT,ew,this.f,this.v,this.z),x(eC,eE,eE,ex,eb,ew,this.f,this.v,this.z);for(let R=0;R<eS;R++){let eh=Math.sqrt(eA[R])-Math.sqrt(eC[R]);eP[R]=Math.round(255-255*(eh/this.radius+this.cutoff))}return eI}};let T=class T{constructor(){this.specification=eh.x.light.position}possiblyEvaluate(R,eu){return eh.G(R.expression.evaluate(eu))}interpolate(R,eu,em){return{x:eh.H.number(R.x,eu.x,em),y:eh.H.number(R.y,eu.y,em),z:eh.H.number(R.z,eu.z,em)}}};let C=class C extends eh.E{constructor(R){super(),eg=eg||new eh.u({anchor:new eh.D(eh.x.light.anchor),position:new T,color:new eh.D(eh.x.light.color),intensity:new eh.D(eh.x.light.intensity)}),this._transitionable=new eh.y(eg,void 0),this.setLight(R),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(R,eu={}){if(!this._validate(eh.z,R,eu))for(let eu in R){let em=R[eu];eu.endsWith(eh.B)?this._transitionable.setTransition(eu.slice(0,-eh.B.length),em):this._transitionable.setValue(eu,em)}}updateTransitions(R){this._transitioning=this._transitionable.transitioned(R,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(R){this.properties=this._transitioning.possiblyEvaluate(R)}_validate(R,eu,em){return!1!==(null==em?void 0:em.validate)&&eh.C(this,R.call(eh.F,{value:eu,style:{glyphs:!0,sprite:!0},styleSpec:eh.x}))}};let ek=new eh.u({"sky-color":new eh.D(eh.x.sky["sky-color"]),"horizon-color":new eh.D(eh.x.sky["horizon-color"]),"fog-color":new eh.D(eh.x.sky["fog-color"]),"fog-ground-blend":new eh.D(eh.x.sky["fog-ground-blend"]),"horizon-fog-blend":new eh.D(eh.x.sky["horizon-fog-blend"]),"sky-horizon-blend":new eh.D(eh.x.sky["sky-horizon-blend"]),"atmosphere-blend":new eh.D(eh.x.sky["atmosphere-blend"])});let M=class M extends eh.E{constructor(R){super(),this._transitionable=new eh.y(ek,void 0),this.setSky(R),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new eh.J(0))}setSky(R,eu={}){if(!this._validate(eh.K,R,eu))for(let eu in R||(R={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),R){let em=R[eu];eu.endsWith(eh.B)?this._transitionable.setTransition(eu.slice(0,-eh.B.length),em):this._transitionable.setValue(eu,em)}}getSky(){return this._transitionable.serialize()}updateTransitions(R){this._transitioning=this._transitionable.transitioned(R,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(R){this.properties=this._transitioning.possiblyEvaluate(R)}_validate(R,eu,em={}){return!1!==(null==em?void 0:em.validate)&&eh.C(this,R.call(eh.F,eh.e({value:eu,style:{glyphs:!0,sprite:!0},styleSpec:eh.x})))}calculateFogBlendOpacity(R){return R<60?0:R<70?(R-60)/10:1}};let S=class S{constructor(R,eh){this.width=R,this.height=eh,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(R,eh){let eu=R.join(",")+String(eh);return this.dashEntry[eu]||(this.dashEntry[eu]=this.addDash(R,eh)),this.dashEntry[eu]}getDashRanges(R,eh,eu){let em=[],e_=R.length%2==1?-R[R.length-1]*eu:0,eg=R[0]*eu,ev=!0;em.push({left:e_,right:eg,isDash:ev,zeroLength:0===R[0]});let ex=R[0];for(let eh=1;eh<R.length;eh++){ev=!ev;let eb=R[eh];e_=ex*eu,ex+=eb,eg=ex*eu,em.push({left:e_,right:eg,isDash:ev,zeroLength:0===eb})}return em}addRoundDash(R,eh,eu){let em=eh/2;for(let eh=-eu;eh<=eu;eh++){let e_=this.width*(this.nextRow+eu+eh),eg=0,ev=R[0];for(let ex=0;ex<this.width;ex++){let eb;ex/ev.right>1&&(ev=R[++eg]);let ew=Math.abs(ex-ev.left),eT=Math.abs(ex-ev.right),eS=Math.min(ew,eT),eP=eh/eu*(em+1);
5if(ev.isDash){let R=em-Math.abs(eP);eb=Math.sqrt(eS*eS+R*R)}else eb=em-Math.sqrt(eS*eS+eP*eP);this.data[e_+ex]=Math.max(0,Math.min(255,eb+128))}}}addRegularDash(R){for(let eh=R.length-1;eh>=0;--eh){let eu=R[eh],em=R[eh+1];eu.zeroLength?R.splice(eh,1):em&&em.isDash===eu.isDash&&(em.left=eu.left,R.splice(eh,1))}let eh=R[0],eu=R[R.length-1];eh.isDash===eu.isDash&&(eh.left=eu.left-this.width,eu.right=eh.right+this.width);let em=this.width*this.nextRow,e_=0,eg=R[0];for(let eh=0;eh<this.width;eh++){eh/eg.right>1&&(eg=R[++e_]);let eu=Math.abs(eh-eg.left),ev=Math.abs(eh-eg.right),ex=Math.min(eu,ev);this.data[em+eh]=Math.max(0,Math.min(255,(eg.isDash?ex:-ex)+128))}}addDash(R,eu){let em=eu?7:0,e_=2*em+1;if(this.nextRow+e_>this.height)return eh.w("LineAtlas out of space"),null;let eg=0;for(let eh of R)eg+=eh;if(0!==eg){let eh=this.width/eg,e_=this.getDashRanges(R,this.width,eh);eu?this.addRoundDash(e_,eh,em):this.addRegularDash(e_)}let ev={y:this.nextRow+em,height:2*em,width:eg};return this.nextRow+=e_,this.dirty=!0,ev}bind(R){let eh=R.gl;this.texture?(eh.bindTexture(eh.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,eh.texSubImage2D(eh.TEXTURE_2D,0,0,0,this.width,this.height,eh.ALPHA,eh.UNSIGNED_BYTE,this.data))):(this.texture=eh.createTexture(),eh.bindTexture(eh.TEXTURE_2D,this.texture),eh.texParameteri(eh.TEXTURE_2D,eh.TEXTURE_WRAP_S,eh.REPEAT),eh.texParameteri(eh.TEXTURE_2D,eh.TEXTURE_WRAP_T,eh.REPEAT),eh.texParameteri(eh.TEXTURE_2D,eh.TEXTURE_MIN_FILTER,eh.LINEAR),eh.texParameteri(eh.TEXTURE_2D,eh.TEXTURE_MAG_FILTER,eh.LINEAR),eh.texImage2D(eh.TEXTURE_2D,0,eh.ALPHA,this.width,this.height,0,eh.ALPHA,eh.UNSIGNED_BYTE,this.data))}};let eR="maplibre_preloaded_worker_pool";let z=class z{constructor(){this.active={}}acquire(R){if(!this.workers)for(this.workers=[];this.workers.length<z.workerCount;)this.workers.push(new Worker(eh.c.WORKER_URL));return this.active[R]=!0,this.workers.slice()}release(R){if(delete this.active[R],0===this.numActive()){for(let R of this.workers)R.terminate();this.workers=null}}isPreloaded(){return!!this.active[eR]}numActive(){return Object.keys(this.active).length}};let eL=Math.floor(eA.hardwareConcurrency/2);function L(){return ev||(ev=new z),ev}z.workerCount=eh.L(globalThis)?Math.max(Math.min(eL,3),1):1;let F=class F{constructor(R,eu){this.workerPool=R,this.actors=[],this.currentActor=0,this.id=eu;let em=this.workerPool.acquire(eu);for(let R=0;R<em.length;R++){let e_=new eh.N(em[R],eu);e_.name=`Worker ${R}`,this.actors.push(e_)}if(!this.actors.length)throw Error("No actors found")}broadcast(R,eh){let eu=[];for(let em of this.actors)eu.push(em.sendAsync({type:R,data:eh}));return Promise.all(eu)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(R=!0){for(let R of this.actors)R.remove();this.actors=[],R&&this.workerPool.release(this.id)}registerMessageHandler(R,eh){for(let eu of this.actors)eu.registerMessageHandler(R,eh)}unregisterMessageHandler(R){for(let eh of this.actors)eh.unregisterMessageHandler(R)}};function k(){return ex||(ex=new F(L(),eh.M)).registerMessageHandler("GR",(R,eu,em)=>eh.m(eu,em)),ex}function j(R,eh){let eu=R.tileID,em=eh.tileID;return eu.overscaledZ-em.overscaledZ||eu.canonical.y-em.canonical.y||eu.wrap-em.wrap||eu.canonical.x-em.canonical.x}function N(R,eh){let eu=R.feature,em=eh.getFeatureState(eu.layer["source-layer"],eu.id);eu.source=eu.layer.source,eu.layer["source-layer"]&&(eu.sourceLayer=eu.layer["source-layer"]),eu.state=em}function Z(R,eu,em,e_){return eh._(this,void 0,void 0,function*(){let eg=R;if(R.url?eg=(yield eh.k((yield eu.transformRequest(R.url,"Source")),em)).data:yield eA.frameAsync(em,e_),!eg)return null;let ev=eh.V(eh.e(eg,R),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in eg&&eg.vector_layers&&(ev.vectorLayerIds=eg.vector_layers.map(R=>R.id)),ev})}let U=class U{constructor(R,eh){R&&(eh?this.setSouthWest(R).setNorthEast(eh):Array.isArray(R)&&(4===R.length?this.setSouthWest([R[0],R[1]]).setNorthEast([R[2],R[3]]):this.setSouthWest(R[0]).setNorthEast(R[1])))}setNorthEast(R){return this._ne=R instanceof eh.W?new eh.W(R.lng,R.lat):eh.W.convert(R),this}
5setSouthWest(R){return this._sw=R instanceof eh.W?new eh.W(R.lng,R.lat):eh.W.convert(R),this}extend(R){let eu,em;let e_=this._sw,eg=this._ne;if(R instanceof eh.W)eu=R,em=R;else{if(!(R instanceof U))return Array.isArray(R)?4===R.length||R.every(Array.isArray)?this.extend(U.convert(R)):this.extend(eh.W.convert(R)):R&&("lng"in R||"lon"in R)&&"lat"in R?this.extend(eh.W.convert(R)):this;if(eu=R._sw,em=R._ne,!eu||!em)return this}return e_||eg?(e_.lng=Math.min(eu.lng,e_.lng),e_.lat=Math.min(eu.lat,e_.lat),eg.lng=Math.max(em.lng,eg.lng),eg.lat=Math.max(em.lat,eg.lat)):(this._sw=new eh.W(eu.lng,eu.lat),this._ne=new eh.W(em.lng,em.lat)),this}getCenter(){return new eh.W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new eh.W(this.getWest(),this.getNorth())}getSouthEast(){return new eh.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(R){let{lng:eu,lat:em}=eh.W.convert(R),e_=this._sw.lng<=eu&&eu<=this._ne.lng;return this._sw.lng>this._ne.lng&&(e_=this._sw.lng>=eu&&eu>=this._ne.lng),this._sw.lat<=em&&em<=this._ne.lat&&e_}intersects(R){if(!((R=U.convert(R)).getNorth()>=this.getSouth()&&R.getSouth()<=this.getNorth()))return!1;let eu=Math.abs(this.getEast()-this.getWest()),em=Math.abs(R.getEast()-R.getWest());if(eu>=360||em>=360)return!0;let e_=eh.X(this.getWest(),-180,180),eg=eh.X(this.getEast(),-180,180),ev=eh.X(R.getWest(),-180,180),ex=eh.X(R.getEast(),-180,180),eb=e_>eg,ew=ev>ex;return!(!eb||!ew)||(eb?ex>=e_||ev<=eg:ew?eg>=ev||e_<=ex:ev<=eg&&ex>=e_)}static convert(R){return R instanceof U?R:R?new U(R):R}static fromLngLat(R,eu=0){let em=360*eu/40075017,e_=em/Math.cos(Math.PI/180*R.lat);return new U(new eh.W(R.lng-e_,R.lat-em),new eh.W(R.lng+e_,R.lat+em))}adjustAntiMeridian(){let R=new eh.W(this._sw.lng,this._sw.lat),eu=new eh.W(this._ne.lng,this._ne.lat);return new U(R,R.lng>eu.lng?new eh.W(eu.lng+360,eu.lat):eu)}};let G=class G{constructor(R,eh,eu){this.bounds=U.convert(this.validateBounds(R)),this.minzoom=eh||0,this.maxzoom=eu||24}validateBounds(R){return Array.isArray(R)&&4===R.length?[Math.max(-180,R[0]),Math.max(-90,R[1]),Math.min(180,R[2]),Math.min(90,R[3])]:[-180,-90,180,90]}contains(R){let eu=Math.pow(2,R.z),em=Math.floor(eh.Z(this.bounds.getWest())*eu),e_=Math.floor(eh.Y(this.bounds.getNorth())*eu),eg=Math.ceil(eh.Z(this.bounds.getEast())*eu),ev=Math.ceil(eh.Y(this.bounds.getSouth())*eu);return R.x>=em&&R.x<eg&&R.y>=e_&&R.y<ev}};let V=class V extends eh.E{constructor(R,eu,em,e_){if(super(),this.id=R,this.dispatcher=em,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,eh.e(this,eh.V(eu,["url","scheme","tileSize","promoteId","encoding"])),this._options=eh.e({type:"vector"},eu),this._collectResourceTiming=eu.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(e_)}load(){return eh._(this,arguments,void 0,function*(R=!1){this._loaded=!1,this.fire(new eh.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let eu=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,eu&&(eh.e(this,eu),eu.bounds&&(this.tileBounds=new G(eu.bounds,this.minzoom,this.maxzoom)),this.fire(new eh.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new eh.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:R})))}catch(R){this._tileJSONRequest=null,this._loaded=!0,eh.$(R)||this.fire(new eh.l(eh.d(R)))}})}loaded(){return this._loaded}hasTile(R){return!this.tileBounds||this.tileBounds.contains(R.canonical)}onAdd(R){this.map=R,this.load()}setSourceProperty(R){this._tileJSONRequest&&this._tileJSONRequest.abort(),R(),this.load(!0)}setTiles(R){return this.setSourceProperty(()=>{this._options.tiles=R}),this}setUrl(R){return this.setSourceProperty(()=>{this.url=R,this._options.url=R}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return eh.e({},this._options)}loadTile(R){return eh._(this,void 0,void 0,function*(){let eh=R.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),eu={request:yield this.map._requestManager.transformRequest(eh,"Tile"),uid:R.uid,tileID:R.tileID,zoom:R.tileID.overscaledZ,tileSize:this.tileSize*R.tileID.overscaleFactor(),type:this.t
5ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(R),etag:R.etag};eu.request.collectResourceTiming=this._collectResourceTiming;let em="RT";if(R.actor&&"expired"!==R.state){if("loading"===R.state)return new Promise((eh,eu)=>{R.reloadPromise={resolve:eh,reject:eu}})}else R.actor=this.dispatcher.getActor(),em="LT";R.abortController=new AbortController;try{let eh=yield R.actor.sendAsync({type:em,data:eu},R.abortController);if(delete R.abortController,R.aborted)return;this._afterTileLoadWorkerResponse(R,eh);let e_={};return(null==eh?void 0:eh.etagUnmodified)&&(e_.unmodified=!0),e_}catch(eh){if(delete R.abortController,R.aborted)return;if(eh&&404!==eh.status)throw eh;this._afterTileLoadWorkerResponse(R,null)}})}_getOverzoomParameters(R){return eh._(this,void 0,void 0,function*(){if(R.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let eh=R.tileID.scaledTo(this.maxzoom).canonical,eu=eh.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:eh,overzoomRequest:yield this.map._requestManager.transformRequest(eu,"Tile")}})}_afterTileLoadWorkerResponse(R,eh){if((null==eh?void 0:eh.resourceTiming)&&(R.resourceTiming=eh.resourceTiming),eh&&this.map._refreshExpiredTiles&&R.setExpiryData(eh),R.etag=null==eh?void 0:eh.etag,R.loadVectorData(eh,this.map.painter),R.reloadPromise){let eh=R.reloadPromise;R.reloadPromise=null,this.loadTile(R).then(eh.resolve).catch(eh.reject)}}abortTile(R){return eh._(this,void 0,void 0,function*(){R.abortController&&(R.abortController.abort(),delete R.abortController),R.actor&&(yield R.actor.sendAsync({type:"AT",data:{uid:R.uid,type:this.t
5ype,source:this.id}}))})}unloadTile(R){return eh._(this,void 0,void 0,function*(){R.unloadVectorData(),R.actor&&(yield R.actor.sendAsync({type:"RMT",data:{uid:R.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}};let W=class W extends eh.E{constructor(R,eu,em,e_){super(),this.id=R,this.dispatcher=em,this.setEventedParent(e_),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=eh.e({type:"raster"},eu),eh.e(this,eh.V(eu,["url","scheme","tileSize"]))}load(){return eh._(this,arguments,void 0,function*(R=!1){this._loaded=!1,this.fire(new eh.n("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let eu=yield Z(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,eu&&(eh.e(this,eu),eu.bounds&&(this.tileBounds=new G(eu.bounds,this.minzoom,this.maxzoom)),this.fire(new eh.n("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new eh.n("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:R})))}catch(R){this._tileJSONRequest=null,this._loaded=!0,eh.$(R)||this.fire(new eh.l(eh.d(R)))}})}loaded(){return this._loaded}onAdd(R){this.map=R,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(R){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),R(),this.load(!0)}setTiles(R){return this.setSourceProperty(()=>{this._options.tiles=R}),this}setUrl(R){return this.setSourceProperty(()=>{this.url=R,this._options.url=R}),this}serialize(){return eh.e({},this._options)}hasTile(R){return!this.tileBounds||this.tileBounds.contains(R.canonical)}loadTile(R){return eh._(this,void 0,void 0,function*(){let eu=R.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);R.abortController=new AbortController;try{let em=yield eI.getImage((yield this.map._requestManager.transformRequest(eu,"Tile")),R.abortController,this.map._refreshExpiredTiles);if(delete R.abortController,R.aborted)return void(R.state="unloaded");if(null==em?void 0:em.data){this.map._refreshExpiredTiles&&(em.cacheControl||em.expires)&&R.setExpiryData({cacheControl:em.cacheControl,expires:em.expires});let eu=this.map.painter.context,e_=eu.gl,eg=em.data;R.texture=this.map.painter.getTileTexture(eg.width),R.texture?R.texture.update(eg,{useMipmap:!0}):(R.texture=new eh.T(eu,eg,e_.RGBA,{useMipmap:!0}),R.texture.bind(e_.LINEAR,e_.CLAMP_TO_EDGE,e_.LINEAR_MIPMAP_NEAREST)),R.state="loaded"}}catch(eh){if(delete R.abortController,R.aborted)R.state="unloaded";else if(eh)throw R.state="errored",eh}})}abortTile(R){return eh._(this,void 0,void 0,function*(){R.abortController&&(R.abortController.abort(),delete R.abortController)})}unloadTile(R){return eh._(this,void 0,void 0,function*(){R.texture&&this.map.painter.saveTileTexture(R.texture)})}hasTransition(){return!1}};let q=class q extends W{constructor(R,eu,em,e_){super(R,eu,em,e_),this.type="raster-dem",this.maxzoom=22,this._options=eh.e({type:"raster-dem"},eu),this.encoding=eu.encoding||"mapbox",this.redFactor=eu.redFactor,this.greenFactor=eu.greenFactor,this.blueFactor=eu.blueFactor,this.baseShift=eu.baseShift}loadTile(R){return eh._(this,void 0,void 0,function*(){let eu=R.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),em=yield this.map._requestManager.transformRequest(eu,"Tile");R.neighboringTiles=this._getNeighboringTiles(R.tileID),R.abortController=new AbortController;try{let eu=yield eI.getImage(em,R.abortController,this.map._refreshExpiredTiles);if(delete R.abortController,R.aborted)return void(R.state="unloaded");if(null==eu?void 0:eu.data){let em=eu.data;this.map._refreshExpiredTiles&&(eu.cacheControl||eu.expires)&&R.setExpiryData({cacheControl:eu.cacheControl,expires:eu.expires});let e_=eh.b(em)&&eh.a0()?em:yield this.readImageNow(em),eg={type:this.type,uid:R.uid,source:this.id,rawImageData:e_,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(R.actor&&"expired"!==R.state&&"reloading"!==R.state)return;R.actor&&"expired"!==R.state||(R.actor=this.dispatcher.getActor()),R.dem=yield R.actor.sendAsync({type:"LDT",data:eg}),R.needsHillshadePrepare=!0,R.needsTerrainPrepare=!0,R.state="loaded"}}catch(eh){if(delete R.abortController,R.aborted)R.state="unloaded";else if(eh)throw R.state="errored",eh}})}readImageNow(R){return eh._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&eh.a1()){let eu=R.width+2,em=R.height+2;try{return new eh.R({width:eu,height:em},(yield eh.a2(R,-1,-1,eu,em)))}catch(R){}}return eA.getImageData(R,1)})}_getNeighboringTiles(R){let eu=R.canonical,em=Math.pow(2,eu.z),e_=(eu.x-1+em)%em,eg=0===eu.x?R.wrap-1:R.wrap,ev=(eu.x+1+em)%em,ex=eu.x+1===em?R.wrap+1:R.wrap,eb={};return eb[new eh.a3(R.overscaledZ,eg,eu.z,e_,eu.y).key]={backfilled:!1},eb[new eh.a3(R.overscaledZ,ex,eu.z,ev,eu.y).key]={backfilled:!1},eu.y>0&&(eb[new eh.a3(R.overscaledZ,eg,eu.z,e_,eu.y-1).key]={backfilled:!1},eb[new eh.a3(R.overscaledZ,R.wrap,eu.z,eu.x,eu.y-1).key]={backfilled:!1},eb[new eh.a3(R.overscaledZ,ex,eu.z,ev,eu.y-1).key]={backfilled:!1}),eu.y+1<em&&(eb[new eh.a3(R.overscaledZ,eg,eu.z,e_,eu.y+1).key]={backfilled:!1},eb[new eh.a3(R.overscaledZ,R.wrap,eu.z,eu.x,eu.y+1).key]={backfilled:!1},eb[new eh.a3(R.overscaledZ,ex,eu.z,ev,eu.y+1).key]={backfilled:!1}),eb}unloadTile(R){return eh._(this,void 0,void 0,function*(){R.demTexture&&this.map.painter.saveTileTexture(R.demTexture),R.fbo&&(R.fbo.destroy(),delete R.fbo),R.dem&&delete R.dem,delete R.neighboringTiles,R.state="unloaded",R.actor&&(yield R.actor.sendAsync({type:"RDT",data:{type:this.t
5ype,uid:R.uid,source:this.id}}))})}};function $(R,eh){return eh?R.properties[eh]:R.id}function X(R){var eh,eu;if(!R)return{};let em={};return em.removeAll=R.removeAll,em.remove=new Set(R.remove||[]),em.add=new Map(null===(eh=R.add)||void 0===eh?void 0:eh.map(R=>[R.id,R])),em.update=new Map(null===(eu=R.update)||void 0===eu?void 0:eu.map(R=>[R.id,R])),em}function Y(R){return"GeometryCollection"===R.type?R.geometries.flatMap(R=>Y(R)):function K(R){return R&&0!==R.length?"number"==typeof R[0]?[R]:R.flatMap(R=>K(R)):[]}(R.coordinates)}function Q(R){let eh;let eu=new U;switch(R.type){case"FeatureCollection":eh=R.features.flatMap(R=>Y(R.geometry));break;case"Feature":eh=Y(R.geometry);break;default:eh=Y(R)}if(0===eh.length)return eu;for(let R of eh){let[eh,em]=R;eu.extend([eh,em])}return eu}let J=class J extends eh.E{constructor(R,eu,em,e_){super(),this.id=R,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:eu.data},this.actor=em.getActor(),this.setEventedParent(e_),this._data="string"==typeof eu.data?{url:eu.data}:{geojson:eu.data},this._options=eh.e({},eu),this._collectResourceTiming=eu.collectResourceTiming,void 0!==eu.maxzoom&&(this.maxzoom=eu.maxzoom),eu.type&&(this.type=eu.type),eu.attribution&&(this.attribution=eu.attribution),this.promoteId=eu.promoteId,void 0!==eu.clusterMaxZoom&&this.maxzoom<=eu.clusterMaxZoom&&eh.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${eu.clusterMaxZoom}".`),this.workerOptions=eh.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==eu.buffer?eu.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==eu.tolerance?eu.tolerance:.375),extent:eh.a6,maxZoom:this.maxzoom,lineMetrics:eu.lineMetrics||!1,generateId:eu.generateId||!1,promoteId:"string"==typeof eu.promoteId?eu.promoteId:void 0,cluster:eu.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(eu.clusterMaxZoom),minPoints:Math.max(2,eu.clusterMinPoints||2),extent:eh.a6,radius:this._pixelsToTileUnits(eu.clusterRadius||50),log:!1,generateId:eu.generateId||!1}},clusterProperties:eu.clusterProperties,filter:eu.filter},eu.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(R){return R*(eh.a6/this.tileSize)}_getClusterMaxZoom(R){let eu=R?Math.round(R):this.maxzoom-1;return Number.isInteger(R)||void 0===R||eh.w(`Integer expected for option 'clusterMaxZoom': provided value "${R}" rounded to "${eu}"`),eu}load(){return eh._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(R){this.map=R,this.load()}setData(R,eh){this._data="string"==typeof R?{url:R}:{geojson:R},this._pendingWorkerUpdate={data:R};let eu=this._updateWorkerData();return eh?eu:this}updateData(R,eh){this._pendingWorkerUpdate.diff=function(R,eh){if(!R)return eh||{};if(!eh)return R||{};let eu=X(R),em=X(eh);!function(R,eh){for(let eu of(eh.removeAll&&(R.add.clear(),R.update.clear(),R.remove.clear(),eh.remove.clear()),eh.remove))R.add.delete(eu),R.update.delete(eu);for(let[eu,em]of eh.update){let e_=R.update.get(eu);e_&&(eh.update.set(eu,function(R,eh){let eu={id:R.id};if(eh.removeAllProperties&&(delete R.removeProperties,delete R.addOrUpdateProperties,delete eh.removeProperties),eh.removeProperties)for(let eu of eh.removeProperties){let eh=R.addOrUpdateProperties.findIndex(R=>R.key===eu);eh>-1&&R.addOrUpdateProperties.splice(eh,1)}return(R.removeAllProperties||eh.removeAllProperties)&&(eu.removeAllProperties=!0),(R.removeProperties||eh.removeProperties)&&(eu.removeProperties=[...R.removeProperties||[],...eh.removeProperties||[]]),(R.addOrUpdateProperties||eh.addOrUpdateProperties)&&(eu.addOrUpdateProperties=[...R.addOrUpdateProperties||[],...eh.addOrUpdateProperties||[]]),(R.newGeometry||eh.newGeometry)&&(eu.newGeometry=eh.newGeometry||R.newGeometry),eu}(e_,em)),R.update.delete(eu))}}(eu,em);let e_={};
5if((eu.removeAll||em.removeAll)&&(e_.removeAll=!0),e_.remove=new Set([...eu.remove,...em.remove]),e_.add=new Map([...eu.add,...em.add]),e_.update=new Map([...eu.update,...em.update]),e_.remove.size&&e_.add.size)for(let R of e_.add.keys())e_.remove.delete(R);return function(R){let eh={};return R.removeAll&&(eh.removeAll=R.removeAll),R.remove&&(eh.remove=Array.from(R.remove)),R.add&&(eh.add=Array.from(R.add.values())),R.update&&(eh.update=Array.from(R.update.values())),eh}(e_)}(this._pendingWorkerUpdate.diff,R);let eu=this._updateWorkerData();return eh?eu:this}getData(){return eh._(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return eh._(this,void 0,void 0,function*(){return Q((yield this.getData()))})}setClusterOptions(R){return this.workerOptions.geojsonVtOptions.cluster=R.cluster,void 0!==R.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(R.clusterRadius)),void 0!==R.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(R.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(R){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:R,source:this.id}})}getClusterChildren(R){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:R,source:this.id}})}getClusterLeaves(R,eh,eu){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:R,limit:eh,offset:eu}})}_updateWorkerData(){return eh._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void eh.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:R,diff:eu,updateCluster:em}=this._pendingWorkerUpdate,e_=this._getLoadGeoJSONParameters(R,eu,em);void 0!==R?this._pendingWorkerUpdate.data=void 0:eu?this._pendingWorkerUpdate.diff=void 0:em&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(e_)})}_getLoadGeoJSONParameters(R,eu,em){return eh._(this,void 0,void 0,function*(){let e_=eh.e({type:this.type},this.workerOptions);return"string"==typeof R?(e_.request=yield this.map._requestManager.transformRequest(eA.resolveURL(R),"Source"),e_.request.collectResourceTiming=this._collectResourceTiming,e_):void 0!==R?(e_.data=R,e_):eu?(e_.dataDiff=eu,e_):em?(e_.updateCluster=!0,e_):void 0})}_dispatchWorkerUpdate(R){return eh._(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new eh.n("dataloading",{dataType:"source"}));try{let eu=yield R,em=yield this.actor.sendAsync({type:"LD",data:eu});if(this._isUpdatingWorker=!1,this._removed||em.abandoned)return void this.fire(new eh.n("dataabort",{dataType:"source"}));em.data&&(this._data={geojson:em.data});let e_=this._applyDiffToSource(eu.dataDiff),eg=this._getShouldReloadTileOptions(e_),ev={dataType:"source"};this._applyResourceTiming(ev,em),this.fire(new eh.n("data",Object.assign(Object.assign({},ev),{sourceDataType:"metadata"}))),this.fire(new eh.n("data",Object.assign(Object.assign({},ev),{sourceDataType:"content",shouldReloadTileOptions:eg})))}catch(R){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new eh.n("dataabort",{dataType:"source"}));this.fire(new eh.l(eh.d(R)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(R,eu){var em;if(!this._collectResourceTiming)return;let e_=null===(em=eu.resourceTiming)||void 0===em?void 0:em[this.id];if(!e_)return;let eg=e_.slice(0);(null==eg?void 0:eg.length)&&eh.e(R,{resourceTiming:eg})}_applyDiffToSource(R){if(!R)return;let eh="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let R=function(R,eh){let eu=new Map;if(null==R||null==R.type)return eu;if("Feature"===R.type){let em=$(R,eh);if(null==em)return;return eu.set(em,R),eu}if("FeatureCollection"===R.type){let em=new Set;for(let e_ of R.features){let R=$(e_,eh);if(null==R||em.has(R))return;em.add(R),eu.set(R,e_)}return eu}}(this._data.geojson,eh);if(!R)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:R}}if(!this._data.updateable)return;let eu=function(R,eh,eu){var em,e_;let eg=[];if(eh.removeAll)R.clear();else if(eh.remove)for(let eu of eh.remove){let eh=R.get(eu);eh&&(eg.push(eh.geometry),R.delete(eu))}if(eh.add)for(let em of eh.add){let eh=$(em,eu);if(null==eh)continue;let e_=R.get(eh);e_&&eg.push(e_.geometry),eg.push(em.geometry),R.set(eh,em)}if(eh.update)for(let eu of eh.update){let eh=R.get(eu.id);if(!eh)continue;let ev=!!eu.newGeometry,ex=eu.removeAllProperties||(null===(em=eu.removeProperties)||void 0===em?void 0:em.length)>0||(null===(e_=eu.addOrUpdateProperties)||void 0===e_?void 0:e_.length)>0;if(!ev&&!ex)continue;eg.push(eh.geometry);let eb=Object.assign({},eh);if(R.set(eu.id,eb),ev&&(eg.push(eu.newGeometry),eb.geometry=eu.newGeometry),ex){if(eb.properties=eu.removeAllProperties?{}:Object.assign({},eb.properties||{}),eu.removeProperties)for(let R of eu.removeProperties)delete eb.properties[R];if(eu.addOrUpdateProperties)for(let{key:R,value:eh}of eu.addOrUpdateProperties)eb.properties[R]=eh}}return eg}(this._data.updateable,R,eh);return R.removeAll||this._options.cluster?void 0:eu}
5_getShouldReloadTileOptions(R){if(R)return{affectedBounds:R.filter(Boolean).map(R=>Q(R))}}shouldReloadTile(R,{affectedBounds:eu}){if("loading"===R.state)return!0;if("unloaded"===R.state)return!1;let{buffer:em,extent:e_}=this.workerOptions.geojsonVtOptions,eg=function({x:R,y:eu,z:em},e_=0){let eg=eh.a4((R-e_)/Math.pow(2,em)),ev=eh.a5((eu+1+e_)/Math.pow(2,em)),ex=eh.a4((R+1+e_)/Math.pow(2,em)),eb=eh.a5((eu-e_)/Math.pow(2,em));return new U([eg,ev],[ex,eb])}(R.tileID.canonical,em/e_);for(let R of eu)if(eg.intersects(R))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(R){return eh._(this,void 0,void 0,function*(){let eh=R.actor?"RT":"LT";R.actor=this.actor;let eu={type:this.type,uid:R.uid,tileID:R.tileID,zoom:R.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};R.abortController=new AbortController;let em=yield this.actor.sendAsync({type:eh,data:eu},R.abortController);delete R.abortController,R.unloadVectorData(),R.aborted||R.loadVectorData(em,this.map.painter,"RT"===eh)})}abortTile(R){return eh._(this,void 0,void 0,function*(){R.abortController&&(R.abortController.abort(),delete R.abortController),R.aborted=!0})}unloadTile(R){return eh._(this,void 0,void 0,function*(){R.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:R.uid,type:this.t
5ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return eh.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}};let ee=class ee extends eh.E{constructor(R,eh,eu,em){super(),this.flippedWindingOrder=!1,this.id=R,this.dispatcher=eu,this.coordinates=eh.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(em),this.options=eh}load(R){return eh._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new eh.n("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let eh=yield eI.getImage((yield this.map._requestManager.transformRequest(this.url,"Image")),this._request);this._request=null,this._loaded=!0,(null==eh?void 0:eh.data)&&(this.image=eh.data,R&&(this.coordinates=R),this._finishLoading())}catch(R){this._request=null,this._loaded=!0,eh.$(R)||this.fire(new eh.l(eh.d(R)))}})}loaded(){return this._loaded}updateImage(R){return R.url&&(this._request&&(this._request.abort(),this._request=null),this.options.url=R.url,this.load(R.coordinates).finally(()=>this.texture=null)),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new eh.n("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(R){this.map=R,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(R){var eu;this.coordinates=R;let em=R.map(eh.a7.fromLngLat);return this.tileID=function(R){let eu=eh.a8.fromPoints(R),em=eu.width(),e_=eu.height(),eg=Math.max(0,Math.floor(-Math.log(Math.max(em,e_))/Math.LN2)),ev=Math.pow(2,eg);return new eh.aa(eg,Math.floor((eu.minX+eu.maxX)/2*ev),Math.floor((eu.minY+eu.maxY)/2*ev))}(em),this.terrainTileRanges=this._getOverlappingTileRanges(em),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=em.map(R=>this.tileID.getTilePoint(R)._round()),this.flippedWindingOrder=((eu=this.tileCoords)[1].x-eu[0].x)*(eu[2].y-eu[0].y)-(eu[1].y-eu[0].y)*(eu[2].x-eu[0].x)<0,this.fire(new eh.n("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let R=this.map.painter.context,eu=R.gl;this.texture||(this.texture=new eh.T(R,this.image,eu.RGBA),this.texture.bind(eu.LINEAR,eu.CLAMP_TO_EDGE));let em=!1;for(let R in this.tiles){let eh=this.tiles[R];"loaded"!==eh.state&&(eh.state="loaded",eh.texture=this.texture,em=!0)}em&&this.fire(new eh.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(R){return eh._(this,void 0,void 0,function*(){var eh;(null===(eh=this.tileID)||void 0===eh?void 0:eh.equals(R.tileID.canonical))?(this.tiles[String(R.tileID.wrap)]=R,R.buckets={}):R.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(R){let{minX:eu,minY:em,maxX:e_,maxY:eg}=eh.a8.fromPoints(R),ev={};for(let R=0;R<=eh.a9;R++){let eh=Math.pow(2,R),ex=Math.floor(eu*eh),eb=Math.floor(em*eh),ew=Math.floor(e_*eh),eT=Math.floor(eg*eh),eS=(ex%eh+eh)%eh,eP=ew%eh,eI=Math.floor(ex/eh),eM=Math.floor(ew/eh);ev[R]={minWrap:eI,maxWrap:eM,minTileXWrapped:eS,maxTileXWrapped:eP,minTileY:eb,maxTileY:eT}}return ev}};let te=class te extends ee{constructor(R,eh,eu,em){super(R,eh,eu,em),this._onPlayingHandler=()=>{var R;null===(R=this.map)||void 0===R||R.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=eh}load(){return eh._(this,void 0,void 0,function*(){this._loaded=!1;let R=this.options;for(let eh of(this.urls=[],R.urls))this.urls.push((yield this.map._requestManager.transformRequest(eh,"Source")).url);try{let R=yield eh.ab(this.urls);if(this._loaded=!0,!R)return;this.video=R,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(R){this.fire(new eh.l(eh.d(R)))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(R){if(this.video){let eu=this.video.seekable;R<eu.start(0)||R>eu.end(0)?this.fire(new eh.l(new eh.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${eu.start(0)} and ${eu.end(0)}-second mark.`))):this.video.currentTime=R}}getVideo(){return this.video}
5onAdd(R){this.map||(this.map=R,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let R=this.map.painter.context,eu=R.gl;this.texture?this.video.paused||(this.texture.bind(eu.LINEAR,eu.CLAMP_TO_EDGE),eu.texSubImage2D(eu.TEXTURE_2D,0,0,0,eu.RGBA,eu.UNSIGNED_BYTE,this.video)):(this.texture=new eh.T(R,this.video,eu.RGBA),this.texture.bind(eu.LINEAR,eu.CLAMP_TO_EDGE));let em=!1;for(let R in this.tiles){let eh=this.tiles[R];"loaded"!==eh.state&&(eh.state="loaded",eh.texture=this.texture,em=!0)}em&&this.fire(new eh.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};let ie=class ie extends ee{constructor(R,eu,em,e_){super(R,eu,em,e_),eu.coordinates?Array.isArray(eu.coordinates)&&4===eu.coordinates.length&&!eu.coordinates.some(R=>!Array.isArray(R)||2!==R.length||R.some(R=>"number"!=typeof R))||this.fire(new eh.l(new eh.ac(`sources.${R}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new eh.l(new eh.ac(`sources.${R}`,null,'missing required property "coordinates"'))),eu.animate&&"boolean"!=typeof eu.animate&&this.fire(new eh.l(new eh.ac(`sources.${R}`,null,'optional "animate" property must be a boolean value'))),eu.canvas?"string"==typeof eu.canvas||eu.canvas instanceof HTMLCanvasElement||this.fire(new eh.l(new eh.ac(`sources.${R}`,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 eh.l(new eh.ac(`sources.${R}`,null,'missing required property "canvas"'))),this.options=eu,this.animate=void 0===eu.animate||eu.animate}load(){return eh._(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 eh.l(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(R){this.map=R,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let R=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,R=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,R=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let eu=this.map.painter.context,em=eu.gl;this.texture?(R||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new eh.T(eu,this.canvas,em.RGBA,{premultiply:!0}),this.texture.bind(em.LINEAR,em.CLAMP_TO_EDGE));let e_=!1;for(let R in this.tiles){let eh=this.tiles[R];"loaded"!==eh.state&&(eh.state="loaded",eh.texture=this.texture,e_=!0)}e_&&this.fire(new eh.n("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let R of[this.canvas.width,this.canvas.height])if(isNaN(R)||R<=0)return!0;return!1}};let eF={},re=R=>{switch(R){case"geojson":return J;case"image":return ee;case"raster":return W;case"raster-dem":return q;case"vector":return V;case"video":return te;case"canvas":return ie}return eF[R]},eB="RTLPluginLoaded";let se=class se extends eh.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=k()}_syncState(R){return this.status=R,this.dispatcher.broadcast("SRPS",{pluginStatus:R,pluginURL:this.url}).catch(R=>{throw this.status="error",R})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(R){return eh._(this,arguments,void 0,function*(R,eh=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=eA.resolveURL(R),!this.url)throw Error(`requested url ${R}
5 is invalid`);if("unavailable"===this.status){if(!eh)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return eh._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new eh.n(eB))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let eO=null;function le(){return eO||(eO=new se),eO}(eT=eM||(eM={}))[eT.Base=0]="Base",eT[eT.Parent=1]="Parent",(eS=eE||(eE={}))[eS.Departing=0]="Departing",eS[eS.Incoming=1]="Incoming";let ue=class ue{constructor(R,eu){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=R,this.uid=eh.ad(),this.uses=0,this.tileSize=eu,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(R){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(R||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:R,fadingDirection:eh,fadingParentID:eu,fadeEndTime:em}){this.resetFadeLogic(),this.fadingRole=R,this.fadingDirection=eh,this.fadingParentID=eu,this.fadeEndTime=em}setSelfFadeLogic(R){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=R}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(R){this.demTexture&&R.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(R,eu,em){if(!0!==(null==R?void 0:R.etagUnmodified)){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",R){for(let e_ in R.featureIndex&&(this.latestFeatureIndex=R.featureIndex,R.rawTileData?(this.latestRawTileData=R.rawTileData,this.latestEncoding=R.encoding,this.latestFeatureIndex.rawTileData=R.rawTileData,this.latestFeatureIndex.encoding=R.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=R.collisionBoxArray,this.buckets=function(R,eh){let eu={};if(!eh)return eu;for(let em of R){let R=em.layerIds.map(R=>eh.getLayer(R)).filter(Boolean);if(0!==R.length)for(let eh of(em.layers=R,em.stateDependentLayerIds&&(em.stateDependentLayers=em.stateDependentLayerIds.map(eh=>R.filter(R=>R.id===eh)[0])),R))eu[eh.id]=em}return eu}(R.buckets,null==eu?void 0:eu.style),this.hasSymbolBuckets=!1,this.buckets){let R=this.buckets[e_];if(R instanceof eh.af){if(this.hasSymbolBuckets=!0,!em)break;R.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let R in this.buckets){let eu=this.buckets[R];if(eu instanceof eh.af&&eu.hasRTLText){this.hasRTLText=!0,le().lazyLoad();break}}for(let R in this.queryPadding=0,this.buckets){let eh=this.buckets[R];this.queryPadding=Math.max(this.queryPadding,eu.style.getLayer(R).queryRadius(eh))}R.imageAtlas&&(this.imageAtlas=R.imageAtlas),R.glyphAtlasImage&&(this.glyphAtlasImage=R.glyphAtlasImage),this.dashPositions=R.dashPositions}else this.collisionBoxArray=new eh.ae}else this.state="loaded"}unloadVectorData(){for(let R in this.buckets)this.buckets[R].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(R){return this.buckets[R.id]}upload(R){for(let eh in this.buckets){let eu=this.buckets[eh];eu.uploadPending()&&eu.upload(R)}let eu=R.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new eh.T(R,this.imageAtlas.image,eu.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new eh.T(R,this.glyphAtlasImage,eu.ALPHA),this.glyphAtlasImage=null)}prepare(R){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(R,this.imageAtlasTexture)}queryRenderedFeatures(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT){var eS;return(null===(eS=this.latestFeatureIndex)||void 0===eS?void 0:eS.rawTileData)?this.latestFeatureIndex.query({queryGeometry:em,cameraQueryGeometry:e_,scale:eg,tileSize:this.tileSize,pixelPosMatrix:ew,transform:ex,params:ev,queryPadding:this.queryPadding*eb,getElevation:eT},R,eh,eu):{}}querySourceFeatures(R,eu){let em=this.latestFeatureIndex;if(!(null==em?void 0:em.rawTileData))return;let e_=em.loadVTLayers(),eg=(null==eu?void 0:eu.sourceLayer)?eu.sourceLayer:"",ev=e_[eh.ag]||e_[eg];if(!ev)return;let ex=eh.ah(null==eu?void 0:eu.filter,null==eu?void 0:eu.globalState),{z:eb,x:ew,y:eT}=this.tileID.canonical,eS={z:eb,x:ew,y:eT};for(let eu=0;eu<ev.length;eu++){let e_=ev.feature(eu);if(ex.needGeometry){let R=eh.ai(e_,!0);
5if(!ex.filter(new eh.J(this.tileID.overscaledZ),R,this.tileID.canonical))continue}else if(!ex.filter(new eh.J(this.tileID.overscaledZ),e_))continue;let eP=em.getId(e_,eg),eI=new eh.aj(e_,eb,ew,eT,eP);eI.tile=eS,R.push(eI)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(R){let eu=this.expirationTime;if(R.cacheControl){let eu=eh.ak(R.cacheControl);eu["max-age"]&&(this.expirationTime=Date.now()+1e3*eu["max-age"])}else R.expires&&(this.expirationTime=new Date(R.expires).getTime());if(this.expirationTime){let R=Date.now(),eh=!1;if(this.expirationTime>R)eh=!1;else if(eu){if(this.expirationTime<eu)eh=!0;else{let em=this.expirationTime-eu;em?this.expirationTime=R+Math.max(em,3e4):eh=!0}}else eh=!0;eh?(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(),2147483647)}setFeatureState(R,eu){var em,e_,eg;if(!(null===(em=this.latestFeatureIndex)||void 0===em?void 0:em.rawTileData)||0===Object.keys(R).length)return;let ev=this.latestFeatureIndex.loadVTLayers();for(let em in this.buckets){if(!eu.style.hasLayer(em))continue;let ex=this.buckets[em],eb=ex.layers[0].sourceLayer||eh.ag,ew=ev[eb],eT=R[eb];if(!ew||!eT||0===Object.keys(eT).length)continue;ex.update(eT,ew,(null===(e_=this.imageAtlas)||void 0===e_?void 0:e_.patternPositions)||{},this.dashPositions||{});let eS=null===(eg=null==eu?void 0:eu.style)||void 0===eg?void 0:eg.getLayer(em);eS&&(this.queryPadding=Math.max(this.queryPadding,eS.queryRadius(ex)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(R){this.symbolFadeHoldUntil=c()+R}setDependencies(R,eh){let eu={};for(let R of eh)eu[R]=!0;this.dependencies[R]=eu}hasDependency(R,eh){for(let eu of R){let R=this.dependencies[eu];if(R){for(let eu of eh)if(R[eu])return!0}}return!1}};let de=class de{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(R,eu,em){var e_,eg,ev;let ex=String(eu);if(this.stateChanges[R]=this.stateChanges[R]||{},this.stateChanges[R][ex]=this.stateChanges[R][ex]||{},eh.e(this.stateChanges[R][ex],em),null===this.deletedStates[R])for(let eh in this.deletedStates[R]={},this.state[R])eh!==ex&&(this.deletedStates[R][eh]=null);else if(null===(null===(e_=this.deletedStates[R])||void 0===e_?void 0:e_[ex]))for(let eh in this.deletedStates[R][ex]={},this.state[R][ex])em[eh]||(this.deletedStates[R][ex][eh]=null);else for(let eh in em)null===(null===(ev=null===(eg=this.deletedStates[R])||void 0===eg?void 0:eg[ex])||void 0===ev?void 0:ev[eh])&&delete this.deletedStates[R][ex][eh]}removeFeatureState(R,eh,eu){var em;if(null===this.deletedStates[R])return;let e_=String(eh);if(this.deletedStates[R]=this.deletedStates[R]||{},eu&&void 0!==eh)null!==this.deletedStates[R][e_]&&(this.deletedStates[R][e_]=this.deletedStates[R][e_]||{},this.deletedStates[R][e_][eu]=null);else if(void 0!==eh){if(null===(em=this.stateChanges[R])||void 0===em?void 0:em[e_])for(eu in this.deletedStates[R][e_]={},this.stateChanges[R][e_])this.deletedStates[R][e_][eu]=null;else this.deletedStates[R][e_]=null}else this.deletedStates[R]=null}getState(R,eu){let em=String(eu),e_=eh.e({},(this.state[R]||{})[em],(this.stateChanges[R]||{})[em]);if(null===this.deletedStates[R])return{};if(this.deletedStates[R]){let eh=this.deletedStates[R][eu];if(null===eh)return{};for(let R in eh)delete e_[R]}return e_}initializeTileState(R,eh){R.setFeatureState(this.state,eh)}coalesceChanges(R,eu){let em={};for(let R in this.stateChanges){this.state[R]=this.state[R]||{};let eu={};for(let em in this.stateChanges[R])this.state[R][em]||(this.state[R][em]={}),eh.e(this.state[R][em],this.stateChanges[R][em]),eu[em]=this.state[R][em];em[R]=eu}for(let R in this.deletedStates){this.state[R]=this.state[R]||{};let eu={};if(null===this.deletedStates[R])for(let eh in this.state[R])eu[eh]={},this.state[R][eh]={};else for(let eh in this.deletedStates[R]){if(null===this.deletedStates[R][eh])this.state[R][eh]={};else for(let eu of Object.keys(this.deletedStates[R][eh]))delete this.state[R][eh][eu];eu[eh]=this.state[R][eh]}em[R]=em[R]||{},eh.e(em[R],eu)}this.stateChanges={},this.deletedStates={},0!==Object.keys(em).length&&(this.revision++,R.setFeatureState(em,eu))}};function pe(R,eu){let em=eh.al(eu.lat,-eh.am,eh.am);return new eh.P(eh.Z(eu.lng)*R,eh.Y(em)*R)}function me(R,eu){return new eh.a7(eu.x/R,eu.y/R).toLngLat()}function fe(R){return R.cameraToCenterDistance*Math.min(.85*Math.tan(eh.an(90-R.pitch)),Math.tan(eh.an(89.25-R.pitch)))}function ge(R,eu){let em=R.canonical,e_=eu/eh.ao(em.z),eg=em.x+Math.pow(2,em.z)*R.wrap,ev=eh.ap(new Float64Array(16));return eh.Q(ev,ev,[eg*e_,em.y*e_,0]),eh.S(ev,ev,[e_/eh.a6,e_/eh.a6,1]),ev}function ve(R,eu,em,e_,eg){let ev=eh.a7.fromLngLat(R,eu),ex=eg*eh.aq(1,R.lat),{x:eb,y:ew,z:eT}=xe(em,e_);
5return new eh.a7(ev.x+-(ex*eb),ev.y+-(ex*ew),ev.z+-(ex*eT))}function xe(R,eu){let em=eh.an(R),e_=eh.an(eu),eg=Math.sin(em);return{x:eg*Math.sin(e_),y:-eg*Math.cos(e_),z:Math.cos(-em)}}function ye(R,eh,eu){let em=0,e_=(eu-eh)/10;for(let eg=0;eg<10;eg++)em+=e_*Math.pow(Math.cos(eh+(eg+.5)/10*(eu-eh)),R);return em}function we(R,eu){return function(em,e_,eg,ev,ex){let eb=2*((R-1)/eh.ar(Math.cos(eh.an(89.25-ex))/Math.cos(eh.an(89.25)))-1),ew=Math.acos(eg/ev),eT=2*ye(eb-1,0,eh.an(ex/2)),eS=Math.min(eh.an(89.25),ew+eh.an(ex/2)),eP=ye(eb-1,Math.min(eS,ew-eh.an(ex/2)),eS),eI=Math.atan(e_/eg),eM=Math.hypot(e_,eg),eE=em;return eE+=eh.ar(ev/eM/Math.max(.5,Math.cos(eh.an(ex/2))))+eb*eh.ar(Math.cos(eI))/2,eE-=eh.ar(Math.max(1,eP/eT/eu))/2}}let eV=we(9.314,3);function Pe(R,eu){let em=(eu.roundZoom?Math.round:Math.floor)(R.zoom+eh.ar(R.tileSize/eu.tileSize));return Math.max(0,em)}function Ce(R,eu){let em=R.getCameraFrustum(),e_=R.getClippingPlane(),eg=R.screenPointToMercatorCoordinate(R.getCameraPoint()),ev=eh.a7.fromLngLat(R.center,R.elevation);eg.z=ev.z+Math.cos(R.pitchInRadians)*R.cameraToCenterDistance/R.worldSize;let ex=R.getCoveringTilesDetailsProvider(),eb=ex.allowVariableZoom(R,eu),ew=Pe(R,eu),eT=eu.minzoom||0,eS=void 0!==eu.maxzoom?eu.maxzoom:R.maxZoom,eP=Math.min(Math.max(0,ew),eS),eI=Math.pow(2,eP),eM=[eI*eg.x,eI*eg.y,0],eE=[eI*ev.x,eI*ev.y,0],eC=Math.hypot(ev.x-eg.x,ev.y-eg.y),eA=Math.abs(ev.z-eg.z),ez=Math.hypot(eC,eA),x=R=>({zoom:0,x:0,y:0,wrap:R,fullyVisible:!1}),eD=[],ek=[];if(R.renderWorldCopies&&ex.allowWorldCopies())for(let R=1;R<=3;R++)eD.push(x(-R)),eD.push(x(R));for(eD.push(x(0));eD.length>0;){let eI=eD.pop(),eC=eI.x,eR=eI.y,eL=eI.fullyVisible,eF={x:eC,y:eR,z:eI.zoom},eB=ex.getTileBoundingVolume(eF,eI.wrap,R.elevation,eu);if(!eL){let R=function(R,eh,eu){let em=eh.intersectsFrustum(R);if(!eu||0===em)return em;let e_=eh.intersectsPlane(eu);return 0===e_?0:2===em&&2===e_?2:1}(em,eB,e_);if(0===R)continue;eL=2===R}let eO=ex.distanceToTile2d(eg.x,eg.y,eF,eB),ej=ew;eb&&(ej=(eu.calculateTileZoom||eV)(R.zoom+eh.ar(R.tileSize/eu.tileSize),eO,eA,ez,R.fov)),ej=Math.max(0,ej=(eu.roundZoom?Math.round:Math.floor)(ej));let eN=Math.min(ej,eS);if(eI.wrap=ex.getWrap(ev,eF,eI.wrap),eI.zoom>=eN){if(eI.zoom<eT)continue;let R=eP-eI.zoom,em=eM[0]-.5-(eC<<R),e_=eM[1]-.5-(eR<<R),eg=eu.reparseOverscaled?Math.max(eI.zoom,ej):eI.zoom;ek.push({tileID:new eh.a3(eI.zoom===eS?eg:eI.zoom,eI.wrap,eI.zoom,eC,eR),distanceSq:eh.as([eE[0]-.5-eC,eE[1]-.5-eR]),tileDistanceToCamera:Math.sqrt(em*em+e_*e_)})}else for(let R=0;R<4;R++)eD.push({zoom:eI.zoom+1,x:(eC<<1)+R%2,y:(eR<<1)+(R>>1),wrap:eI.wrap,fullyVisible:eL})}return ek.sort((R,eh)=>R.distanceSq-eh.distanceSq).map(R=>R.tileID)}let ej=eh.a8.fromPoints([new eh.P(0,0),new eh.P(eh.a6,eh.a6)]);function Me(R){return"raster"===R||"image"===R||"video"===R}function ze(R,eh,eu,em,e_,eg,ev){if(eu[0].overscaledZ>=eg)return!1;let ex=!1;for(let eg of eu){let eu=R.getLoadedTile(eg);if(!eu)continue;let{fadingRole:eb,fadingDirection:ew,fadingParentID:eT}=eu;eb===eM.Base&&ew===eE.Departing&&eT||(eu.setCrossFadeLogic({fadingRole:eM.Base,fadingDirection:eE.Departing,fadingParentID:eh.tileID,fadeEndTime:e_+ev}),eh.setCrossFadeLogic({fadingRole:eM.Parent,fadingDirection:eE.Incoming,fadeEndTime:e_+ev})),em[eg.key]=eg,ex=!0}return ex}function De(R,eh){var eu;R.needsHillshadePrepare=!0,R.needsTerrainPrepare=!0;let em=eh.tileID.canonical.x-R.tileID.canonical.x,e_=eh.tileID.canonical.y-R.tileID.canonical.y,eg=Math.pow(2,R.tileID.canonical.z),ev=eh.tileID.key;0===em&&0===e_||Math.abs(e_)>1||(Math.abs(em)>1&&(1===Math.abs(em+eg)?em+=eg:1===Math.abs(em-eg)&&(em-=eg)),eh.dem&&R.dem&&(R.dem.backfillBorder(eh.dem,em,e_),(null===(eu=R.neighboringTiles)||void 0===eu?void 0:eu[ev])&&(R.neighboringTiles[ev].backfilled=!0)))}let Ae=class Ae{constructor(){this._tiles={}}handleWrapJump(R){let eh={};for(let eu in this._tiles){let em=this._tiles[eu];em.tileID=em.tileID.unwrapTo(em.tileID.wrap+R),eh[em.tileID.key]=em}this._tiles=eh}setFeatureState(R,eh){for(let eu in this._tiles)this._tiles[eu].setFeatureState(R,eh)}getAllTiles(){return Object.values(this._tiles)}getAllIds(R=!1){return R?Object.values(this._tiles).map(R=>R.tileID).sort(eh.au).map(R=>R.key):Object.keys(this._tiles)}getTileById(R){return this._tiles[R]}setTile(R,eh){this._tiles[R]=eh}deleteTileById(R){delete this._tiles[R]}getLoadedTile(R){let eh=this.getTileById(R.key);return(null==eh?void 0:eh.hasData())?eh:null}isIdRenderable(R,eh=!1){var eu;return null===(eu=this.getTileById(R))||void 0===eu?void 0:eu.isRenderable(eh)}getRenderableIds(R=0,eu){let em=[];for(let R of this.getAllIds())this.isIdRenderable(R,eu)&&em.push(this.getTileById(R));return eu?em.sort((eu,em)=>{let e_=eu.tileID,eg=em.tileID,ev=new eh.P(e_.canonical.x,e_.canonical.y)._rotate(-R),ex=new eh.P(eg.canonical.x,eg.canonical.y)._rotate(-R);return e_.overscaledZ-eg.overscaledZ||ex.y-ev.y||ex.x-ev.x}).map(R=>R.tileID.key):em.map(R=>R.tileID).sort(eh.au).map(R=>R.key)}};let Le=class Le extends eh.E{constructor(R,eu,em){super(),this.id=R,this.dispatcher=em,this.on("data",R=>{this._dataHandler(R)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((R,eh,eu,em)=>{let e_=new(re(eh.type))(R,eh,eu,em);if(e_.id!==R)throw Error(`Expected Source id to be ${R} instead of ${e_.id}`);return e_})(R,eu,em,this),this._inViewTiles=new Ae,this._outOfViewCache=new eh.av(0,R=>this._unloadTile(R)),this._timers={}
5,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new de,this._didEmitContent=!1,this._updated=!1}onAdd(R){var eh;this.map=R,this._maxTileCacheSize=R?R._maxTileCacheSize:null,this._maxTileCacheZoomLevels=R?R._maxTileCacheZoomLevels:null,(null===(eh=this._source)||void 0===eh?void 0:eh.onAdd)&&this._source.onAdd(R)}onRemove(R){var eh;for(let R of this._inViewTiles.getAllTiles())R.unloadVectorData();this.clearTiles(),(null===(eh=this._source)||void 0===eh?void 0:eh.onRemove)&&this._source.onRemove(R),this._inViewTiles=new Ae}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let R of this._inViewTiles.getAllTiles())if("loaded"!==R.state&&"errored"!==R.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let R=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,R&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(R,eu,em){return eh._(this,void 0,void 0,function*(){try{let eh=yield this._source.loadTile(R);this._tileLoaded(R,eu,em,eh)}catch(eu){R.state="errored",404!==eu.status?this._source.fire(new eh.l(eh.d(eu),{tile:R})):this.update(this.transform,this.terrain)}})}_unloadTile(R){this._source.unloadTile&&this._source.unloadTile(R)}_abortTile(R){this._source.abortTile&&this._source.abortTile(R),this._source.fire(new eh.n("dataabort",{tile:R,coord:R.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(R){for(let eh of(this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null),this._inViewTiles.getAllTiles()))eh.upload(R),eh.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(R){var eh;return this._inViewTiles.getRenderableIds(null===(eh=this.transform)||void 0===eh?void 0:eh.bearingInRadians,R)}hasRenderableParent(R){let eh=R.overscaledZ-1;if(eh>=this._source.minzoom){let eu=this.getLoadedTile(R.scaledTo(eh));if(eu)return this._inViewTiles.isIdRenderable(eu.tileID.key)}return!1}reload(R,eh){if(this._paused)this._shouldReloadOnResume=!0;else for(let eu of(this._outOfViewCache.reset(),this._inViewTiles.getAllIds())){let em=this._inViewTiles.getTileById(eu);eh&&!this._source.shouldReloadTile(em,eh)||(R?this._reloadTile(eu,"expired"):"errored"!==em.state&&this._reloadTile(eu,"reloading"))}}_reloadTile(R,eu){return eh._(this,void 0,void 0,function*(){let eh=this._inViewTiles.getTileById(R);eh&&("loading"!==eh.state&&(eh.state=eu),yield this._loadTile(eh,R,eu))})}_tileLoaded(R,eu,em,e_){R.timeAdded=c(),R.selfFading&&(R.fadeEndTime=R.timeAdded+this._rasterFadeDuration),"expired"===em&&(R.refreshedUponExpiration=!0),this._setTileReloadTimer(eu,R),(null==e_?void 0:e_.unmodified)||("raster-dem"===this.getSource().type&&R.dem&&function(R,eh){var eu,em,e_;let eg=eh.getRenderableIds();for(let ev of eg){if(!(null===(eu=R.neighboringTiles)||void 0===eu?void 0:eu[ev]))continue;let eg=eh.getTileById(ev);R.neighboringTiles[ev].backfilled||De(R,eg),(null===(e_=null===(em=eg.neighboringTiles)||void 0===em?void 0:em[R.tileID.key])||void 0===e_?void 0:e_.backfilled)||De(eg,R)}}(R,this._inViewTiles),this._state.initializeTileState(R,this.map?this.map.painter:null),R.aborted||this._source.fire(new eh.n("data",{dataType:"source",tile:R,coord:R.tileID})))}getTile(R){return this.getTileByID(R.key)}getTileByID(R){return this._inViewTiles.getTileById(R)}_retainLoadedChildren(R,eh){let eu=this._getLoadedDescendents(eh),em=new Set;for(let e_ of eh){let eh=eu[e_.key];if(!(null==eh?void 0:eh.length)){em.add(e_);continue}let eg=e_.overscaledZ+Le.maxOverzooming,ev=eh.filter(R=>R.tileID.overscaledZ<=eg);if(!ev.length){em.add(e_);continue}let ex=Math.min(...ev.map(R=>R.tileID.overscaledZ)),eb=ev.filter(R=>R.tileID.overscaledZ===ex).map(R=>R.tileID);for(let eh of eb)R[eh.key]=eh;
5this._areDescendentsComplete(eb,ex,e_.overscaledZ)||em.add(e_)}return em}_getLoadedDescendents(R){var eh;let eu={};for(let em of this._inViewTiles.getAllTiles().filter(R=>R.hasData()))for(let e_ of R)em.tileID.isChildOf(e_)&&(eu[eh=e_.key]||(eu[eh]=[])).push(em);return eu}_areDescendentsComplete(R,eh,eu){return 1===R.length&&R[0].isOverscaled()?R[0].overscaledZ===eh:Math.pow(4,eh-eu)===R.length}getLoadedTile(R){return this._inViewTiles.getLoadedTile(R)}updateCacheSize(R){let eu=Math.ceil(R.width/this._source.tileSize)+1,em=Math.ceil(R.height/this._source.tileSize)+1,e_=Math.floor(eu*em*(null===this._maxTileCacheZoomLevels?eh.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),eg="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,e_):e_;this._outOfViewCache.setMaxSize(eg)}handleWrapJump(R){let eh=Math.round((R-(void 0===this._prevLng?R:this._prevLng))/360);this._prevLng=R,eh&&(this._inViewTiles.handleWrapJump(eh),this._resetTileReloadTimers())}update(R,eu){let em;if(!this._sourceLoaded||this._paused)return;this.transform=R,this.terrain=eu,this.updateCacheSize(R),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?em=R.getVisibleUnwrappedCoordinates(this._source.tileID).map(R=>new eh.a3(R.canonical.z,R.wrap,R.canonical.z,R.canonical.x,R.canonical.y)):(em=Ce(R,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?R.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:eu,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(em=em.filter(R=>this._source.hasTile(R)))):em=[],this.usedForTerrain&&(em=this._addTerrainIdealTiles(em));let e_=0===em.length&&!this._updated&&this._didEmitContent;this._updated=!0,e_&&this.fire(new eh.n("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let eg=Pe(R,this._source),ev=this._updateRetainedTiles(em,eg),ex=Me(this._source.type);ex&&this._rasterFadeDuration>0&&!eu&&function(R,eu,em,e_,eg,ev,ex){let eb=c(),ew=eh.at(eu);for(let eh of eu){let eu=R.getTileById(eh.key);eu.fadingDirection!==eE.Departing&&0!==eu.fadeOpacity||eu.resetFadeLogic(),function(R,eh,eu,em,e_,eg,ev){if(!eh.hasData())return!1;let{tileID:ex,fadingRole:eb,fadingDirection:ew,fadingParentID:eT}=eh;if(eb===eM.Base&&ew===eE.Incoming&&eT)return eu[eT.key]=eT,!0;let eS=Math.max(ex.overscaledZ-e_,eg);for(let e_=ex.overscaledZ-1;e_>=eS;e_--){let eg=ex.scaledTo(e_),eb=R.getLoadedTile(eg);if(eb)return eh.setCrossFadeLogic({fadingRole:eM.Base,fadingDirection:eE.Incoming,fadingParentID:eb.tileID,fadeEndTime:em+ev}),eb.setCrossFadeLogic({fadingRole:eM.Parent,fadingDirection:eE.Departing,fadeEndTime:em+ev}),eu[eg.key]=eg,!0}return!1}(R,eu,em,eb,e_,eg,ex)||function(R,eh,eu,em,e_,eg){if(!eh.hasData())return!1;let ev=eh.tileID.children(e_),ex=ze(R,eh,ev,eu,em,e_,eg);if(ex)return!0;for(let eb of ev)ze(R,eh,eb.children(e_),eu,em,e_,eg)&&(ex=!0);return ex}(R,eu,em,eb,ev,ex)||function(R,eh,eu,em){let e_=R.tileID;return!!R.selfFading||!R.hasData()&&!!eh.has(e_)&&(R.setSelfFadeLogic(eu+em),!0)}(eu,ew,eb,ex)||eu.resetFadeLogic()}}(this._inViewTiles,em,ev,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),ex?this._cleanUpRasterTiles(ev):this._cleanUpVectorTiles(ev)}_cleanUpRasterTiles(R){for(let eh of this._inViewTiles.getAllIds())R[eh]||this._removeTile(eh)}_cleanUpVectorTiles(R){for(let eh of this._inViewTiles.getAllIds()){let eu=this._inViewTiles.getTileById(eh);R[eh]?eu.clearSymbolFadeHold():eu.hasSymbolBuckets?eu.holdingForSymbolFade()?eu.symbolFadeFinished()&&this._removeTile(eh):eu.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(eh)}}_addTerrainIdealTiles(R){let eh=[];for(let eu of R)if(eu.canonical.z>this._source.minzoom){let R=eu.scaledTo(eu.canonical.z-1);eh.push(R);let em=eu.scaledTo(Math.max(this._source.minzoom,Math.min(eu.canonical.z,5)));eh.push(em)}return R.concat(eh)}releaseSymbolFadeTiles(){for(let R of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(R).holdingForSymbolFade()&&this._removeTile(R)}_updateRetainedTiles(R,eh){var eu;let em=new Set;for(let eh of R)this._addTile(eh).hasData()||em.add(eh);let e_=R.reduce((R,eh)=>(R[eh.key]=eh,R),{}),eg=this._retainLoadedChildren(e_,em),ev={},ex=Math.max(eh-Le.maxUnderzooming,this._source.minzoom);for(let R of eg){let eh=this._inViewTiles.getTileById(R.key),em=null==eh?void 0:eh.wasRequested();for(let eg=R.overscaledZ-1;eg>=ex;--eg){let ex=R.scaledTo(eg);if(ev[ex.key])break;if(ev[ex.key]=!0,(eh=this.getTile(ex))||!em||(eh=this._addTile(ex)),eh){let R=eh.hasData();
5if((R||!(null===(eu=this.map)||void 0===eu?void 0:eu.cancelPendingTileRequestsWhileZooming)||em)&&(e_[ex.key]=ex),em=eh.wasRequested(),R)break}}}return e_}_addTile(R){let eu=this._inViewTiles.getTileById(R.key);if(eu)return eu;(eu=this._outOfViewCache.getAndRemove(R))&&(eu.resetFadeLogic(),this._setTileReloadTimer(R.key,eu),eu.tileID=R,this._state.initializeTileState(eu,this.map?this.map.painter:null));let em=eu;return eu||(eu=new ue(R,this._source.tileSize*R.overscaleFactor()),this._loadTile(eu,R.key,eu.state)),eu.uses++,this._inViewTiles.setTile(R.key,eu),em||this._source.fire(new eh.n("dataloading",{tile:eu,coord:eu.tileID,dataType:"source"})),eu}_setTileReloadTimer(R,eh){this._clearTileReloadTimer(R);let eu=eh.getExpiryTimeout();eu&&(this._timers[R]=setTimeout(()=>{this._reloadTile(R,"expired"),delete this._timers[R]},eu))}_clearTileReloadTimer(R){let eh=this._timers[R];eh&&(clearTimeout(eh),delete this._timers[R])}_resetTileReloadTimers(){for(let R in this._timers)clearTimeout(this._timers[R]),delete this._timers[R];for(let R of this._inViewTiles.getAllIds()){let eh=this._inViewTiles.getTileById(R);this._setTileReloadTimer(R,eh)}}refreshTiles(R){for(let eh of this._inViewTiles.getAllIds()){let eu=this._inViewTiles.getTileById(eh);(this._inViewTiles.isIdRenderable(eh)||"errored"==eu.state)&&R.some(R=>R.equals(eu.tileID.canonical))&&this._reloadTile(eh,"expired")}}_removeTile(R){let eh=this._inViewTiles.getTileById(R);eh&&(eh.uses--,this._inViewTiles.deleteTileById(R),this._clearTileReloadTimer(R),eh.uses>0||(eh.hasData()&&"reloading"!==eh.state?this._outOfViewCache.add(eh.tileID,eh,eh.getExpiryTimeout()):(eh.aborted=!0,this._abortTile(eh),this._unloadTile(eh))))}_dataHandler(R){"source"===R.dataType&&("metadata"!==R.sourceDataType?"content"===R.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(R.sourceDataChanged,R.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){for(let R of(this._shouldReloadOnResume=!1,this._paused=!1,this._inViewTiles.getAllIds()))this._removeTile(R);this._outOfViewCache.reset()}tilesIn(R,eu,em){let e_=[],eg=this.transform;if(!eg)return e_;let ev=eg.getCoveringTilesDetailsProvider().allowWorldCopies(),ex=em?eg.getCameraQueryGeometry(R):R,l=R=>eg.screenPointToMercatorCoordinate(R,this.terrain),eb=this.transformBbox(R,l,!ev),ew=this.transformBbox(ex,l,!ev),eT=this.getIds(),eS=eh.a8.fromPoints(ew);for(let R of eT){let em=this._inViewTiles.getTileById(R);if(em.holdingForSymbolFade())continue;let ex=ev?[em.tileID]:[em.tileID.unwrapTo(-1),em.tileID.unwrapTo(0)],eT=Math.pow(2,eg.zoom-em.tileID.overscaledZ),eP=eu*em.queryPadding*eh.a6/em.tileSize/eT;for(let R of ex){let eu=eS.map(eu=>R.getTilePoint(new eh.a7(eu.x,eu.y)));if(eu.expandBy(eP),eu.intersects(ej)){let eh=eb.map(eh=>R.getTilePoint(eh)),eu=ew.map(eh=>R.getTilePoint(eh));e_.push({tile:em,tileID:ev?R:R.unwrapTo(0),queryGeometry:eh,cameraQueryGeometry:eu,scale:eT})}}}return e_}transformBbox(R,eu,em){let e_=R.map(eu);if(em){let em=eh.a8.fromPoints(R);em.shrinkBy(.001*Math.min(em.width(),em.height()));let eg=em.map(eu);eh.a8.fromPoints(e_).covers(eg)||(e_=e_.map(R=>R.x>.5?new eh.a7(R.x-1,R.y,R.z):R))}return e_}getVisibleCoordinates(R){let eh=this.getRenderableIds(R).map(R=>this._inViewTiles.getTileById(R).tileID);return this.transform&&this.transform.populateCache(eh),eh}hasTransition(){return!!this._source.hasTransition()||Me(this._source.type)&&function(R,eh){if(eh<=0)return!1;let eu=c();for(let eh of R.getAllTiles())if(eh.fadeEndTime>=eu)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(R){this._rasterFadeDuration=R}setFeatureState(R,eu,em){this._state.updateState(R=R||eh.ag,eu,em)}removeFeatureState(R,eu,em){this._state.removeFeatureState(R=R||eh.ag,eu,em)}getFeatureState(R,eu){return this._state.getState(R=R||eh.ag,eu)}setDependencies(R,eh,eu){let em=this._inViewTiles.getTileById(R);em&&em.setDependencies(eh,eu)}reloadTilesForDependencies(R,eh){for(let eu of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(eu).hasDependency(R,eh)&&this._reloadTile(eu,"reloading");this._outOfViewCache.filter(eu=>!eu.hasDependency(R,eh))}areTilesLoaded(){for(let R of this._inViewTiles.getAllTiles())if("loaded"!==R.state&&"errored"!==R.state)return!1;return!0}};Le.maxUnderzooming=10,Le.maxOverzooming=3;let Fe=class Fe{constructor(R,eh){this.reset(R,eh)}reset(R,eh){this.points=R||[],this._distances=[0];for(let R=1;R<this.points.length;R++)this._distances[R]=this._distances[R-1]+this.points[R].dist(this.points[R-1]
5);this.length=this._distances[this._distances.length-1],this.padding=Math.min(eh||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(R){if(1===this.points.length)return this.points[0];R=eh.al(R,0,1);let eu=1,em=this._distances[eu],e_=R*this.paddedLength+this.padding;for(;em<e_&&eu<this._distances.length;)em=this._distances[++eu];let eg=eu-1,ev=this._distances[eg],ex=em-ev,eb=ex>0?(e_-ev)/ex:0;return this.points[eg].mult(1-eb).add(this.points[eu].mult(eb))}};function ke(R,eh){let eu=!0;return"always"===R||"never"!==R&&"never"!==eh||(eu=!1),eu}let Be=class Be{constructor(R,eh,eu){let em=this.boxCells=[],e_=this.circleCells=[];this.xCellCount=Math.ceil(R/eu),this.yCellCount=Math.ceil(eh/eu);for(let R=0;R<this.xCellCount*this.yCellCount;R++)em.push([]),e_.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=R,this.height=eh,this.xScale=this.xCellCount/R,this.yScale=this.yCellCount/eh,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(R,eh,eu,em,e_){this._forEachCell(eh,eu,em,e_,this._insertBoxCell,this.boxUid++),this.boxKeys.push(R),this.bboxes.push(eh),this.bboxes.push(eu),this.bboxes.push(em),this.bboxes.push(e_)}
vendor: 4,844 bytes, line 5
5insertCircle(R,eh,eu,em){this._forEachCell(eh-em,eu-em,eh+em,eu+em,this._insertCircleCell,this.circleUid++),this.circleKeys.push(R),this.circles.push(eh),this.circles.push(eu),this.circles.push(em)}_insertBoxCell(R,eh,eu,em,e_,eg){this.boxCells[e_].push(eg)}_insertCircleCell(R,eh,eu,em,e_,eg){this.circleCells[e_].push(eg)}_query(R,eh,eu,em,e_,eg,ev){if(eu<0||R>this.width||em<0||eh>this.height)return[];let ex=[];if(R<=0&&eh<=0&&this.width<=eu&&this.height<=em){if(e_)return[{key:null,x1:R,y1:eh,x2:eu,y2:em}];for(let R=0;R<this.boxKeys.length;R++)ex.push({key:this.boxKeys[R],x1:this.bboxes[4*R],y1:this.bboxes[4*R+1],x2:this.bboxes[4*R+2],y2:this.bboxes[4*R+3]});for(let R=0;R<this.circleKeys.length;R++){let eh=this.circles[3*R],eu=this.circles[3*R+1],em=this.circles[3*R+2];ex.push({key:this.circleKeys[R],x1:eh-em,y1:eu-em,x2:eh+em,y2:eu+em})}}else this._forEachCell(R,eh,eu,em,this._queryCell,ex,{hitTest:e_,overlapMode:eg,seenUids:{box:{},circle:{}}},ev);return ex}query(R,eh,eu,em){return this._query(R,eh,eu,em,!1,null)}hitTest(R,eh,eu,em,e_,eg){return this._query(R,eh,eu,em,!0,e_,eg).length>0}hitTestCircle(R,eh,eu,em,e_){let eg=R-eu,ev=R+eu,ex=eh-eu,eb=eh+eu;if(ev<0||eg>this.width||eb<0||ex>this.height)return!1;let ew=[];return this._forEachCell(eg,ex,ev,eb,this._queryCellCircle,ew,{hitTest:!0,overlapMode:em,circle:{x:R,y:eh,radius:eu},seenUids:{box:{},circle:{}}},e_),ew.length>0}_queryCell(R,eh,eu,em,e_,eg,ev,ex){let{seenUids:eb,hitTest:ew,overlapMode:eT}=ev,eS=this.boxCells[e_];if(null!==eS){let e_=this.bboxes;for(let ev of eS)if(!eb.box[ev]){eb.box[ev]=!0;let eS=4*ev,eP=this.boxKeys[ev];if(R<=e_[eS+2]+1e-6&&eh<=e_[eS+3]+1e-6&&eu>=e_[eS+0]-1e-6&&em>=e_[eS+1]-1e-6&&(!ex||ex(eP))&&(!ew||!ke(eT,eP.overlapMode))&&(eg.push({key:eP,x1:e_[eS],y1:e_[eS+1],x2:e_[eS+2],y2:e_[eS+3]}),ew))return!0}}let eP=this.circleCells[e_];if(null!==eP){let e_=this.circles;for(let ev of eP)if(!eb.circle[ev]){eb.circle[ev]=!0;let eS=3*ev,eP=this.circleKeys[ev];if(this._circleAndRectCollide(e_[eS],e_[eS+1],e_[eS+2],R,eh,eu,em)&&(!ex||ex(eP))&&(!ew||!ke(eT,eP.overlapMode))){let R=e_[eS],eh=e_[eS+1],eu=e_[eS+2];if(eg.push({key:eP,x1:R-eu,y1:eh-eu,x2:R+eu,y2:eh+eu}),ew)return!0}}}return!1}_queryCellCircle(R,eh,eu,em,e_,eg,ev,ex){let{circle:eb,seenUids:ew,overlapMode:eT}=ev,eS=this.boxCells[e_];if(null!==eS){let R=this.bboxes;for(let eh of eS)if(!ew.box[eh]){ew.box[eh]=!0;let eu=4*eh,em=this.boxKeys[eh];if(this._circleAndRectCollide(eb.x,eb.y,eb.radius,R[eu+0],R[eu+1],R[eu+2],R[eu+3])&&(!ex||ex(em))&&!ke(eT,em.overlapMode))return eg.push(!0),!0}}let eP=this.circleCells[e_];if(null!==eP){let R=this.circles;for(let eh of eP)if(!ew.circle[eh]){ew.circle[eh]=!0;let eu=3*eh,em=this.circleKeys[eh];if(this._circlesCollide(R[eu],R[eu+1],R[eu+2],eb.x,eb.y,eb.radius)&&(!ex||ex(em))&&!ke(eT,em.overlapMode))return eg.push(!0),!0}}}_forEachCell(R,eh,eu,em,e_,eg,ev,ex){let eb=this._convertToXCellCoord(R),ew=this._convertToYCellCoord(eh),eT=this._convertToXCellCoord(eu),eS=this._convertToYCellCoord(em);for(let eP=eb;eP<=eT;eP++)for(let eb=ew;eb<=eS;eb++)if(e_.call(this,R,eh,eu,em,this.xCellCount*eb+eP,eg,ev,ex))return}_convertToXCellCoord(R){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(R*this.xScale)))}_convertToYCellCoord(R){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(R*this.yScale)))}_circlesCollide(R,eh,eu,em,e_,eg){let ev=em-R,ex=e_-eh,eb=eu+eg;return eb*eb>ev*ev+ex*ex}_circleAndRectCollide(R,eh,eu,em,e_,eg,ev){let ex=(eg-em)/2,eb=Math.abs(R-(em+ex));if(eb>ex+eu)return!1;let ew=(ev-e_)/2,eT=Math.abs(eh-(e_+ew));if(eT>ew+eu)return!1;if(eb<=ex||eT<=ew)return!0;let eS=eb-ex,eP=eT-ew;return eS*eS+eP*eP<=eu*eu}};function Oe(R,eu,em){var e_,eg,ev,ex,eb;let ew=eh.O();if(!R){let{vecSouth:R,vecEast:eh}=Ne(eu),em=o();em[0]=eh[0],em[1]=eh[1],em[2]=R[0],em[3]=R[1],(eb=(e_=em[0])*(ex=em[3])-(ev=em[2])*(eg=em[1]))&&(em[0]=ex*(eb=1/eb),em[1]=-eg*eb,em[2]=-ev*eb,em[3]=e_*eb),ew[0]=em[0],ew[1]=em[1],ew[4]=em[2],ew[5]=em[3]}return eh.S(ew,ew,[1/em,1/em,1]),ew}function Ne(R){let eu=Math.cos(R.rollInRadians),em=Math.sin(R.rollInRadians),e_=Math.cos(R.pitchInRadians),eg=Math.cos(R.bearingInRadians),ev=Math.sin(R.bearingInRadians),ex=eh.aA();ex[0]=-eg*e_*em-ev*eu,ex[1]=-ev*e_*em+eg*eu;let eb=eh.aB(ex);eb<1e-9?eh.aC(ex):eh.aD(ex,ex,1/eb);let ew=eh.aA();ew[0]=eg*e_*eu-ev*em,ew[1]=ev*e_*eu+eg*em;let eT=eh.aB(ew);return eT<1e-9?eh.aC(ew):eh.aD(ew,ew,1/eT),{vecEast:ew,vecSouth:ex}}function Ze(R,eu,em,e_){let eg;e_?(eg=[R,eu,e_(R,eu),1],eh.aF(eg,eg,em)):rt(eg=[R,eu,0,1],eg,em);let ev=eg[3];return{point:new eh.P(eg[0]/ev,eg[1]/ev),signedDistanceFromCamera:ev,isOccluded:!1}}function We(R,eh,eu,em,e_,eg,ev,ex){let eb=eg.glyphStartIndex+eg.numGlyphs,ew=eg.lineStartIndex,eT=eg.lineStartIndex+eg.lineLength,eS=eh.getoffsetX(eg.glyphStartIndex),eP=eh.getoffsetX(eb-1),eI=tt(R*eS,eu,em,e_,eg.segment,ew,eT,ex,ev);
5if(!eI)return null;let eM=tt(R*eP,eu,em,e_,eg.segment,ew,eT,ex,ev);return eM?ex.projectionCache.anyProjectionOccluded?null:{first:eI,last:eM}:null}function qe(R,eu,em,e_){return R===eh.ax.horizontal&&Math.abs(em.y-eu.y)>Math.abs(em.x-eu.x)*e_?{useVertical:!0}:(R===eh.ax.vertical?eu.y<em.y:eu.x>em.x)?{needsFlipping:!0}:null}function $e(R){let eu;let{projectionContext:em,pitchedLabelPlaneMatrixInverse:e_,symbol:eg,fontSize:ev,flip:ex,keepUpright:eb,glyphOffsetArray:ew,dynamicLayoutVertexArray:eT,aspectRatio:eS,rotateToLine:eP}=R,eI=ev/24,eM=eg.lineOffsetX*eI,eE=eg.lineOffsetY*eI;if(eg.numGlyphs>1){let R=eg.glyphStartIndex+eg.numGlyphs,eh=eg.lineStartIndex,ev=eg.lineStartIndex+eg.lineLength,eT=We(eI,ew,eM,eE,ex,eg,eP,em);if(!eT)return{notEnoughRoom:!0};let eC=Ye(eT.first.point.x,eT.first.point.y,em,e_),eA=Ye(eT.last.point.x,eT.last.point.y,em,e_);if(eb&&!ex){let R=qe(eg.writingMode,eC,eA,eS);if(R)return R}eu=[eT.first];for(let e_=eg.glyphStartIndex+1;e_<R-1;e_++){let R=tt(eI*ew.getoffsetX(e_),eM,eE,ex,eg.segment,eh,ev,em,eP);if(!R)return{notEnoughRoom:!0};eu.push(R)}eu.push(eT.last)}else{if(eb&&!ex){let R=Ke(em.tileAnchorPoint.x,em.tileAnchorPoint.y,em).point,eu=eg.lineStartIndex+eg.segment+1,ev=new eh.P(em.lineVertexArray.getx(eu),em.lineVertexArray.gety(eu)),ex=Ke(ev.x,ev.y,em),eb=ex.signedDistanceFromCamera>0?ex.point:He(em.tileAnchorPoint,ev,R,1,em),ew=Ye(R.x,R.y,em,e_),eT=Ye(eb.x,eb.y,em,e_),eP=qe(eg.writingMode,ew,eT,eS);if(eP)return eP}let R=tt(eI*ew.getoffsetX(eg.glyphStartIndex),eM,eE,ex,eg.segment,eg.lineStartIndex,eg.lineStartIndex+eg.lineLength,em,eP);if(!R||em.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};eu=[R]}for(let R of eu)eh.aE(eT,R.point,R.angle);return{}}function He(R,eh,eu,em,e_){let eg=R.add(R.sub(eh)._unit()),ev=Ke(eg.x,eg.y,e_).point,ex=eu.sub(ev);return eu.add(ex._mult(em/ex.mag()))}function Xe(R,eu,em){let e_=eu.projectionCache;if(e_.projections[R])return e_.projections[R];let eg=new eh.P(eu.lineVertexArray.getx(R),eu.lineVertexArray.gety(R)),ev=Ke(eg.x,eg.y,eu);if(ev.signedDistanceFromCamera>0)return e_.projections[R]=ev.point,e_.anyProjectionOccluded=e_.anyProjectionOccluded||ev.isOccluded,ev.point;let ex=R-em.direction;return He(0===em.distanceFromAnchor?eu.tileAnchorPoint:new eh.P(eu.lineVertexArray.getx(ex),eu.lineVertexArray.gety(ex)),eg,em.previousVertex,em.absOffsetX-em.distanceFromAnchor+1,eu)}function Ke(R,eh,eu){let em;let e_=R+eu.translation[0],eg=eh+eu.translation[1];return eu.pitchWithMap?(em=Ze(e_,eg,eu.pitchedLabelPlaneMatrix,eu.getElevation)).isOccluded=!1:((em=eu.transform.projectTileCoordinates(e_,eg,eu.unwrappedTileID,eu.getElevation)).point.x=(.5*em.point.x+.5)*eu.width,em.point.y=(-(.5*em.point.y)+.5)*eu.height),em}function Ye(R,eu,em,e_){if(em.pitchWithMap){let eg=[R,eu,0,1];return eh.aF(eg,eg,e_),em.transform.projectTileCoordinates(eg[0]/eg[3],eg[1]/eg[3],em.unwrappedTileID,em.getElevation).point}return{x:R/em.width*2-1,y:1-eu/em.height*2}}function Qe(R,eh,eu){return eu.transform.projectTileCoordinates(R,eh,eu.unwrappedTileID,eu.getElevation)}function Je(R,eh,eu){return R._unit()._perp()._mult(eh*eu)}function tt(R,eu,em,e_,eg,ev,ex,eb,ew){let eT;let eS=e_?R-eu:R+eu,eP=eS>0?1:-1,eI=0;e_&&(eP*=-1,eI=Math.PI),eP<0&&(eI+=Math.PI);let eM,eE=eP>0?ev+eg:ev+eg+1;eb.projectionCache.cachedAnchorPoint?eM=eb.projectionCache.cachedAnchorPoint:(eM=Ke(eb.tileAnchorPoint.x,eb.tileAnchorPoint.y,eb).point,eb.projectionCache.cachedAnchorPoint=eM);let eC,eA,ez=eM,eD=eM,ek=0,eR=0,eL=Math.abs(eS),eF=[];for(;ek+eR<=eL;){if((eE+=eP)<ev||eE>=ex)return null;ek+=eR,eD=ez,eA=eC;let R={absOffsetX:eL,direction:eP,distanceFromAnchor:ek,previousVertex:eD};if(ez=Xe(eE,eb,R),0===em)eF.push(eD),eT=ez.sub(eD);else{let eu;let e_=ez.sub(eD);eu=0===e_.mag()?Je(Xe(eE+eP,eb,R).sub(ez),em,eP):Je(e_,em,eP),eA||(eA=eD.add(eu)),eC=function(R,eu,em,e_,eg,ev,ex,eb,ew){if(eb.projectionCache.offsets[R])return eb.projectionCache.offsets[R];let eT=em.add(eu);if(R+ew.direction<e_||R+ew.direction>=eg)return eb.projectionCache.offsets[R]=eT,eT;let eS=Xe(R+ew.direction,eb,ew),eP=Je(eS.sub(em),ex,ew.direction),eI=em.add(eP),eM=eS.add(eP);return eb.projectionCache.offsets[R]=eh.aG(ev,eT,eI,eM)||eT,eb.projectionCache.offsets[R]}(eE,eu,ez,ev,ex,eA,em,eb,R),eF.push(eA),eT=eC.sub(eA)}eR=eT.mag()}let eB=eT._mult((eL-ek)/eR)._add(eA||eD),eO=eI+Math.atan2(ez.y-eD.y,ez.x-eD.x);return eF.push(eB),{point:eB,angle:ew?eO:0,path:eF}}let eN=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ot(R,eh){for(let eu=0;eu<R;eu++){let R=eh.length;eh.resize(R+4),eh.float32.set(eN,3*R)}}function rt(R,eh,eu){let em=eh[0],e_=eh[1];return R[0]=eu[0]*em+eu[4]*e_+eu[12],R[1]=eu[1]*em+eu[5]*e_+eu[13],R[3]=eu[3]*em+eu[7]*e_+eu[15],R}let st=class st{constructor(R,eh=new Be(R.width+200,R.height+200,25),eu=new Be(R.width+200,R.height+200,25)){this.transform=R,this.grid=eh,this.ignoredGrid=eu,this.pitchFactor=Math.cos(R.pitch*Math.PI/180)*R.cameraToCenterDistance,this.screenRightBoundary=R.width+100,this.screenBottomBoundary=R.height+100,this.gridRightBoundary=R.width+200,this.gridBottomBoundary=R.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS){let eP;let eI=this.projectAndGetPerspectiveRatio(R.anchorPointX+ex[0],R.anch
5orPointY+ex[1],e_,ew,eS),eM=eu*eI.perspectiveRatio;if(eg||ev)eP=this._projectCollisionBox(R,eM,em,e_,eg,ev,ex,eI,ew,eT,eS);else{let eh=eI.x+(eT?eT.x*eM:0),eu=eI.y+(eT?eT.y*eM:0);eP={allPointsOccluded:!1,box:[eh+R.x1*eM,eu+R.y1*eM,eh+R.x2*eM,eu+R.y2*eM]}}let[eE,eC,eA,ez]=eP.box,eD=eg?eP.allPointsOccluded:eI.isOccluded,ek=eD;return ek||(ek=eI.perspectiveRatio<this.perspectiveRatioCutoff),ek||(ek=!this.isInsideGrid(eE,eC,eA,ez)),ek||"always"!==eh&&this.grid.hitTest(eE,eC,eA,ez,eh,eb)?{box:[eE,eC,eA,ez],placeable:!1,offscreen:!1,occluded:eD}:{box:[eE,eC,eA,ez],placeable:!0,offscreen:this.isOffscreen(eE,eC,eA,ez),occluded:eD}}placeCollisionCircles(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM){let eE=[],eC=new eh.P(eu.anchorX,eu.anchorY),eA=this.getPerspectiveRatio(eC.x,eC.y,ev,eM),ez=(ew?eg*this.transform.getPitchedTextCorrection(eu.anchorX,eu.anchorY,ev)/eA:eg*eA)/eh.aK,eD={getElevation:eM,pitchedLabelPlaneMatrix:ex,lineVertexArray:em,pitchWithMap:ew,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:eC,unwrappedTileID:ev,width:this.transform.width,height:this.transform.height,translation:eI},ek=We(ez,e_,eu.lineOffsetX*ez,eu.lineOffsetY*ez,!1,eu,!1,eD),eR=!1,eL=!1,eF=!0;if(ek){let eu=.5*eS*eA+eP,em=new eh.P(-100,-100),e_=new eh.P(this.screenRightBoundary,this.screenBottomBoundary),eg=new Fe,ev=ek.first,ex=ek.last,eI=[];for(let R=ev.path.length-1;R>=1;R--)eI.push(ev.path[R]);for(let R=1;R<ex.path.length;R++)eI.push(ex.path[R]);let eM=2.5*eu;if(ew){let R=this.projectPathToScreenSpace(eI,eD);eI=R.some(R=>R.signedDistanceFromCamera<=0)?[]:R.map(R=>R.point)}let eC=[];if(eI.length>0){let R=eI[0].clone(),eu=eI[0].clone();for(let eh=1;eh<eI.length;eh++)R.x=Math.min(R.x,eI[eh].x),R.y=Math.min(R.y,eI[eh].y),eu.x=Math.max(eu.x,eI[eh].x),eu.y=Math.max(eu.y,eI[eh].y);eC=R.x>=em.x&&eu.x<=e_.x&&R.y>=em.y&&eu.y<=e_.y?[eI]:eu.x<em.x||R.x>e_.x||eu.y<em.y||R.y>e_.y?[]:eh.aH([eI],em.x,em.y,e_.x,e_.y)}for(let eh of eC){eg.reset(eh,.25*eu);let em=0;em=eg.length<=.5*eu?1:Math.ceil(eg.paddedLength/eM)+1;for(let eh=0;eh<em;eh++){let e_=eh/Math.max(em-1,1),ev=eg.lerp(e_),ex=ev.x+100,ew=ev.y+100;eE.push(ex,ew,eu,0);let eS=ex-eu,eP=ew-eu,eI=ex+eu,eM=ew+eu;if(eF=eF&&this.isOffscreen(eS,eP,eI,eM),eL=eL||this.isInsideGrid(eS,eP,eI,eM),"always"!==R&&this.grid.hitTestCircle(ex,ew,eu,R,eT)&&(eR=!0,!eb))return{circles:[],offscreen:!1,collisionDetected:eR}}}}return{circles:!eb&&eR||!eL||eA<this.perspectiveRatioCutoff?[]:eE,offscreen:eF,collisionDetected:eR}}projectPathToScreenSpace(R,eu){let em=function(R,eu){let em=eh.O();return eh.az(em,eu.pitchedLabelPlaneMatrix),R.map(R=>{let eh=Ze(R.x,R.y,em,eu.getElevation),e_=eu.transform.projectTileCoordinates(eh.point.x,eh.point.y,eu.unwrappedTileID,eu.getElevation);return e_.point.x=(.5*e_.point.x+.5)*eu.width,e_.point.y=(-(.5*e_.point.y)+.5)*eu.height,e_})}(R,eu);return function(R){let eh=0,eu=0,em=0,e_=0;for(let eg=0;eg<R.length;eg++)R[eg].isOccluded?(em=eg+1,e_=0):++e_>eu&&(eu=e_,eh=em);return R.slice(eh,eh+eu)}(em)}queryRenderedSymbols(R){if(0===R.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let eu=[],em=new eh.a8;for(let e_ of R){let R=new eh.P(e_.x+100,e_.y+100);em.extend(R),eu.push(R)}let{minX:e_,minY:eg,maxX:ev,maxY:ex}=em,eb=this.grid.query(e_,eg,ev,ex).concat(this.ignoredGrid.query(e_,eg,ev,ex)),ew={},eT={};for(let R of eb){let em=R.key;if(void 0===ew[em.bucketInstanceId]&&(ew[em.bucketInstanceId]={}),ew[em.bucketInstanceId][em.featureIndex])continue;let e_=[new eh.P(R.x1,R.y1),new eh.P(R.x2,R.y1),new eh.P(R.x2,R.y2),new eh.P(R.x1,R.y2)];eh.aI(eu,e_)&&(ew[em.bucketInstanceId][em.featureIndex]=!0,void 0===eT[em.bucketInstanceId]&&(eT[em.bucketInstanceId]=[]),eT[em.bucketInstanceId].push(em.featureIndex))}return eT}insertCollisionBox(R,eh,eu,em,e_,eg){(eu?this.ignoredGrid:this.grid).insert({bucketInstanceId:em,featureIndex:e_,collisionGroupID:eg,overlapMode:eh},R[0],R[1],R[2],R[3])}insertCollisionCircles(R,eh,eu,em,e_,eg){let ev=eu?this.ignoredGrid:this.grid,ex={bucketInstanceId:em,featureIndex:e_,collisionGroupID:eg,overlapMode:eh};for(let eh=0;eh<R.length;
5eh+=4)ev.insertCircle(ex,R[eh],R[eh+1],R[eh+2])}projectAndGetPerspectiveRatio(R,eu,em,e_,eg){if(eg){let em;e_?(em=[R,eu,e_(R,eu),1],eh.aF(em,em,eg)):rt(em=[R,eu,0,1],em,eg);let ev=em[3];return{x:(em[0]/ev+1)/2*this.transform.width+100,y:(-em[1]/ev+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/ev*.5,isOccluded:!1,signedDistanceFromCamera:ev}}{let eh=this.transform.projectTileCoordinates(R,eu,em,e_);return{x:(eh.point.x+1)/2*this.transform.width+100,y:(1-eh.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/eh.signedDistanceFromCamera*.5,isOccluded:eh.isOccluded,signedDistanceFromCamera:eh.signedDistanceFromCamera}}}getPerspectiveRatio(R,eh,eu,em){let e_=this.transform.projectTileCoordinates(R,eh,eu,em);return .5+this.transform.cameraToCenterDistance/e_.signedDistanceFromCamera*.5}isOffscreen(R,eh,eu,em){return eu<100||R>=this.screenRightBoundary||em<100||eh>this.screenBottomBoundary}isInsideGrid(R,eh,eu,em){return eu>=0&&R<this.gridRightBoundary&&em>=0&&eh<this.gridBottomBoundary}getViewportMatrix(){let R=eh.ap([]);return eh.Q(R,R,[-100,-100,0]),R}_projectCollisionBox(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS){let eP=1,eI=0,eM=0,eE=1,eC=R.anchorPointX+ex[0],eA=R.anchorPointY+ex[1];if(ev&&!eg){let R=this.projectAndGetPerspectiveRatio(eC+1,eA,e_,ew,eS),eh=R.x-eb.x,eu=Math.atan((R.y-eb.y)/eh)+(eh<0?Math.PI:0),em=Math.sin(eu),eg=Math.cos(eu);eP=eg,eI=em,eM=-em,eE=eg}else if(!ev&&eg){let R=Ne(this.transform);eP=R.vecEast[0],eI=R.vecEast[1],eM=R.vecSouth[0],eE=R.vecSouth[1]}let ez=eb.x,eD=eb.y,ek=eu;eg&&(ez=eC,eD=eA,ek=Math.pow(2,-(this.transform.zoom-em.overscaledZ))*this.transform.getPitchedTextCorrection(eC,eA,e_),eT||(ek*=eh.al(.5+eb.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),eT&&(ez+=eP*eT.x*ek+eM*eT.y*ek,eD+=eI*eT.x*ek+eE*eT.y*ek);let eR=R.x1*ek,eL=R.x2*ek,eF=(eR+eL)/2,eB=R.y1*ek,eO=R.y2*ek,eV=(eB+eO)/2,ej=[];for(let{offsetX:R,offsetY:eu}of[{offsetX:eR,offsetY:eB},{offsetX:eF,offsetY:eB},{offsetX:eL,offsetY:eB},{offsetX:eL,offsetY:eV},{offsetX:eL,offsetY:eO},{offsetX:eF,offsetY:eO},{offsetX:eR,offsetY:eO},{offsetX:eR,offsetY:eV}])ej.push(new eh.P(ez+eP*R+eM*eu,eD+eI*R+eE*eu));let eN=!1;if(eg){let R=ej.map(R=>this.projectAndGetPerspectiveRatio(R.x,R.y,e_,ew,eS));eN=R.some(R=>!R.isOccluded),ej=R.map(R=>new eh.P(R.x,R.y))}else eN=!0;return{box:eh.aJ(ej),allPointsOccluded:!eN}}};let nt=class nt{constructor(R,eh,eu,em){this.opacity=R?Math.max(0,Math.min(1,R.opacity+(R.placed?eh:-eh))):em&&eu?1:0,this.placed=eu}isHidden(){return 0===this.opacity&&!this.placed}};let lt=class lt{constructor(R,eh,eu,em,e_){this.text=new nt(R?R.text:null,eh,eu,e_),this.icon=new nt(R?R.icon:null,eh,em,e_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};let ct=class ct{constructor(R,eh,eu){this.text=R,this.icon=eh,this.skipFade=eu}};let ht=class ht{constructor(R,eh,eu,em,e_){this.bucketInstanceId=R,this.featureIndex=eh,this.sourceLayerIndex=eu,this.bucketIndex=em,this.tileID=e_}};let ut=class ut{constructor(R){this.crossSourceCollisions=R,this.maxGroupID=0,this.collisionGroups={}}get(R){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[R]){let eh=++this.maxGroupID;this.collisionGroups[R]={ID:eh,predicate:R=>R.collisionGroupID===eh}}return this.collisionGroups[R]}};function dt(R,eu,em,e_,eg){let{horizontalAlign:ev,verticalAlign:ex}=eh.aQ(R);return new eh.P(-(ev-.5)*eu+e_[0]*eg,-(ex-.5)*em+e_[1]*eg)}let _t=class _t{constructor(R,eh,eu,em,e_){this.transform=R.clone(),this.terrain=eh,this.collisionIndex=new st(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=eu,this.retainedQueryData={},this.collisionGroups=new ut(em),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=e_,e_&&(e_.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(R){let eh=this.terrain;return eh?(eu,em)=>eh.getElevation(R,eu,em):null}getBucketParts(R,eu,em,e_){let eg=em.getBucket(eu),ev=em.latestFeatureIndex;if(!eg||!ev||eu.id!==eg.layerIds[0])return;let ex=em.collisionBoxArray,eb=eg.layers[0].layout,ew=eg.layers[0].paint,eT=Math.pow(2,this.transform.zoom-em.tileID.overscaledZ
5),eS=em.tileSize/eh.a6,eP=em.tileID.toUnwrapped(),eI="map"===eb.get("text-rotation-alignment"),eM=eh.aL(em,1,this.transform.zoom),eE=eh.aM(this.collisionIndex.transform,em,ew.get("text-translate"),ew.get("text-translate-anchor")),eC=eh.aM(this.collisionIndex.transform,em,ew.get("icon-translate"),ew.get("icon-translate-anchor")),eA=Oe(eI,this.transform,eM);this.retainedQueryData[eg.bucketInstanceId]=new ht(eg.bucketInstanceId,ev,eg.sourceLayerIndex,eg.index,em.tileID);let ez={bucket:eg,layout:eb,translationText:eE,translationIcon:eC,unwrappedTileID:eP,pitchedLabelPlaneMatrix:eA,scale:eT,textPixelRatio:eS,holdingForFade:em.holdingForSymbolFade(),collisionBoxArray:ex,partiallyEvaluatedTextSize:eh.aw(eg.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(eg.sourceID)};if(e_)for(let eh of eg.sortKeyRanges){let{sortKey:eu,symbolInstanceStart:em,symbolInstanceEnd:e_}=eh;R.push({sortKey:eu,symbolInstanceStart:em,symbolInstanceEnd:e_,parameters:ez})}else R.push({symbolInstanceStart:0,symbolInstanceEnd:eg.symbolInstances.length,parameters:ez})}attemptAnchorPlacement(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez,eD,ek){var eR,eL,eF;let eB=eh.aN[R.textAnchor],eO=[R.textOffset0,R.textOffset1],eV=dt(eB,em,e_,eO,eg),ej=this.collisionIndex.placeCollisionBox(eu,eP,eb,ew,eT,ex,ev,eC,eS.predicate,eD,eV,ek);if((!ez||this.collisionIndex.placeCollisionBox(ez,eP,eb,ew,eT,ex,ev,eA,eS.predicate,eD,eV,ek).placeable)&&ej.placeable){let R;if((null===(eR=this.prevPlacement)||void 0===eR?void 0:eR.variableOffsets[eI.crossTileID])&&(null===(eF=null===(eL=this.prevPlacement)||void 0===eL?void 0:eL.placements[eI.crossTileID])||void 0===eF?void 0:eF.text)&&(R=this.prevPlacement.variableOffsets[eI.crossTileID].anchor),0===eI.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[eI.crossTileID]={textOffset:eO,width:em,height:e_,anchor:eB,textBoxScale:eg,prevAnchor:R},this.markUsedJustification(eM,eB,eI,eE),eM.allowVerticalPlacement&&(this.markUsedOrientation(eM,eE,eI),this.placedOrientations[eI.crossTileID]=eE),{shift:eV,placedGlyphBoxes:ej}}}placeLayerBucketPart(R,eu,em){let{bucket:e_,layout:eg,translationText:ev,translationIcon:ex,unwrappedTileID:eb,pitchedLabelPlaneMatrix:ew,textPixelRatio:eT,holdingForFade:eS,collisionBoxArray:eP,partiallyEvaluatedTextSize:eI,collisionGroup:eM}=R.parameters,eE=eg.get("text-optional"),eC=eg.get("icon-optional"),eA=eh.aO(eg,"text-overlap","text-allow-overlap"),ez="always"===eA,eD=eh.aO(eg,"icon-overlap","icon-allow-overlap"),ek="always"===eD,eR="map"===eg.get("text-rotation-alignment"),eL="map"===eg.get("text-pitch-alignment"),eF="none"!==eg.get("icon-text-fit"),eB="viewport-y"===eg.get("symbol-z-order"),eO=ez&&(ek||!e_.hasIconData()||eC),eV=ek&&(ez||!e_.hasTextData()||eE);!e_.collisionArrays&&eP&&e_.deserializeCollisionBoxes(eP);let ej=this.retainedQueryData[e_.bucketInstanceId].tileID,eN=this._getTerrainElevationFunc(ej),eU=this.transform.getFastPathSimpleProjectionMatrix(ej),z=(R,eP,ek)=>{var eB,eG;if(eu[R.crossTileID])return;if(eS)return void(this.placements[R.crossTileID]=new ct(!1,!1,!1));let e$=!1,eZ=!1,eq=!0,eW=null,eX={box:null,placeable:!1,offscreen:null,occluded:!1},eH={placeable:!1},eY=null,eJ=null,eK=null,eQ=0,e0=0,e1=0;eP.textFeatureIndex?eQ=eP.textFeatureIndex:R.useRuntimeCollisionCircles&&(eQ=R.featureIndex),eP.verticalTextFeatureIndex&&(e0=eP.verticalTextFeatureIndex);let e2=eP.textBox;if(e2){let i=eu=>{let em=eh.ax.horizontal;if(e_.allowVerticalPlacement&&!eu&&this.prevPlacement){let eh=this.prevPlacement.placedOrientations[R.crossTileID];eh&&(this.placedOrientations[R.crossTileID]=eh,em=eh,this.markUsedOrientation(e_,em,R))}return em},a=(eu,em)=>{if(e_.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&eP.verticalTextBox){for(let R of e_.writingModes)if(R===eh.ax.vertical?eH=eX=em():eX=eu(),null==eX?void 0:eX.placeable)break}else eX=eu()},eu=R.textAnchorOffsetStartIndex,eg=R.textAnchorOffsetEndIndex;if(eg===eu){let o=(eh,eu)=>{let em=this.collisionIndex.placeCollisionBox(eh,eA,eT,ej,eb,eL,eR,ev,eM.predicate,eN,void 0,eU);return(null==em?void 0:em.placeable)&&(this.markUsedOrientation(e_,eu,R),this.placedOrientations[R.crossTileID]=eu),em};a(()=>o(e2,eh.ax.horizontal),()=>{let eu=eP.verticalTextBox;return e_.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&eu?o(eu,eh.ax.vertical):{box:null,offscreen:null}}),i(null==eX?void 0:eX.placeable)}else{let ew=eh.aN[null===(eG=null===(eB=this.prevPlacement)||void 0===eB?void 0:eB.variableOffsets[R.crossTileID])||void 0===eG?void 0:eG.anchor],m=(eh,eS,eP)=>{let eI=eh.x2-eh.x1,eE=eh.y2-eh.y1,eC=R.textBoxScale,ez=eF&&"never"===eD?eS:null,ek=null,eB="never"===eA?1:2,eO="never";ew&&eB++;for(let em=0;em<eB;em++){for(let em=eu;em<eg;em++){let eu=e_.textAnchorOffsets.get(em);if(ew&&eu.textAnchor!==ew)continue;let eg=this.attemptAnchorPlacement(eu,eh,eI,eE,eC,eR,eL,eT,ej,eb,eM,eO,R,e_,eP,ev,ex,ez,eN);if(eg&&(null==(ek=eg.placedGlyphBoxes)?void 0:ek.placeable))return e$=!0,eW=eg.shift,ek}ew?ew=null:eO=eA}return em&&!ek&&(ek={box:this.collisionIndex.placeCollisionBox(e2,"always",eT,ej,eb,eL,eR,ev,eM.predicate,eN,void 0,eU).box,offscreen:!1,placeable:!1,occluded:!1}),ek};a(()=>m(e2,eP.iconBox,eh.ax.horizontal),()=>{let eu=eP.verticalTextBox;return e_.allowVerticalPlacement&&!(null==eX?void 0:eX.placeable)&&R.numVerticalGlyphVertices>0&&eu?m(eu,eP.verticalIconBox,eh.ax.vertical):{box:null,occluded:!0,offscreen:null}}),eX&&(e$=eX.placeable,eq=eX.offscreen);let eS=i(null==eX?void 0:eX.placeable);if(!e$&&this.prevPlacement){let eh=this.prevPlacement.variableOffsets[R.crossTileID];eh&&(this.variableOffsets[R.crossTileID]=eh,this.markUsedJustification(e_,eh.anchor,R,eS))}}}if(e$=null==(eY=eX)?void 0:eY.placeable,eq=null==eY?void 0:eY.offscreen,R.useRuntimeCollisionCircles&&R.centerJustifiedTextSymbolIndex>=0){let eu=e_.text.placedSymbolArray.get(R.centerJustifiedTextSymbolIndex),ex=eh.ay(e_.textSizeData,eI,eu),eT=eg.get("text-padding");(eJ=this.collisionIndex.placeCollisionCircles(eA,eu,e_.lineVertexArray,e_.glyphOffsetArray,ex,eb,ew,em,eL,eM.predicate,R.collisionCircleDiameter,eT,ev,eN)
5).circles.length&&eJ.collisionDetected&&!em&&eh.w("Collisions detected, but collision boxes are not shown"),e$=ez||eJ.circles.length>0&&!eJ.collisionDetected,eq=eq&&eJ.offscreen}if(eP.iconFeatureIndex&&(e1=eP.iconFeatureIndex),eP.iconBox){let e=R=>this.collisionIndex.placeCollisionBox(R,eD,eT,ej,eb,eL,eR,ex,eM.predicate,eN,eF&&eW?eW:void 0,eU);eZ=eH&&eH.placeable&&eP.verticalIconBox?(eK=e(eP.verticalIconBox)).placeable:(eK=e(eP.iconBox)).placeable,eq=eq&&eK.offscreen}let e3=eE||0===R.numHorizontalGlyphVertices&&0===R.numVerticalGlyphVertices,e5=eC||0===R.numIconVertices;e3||e5?e5?e3||(eZ=eZ&&e$):e$=eZ&&e$:eZ=e$=eZ&&e$;let e4=eZ&&eK.placeable;if(e$&&eY.placeable&&this.collisionIndex.insertCollisionBox(eY.box,eA,eg.get("text-ignore-placement"),e_.bucketInstanceId,eH&&eH.placeable&&e0?e0:eQ,eM.ID),e4&&this.collisionIndex.insertCollisionBox(eK.box,eD,eg.get("icon-ignore-placement"),e_.bucketInstanceId,e1,eM.ID),eJ&&e$&&this.collisionIndex.insertCollisionCircles(eJ.circles,eA,eg.get("text-ignore-placement"),e_.bucketInstanceId,eQ,eM.ID),em&&this.storeCollisionData(e_.bucketInstanceId,ek,eP,eY,eK,eJ),0===R.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===e_.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");this.placements[R.crossTileID]=new ct((e$||eO)&&!(null==eY?void 0:eY.occluded),(eZ||eV)&&!(null==eK?void 0:eK.occluded),eq||e_.justReloaded),eu[R.crossTileID]=!0};if(eB){if(0!==R.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let eh=e_.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let R=eh.length-1;R>=0;--R){let eu=eh[R];z(e_.symbolInstances.get(eu),e_.collisionArrays[eu],eu)}}else for(let eh=R.symbolInstanceStart;eh<R.symbolInstanceEnd;eh++)z(e_.symbolInstances.get(eh),e_.collisionArrays[eh],eh);e_.justReloaded=!1}storeCollisionData(R,eh,eu,em,e_,eg){if(eu.textBox||eu.iconBox){let eg,ev;this.collisionBoxArrays.has(R)?eg=this.collisionBoxArrays.get(R):(eg=new Map,this.collisionBoxArrays.set(R,eg)),eg.has(eh)?ev=eg.get(eh):(ev={text:null,icon:null},eg.set(eh,ev)),eu.textBox&&(ev.text=em.box),eu.iconBox&&(ev.icon=e_.box)}if(eg){let eh=this.collisionCircleArrays[R];void 0===eh&&(eh=this.collisionCircleArrays[R]=[]);for(let R=0;R<eg.circles.length;R+=4)eh.push(eg.circles[R+0]-100),eh.push(eg.circles[R+1]-100),eh.push(eg.circles[R+2]),eh.push(eg.collisionDetected?1:0)}}markUsedJustification(R,eu,em,e_){let eg;eg=e_===eh.ax.vertical?em.verticalPlacedTextSymbolIndex:({left:em.leftJustifiedTextSymbolIndex,center:em.centerJustifiedTextSymbolIndex,right:em.rightJustifiedTextSymbolIndex})[eh.aP(eu)];let ev=[em.leftJustifiedTextSymbolIndex,em.centerJustifiedTextSymbolIndex,em.rightJustifiedTextSymbolIndex,em.verticalPlacedTextSymbolIndex];for(let eh of ev)eh>=0&&(R.text.placedSymbolArray.get(eh).crossTileID=eg>=0&&eh!==eg?0:em.crossTileID)}markUsedOrientation(R,eu,em){let e_=eu===eh.ax.horizontal||eu===eh.ax.horizontalOnly?eu:0,eg=eu===eh.ax.vertical?eu:0,ev=[em.leftJustifiedTextSymbolIndex,em.centerJustifiedTextSymbolIndex,em.rightJustifiedTextSymbolIndex];for(let eh of ev)R.text.placedSymbolArray.get(eh).placedOrientation=e_;em.verticalPlacedTextSymbolIndex&&(R.text.placedSymbolArray.get(em.verticalPlacedTextSymbolIndex).placedOrientation=eg)}commit(R){this.commitTime=R,this.zoomAtLastRecencyCheck=this.transform.zoom;let eh=this.prevPlacement,eu=!1;this.prevZoomAdjustment=eh?eh.zoomAdjustment(this.transform.zoom):0;let em=eh?eh.symbolFadeChange(R):1,e_=eh?eh.opacities:{},eg=eh?eh.variableOffsets:{},ev=eh?eh.placedOrientations:{};for(let R in this.placements){let eh=this.placements[R],eg=e_[R];eg?(this.opacities[R]=new lt(eg,em,eh.text,eh.icon),eu=eu||eh.text!==eg.text.placed||eh.icon!==eg.icon.placed):(this.opacities[R]=new lt(null,em,eh.text,eh.icon,eh.skipFade),eu=eu||eh.text||eh.icon)}for(let R in e_){let eh=e_[R];if(!this.opacities[R]){let e_=new lt(eh,em,!1,!1);e_.isHidden()||(this.opacities[R]=e_,eu=eu||eh.text.placed||eh.icon.placed)}}for(let R in eg)this.variableOffsets[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.variableOffsets[R]=eg[R]);for(let R in ev)this.placedOrientations[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.placedOrientations[R]=ev[R]);if(eh&&void 0===eh.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");eu?this.lastPlacementChangeTime=R:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=eh?eh.lastPlacementChangeTime:R)}updateLayerOpacities(R,eh){let eu={};for(let em of eh){let eh=em.getBucket(R);eh&&em.latestFeatureIndex&&R.id===eh.layerIds[0]&&this.updateBucketOpacities(eh,em.tileID,eu,em.collisionBoxArray)}}updateBucketOpacities(R,eu,em,e_){R.hasTextData()&&(R.text.opacityVertexArray.clear(),R.text.hasVisibleVertices=!1),R.hasIconData()&&(R.icon.opacityVertexArray.clear(),R.icon.hasVisibleVertices=!1),R.hasIconCollisionBoxData()&&R.iconCollisionBox.collisionVertexArray.clear(),R.hasTextCollisionBoxData()&&R.textCollisionBox.collisionVertexArray.clear();
5let eg=R.layers[0],ev=eg.layout,ex=new lt(null,0,!1,!1,!0),eb=ev.get("text-allow-overlap"),ew=ev.get("icon-allow-overlap"),eT=eg._unevaluatedLayout.hasValue("text-variable-anchor")||eg._unevaluatedLayout.hasValue("text-variable-anchor-offset"),eS="map"===ev.get("text-rotation-alignment"),eP="map"===ev.get("text-pitch-alignment"),eI="none"!==ev.get("icon-text-fit"),eM=new lt(null,0,eb&&(ew||!R.hasIconData()||ev.get("icon-optional")),ew&&(eb||!R.hasTextData()||ev.get("text-optional")),!0);!R.collisionArrays&&e_&&(R.hasIconCollisionBoxData()||R.hasTextCollisionBoxData())&&R.deserializeCollisionBoxes(e_);let m=(R,eh,eu)=>{for(let em=0;em<eh/4;em++)R.opacityVertexArray.emplaceBack(eu);R.hasVisibleVertices=R.hasVisibleVertices||eu!==eU},eE=this.collisionBoxArrays.get(R.bucketInstanceId);for(let eu=0;eu<R.symbolInstances.length;eu++){let e_=R.symbolInstances.get(eu),{numHorizontalGlyphVertices:eg,numVerticalGlyphVertices:ev,crossTileID:eb}=e_,ew=this.opacities[eb];em[eb]?ew=ex:ew||(ew=eM,this.opacities[eb]=ew),em[eb]=!0;let eC=e_.numIconVertices>0,eA=this.placedOrientations[e_.crossTileID],ez=eA===eh.ax.vertical,eD=eA===eh.ax.horizontal||eA===eh.ax.horizontalOnly;if(eg>0||ev>0){let eh=wt(ew.text);m(R.text,eg,ez?eU:eh),m(R.text,ev,eD?eU:eh);let eu=ew.text.isHidden(),em=[e_.rightJustifiedTextSymbolIndex,e_.centerJustifiedTextSymbolIndex,e_.leftJustifiedTextSymbolIndex];for(let eh of em)eh>=0&&(R.text.placedSymbolArray.get(eh).hidden=eu||ez?1:0);e_.verticalPlacedTextSymbolIndex>=0&&(R.text.placedSymbolArray.get(e_.verticalPlacedTextSymbolIndex).hidden=eu||eD?1:0);let ex=this.variableOffsets[e_.crossTileID];ex&&this.markUsedJustification(R,ex.anchor,e_,eA);let eb=this.placedOrientations[e_.crossTileID];eb&&(this.markUsedJustification(R,"left",e_,eb),this.markUsedOrientation(R,eb,e_))}if(eC){let eh=wt(ew.icon),eu=!(eI&&e_.verticalPlacedIconSymbolIndex&&ez);e_.placedIconSymbolIndex>=0&&(m(R.icon,e_.numIconVertices,eu?eh:eU),R.icon.placedSymbolArray.get(e_.placedIconSymbolIndex).hidden=ew.icon.isHidden()),e_.verticalPlacedIconSymbolIndex>=0&&(m(R.icon,e_.numVerticalIconVertices,eu?eU:eh),R.icon.placedSymbolArray.get(e_.verticalPlacedIconSymbolIndex).hidden=ew.icon.isHidden())}let ek=(null==eE?void 0:eE.has(eu))?eE.get(eu):{text:null,icon:null};if(R.hasIconCollisionBoxData()||R.hasTextCollisionBoxData()){let em=R.collisionArrays[eu];if(em){let eu=new eh.P(0,0);if(em.textBox||em.verticalTextBox){let eh=!0;if(eT){let R=this.variableOffsets[eb];R?(eu=dt(R.anchor,R.width,R.height,R.textOffset,R.textBoxScale),eS&&eu._rotate(eP?-this.transform.bearingInRadians:this.transform.bearingInRadians)):eh=!1}if(em.textBox||em.verticalTextBox){let e_;em.textBox&&(e_=ez),em.verticalTextBox&&(e_=eD),pt(R.textCollisionBox.collisionVertexArray,ew.text.placed,!eh||e_,ek.text,eu.x,eu.y)}}if(em.iconBox||em.verticalIconBox){let eh;let e_=!!(!eD&&em.verticalIconBox);em.iconBox&&(eh=e_),em.verticalIconBox&&(eh=!e_),pt(R.iconCollisionBox.collisionVertexArray,ew.icon.placed,eh,ek.icon,eI?eu.x:0,eI?eu.y:0)}}}}if(R.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[R.bucketInstanceId]&&(this.retainedQueryData[R.bucketInstanceId].featureSortOrder=R.featureSortOrder),R.hasTextData()&&R.text.opacityVertexBuffer&&R.text.opacityVertexBuffer.updateData(R.text.opacityVertexArray),R.hasIconData()&&R.icon.opacityVertexBuffer&&R.icon.opacityVertexBuffer.updateData(R.icon.opacityVertexArray),R.hasIconCollisionBoxData()&&R.iconCollisionBox.collisionVertexBuffer&&R.iconCollisionBox.collisionVertexBuffer.updateData(R.iconCollisionBox.collisionVertexArray),R.hasTextCollisionBoxData()&&R.textCollisionBox.collisionVertexBuffer&&R.textCollisionBox.collisionVertexBuffer.updateData(R.textCollisionBox.collisionVertexArray),R.text.opacityVertexArray.length!==R.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${R.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${R.text.layoutVertexArray.length}) / 4`);if(R.icon.opacityVertexArray.length!==R.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${R.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${R.icon.layoutVertexArray.length}) / 4`);R.bucketInstanceId in this.collisionCircleArrays&&(R.collisionCircleArray=this.collisionCircleArrays[R.bucketInstanceId],delete this.collisionCircleArrays[R.bucketInstanceId])}symbolFadeChange(R){return 0===this.fadeDuration?1:(R-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(R){return Math.max(0,(this.transform.zoom-R)/1.5)}hasTransitions(R){return this.stale||R-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(R,eh){let eu=this.zoomAtLastRecencyCheck===eh?1-this.zoomAdjustment(eh):1;return this.zoomAtLastRecencyCheck=eh,this.commitTime+this.fadeDuration*eu>R}setStale(){this.stale=!0}};function pt(R,eh,eu,em,e_,eg){em&&0!==em.length||(em=[0,0,0,0]);let ev=em[0]-100,ex=em[1]-100,eb=em[2]-100,ew=em[3]-100;R.emplaceBack(eh?1:0,eu?1:0,e_||0,eg||0,ev,ex),R.emplaceBack(eh?1:0,eu?1:0,e_||0,eg||0,eb,ex),R.emplaceBack(eh?1:0,eu?1:0,e_||0,eg||0,eb,ew),R.emplaceBack(eh?1:0,eu?1:0,e_||0,eg||0,ev,ew)}
5function wt(R){if(0===R.opacity&&!R.placed)return 0;if(1===R.opacity&&R.placed)return 4294967295;let eh=R.placed?1:0,eu=Math.floor(127*R.opacity);return 33554432*eu+16777216*eh+131072*eu+65536*eh+512*eu+256*eh+2*eu+eh}let eU=0;let Pt=class Pt{constructor(R){this._sortAcrossTiles="viewport-y"!==R.layout.get("symbol-z-order")&&!R.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(R,eh,eu,em,e_){let eg=this._bucketParts;for(;this._currentTileIndex<R.length;)if(eh.getBucketParts(eg,em,R[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,e_())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,eg.sort((R,eh)=>R.sortKey-eh.sortKey));this._currentPartIndex<eg.length;)if(eh.placeLayerBucketPart(eg[this._currentPartIndex],this._seenCrossTileIDs,eu),this._currentPartIndex++,e_())return!0;return!1}};let Ct=class Ct{constructor(R,eh,eu,em,e_,eg,ev,ex){this.placement=new _t(R,eh,eg,ev,ex),this._currentPlacementIndex=eu.length-1,this._forceFullPlacement=em,this._showCollisionBoxes=e_,this._done=!1}isDone(){return this._done}continuePlacement(R,eu,em){let e_=c(),a=()=>!this._forceFullPlacement&&c()-e_>2;for(;this._currentPlacementIndex>=0;){let e_=eu[R[this._currentPlacementIndex]],eg=this.placement.collisionIndex.transform.zoom;if(eh.aR(e_)&&e_.layout&&(!e_.minzoom||e_.minzoom<=eg)&&(!e_.maxzoom||e_.maxzoom>eg)){if(this._inProgressLayer||(this._inProgressLayer=new Pt(e_)),this._inProgressLayer.continuePlacement(em[e_.source],this.placement,this._showCollisionBoxes,e_,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(R){return this.placement.commit(R),this.placement}};let eG=512/eh.a6/2;let Mt=class Mt{constructor(R,eu,em){this.tileID=R,this.bucketInstanceId=em,this._symbolsByKey={};let e_=new Map;for(let R=0;R<eu.length;R++){let eh=eu.get(R),em=eh.key,eg=e_.get(em);eg?eg.push(eh):e_.set(em,[eh])}for(let[R,eu]of e_){let em={positions:eu.map(R=>({x:Math.floor(R.anchorX*eG),y:Math.floor(R.anchorY*eG)})),crossTileIDs:eu.map(R=>R.crossTileID)};if(em.positions.length>128){let R=new eh.aS(em.positions.length,16,Uint16Array);for(let{x:eh,y:eu}of em.positions)R.add(eh,eu);R.finish(),delete em.positions,em.index=R}this._symbolsByKey[R]=em}}getScaledCoordinates(R,eu){let{x:em,y:e_,z:eg}=this.tileID.canonical,{x:ev,y:ex,z:eb}=eu.canonical,ew=eG/Math.pow(2,eb-eg),eT=(ex*eh.a6+R.anchorY)*ew,eS=e_*eh.a6*eG;return{x:Math.floor((ev*eh.a6+R.anchorX)*ew-em*eh.a6*eG),y:Math.floor(eT-eS)}}findMatches(R,eh,eu){let em=this.tileID.canonical.z<eh.canonical.z?1:Math.pow(2,this.tileID.canonical.z-eh.canonical.z);for(let e_=0;e_<R.length;e_++){let eg=R.get(e_);if(eg.crossTileID)continue;let ev=this._symbolsByKey[eg.key];if(!ev)continue;let ex=this.getScaledCoordinates(eg,eh);if(ev.index){let R=ev.index.range(ex.x-em,ex.y-em,ex.x+em,ex.y+em).sort();for(let eh of R){let R=ev.crossTileIDs[eh];if(!eu[R]){eu[R]=!0,eg.crossTileID=R;break}}}else if(ev.positions)for(let R=0;R<ev.positions.length;R++){let eh=ev.positions[R],e_=ev.crossTileIDs[R];if(Math.abs(eh.x-ex.x)<=em&&Math.abs(eh.y-ex.y)<=em&&!eu[e_]){eu[e_]=!0,eg.crossTileID=e_;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:R})=>R)}};let St=class St{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};let Et=class Et{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(R){let eh=Math.round((R-this.lng)/360);if(0!==eh)for(let R in this.indexes){let eu=this.indexes[R],em={};for(let R in eu){let e_=eu[R];e_.tileID=e_.tileID.unwrapTo(e_.tileID.wrap+eh),em[e_.tileID.key]=e_}this.indexes[R]=em}this.lng=R}addBucket(R,eh,eu){var em;if(null===(em=this.indexes[R.overscaledZ])||void 0===em?void 0:em[R.key]){if(this.indexes[R.overscaledZ][R.key].bucketInstanceId===eh.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(R.overscaledZ,this.indexes[R.overscaledZ][R.key])}for(let R=0;R<eh.symbolInstances.length;R++)eh.symbolInstances.get(R).crossTileID=0;this.usedCrossTileIDs[R.overscaledZ]||(this.usedCrossTileIDs[R.overscaledZ]={});let e_=this.usedCrossTileIDs[R.overscaledZ];for(let eu in this.indexes){let em=this.indexes[eu];if(Number(eu)>
5R.overscaledZ)for(let eu in em){let eg=em[eu];eg.tileID.isChildOf(R)&&eg.findMatches(eh.symbolInstances,R,e_)}else{let eg=em[R.scaledTo(Number(eu)).key];eg&&eg.findMatches(eh.symbolInstances,R,e_)}}for(let R=0;R<eh.symbolInstances.length;R++){let em=eh.symbolInstances.get(R);em.crossTileID||(em.crossTileID=eu.generate(),e_[em.crossTileID]=!0)}return void 0===this.indexes[R.overscaledZ]&&(this.indexes[R.overscaledZ]={}),this.indexes[R.overscaledZ][R.key]=new Mt(R,eh.symbolInstances,eh.bucketInstanceId),!0}removeBucketCrossTileIDs(R,eh){for(let eu of eh.getCrossTileIDsLists())for(let eh of eu)delete this.usedCrossTileIDs[R][eh]}removeStaleBuckets(R){let eh=!1;for(let eu in this.indexes){let em=this.indexes[eu];for(let e_ in em)R[em[e_].bucketInstanceId]||(this.removeBucketCrossTileIDs(eu,em[e_]),delete em[e_],eh=!0)}return eh}};let zt=class zt{constructor(){this.layerIndexes={},this.crossTileIDs=new St,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(R,eh,eu){let em=this.layerIndexes[R.id];void 0===em&&(em=this.layerIndexes[R.id]=new Et);let e_=!1,eg={};for(let ev of(em.handleWrapJump(eu),eh)){let eh=ev.getBucket(R);R.id===(null==eh?void 0:eh.layerIds[0])&&(eh.bucketInstanceId||(eh.bucketInstanceId=++this.maxBucketInstanceId),em.addBucket(ev.tileID,eh,this.crossTileIDs)&&(e_=!0),eg[eh.bucketInstanceId]=!0)}return em.removeStaleBuckets(eg)&&(e_=!0),e_}pruneUnusedLayers(R){let eh={};for(let eu of R)eh[eu]=!0;for(let R in this.layerIndexes)eh[R]||delete this.layerIndexes[R]}};var e$="void main() {fragColor=vec4(1.0);}";let eZ={prelude:At("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:At("","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:At("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:At("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:At("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;
5uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:At("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:At(e$,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:At("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:At("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:At("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:At("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:At("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:At("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:At(e$,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:At("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:At("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:At("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:At("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
5rn_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:At("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:At("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:At("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
5ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:At("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:At("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
5float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:At("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:At("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
5float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:At("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
5float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:At("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
5float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:At("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:At("uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}"),symbolSDF:At("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;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*total_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:At("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
5fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;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*total_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}"),terrain:At("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);
5float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:At("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:At("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:At("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:At("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:At("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);}")};
5function At(R,eh){let eu=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,em=eh.match(/in ([\w]+) ([\w]+)/g),e_=R.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),eg=eh.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),ev=eg?eg.concat(e_):e_,ex={};return{fragmentSource:R=R.replace(eu,(R,eh,eu,em,e_)=>(ex[e_]=!0,"define"===eh?` 6#ifndef HAS_UNIFORM_u_${e_} 7in ${eu} ${em} ${e_}; 8#else 9uniform ${eu} ${em} u_${e_}; 10#endif 11`:` 12#ifdef HAS_UNIFORM_u_${e_} 13 ${eu} ${em} ${e_} = u_${e_}; 14#endif 15`)),vertexSource:eh=eh.replace(eu,(R,eh,eu,em,e_)=>{let eg="float"===em?"vec2":"vec4",ev=e_.match(/color/)?"color":eg;return ex[e_]?"define"===eh?` 16#ifndef HAS_UNIFORM_u_${e_} 17uniform lowp float u_${e_}_t; 18in ${eu} ${eg} a_${e_}; 19out ${eu} ${em} ${e_}; 20#else 21uniform ${eu} ${em} u_${e_}; 22#endif 23`:"vec4"===ev?` 24#ifndef HAS_UNIFORM_u_${e_} 25 ${e_} = a_${e_}; 26#else 27 ${eu} ${em} ${e_} = u_${e_}; 28#endif 29`:` 30#ifndef HAS_UNIFORM_u_${e_} 31 ${e_} = unpack_mix_${ev}(a_${e_}, u_${e_}_t); 32#else 33 ${eu} ${em} ${e_} = u_${e_}; 34#endif 35`:"define"===eh?` 36#ifndef HAS_UNIFORM_u_${e_} 37uniform lowp float u_${e_}_t; 38in ${eu} ${eg} a_${e_}; 39#else 40uniform ${eu} ${em} u_${e_}; 41#endif 42`:"vec4"===ev?` 43#ifndef HAS_UNIFORM_u_${e_} 44 ${eu} ${em} ${e_} = a_${e_}; 45#else 46 ${eu} ${em} ${e_} = u_${e_}; 47#endif 48`:` 49#ifndef HAS_UNIFORM_u_${e_} 50 ${eu} ${em} ${e_} = unpack_mix_${ev}(a_${e_}, u_${e_}_t); 51#else 52 ${eu} ${em} ${e_} = u_${e_}; 53#endif 54`}),staticAttributes:em,staticUniforms:ev}}let Lt=class Lt{constructor(R,eh,eu){this.vertexBuffer=R,this.indexBuffer=eh,this.segments=eu}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};var eq=eh.aT([{name:"a_pos",type:"Int16",components:2}]);let eW="#define PROJECTION_MERCATOR",eX="mercator";let Ot=class Ot{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return eX}get shaderDefine(){return eW}get shaderPreludeCode(){return eZ.projectionMercator}get vertexShaderPreludeCode(){return eZ.projectionMercator.vertexSource}get subdivisionGranularity(){return eh.aU.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(R){}getMeshFromTileID(R,eu,em,e_,eg){if(this._cachedMesh)return this._cachedMesh;let ev=new eh.aV;ev.emplaceBack(0,0),ev.emplaceBack(eh.a6,0),ev.emplaceBack(0,eh.a6),ev.emplaceBack(eh.a6,eh.a6);let ex=R.createVertexBuffer(ev,eq.members),eb=eh.aW.simpleSegment(0,0,4,2),ew=new eh.aX;ew.emplaceBack(1,0,2),ew.emplaceBack(1,2,3);let eT=R.createIndexBuffer(ew);return this._cachedMesh=new Lt(ex,eT,eb),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(R){}};let jt=class jt{constructor(R=0,eh=0,eu=0,em=0){if(isNaN(R)||R<0||isNaN(eh)||eh<0||isNaN(eu)||eu<0||isNaN(em)||em<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=R,this.bottom=eh,this.left=eu,this.right=em}interpolate(R,eu,em){return null!=eu.top&&null!=R.top&&(this.top=eh.H.number(R.top,eu.top,em)),null!=eu.bottom&&null!=R.bottom&&(this.bottom=eh.H.number(R.bottom,eu.bottom,em)),null!=eu.left&&null!=R.left&&(this.left=eh.H.number(R.left,eu.left,em)),null!=eu.right&&null!=R.right&&(this.right=eh.H.number(R.right,eu.right,em)),this}getCenter(R,eu){let em=eh.al((this.left+R-this.right)/2,0,R),e_=eh.al((this.top+eu-this.bottom)/2,0,eu);return new eh.P(em,e_)}equals(R){return this.top===R.top&&this.bottom===R.bottom&&this.left===R.left&&this.right===R.right}clone(){return new jt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function Nt(R,eh){if(!R.renderWorldCopies||R.lngRange)return;let eu=eh.lng-R.center.lng;eh.lng+=eu>180?-360:eu<-180?360:0}function Zt(R){return Math.max(0,Math.floor(R))}let Ut=class Ut{constructor(R,eu){var em;this.applyConstrain=(R,eh)=>null!==this._constrainOverride?this._constrainOverride(R,eh):this._callbacks.defaultConstrain(R,eh),this._callbacks=R,this._tileSize=512,this._renderWorldCopies=void 0===(null==eu?void 0:eu.renderWorldCopies)||!!(null==eu?void 0:eu.renderWorldCopies),this._minZoom=(null==eu?void 0:eu.minZoom)||0,this._maxZoom=(null==eu?void 0:eu.maxZoom)||22,this._minPitch=null==(null==eu?void 0:eu.minPitch)?0:null==eu?void 0:eu.minPitch,this._maxPitch=null==(null==eu?void 0:eu.maxPitch)?60:null==eu?void 0:eu.maxPitch,this._constrainOverride=null!==(em=null==eu?void 0:eu.constrainOverride)&&void 0!==em?em:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new eh.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Zt(this._zoom),this._scale=eh.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new jt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(R,eu,em){this._constrainOverride=R.constrainOverride,this._latRange=R.latRange,this._lngRange=R.lngRange,this._width=R.width,this._height=R.height,this._center=R.center,this._elevation=R.elevation,this._minElevationForCurrentTile=R.minElevationForCurrentTile,this._zoom=R.zoom,this._tileZoom=Zt(this._zoom),this._scale=eh.ao(this._zoom),this._bearingInRadians=R.bearingInRadians,this._fovInRadians=R.fovInRadians,this._pitchInRadians=R.pitchInRadians,this._rollInRadians=R.rollInRadians,this._unmodified=R.unmodified,this._edgeInsets=new jt(R.padding.top,R.padding.bottom,R.padding.left,R.padding.right),this._minZoom=R.minZoom,this._maxZoom=R.maxZoom,this._minPitch=R.minPitch,this._maxPitch=R.maxPitch,this._renderWorldCopies=R.renderWorldCopies,this._cameraToCenterDistance=R.cameraToCenterDistance,this._nearZ=R.nearZ,this._farZ=R.farZ,this._autoCalculateNearFarZ=!em&&R.autoCalculateNearFarZ,eu&&this.constrainInternal(),this._calcMatrices()}
54get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(R){this._minElevationForCurrentTile=R}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(R){this._minZoom!==R&&(this._minZoom=R,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(R){this._maxZoom!==R&&(this._maxZoom=R,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(R){this._minPitch!==R&&(this._minPitch=R,this.setPitch(Math.max(this.pitch,R)))}get maxPitch(){return this._maxPitch}setMaxPitch(R){this._maxPitch!==R&&(this._maxPitch=R,this.setPitch(Math.min(this.pitch,R)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(R){void 0===R?R=!0:null===R&&(R=!1),this._renderWorldCopies=R}get constrainOverride(){return this._constrainOverride}setConstrainOverride(R){void 0===R&&(R=null),this._constrainOverride!==R&&(this._constrainOverride=R,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 eh.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(R){var eu,em,e_,eg,ev,ex,eb,ew,eT;let eS=eh.X(R,-180,180)*Math.PI/180;this._bearingInRadians!==eS&&(this._unmodified=!1,this._bearingInRadians=eS,this._calcMatrices(),this._rotationMatrix=o(),eu=this._rotationMatrix,e_=-this._bearingInRadians,eg=(em=this._rotationMatrix)[0],ev=em[1],ex=em[2],eb=em[3],ew=Math.sin(e_),eT=Math.cos(e_),eu[0]=eg*eT+ex*ew,eu[1]=ev*eT+eb*ew,eu[2]=-(eg*ew)+ex*eT,eu[3]=-(ev*ew)+eb*eT)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(R){let eu=eh.al(R,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==eu&&(this._unmodified=!1,this._pitchInRadians=eu,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(R){let eh=R/180*Math.PI;this._rollInRadians!==eh&&(this._unmodified=!1,this._rollInRadians=eh,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return eh.aY(this._fovInRadians)}setFov(R){R=eh.al(R,.1,150),this.fov!==R&&(this._unmodified=!1,this._fovInRadians=eh.an(R),this._calcMatrices())}get zoom(){return this._zoom}setZoom(R){let eu=this.applyConstrain(this._center,R).zoom;this._zoom!==eu&&(this._unmodified=!1,this._zoom=eu,this._tileZoom=Math.max(0,Math.floor(eu)),this._scale=eh.ao(eu),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(R){R.lat===this._center.lat&&R.lng===this._center.lng||(this._unmodified=!1,this._center=R,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(R){R!==this._elevation&&(this._elevation=R,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(R){this._edgeInsets.equals(R)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,R,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(R,eh){this._autoCalculateNearFarZ=!1,this._nearZ=R,this._farZ=eh,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(R){return this._edgeInsets.equals(R)}interpolatePadding(R,eh,eu){this._unmodified=!1,this._edgeInsets.interpolate(R,eh,eu),this.constrainInternal(),this._calcMatrices()}resize(R,eh,eu=!0){this._width=R,this._height=eh,eu&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var R,eh;return 2!==(null===(R=this._latRange)||void 0===R?void 0:R.length)||2!==(null===(eh=this._lngRange)||void 0===eh?void 0:eh.length)?null:new U([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(R){R?(this._lngRange=[R.getWest(),R.getEast()],this._latRange=[R.getSouth(),R.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-eh.am,eh.am])}getCameraQueryGeometry(R,eu){if(1===eu.length)return[eu[0],R];{let{minX:em,minY:e_,maxX:eg,maxY:ev}=eh.a8.fromPoints(eu).extend(R);return[new eh.P(em,e_),new eh.P(eg,e_),new eh.P(eg,ev),new eh.P(em,ev),new eh.P(em,e_)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let R=this._unmodified,{center:eh,zoom:eu}=this.applyConstrain(this.center,this.zoom);this.setCenter(eh),this.setZoom(eu),this._unmodified=R,this._constraining=!1}
54_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let R=eh.ap(new Float64Array(16));eh.S(R,R,[this._width/2,-this._height/2,1]),eh.Q(R,R,[1,-1,0]),this._clipSpaceToPixelsMatrix=R,R=eh.ap(new Float64Array(16)),eh.S(R,R,[1,-1,1]),eh.Q(R,R,[-1,-1,0]),eh.S(R,R,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=R,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(R,eu,em,e_){let eg=void 0!==em?em:this.bearing,ev=e_=void 0!==e_?e_:this.pitch,{distanceToCenter:ex,clampedElevation:eb}=this._distanceToCenterFromAltElevationPitch(eu,this.elevation,ev),{x:ew,y:eT}=xe(ev,eg),eS=eh.a7.fromLngLat(R,eu),eP,eI,eM=eh.aZ(1,eS.y),eE=0;do{if((eE+=1)>10)break;eI=ex/eM,eM=1/(eP=new eh.a7(eS.x+ew*eI,eS.y+eT*eI)).meterInMercatorCoordinateUnits()}while(Math.abs(ex-eI*eM)>1e-12);return{center:eP.toLngLat(),elevation:eb,zoom:eh.ar(this.height/2/Math.tan(this.fovInRadians/2)/eI/this.tileSize)}}recalculateZoomAndCenter(R){if(this.elevation-R==0)return;let eu=1/this.worldSize,em=eh.aq(1,this.center.lat)*this.worldSize,e_=eh.a7.fromLngLat(this.center,this.elevation),eg=e_.x/eu,ev=e_.y/eu,ex=e_.z/eu,eb=this.pitch,ew=this.bearing,{x:eT,y:eS,z:eP}=xe(eb,ew),eI=this.cameraToCenterDistance,eM=eg+-(eI*eT),eE=ev+-(eI*eS),{distanceToCenter:eC,clampedElevation:eA}=this._distanceToCenterFromAltElevationPitch((ex+eI*eP)/em,R,eb),ez=eC*em,eD=new eh.a7((eM+eT*ez)*eu,(eE+eS*ez)*eu,0).toLngLat(),ek=eh.aq(1,eD.lat),eR=eh.ar(this.height/2/Math.tan(this.fovInRadians/2)/eC/ek/this.tileSize);this._elevation=eA,this._center=eD,this.setZoom(eR)}_distanceToCenterFromAltElevationPitch(R,eu,em){let e_=-Math.cos(eh.an(em)),eg=R-eu,ev,ex=eu;return e_*eg>=0||.1>Math.abs(e_)?ex=R+(ev=1e4)*e_:ev=-eg/e_,{distanceToCenter:ev,clampedElevation:ex}}getCameraPoint(){let R=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new eh.P(R*Math.sin(this.rollInRadians),R*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let R=eh.aq(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/R).toLngLat()}getMercatorTileCoordinates(R){if(!R)return[0,0,1,1];let eu=R.canonical.z>=0?1<<R.canonical.z:Math.pow(2,R.canonical.z);return[R.canonical.x/eu,R.canonical.y/eu,1/eu/eh.a6,1/eu/eh.a6]}};let Gt=class Gt{constructor(R,eu){this.min=R,this.max=eu,this.center=eh.a_([],eh.a$([],this.min,this.max),.5)}quadrant(R){let eu=[R%2==0,R<2],em=eh.b0(this.min),e_=eh.b0(this.max);for(let R=0;R<eu.length;R++)em[R]=eu[R]?this.min[R]:this.center[R],e_[R]=eu[R]?this.center[R]:this.max[R];return e_[2]=this.max[2],new Gt(em,e_)}distanceX(R){return Math.max(Math.min(this.max[0],R[0]),this.min[0])-R[0]}distanceY(R){return Math.max(Math.min(this.max[1],R[1]),this.min[1])-R[1]}intersectsFrustum(R){let eh=!0;for(let eu of R.planes){let R=this.intersectsPlane(eu);if(0===R)return 0;1===R&&(eh=!1)}return eh?2:R.aabb.min[0]>this.max[0]||R.aabb.min[1]>this.max[1]||R.aabb.min[2]>this.max[2]||R.aabb.max[0]<this.min[0]||R.aabb.max[1]<this.min[1]||R.aabb.max[2]<this.min[2]?0:1}intersectsPlane(R){let eh=R[3],eu=R[3];for(let em=0;em<3;em++)R[em]>0?(eh+=R[em]*this.min[em],eu+=R[em]*this.max[em]):(eu+=R[em]*this.min[em],eh+=R[em]*this.max[em]);return eh>=0?2:eu<0?0:1}};let Vt=class Vt{distanceToTile2d(R,eh,eu,em){let e_=em.distanceX([R,eh]),eg=em.distanceY([R,eh]);return Math.hypot(e_,eg)}getWrap(R,eh,eu){return eu}getTileBoundingVolume(R,eu,em,e_){var eg,ev;let ex=0,eb=0;if(null==e_?void 0:e_.terrain){let ew=new eh.a3(R.z,eu,R.z,R.x,R.y),eT=e_.terrain.getMinMaxElevation(ew);ex=null!==(eg=eT.minElevation)&&void 0!==eg?eg:Math.min(0,em),eb=null!==(ev=eT.maxElevation)&&void 0!==ev?ev:Math.max(0,em)}let ew=1<<R.z;return new Gt([eu+R.x/ew,R.y/ew,ex],[eu+(R.x+1)/ew,(R.y+1)/ew,eb])}allowVariableZoom(R,eu){let em=R.fov*(Math.abs(Math.cos(R.rollInRadians))*R.height+Math.abs(Math.sin(R.rollInRadians))*R.width)/R.height,e_=eh.al(78.5-em/2,0,60);return!!eu.terrain||R.pitch>e_}allowWorldCopies(){return!0}prepareNextFrame(){}};let Wt=class Wt{constructor(R,eh,eu){this.points=R,this.planes=eh,this.aabb=eu}static fromInvProjectionMatrix(R,eu=1,em=0,e_,eg){let ev=eg?[[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]],ex=Math.pow(2,em),eb=[[-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(em=>(function(R,eu,em,e_){let eg=eh.aF([],R,eu),ev=1/eg[3]/em*e_;return eh.b5(eg,eg,[ev,ev,1/eg[3],ev])})(em,R,eu,ex));e_&&function(R,eu,em,e_){let eg=e_?4:0,ev=e_?0:4,ex=0,eb=[],ew=[];for(let eu=0;eu<4;eu++){let em=eh.b1([],R[eu+ev],R[eu+eg]),e_=eh.b6(em);
54eh.a_(em,em,1/e_),eb.push(e_),ew.push(em)}for(let eu=0;eu<4;eu++){let e_=eh.b7(R[eu+eg],ew[eu],em);ex=null!==e_&&e_>=0?Math.max(ex,e_):Math.max(ex,eb[eu])}let eT=function(R,eu){let em=eh.b1([],R[eu[0]],R[eu[1]]),e_=eh.b1([],R[eu[2]],R[eu[1]]),eg=[0,0,0,0];return eh.b2(eg,eh.b3([],em,e_)),eg[3]=-eh.b4(eg,R[eu[0]]),eg}(R,eu),eS=function(R,eu){let em=eh.b8(R),e_=eh.b9([],R,1/em),eg=eh.b1([],eu,eh.a_([],e_,eh.b4(eu,e_))),ev=eh.b8(eg);if(ev>0){let R=Math.sqrt(1-e_[3]*e_[3]),em=eh.a_([],e_,-e_[3]),ex=eh.a$([],em,eh.a_([],eg,R/ev));return eh.ba(eu,ex)}return null}(em,eT);if(null!==eS){let R=eS/eh.b4(ew[0],eT);ex=Math.min(ex,R)}for(let eh=0;eh<4;eh++){let eu=Math.min(ex,eb[eh]);R[eh+ev]=[R[eh+eg][0]+ew[eh][0]*eu,R[eh+eg][1]+ew[eh][1]*eu,R[eh+eg][2]+ew[eh][2]*eu,1]}}(eb,ev[0],e_,eg);let ew=ev.map(R=>{let eu=eh.b1([],eb[R[0]],eb[R[1]]),em=eh.b1([],eb[R[2]],eb[R[1]]),e_=eh.b2([],eh.b3([],eu,em)),eg=-eh.b4(e_,eb[R[1]]);return e_.concat(eg)}),eT=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],eS=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let R of eb)for(let eh=0;eh<3;eh++)eT[eh]=Math.min(eT[eh],R[eh]),eS[eh]=Math.max(eS[eh],R[eh]);return new Wt(eb,ew,new Gt(eT,eS))}};let qt=class qt{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(R){this._helper.setMinZoom(R)}setMaxZoom(R){this._helper.setMaxZoom(R)}setMinPitch(R){this._helper.setMinPitch(R)}setMaxPitch(R){this._helper.setMaxPitch(R)}setRenderWorldCopies(R){this._helper.setRenderWorldCopies(R)}setBearing(R){this._helper.setBearing(R)}setPitch(R){this._helper.setPitch(R)}setRoll(R){this._helper.setRoll(R)}setFov(R){this._helper.setFov(R)}setZoom(R){this._helper.setZoom(R)}setCenter(R){this._helper.setCenter(R)}setElevation(R){this._helper.setElevation(R)}setMinElevationForCurrentTile(R){this._helper.setMinElevationForCurrentTile(R)}setPadding(R){this._helper.setPadding(R)}interpolatePadding(R,eh,eu){this._helper.interpolatePadding(R,eh,eu)}isPaddingEqual(R){return this._helper.isPaddingEqual(R)}resize(R,eh,eu=!0){this._helper.resize(R,eh,eu)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(R){this._helper.setMaxBounds(R)}setConstrainOverride(R){this._helper.setConstrainOverride(R)}overrideNearFarZ(R,eh){this._helper.overrideNearFarZ(R,eh)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(R){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),R)}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(R,eh){}constructor(R){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(R,eu)=>{let em,e_;eu=eh.al(+eu,this.minZoom,this.maxZoom);let eg={center:new eh.W(R.lng,R.lat),zoom:eu},ev=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===ev){let R=180-1e-10;ev=[-R,R]}let ex=this.tileSize*eh.ao(eg.zoom),eb=0,ew=ex,eT=0,eS=ex,eP=0,eI=0,{x:eM,y:eE}=this.size;if(this._helper._latRange){let R=this._helper._latRange;eb=eh.Y(R[1])*ex,(ew=eh.Y(R[0])*ex)-eb<eE&&(eP=eE/(ew-eb))}ev&&(eT=eh.X(eh.Z(ev[0])*ex,0,ex),(eS=eh.X(eh.Z(ev[1])*ex,0,ex))<eT&&(eS+=ex),eS-eT<eM&&(eI=eM/(eS-eT)));let{x:eC,y:eA}=pe(ex,R),ez=Math.max(eI||0,eP||0);if(ez){let R=new eh.P(eI?(eS+eT)/2:eC,eP?(ew+eb)/2:eA);return eg.center=me(ex,R).wrap(),eg.zoom+=eh.ar(ez),eg}if(this._helper._latRange){let R=eE/2;eA-R<eb&&(e_=eb+R),eA+R>ew&&(e_=ew-R)}if(ev){let R=(eT+eS)/2,eu=eC;
54this._helper._renderWorldCopies&&(eu=eh.X(eC,R-ex/2,R+ex/2));let e_=eM/2;eu-e_<eT&&(em=eT+e_),eu+e_>eS&&(em=eS-e_)}if(void 0!==em||void 0!==e_){let R=new eh.P(null!=em?em:eC,null!=e_?e_:eA);eg.center=me(ex,R).wrap()}return eg},this.applyConstrain=(R,eh)=>this._helper.applyConstrain(R,eh),this._helper=new Ut({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(R,eh)=>this.defaultConstrain(R,eh)},R),this._coveringTilesDetailsProvider=new Vt}clone(){let R=new qt;return R.apply(this,!1),R}apply(R,eh,eu){this._helper.apply(R,eh,eu)}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(R){let eu=[new eh.bb(0,R)];if(this._helper._renderWorldCopies){let em=this.screenPointToMercatorCoordinate(new eh.P(0,0)),e_=this.screenPointToMercatorCoordinate(new eh.P(this._helper._width,0)),eg=this.screenPointToMercatorCoordinate(new eh.P(this._helper._width,this._helper._height)),ev=this.screenPointToMercatorCoordinate(new eh.P(0,this._helper._height)),ex=Math.floor(Math.min(em.x,e_.x,eg.x,ev.x)),eb=Math.floor(Math.max(em.x,e_.x,eg.x,ev.x));for(let em=ex-1;em<=eb+1;em++)0!==em&&eu.push(new eh.bb(em,R))}return eu}getCameraFrustum(){return Wt.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(R){let eh=this.screenPointToLocation(this.centerPoint,R),eu=R?R.getElevationForLngLatZoom(eh,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(eu)}setLocationAtPoint(R,eu){let em=eh.aq(this.elevation,this.center.lat),e_=this.screenPointToMercatorCoordinateAtZ(eu,em),eg=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,em),ev=eh.a7.fromLngLat(R),ex=new eh.a7(ev.x-(e_.x-eg.x),ev.y-(e_.y-eg.y));this.setCenter(null==ex?void 0:ex.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(R,eu){return eu?this.coordinatePoint(eh.a7.fromLngLat(R),eu.getElevationForLngLat(R,this),this._pixelMatrix3D):this.coordinatePoint(eh.a7.fromLngLat(R))}screenPointToLocation(R,eh){var eu;return null===(eu=this.screenPointToMercatorCoordinate(R,eh))||void 0===eu?void 0:eu.toLngLat()}screenPointToMercatorCoordinate(R,eh){if(eh){let eu=eh.pointCoordinate(R);if(null!=eu)return eu}return this.screenPointToMercatorCoordinateAtZ(R)}screenPointToMercatorCoordinateAtZ(R,eu){let em=eu||0,e_=[R.x,R.y,0,1],eg=[R.x,R.y,1,1];eh.aF(e_,e_,this._pixelMatrixInverse),eh.aF(eg,eg,this._pixelMatrixInverse);let ev=e_[3],ex=eg[3],eb=e_[1]/ev,ew=eg[1]/ex,eT=e_[2]/ev,eS=eg[2]/ex,eP=eT===eS?0:(em-eT)/(eS-eT);return new eh.a7(eh.H.number(e_[0]/ev,eg[0]/ex,eP)/this.worldSize,eh.H.number(eb,ew,eP)/this.worldSize,em)}coordinatePoint(R,eu=0,em=this._pixelMatrix){let e_=[R.x*this.worldSize,R.y*this.worldSize,eu,1];return eh.aF(e_,e_,em),new eh.P(e_[0]/e_[3],e_[1]/e_[3])}getBounds(){let R=Math.max(0,this._helper._height/2-fe(this));return(new U).extend(this.screenPointToLocation(new eh.P(0,R))).extend(this.screenPointToLocation(new eh.P(this._helper._width,R))).extend(this.screenPointToLocation(new eh.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new eh.P(0,this._helper._height)))}isPointOnMapSurface(R,eh){return eh?null!=eh.pointCoordinate(R):R.y>this.height/2-fe(this)}calculatePosMatrix(R,eu=!1,em){var e_;let eg=null!==(e_=R.key)&&void 0!==e_?e_:eh.bc(R.wrap,R.canonical.z,R.canonical.z,R.canonical.x,R.canonical.y),ev=eu?this._alignedPosMatrixCache:this._posMatrixCache;if(ev.has(eg)){let R=ev.get(eg);return em?R.f32:R.f64}let ex=ge(R,this.worldSize);eh.U(ex,eu?this._alignedProjMatrix:this._viewProjMatrix,ex);let eb={f64:ex,f32:new Float32Array(ex)};return ev.set(eg,eb),em?eb.f32:eb.f64}calculateFogMatrix(R){let eu=R.key,em=this._fogMatrixCacheF32;if(em.has(eu))return em.get(eu);let e_=ge(R,this.worldSize);return eh.U(e_,this._fogMatrix,e_),em.set(eu,new Float32Array(e_)),em.get(eu)}calculateCenterFromCameraLngLatAlt(R,eh,eu,em){return this._helper.calculateCenterFromCameraLngLatAlt(R,eh,eu,em)}_calculateNearFarZIfNeeded(R,eu,em){if(!this._helper.autoCalculateNearFarZ)return;let e_=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),eg=R-e_*this._helper._pixelPerMeter/Math.cos(eu),ev=e_<0?eg:R,ex=Math.PI/2+this.pitchInRadians,eb=eh.an(this.fov)*(Math.abs(Math.cos(eh.an(this.roll)))*this.height+Math.abs(Math.sin(eh.an(this.roll)))*this.width)/this.height*(.5+em.y/this.height),ew=Math.sin(eb)*ev/Math.sin(eh.al(Math.PI-ex-eb,.01,Math.PI-.01)),eT=fe(this),eS=Math.atan(eT/this._helper.cameraToCenterDistance),eP=eh.an(.75),eI=eS>eP?2*eS*(.5+em.y/(2*eT)):eP,eM=Math.sin(eI)*ev/Math.sin(eh.al(Math.PI-ex-eI,.01,Math.PI-.01));this._helper._farZ=1.01*(Math.cos(Math.PI/2-eu)*Math.min(ew,eM)+ev),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let R;if(!this._helper._height)return;let eu=this.centerOffset,em=pe(this.worldSize,this.center),e_=em.x,eg=em.y;this._helper._pixelPerMeter=eh.aq(1,this.center.lat)*this.worldSize;let ev=eh.an(Math.min(this.pitch,89.25)),ex=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(ev));this._calculateNearFarZIfNeeded(ex,ev,eu),R=new Float64Array(16),eh.bd(R,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),eh.az(this._invProjMatrix,R),R[8]=-(2*eu.x)/this._helper._width,R[9]=2*eu.y/this._helper._height,this._projectionMatrix=eh.be(R),eh.S(R,R,[1,-1,1]),eh.Q(R,R,[0,0,-this._helper.cameraToCenterDistance]),eh.bf(R,R,-this.rollInRadians),eh.bg(R,R,this.pitchInRadians),eh.bf(R,R,-this.bearingInRadians),eh.Q(R,R,[-e_,-eg,0]),this._mercatorMatrix=eh.S([],R,[this.worldSize,this.worldSize,this.worldSize]),eh.S(R,R,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=eh.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,R),eh.Q(R,R,[0,0,-this.elevation]),this._viewProjMatrix=R,this._invViewProjMatrix=eh.az([],R);let eb=[0,0,-1,1];eh.aF(eb,eb,this._invViewProjMatrix),this._cameraPosition=[eb[0]/eb[3],eb[1]/eb[3],eb[2]/eb[3]],this._fogMatrix=new Float64Array(16),eh.bd(this._fogMatrix,this.fovInRadians,this.width/this.height,ex,this._helper._farZ),this._fogMatrix[8]=-(2*eu.x)/this.width,this._fogMatrix[9]=2*eu.y/this.height,eh.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),eh.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),eh.bf(this._fogMatrix,this._fogMatrix,-this.rollInRadians),eh.bg(this._fogMatrix,this._fogMatrix,this.pitchInRadians),eh.bf(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),eh.Q(this._fogMatrix,this._fogMatrix,[-e_,-eg,0]),eh.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),eh.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=eh.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,R);let ew=this._helper._width%2/2,eT=this._helper._height%2/2,eS=Math.cos(this.bearingInRadians),eP=Math.sin(-this.bearingInRadians),eI=e_-Math.round(e_)+eS*ew+eP*eT,eM=eg-Math.round(eg)+eS*eT+eP*ew,eE=new Float64Array(R);if(eh.Q(eE,eE,[eI>.5?eI-1:eI,eM>.5?eM-1:eM,0]),this._alignedProjMatrix=eE,!(R=eh.az(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=R,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let R=this.screenPointToMercatorCoordinate(new eh.P(0,0)),eu=[R.x*this.worldSize,R.y*this.worldSize,0,1];return eh.aF(eu,eu,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let R=eh.aq(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/R).toLngLat()}lngLatToCameraDepth(R,eu){let em=eh.a7.fromLngLat(R),e_=[em.x*this.worldSize,em.y*this.worldSize,eu,1];return eh.aF(e_,e_,this._viewProjMatrix),e_[2]/e_[3]}getProjectionData(R){let eu;let{overscaledTileID:em,aligned:e_,applyTerrainMatrix:eg}=R,ev=this._helper.getMercatorTileCoordinates(em),ex=em?this.calculatePosMatrix(em,e_,!0):null;return{mainMatrix:eu=(null==em?void 0:em.terrainRttPosMatrix32f)&&eg?em.terrainRttPosMatrix32f:ex||eh.bh(),tileMercatorCoords:ev,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:eu}}isLocationOccluded(R){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(R,eh,eu){return 1}transformLightDirection(R){return eh.b0(R)}getRayDirectionFromPixel(R){throw Error("Not implemented.")}projectTileCoordinates(R,eu,em,e_){let eg;let ev=this.calculatePosMatrix(em);e_?(eg=[R,eu,e_(R,eu),1],eh.aF(eg,eg,ev)):rt(eg=[R,eu,0,1],eg,ev);let ex=eg[3];return{point:new eh.P(eg[0]/ex,eg[1]/ex),signedDistanceFromCamera:ex,isOccluded:!1}}
54populateCache(R){for(let eh of R)this.calculatePosMatrix(eh)}getMatrixForModel(R,eu){let em=eh.a7.fromLngLat(R,eu),e_=em.meterInMercatorCoordinateUnits(),eg=eh.bi();return eh.Q(eg,eg,[em.x,em.y,em.z]),eh.bf(eg,eg,Math.PI),eh.bg(eg,eg,Math.PI/2),eh.S(eg,eg,[-e_,e_,e_]),eg}getProjectionDataForCustomLayer(R=!0){let eu=new eh.a3(0,0,0,0,0),em=this.getProjectionData({overscaledTileID:eu,applyGlobeMatrix:R}),e_=ge(eu,this.worldSize);eh.U(e_,this._viewProjMatrix,e_),em.tileMercatorCoords=[0,0,1,1];let eg=[eh.a6,eh.a6,this.worldSize/this._helper.pixelsPerMeter],ev=eh.bj();return eh.S(ev,e_,eg),em.fallbackMatrix=ev,em.mainMatrix=ev,em}getFastPathSimpleProjectionMatrix(R){return this.calculatePosMatrix(R)}};function $t(){eh.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Ht(R){if(R.useSlerp){if(R.k<1){let eu=eh.bk(R.startEulerAngles.roll,R.startEulerAngles.pitch,R.startEulerAngles.bearing),em=eh.bk(R.endEulerAngles.roll,R.endEulerAngles.pitch,R.endEulerAngles.bearing),e_=new Float64Array(4);eh.bl(e_,eu,em,R.k);let eg=eh.bm(e_);R.tr.setRoll(eg.roll),R.tr.setPitch(eg.pitch),R.tr.setBearing(eg.bearing)}else R.tr.setRoll(R.endEulerAngles.roll),R.tr.setPitch(R.endEulerAngles.pitch),R.tr.setBearing(R.endEulerAngles.bearing)}else R.tr.setRoll(eh.H.number(R.startEulerAngles.roll,R.endEulerAngles.roll,R.k)),R.tr.setPitch(eh.H.number(R.startEulerAngles.pitch,R.endEulerAngles.pitch,R.k)),R.tr.setBearing(eh.H.number(R.startEulerAngles.bearing,R.endEulerAngles.bearing,R.k))}function Xt(R,eu,em,e_,eg){let ev=eg.padding,ex=pe(eg.worldSize,em.getNorthWest()),eb=pe(eg.worldSize,em.getNorthEast()),ew=pe(eg.worldSize,em.getSouthEast()),eT=pe(eg.worldSize,em.getSouthWest
54()),eS=eh.an(-e_),eP=ex.rotate(eS),eI=eb.rotate(eS),eM=ew.rotate(eS),eE=eT.rotate(eS),eC=new eh.P(Math.max(eP.x,eI.x,eE.x,eM.x),Math.max(eP.y,eI.y,eE.y,eM.y)),eA=new eh.P(Math.min(eP.x,eI.x,eE.x,eM.x),Math.min(eP.y,eI.y,eE.y,eM.y)),ez=eC.sub(eA),eD=(eg.width-(ev.left+ev.right+eu.left+eu.right))/ez.x,ek=(eg.height-(ev.top+ev.bottom+eu.top+eu.bottom))/ez.y;if(ek<0||eD<0)return void $t();let eR=Math.min(eh.ar(eg.scale*Math.min(eD,ek)),R.maxZoom),eL=eh.P.convert(R.offset),eF=new eh.P((eu.left-eu.right)/2,(eu.top-eu.bottom)/2).rotate(eh.an(e_)),eB=eL.add(eF).mult(eg.scale/eh.ao(eR));return{center:me(eg.worldSize,ex.add(ew).div(2).sub(eB)),zoom:eR,bearing:e_}}let Kt=class Kt{get useGlobeControls(){return!1}handlePanInertia(R,eh){let eu=R.mag(),em=Math.abs(fe(eh));return{easingOffset:R.mult(Math.min(.75*em/eu,1)),easingCenter:eh.center}}handleMapControlsRollPitchBearingZoom(R,eh){R.bearingDelta&&eh.setBearing(eh.bearing+R.bearingDelta),R.pitchDelta&&eh.setPitch(eh.pitch+R.pitchDelta),R.rollDelta&&eh.setRoll(eh.roll+R.rollDelta),R.zoomDelta&&eh.setZoom(eh.zoom+R.zoomDelta)}handleMapControlsPan(R,eh,eu){.01>R.around.distSqr(eh.centerPoint)||eh.setLocationAtPoint(eu,R.around)}cameraForBoxAndBearing(R,eh,eu,em,e_){return Xt(R,eh,eu,em,e_)}handleJumpToCenterZoom(R,eu){R.zoom!==(void 0!==eu.zoom?+eu.zoom:R.zoom)&&R.setZoom(+eu.zoom),void 0!==eu.center&&R.setCenter(eh.W.convert(eu.center))}handleEaseTo(R,eu){let em=R.zoom,e_=R.padding,eg={roll:R.roll,pitch:R.pitch,bearing:R.bearing},ev={roll:void 0===eu.roll?R.roll:eu.roll,pitch:void 0===eu.pitch?R.pitch:eu.pitch,bearing:void 0===eu.bearing?R.bearing:eu.bearing},ex=void 0!==eu.zoom,eb=!R.isPaddingEqual(eu.padding),ew=!1,eT=ex?+eu.zoom:R.zoom,eS=R.centerPoint.add(eu.offsetAsPoint),eP=R.screenPointToLocation(eS),{center:eI,zoom:eM}=R.applyConstrain(eh.W.convert(eu.center||eP),null!=eT?eT:em);Nt(R,eI);let eE=pe(R.worldSize,eP),eC=pe(R.worldSize,eI).sub(eE),eA=eh.ao(eM-em);return{easeFunc:ex=>{if(ew&&R.setZoom(eh.H.number(em,eM,ex)),eh.bn(eg,ev)||Ht({startEulerAngles:eg,endEulerAngles:ev,tr:R,k:ex,useSlerp:eg.roll!=ev.roll}),eb&&(R.interpolatePadding(e_,eu.padding,ex),eS=R.centerPoint.add(eu.offsetAsPoint)),eu.around)R.setLocationAtPoint(eu.around,eu.aroundPoint);else{let eu=eh.ao(R.zoom-em),e_=eM>em?Math.min(2,eA):Math.max(.5,eA),eg=Math.pow(e_,1-ex),ev=me(R.worldSize,eE.add(eC.mult(ex*eg)).mult(eu));R.setLocationAtPoint(R.renderWorldCopies?ev.wrap():ev,eS)}},isZooming:ew=eM!==em,elevationCenter:eI}}handleFlyTo(R,eu){let em;let e_=void 0!==eu.zoom,eg=R.zoom,ev=R.applyConstrain(eh.W.convert(eu.center||eu.locationAtOffset),e_?+eu.zoom:eg),ex=ev.center,eb=ev.zoom;Nt(R,ex);let ew=pe(R.worldSize,eu.locationAtOffset),eT=pe(R.worldSize,ex).sub(ew),eS=eT.mag(),eP=eh.ao(eb-eg);if(void 0!==eu.minZoom){let e_=Math.min(+eu.minZoom,eg,eb),ev=R.applyConstrain(ex,e_).zoom;em=eh.ao(ev-eg)}return{easeFunc:(eu,em,e_,ev)=>{R.setZoom(1===eu?eb:eg+eh.ar(em));let eS=1===eu?ex:me(R.worldSize,ew.add(eT.mult(e_)).mult(em));R.setLocationAtPoint(R.renderWorldCopies?eS.wrap():eS,ev)},scaleOfZoom:eP,targetCenter:ex,scaleOfMinZoom:em,pixelPathLength:eS}}};let Yt=class Yt{constructor(R,eh,eu){this.blendFunction=R,this.blendColor=eh,this.mask=eu}};Yt.Replace=[1,0],Yt.disabled=new Yt(Yt.Replace,eh.bo.transparent,[!1,!1,!1,!1]),Yt.unblended=new Yt(Yt.Replace,eh.bo.transparent,[!0,!0,!0,!0]),Yt.alphaBlended=new Yt([1,771],eh.bo.transparent,[!0,!0,!0,!0]);let Jt=class Jt{constructor(R,eh,eu){this.enable=R,this.mode=eh,this.frontFace=eu}};Jt.disabled=new Jt(!1,1029,2305),Jt.backCCW=new Jt(!0,1029,2305),Jt.frontCCW=new Jt(!0,1028,2305);let ei=class ei{constructor(R,eh,eu){this.func=R,this.mask=eh,this.range=eu}};ei.ReadOnly=!1,ei.ReadWrite=!0,ei.disabled=new ei(519,ei.ReadOnly,[0,1]);let ii=class ii{constructor(R,eh,eu,em,e_,eg){this.test=R,this.ref=eh,this.mask=eu,this.fail=em,this.depthFail=e_,this.pass=eg}};ii.disabled=new ii({func:519,mask:0},0,0,7680,7680,7680);let eH=new WeakMap;function ri(R){var eh;if(eH.has(R))return eH.get(R);{let eu=null===(eh=R.getParameter(R.VERSION))||void 0===eh?void 0:eh.startsWith("WebGL 2.0");return eH.set(R,eu),eu}}let ai=class ai{get awaitingQuery(){return!!this._readbackQueue}constructor(R){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=R;let eu=R.context,em=eu.gl;this._texFormat=em.RGBA,this._texType=em.UNSIGNED_BYTE;let e_=new eh.aV;e_.emplaceBack(-1,-1),e_.emplaceBack(2,-1),e_.emplaceBack(-1,2);let eg=new eh.aX;eg.emplaceBack(0,1,2),this._fullscreenTriangle=new Lt(eu.createVertexBuffer(e_,eq.members),eu.createIndexBuffer(eg),eh.aW.simpleSegment(0,0,e_.length,eg.length)),this._resultBuffer=new Uint8Array(4),eu.activeTexture.set(em.TEXTURE1);let ev=em.createTexture();em.bindTexture(em.TEXTURE_2D,ev),em.texParameteri(em.TEXTURE_2D,em.TEXTURE_WRAP_S,em.CLAMP_TO_EDGE),em.texParameteri(em.TEXTURE_2D,em.TEXTURE_WRAP_T,em.CLAMP_TO_EDGE),em.texParameteri(em.TEXTURE_2D,em.TEXTURE_MIN_FILTER,em.NEAREST),em.texParameteri(em.TEXTURE_2D,em.TEXTURE_MAG_FILTER,em.NEAREST),em.texImage2D(em.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=eu.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(ev),ri(em)&&(this._pbo=em.createBuffer(),em.bindBuffer(em.PIXEL_PACK_BUFFER,this._pbo),em.bufferData(em.PIXEL_PACK_BUFFER,4,em.STREAM_READ),em.bindBuffer(em.PIXEL_PACK_BUFFER,null))}destroy(){let R=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),R.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(R,eh){let eu=this._updateCount;return this._readbackQueue?eu>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():eu>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(R,eh),this._updateCount++,this._measuredError}_bindFramebuffer(){let R=this._cachedRenderContext.context,eh=R.gl;R.activeTexture.set(eh.TEXTURE1),eh.bindTexture(eh.TEXTURE_2D,this._fbo.colorAttachment.get()),R.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(R,eu){let em=this._cachedRenderContext.context,e_=em.gl;if(this._bindFramebuffer(),em.viewport.set([0,0,this._texWidth,this._texHeight]),em.clear({color:eh.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(em,e_.TRIANGLES,ei.disabled,ii.disabled,Yt.unblended,Jt.disabled,{u_input:R,u_output_expected:eu},null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&ri(e_)){e_.bindBuffer(e_.PIXEL_PACK_BUFFER,this._pbo),e_.readBuffer(e_.COLOR_ATTACHMENT0),e_.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),e_.bindBuffer(e_.PIXEL_PACK_BUFFER,null);let R=e_.fenceSync(e_.SYNC_GPU_COMMANDS_COMPLETE,0);e_.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:R}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let R=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&ri(R)){let eu=R.clientWaitSync(this._readbackQueue.sync,0,0);if(eu===R.WAIT_FAILED)return eh.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(eu===R.TIMEOUT_EXPIRED)return;R.bindBuffer(R.PIXEL_PACK_BUFFER,this._pbo),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),R.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ai._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(R){let eh;return eh=0+(R[0]/256+R[1]/65536+R[2]/16777216),R[3]<127&&(eh=-eh),eh/128}};let eY=eh.a6/128;function ni(R,eu){let em=void 0!==R.granularity?Math.max(R.granularity,1):1,e_=em+(R.generateBorders?2:0),eg=em+(R.extendToNorthPole||R.generateBorders?1:0)+(R.extendToSouthPole||R.generateBorders?1:0),ev=e_+1,ex=eg+1,eb=R.generateBorders?-1:0,ew=R.generateBorders||R.extendToNorthPole?-1:0,eT=em+(R.generateBorders?1:0),eS=em+(R.generateBorders||R.extendToSouthPole?1:0),eP=e_*eg*6,eI=ev*ex>65536;if(eI&&"16bit"===eu)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let eM=eI||"32bit"===eu,eE=new Int16Array(2*(ev*ex)),eC=0;for(let eu=ew;eu<=eS;eu++)for(let e_=eb;e_<=eT;e_++){let eg=e_/em*eh.a6;-1===e_&&(eg=-eY),e_===em+1&&(eg=eh.a6+eY);let ev=eu/em*eh.a6;-1===eu&&(ev=R.extendToNorthPole?eh.bq:-eY),eu===em+1&&(ev=R.extendToSouthPole?eh.br:eh.a6+eY),eE[eC++]=eg,eE[eC++]=ev}let eA=eM?new Uint32Array(eP):new Uint16Array(eP),ez=0;for(let R=0;R<eg;R++)for(let eh=0;eh<e_;
54eh++){let eu=eh+1+R*ev,em=eh+(R+1)*ev,e_=eh+1+(R+1)*ev;eA[ez++]=eh+R*ev,eA[ez++]=em,eA[ez++]=eu,eA[ez++]=eu,eA[ez++]=em,eA[ez++]=e_}return{vertices:eE.buffer.slice(0),indices:eA.buffer.slice(0),uses32bitIndices:eM}}let eJ=new eh.aU({fill:new eh.bs(128,2),line:new eh.bs(512,0),tile:new eh.bs(128,32),stencil:new eh.bs(128,1),circle:3});let ci=class ci{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 eZ.projectionGlobe}get vertexShaderPreludeCode(){return eZ.projectionMercator.vertexSource}get subdivisionGranularity(){return eJ}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(R){this._errorMeasurement||(this._errorMeasurement=new ai(R));let eu=eh.Y(this._errorQueryLatitudeDegrees),em=2*Math.atan(Math.exp(Math.PI-eu*Math.PI*2))-.5*Math.PI,e_=this._errorMeasurement.updateErrorLoop(eu,em),eg=c();e_!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=e_,this._errorMeasurementLastChangeTime=eg);let ev=Math.min(Math.max((eg-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=eh.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,eh.bu(ev))}_getMeshKey(R){return`${R.granularity.toString(36)}_${R.generateBorders?"b":""}${R.extendToNorthPole?"n":""}${R.extendToSouthPole?"s":""}`}getMeshFromTileID(R,eh,eu,em,e_){let eg=("stencil"===e_?eJ.stencil:eJ.tile).getGranularityForZoomLevel(eh.z);return this._getMesh(R,{granularity:eg,generateBorders:eu,extendToNorthPole:0===eh.y&&em,extendToSouthPole:eh.y===(1<<eh.z)-1&&em})}_getMesh(R,eu){let em=this._getMeshKey(eu);if(em in this._tileMeshCache)return this._tileMeshCache[em];let e_=function(R,eu){let em=ni(eu,"16bit"),e_=eh.aV.deserialize({arrayBuffer:em.vertices,length:em.vertices.byteLength/2/2}),eg=eh.aX.deserialize({arrayBuffer:em.indices,length:em.indices.byteLength/2/3});return new Lt(R.createVertexBuffer(e_,eq.members),R.createIndexBuffer(eg),eh.aW.simpleSegment(0,0,e_.length,eg.length))}(R,eu);return this._tileMeshCache[em]=e_,e_}recalculate(R){}hasTransition(){var R;let eh=c();return(eh-this._errorMeasurementLastChangeTime)/1e3<.7||(null===(R=this._errorMeasurement)||void 0===R?void 0:R.awaitingQuery)}setErrorQueryLatitudeDegrees(R){this._errorQueryLatitudeDegrees=R}};let eK=new eh.u({type:new eh.D(eh.x.projection.type)});let ui=class ui extends eh.E{constructor(R){super(),this._transitionable=new eh.y(eK,void 0),this.setProjection(R),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new eh.J(0)),this._mercatorProjection=new Ot,this._verticalPerspectiveProjection=new ci}get transitionState(){let R=this.properties.get("type");if("string"==typeof R&&"mercator"===R)return 0;if("string"==typeof R&&"vertical-perspective"===R)return 1;if(R instanceof eh.bv){if("vertical-perspective"===R.from&&"mercator"===R.to)return 1-R.transition;if("mercator"===R.from&&"vertical-perspective"===R.to)return R.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(R){this._mercatorProjection.updateGPUdependent(R),this._verticalPerspectiveProjection.updateGPUdependent(R)}getMeshFromTileID(R,eh,eu,em,e_){return this.currentProjection.getMeshFromTileID(R,eh,eu,em,e_)}setProjection(R){this._transitionable.setValue("type",(null==R?void 0:R.type)||"mercator")}updateTransitions(R){this._transitioning=this._transitionable.transitioned(R,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(R){this.properties=this._transitioning.possiblyEvaluate(R)}setErrorQueryLatitudeDegrees(R){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(R),this._mercatorProjection.setErrorQueryLatitudeDegrees(R)}};function di(R){let eh=mi(R.worldSize,R.center.lat);return 2*Math.PI*eh}function _i(R,eu,em,e_,eg){let ev=1/(1<<eg),ex=eu/eh.a6*ev+e_*ev,eb=eh.by((R/eh.a6*ev+em*ev)*Math.PI*2+Math.PI,2*Math.PI),ew=2*Math.atan(Math.exp(Math.PI-ex*Math.PI*2))-.5*Math.PI,eT=Math.cos(ew),eS=new Float64Array(3);return eS[0]=Math.sin(eb)*eT,eS[1]=Math.sin(ew),eS[2]=Math.cos(eb)*eT,eS}function pi(R){return function(R,eh){let eu=Math.cos(eh),em=new Float64Array(3);return em[0]=Math.sin(R)*eu,em[1]=Math.sin(eh),em[2]=Math.cos(R)*eu,em}(R.lng*Math.PI/180,R.lat*Math.PI/180)}function mi(R,eh){return R/(2*Math.PI)/Math.cos(eh*Math.PI/180)}function fi(R){let eu=Math.asin(R[1])/Math.PI*180,em=Math.sqrt(R[0]*R[0]+R[2]*R[2]);if(em>1e-6){let e_=R[0]/em,eg=Math.acos(R[2]/em),ev=(e_>0?eg:-eg)/Math.PI*180;return new eh.W(eh.X(ev,-180,180),eu)}return new eh.W(0,eu)}function gi(R){return Math.cos(R*Math.PI/180)}function vi(R,eu){let em=gi(R),e_=gi(eu);return eh.ar(e_/em)}function xi(R,eu){let em=R.rotate(eu.bearingInRadians),e_=eu.zoom+vi(eu.center.lat,0),eg=eh.bt(1/gi(eu.center.lat),1/gi(Math.min(Math.abs(eu.center.lat),60)),eh.bw(e_,7,3,0,1)),ev=360/di({worldSize:eu.worldSize,center:{lat:eu.center.lat}});return new eh.W(eu.center.lng-em.x*ev*eg,eh.al(eu.center.lat+em.y*ev,-eh.am,eh.am))}function bi(R){let eh=.5*R,eu=Math.sin(eh),em=Math.cos(eh);return Math.log(eu+em)-Math.log(em-eu)}
54function yi(R,eu,em,e_){let eg=R.lat+em*e_;if(Math.abs(em)>1){let ev=(Math.sign(R.lat+em)!==Math.sign(R.lat)?-Math.abs(R.lat):Math.abs(R.lat))*Math.PI/180,ex=Math.abs(R.lat+em)*Math.PI/180,eb=bi(ev+e_*(ex-ev)),ew=bi(ev),eT=bi(ex);return new eh.W(R.lng+eu*((eb-ew)/(eT-ew)),eg)}return new eh.W(R.lng+eu*e_,eg)}let wi=class wi{constructor(R){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=R}swapBuffers(){if(!this._hadAnyChanges)return;let R=this._cachePrevious;this._cachePrevious=this._cache,this._cache=R,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(R,eh,eu,em){let e_=`${R.z}_${R.x}_${R.y}_${(null==em?void 0:em.terrain)?"t":""}`,eg=this._cache.get(e_);if(eg)return eg;let ev=this._cachePrevious.get(e_);if(ev)return this._cache.set(e_,ev),ev;let ex=this._boundingVolumeFactory(R,eh,eu,em);return this._cache.set(e_,ex),this._hadAnyChanges=!0,ex}};let Ti=class Ti{constructor(R,eh,eu,em){this.min=eu,this.max=em,this.points=R,this.planes=eh}static fromAabb(R,eh){let eu=[];for(let em=0;em<8;em++)eu.push([1&~em?R[0]:eh[0],1==(em>>1&1)?eh[1]:R[1],1==(em>>2&1)?eh[2]:R[2]]);return new Ti(eu,[[-1,0,0,eh[0]],[1,0,0,-R[0]],[0,-1,0,eh[1]],[0,1,0,-R[1]],[0,0,-1,eh[2]],[0,0,1,-R[2]]],R,eh)}static fromCenterSizeAngles(R,eu,em){let e_=eh.bA([],em[0],em[1],em[2]),eg=eh.bB([],[eu[0],0,0],e_),ev=eh.bB([],[0,eu[1],0],e_),ex=eh.bB([],[0,0,eu[2]],e_),eb=[...R],ew=[...R];for(let eh=0;eh<8;eh++)for(let eu=0;eu<3;eu++){let em=R[eu]+eg[eu]*(1&~eh?-1:1)+ev[eu]*(1==(eh>>1&1)?1:-1)+ex[eu]*(1==(eh>>2&1)?1:-1);eb[eu]=Math.min(eb[eu],em),ew[eu]=Math.max(ew[eu],em)}let eT=[];for(let eu=0;eu<8;eu++){let em=[...R];eh.a$(em,em,eh.a_([],eg,1&~eu?-1:1)),eh.a$(em,em,eh.a_([],ev,1==(eu>>1&1)?1:-1)),eh.a$(em,em,eh.a_([],ex,1==(eu>>2&1)?1:-1)),eT.push(em)}return new Ti(eT,[[...eg,-eh.b4(eg,eT[0])],[...ev,-eh.b4(ev,eT[0])],[...ex,-eh.b4(ex,eT[0])],[-eg[0],-eg[1],-eg[2],-eh.b4(eg,eT[7])],[-ev[0],-ev[1],-ev[2],-eh.b4(ev,eT[7])],[-ex[0],-ex[1],-ex[2],-eh.b4(ex,eT[7])]],eb,ew)}intersectsFrustum(R){let eh=!0,eu=this.points.length,em=this.planes.length,e_=R.planes.length,eg=R.points.length;for(let em=0;em<e_;em++){let e_=R.planes[em],eg=0;for(let R=0;R<eu;R++){let eh=this.points[R];e_[0]*eh[0]+e_[1]*eh[1]+e_[2]*eh[2]+e_[3]>=0&&eg++}if(0===eg)return 0;eg<eu&&(eh=!1)}if(eh)return 2;for(let eh=0;eh<em;eh++){let eu=this.planes[eh],em=0;for(let eh=0;eh<eg;eh++){let e_=R.points[eh];eu[0]*e_[0]+eu[1]*e_[1]+eu[2]*e_[2]+eu[3]>=0&&em++}if(0===em)return 0}return 1}intersectsPlane(R){let eh=this.points.length,eu=0;for(let em=0;em<eh;em++){let eh=this.points[em];R[0]*eh[0]+R[1]*eh[1]+R[2]*eh[2]+R[3]>=0&&eu++}return eu===eh?2:0===eu?0:1}};function Pi(R,eh,eu){let em=R-eh;return em<0?-em:Math.max(0,em-eu)}function Ci(R,eh,eu,em,e_){let eg=R-eu;return Math.max(eg<0?Math.min(-eg,1+eg-e_):eg>e_?Math.min(Math.max(eg-e_,0),1-eg):0,Pi(eh,em,e_))}let Ii=class Ii{constructor(){this._boundingVolumeCache=new wi(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(R,eh,eu,em){let e_=1<<eu.z,eg=1/e_,ev=eu.x/e_,ex=eu.y/e_;return Math.min(Math.min(Math.min(2,Ci(R,eh,ev,ex,eg)),Ci(R,eh,ev+.5,-ex-eg,eg)),Ci(R,eh,ev+.5,2-ex-eg,eg))}getWrap(R,eh,eu){let em=1<<eh.z,e_=1/em,eg=eh.x/em,ev=Pi(R.x,eg,e_),ex=Pi(R.x,eg-1,e_),eb=Pi(R.x,eg+1,e_),ew=Math.min(ev,ex,eb);return ew===eb?1:ew===ex?-1:0}allowVariableZoom(R,eh){return Pe(R,eh)>4}allowWorldCopies(){return!1}getTileBoundingVolume(R,eh,eu,em){return this._boundingVolumeCache.getTileBoundingVolume(R,eh,eu,em)}_computeTileBoundingVolume(R,eu,em,e_){var eg,ev;let ex=0,eb=0;if(null==e_?void 0:e_.terrain){let ew=new eh.a3(R.z,eu,R.z,R.x,R.y),eT=e_.terrain.getMinMaxElevation(ew);ex=null!==(eg=eT.minElevation)&&void 0!==eg?eg:Math.min(0,em),eb=null!==(ev=eT.maxElevation)&&void 0!==ev?ev:Math.max(0,em)}if(ex/=eh.bD,eb/=eh.bD,ex+=1,eb+=1,R.z<=0)return Ti.fromAabb([-eb,-eb,-eb],[eb,eb,eb]);if(1===R.z)return Ti.fromAabb([0===R.x?-eb:0,0===R.y?0:-eb,-eb],[0===R.x?0:eb,0===R.y?eb:0,eb]);{let eu=[_i(0,0,R.x,R.y,R.z),_i(eh.a6,0,R.x,R.y,R.z),_i(eh.a6,eh.a6,R.x,R.y,R.z),_i(0,eh.a6,R.x,R.y,R.z)],em=[];for(let R of eu)em.push(eh.a_([],R,eb));if(eb!==ex)for(let R of eu)em.push(eh.a_([],R,ex));0===R.y&&em.push([0,1,0]),R.y===(1<<R.z)-1&&em.push([0,-1,0]);let e_=[1,1,1],eg=[-1,-1,-1];for(let R of em)for(let eh=0;eh<3;
vendor: 22,101 bytes, line 54
54eh++)e_[eh]=Math.min(e_[eh],R[eh]),eg[eh]=Math.max(eg[eh],R[eh]);let ev=_i(eh.a6/2,eh.a6/2,R.x,R.y,R.z),ew=eh.b3([],[0,1,0],ev);eh.b2(ew,ew);let eT=eh.b3([],ev,ew);eh.b2(eT,eT);let eS=eh.b3([],eu[2],eu[1]);eh.b2(eS,eS);let eP=eh.b3([],eu[0],eu[3]);eh.b2(eP,eP),em.push(eh.a_([],ev,eb)),R.y>=(1<<R.z)/2&&em.push(eh.a_([],_i(eh.a6/2,0,R.x,R.y,R.z),eb)),R.y<(1<<R.z)/2&&em.push(eh.a_([],_i(eh.a6/2,eh.a6,R.x,R.y,R.z),eb));let eI=Mi(ev,em),eM=Mi(eT,em),eE=[-ev[0],-ev[1],-ev[2],eI.max],eC=[ev[0],ev[1],ev[2],-eI.min],eA=[-eT[0],-eT[1],-eT[2],eM.max],ez=[eT[0],eT[1],eT[2],-eM.min],eD=[...eS,0],ek=[...eP,0],eR=[];return 0===R.y?eR.push(eh.bC(ek,eD,eE),eh.bC(ek,eD,eC)):eR.push(eh.bC(eA,eD,eE),eh.bC(eA,eD,eC),eh.bC(eA,ek,eE),eh.bC(eA,ek,eC)),R.y===(1<<R.z)-1?eR.push(eh.bC(ek,eD,eE),eh.bC(ek,eD,eC)):eR.push(eh.bC(ez,eD,eE),eh.bC(ez,eD,eC),eh.bC(ez,ek,eE),eh.bC(ez,ek,eC)),new Ti(eR,[eE,eC,eA,ez,eD,ek],e_,eg)}}};function Mi(R,eu){let em=1/0,e_=-1/0;for(let eg of eu){let eu=eh.b4(R,eg);em=Math.min(em,eu),e_=Math.max(e_,eu)}return{min:em,max:e_}}let Si=class Si{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(R){this._helper.setMinZoom(R)}setMaxZoom(R){this._helper.setMaxZoom(R)}setMinPitch(R){this._helper.setMinPitch(R)}setMaxPitch(R){this._helper.setMaxPitch(R)}setRenderWorldCopies(R){this._helper.setRenderWorldCopies(R)}setBearing(R){this._helper.setBearing(R)}setPitch(R){this._helper.setPitch(R)}setRoll(R){this._helper.setRoll(R)}setFov(R){this._helper.setFov(R)}setZoom(R){this._helper.setZoom(R)}setCenter(R){this._helper.setCenter(R)}setElevation(R){this._helper.setElevation(R)}setMinElevationForCurrentTile(R){this._helper.setMinElevationForCurrentTile(R)}setPadding(R){this._helper.setPadding(R)}interpolatePadding(R,eh,eu){this._helper.interpolatePadding(R,eh,eu)}isPaddingEqual(R){return this._helper.isPaddingEqual(R)}resize(R,eh){this._helper.resize(R,eh)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(R){this._helper.setMaxBounds(R)}setConstrainOverride(R){this._helper.setConstrainOverride(R)}overrideNearFarZ(R,eh){this._helper.overrideNearFarZ(R,eh)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(R){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),R)}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(R){}constructor(R){this._cachedClippingPlane=eh.bE(),this._projectionMatrix=eh.bi(),this._globeViewProjMatrix32f=eh.bh(),this._globeViewProjMatrixNoCorrection=eh.bi(),this._globeViewProjMatrixNoCorrectionInverted=eh.bi(),this._globeProjMatrixInverted=eh.bi(),this._cameraPosition=eh.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(R,eu)=>{let em=eh.al(R.lat,-eh.am,eh.am),e_=eh.al(+eu,this.minZoom+vi(0,em),this.maxZoom);return{center:new eh.W(R.lng,em),zoom:e_}},this.applyConstrain=(R,eh)=>this._helper.applyConstrain(R,eh),this._helper=new Ut({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(R,eh)=>this.defaultConstrain(R,eh)},R),this._coveringTilesDetailsProvider=new Ii}clone(){let R=new Si;return R.apply(this,!1),R}apply(R,eh,eu){this._globeLatitudeErrorCorrectionRadians=eu||0,this._helper.apply(R,eh)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let R=eh.bz();return R[0]=this._cameraPosition[0],R[1]=this._cameraPosition[1],R[2]=this._cameraPosition[2],R}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(R){let{overscaledTileID:eh,applyGlobeMatrix:eu}=R,em=this._helper.getMercatorTileCoordinates(eh);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:em,clippingPlane:this._cachedClippingPlane,projectionTransition:eu?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(R){let eu=this.pitchInRadians,em=this.cameraToCenterDistance/R,e_=Math.sin(eu)*em,eg=Math.cos(eu)*em+1,ev=-e_,ex=eg,eb=Math.sqrt(ev*ev+ex*ex);ev/=eb,ex/=eb;let ew=[0,ev,ex];eh.bF(ew,ew,[0,0,0],-this.bearingInRadians),eh.bG(ew,ew,[0,0,0],-1*this.center.lat*Math.PI/180),eh.bH(ew,ew,[0,0,0],this.center.lng*Math.PI/180);let eT=1/eh.b6(ew);return eh.a_(ew,ew,eT),[...ew,-(1/Math.sqrt(e_*e_+eg*eg)*1)*eT]}isLocationOccluded(R){return!this.isSurfacePointVisible(pi(R))}transformLightDirection(R){let eu=this._helper._center.lng*Math.PI/180,em=this._helper._center.lat*Math.PI/180,e_=Math.cos(em),eg=[Math.sin(eu)*e_,Math.sin(em),Math.cos(eu)*e_],ev=[eg[2],0,-eg[0]],ex=[0,0,0];eh.b3(ex,ev,eg),eh.b2(ev,ev),eh.b2(ex,ex);let eb=[0,0,0];return eh.b2(eb,[ev[0]*R[0]+ex[0]*R[1]+eg[0]*R[2],ev[1]*R[0]+ex[1]*R[1]+eg[1]*R[2],ev[2]*R[0]+ex[2]*R[1]+eg[2]*R[2]]),eb}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(R,eu,em){var e_;let eg=function(R,eu,em){let e_=1/(1<<em.z);return new eh.a7(R/eh.a6*e_+em.x*e_,eu/eh.a6*e_+em.y*e_)}(R,eu,em.canonical),ev=(e_=eg.y,[eh.by(eg.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-e_*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(ev[1])}projectTileCoordinates(R,eu,em,e_){let eg=em.canonical,ev=_i(R,eu,eg.x,eg.y,eg.z),ex=1+(e_?e_(R,eu):0)/eh.bD,eb=[ev[0]*ex,ev[1]*ex,ev[2]*ex,1];eh.aF(eb,eb,this._globeViewProjMatrixNoCorrection);let ew=this._cachedClippingPlane,eT=ew[0]*ev[0]+ew[1]*ev[1]+ew[2]*ev[2]+ew[3]<0;return{point:new eh.P(eb[0]/eb[3],eb[1]/eb[3]),signedDistanceFromCamera:eb[3],isOccluded:eT}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let R=mi(this.worldSize,this.center.lat),eu=eh.bj(),em=eh.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*R),eh.bd(eu,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let e_=this.centerOffset;eu[8]=-(2*e_.x)/this._helper._width,eu[9]=2*e_.y/this._helper._height,this._projectionMatrix=eh.be(eu),this._globeProjMatrixInverted=eh.bj(),eh.az(this._globeProjMatrixInverted,eu),eh.Q(eu,eu,[0,0,-this.cameraToCenterDistance]),eh.bf(eu,eu,this.rollInRadians),eh.bg(eu,eu,-this.pitchInRadians),eh.bf(eu,eu,this.bearingInRadians),eh.Q(eu,eu,[0,0,-R]);let eg=eh.bz();eg[0]=R,eg[1]=R,eg[2]=R,eh.bg(em,eu,this.center.lat*Math.PI/180),eh.bI(em,em,-this.center.lng*Math.PI/180),eh.S(em,em,eg),this._globeViewProjMatrixNoCorrection=em,eh.bg(eu,eu,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),eh.bI(eu,eu,-this.center.lng*Math.PI/180),eh.S(eu,eu,eg),this._globeViewProjMatrix32f=new Float32Array(eu),this._globeViewProjMatrixNoCorrectionInverted=eh.bj(),eh.az(this._globeViewProjMatrixNoCorrectionInverted,em);let ev=eh.bz();this._cameraPosition=eh.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/R,eh.bF(this._cameraPosition,this._cameraPosition,ev,-this.rollInRadians),eh.bG(this._cameraPosition,this._cameraPosition,ev,this.pitchInRadians),eh.bF(this._cameraPosition,this._cameraPosition,ev,-this.bearingInRadians),eh.a$(this._cameraPosition,this._cameraPosition,[0,0,1]),eh.bG(this._cameraPosition,this._cameraPosition,ev,-this.center.lat*Math.PI/180),eh.bH(this._cameraPosition,this._cameraPosition,ev,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(R);let ex=eh.be(this._globeViewProjMatrixNoCorrectionInverted);eh.S(ex,ex,[1,1,-1]),this._cachedFrustum=Wt.fromInvProjectionMatrix(ex,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(R){eh.w("calculateFogMatrix is not supported on globe projection.");let eu=eh.bj();return eh.ap(eu),eu}getVisibleUnwrappedCoordinates(R){return[new eh.bb(0,R)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(R){R&&eh.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(R,eu){if(!this._globeViewProjMatrixNoCorrection)return 1;let em=pi(R);eh.a_(em,em,1+eu/eh.bD);let e_=eh.bE();return eh.aF(e_,[em[0],em[1],em[2],1],this._globeViewProjMatrixNoCorrection),e_[2]/e_[3]}populateCache(R){}getBounds(){let R=.5*this.width,eu=.5*this.height,em=[new eh.P(0,0),new eh.P(R,0),new eh.P(this.width,0),new eh.P(this.width,eu),new eh.P(this.width,this.height),new eh.P(R,this.height),new eh.P(0,this.height),new eh.P(0,eu)],e_=[];for(let R of em)e_.push(this.unprojectScreenPoint(R));let eg=0,ev=0,ex=0,eb=0,ew=this.center;for(let R of e_){let eu=eh.bJ(ew.lng,R.lng),em=eh.bJ(ew.lat,R.lat);eu<ev&&(ev=eu),eu>eg&&(eg=eu),em<eb&&(eb=em),em>ex&&(ex=em)}let eT=[ew.lng+ev,ew.lat+eb,ew.lng+eg,ew.lat+ex];return this.isSurfacePointOnScreen([0,1,0])&&(eT[3]=90,eT[0]=-180,eT[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(eT[1]=-90,eT[0]=-180,eT[2]=180),new U(eT)}calculateCenterFromCameraLngLatAlt(R,eh,eu,em){return this._helper.calculateCenterFromCameraLngLatAlt(R,eh,eu,em)}setLocationAtPoint(R,eu){let em,e_;let eg=pi(this.unprojectScreenPoint(eu)),ev=pi(R),ex=eh.bz();eh.bK(ex);let eb=eh.bz();eh.bH(eb,eg,ex,-this.center.lng*Math.PI/180),eh.bG(eb,eb,ex,this.center.lat*Math.PI/180);let ew=ev[0]*ev[0]+ev[2]*ev[2],eT=eb[0]*eb[0];if(ew<eT)return;let eS=Math.sqrt(ew-eT),eP=-eS,eI=eh.bL(ev[0],ev[2],eb[0],eS),eM=eh.bL(ev[0],ev[2],eb[0],eP),eE=eh.bz();eh.bH(eE,ev,ex,-eI);let eC=eh.bL(eE[1],eE[2],eb[1],eb[2]),eA=eh.bz();eh.bH(eA,ev,ex,-eM);let ez=eh.bL(eA[1],eA[2],eb[1],eb[2]),eD=.5*Math.PI,ek=eC>=-eD&&eC<=eD,eR=ez>=-eD&&ez<=eD;if(ek&&eR){let R=this.center.lng*Math.PI/180,eu=this.center.lat*Math.PI/180;eh.bM(eI,R)+eh.bM(eC,eu)<eh.bM(eM,R)+eh.bM(ez,eu)?(em=eI,e_=eC):(em=eM,e_=ez)}else if(ek)em=eI,e_=eC;else{if(!eR)return;em=eM,e_=ez}let eL=em/Math.PI*180,eF=e_/Math.PI*180,eB=this.center.lat;this.setCenter(new eh.W(eL,eh.al(eF,-90,90))),this.setZoom(this.zoom+vi(eB,this.center.lat))}locationToScreenPoint(R,eu){let em=pi(R);if(eu){let e_=eu.getElevationForLngLatZoom(R,this._helper._tileZoom);eh.a_(em,em,1+e_/eh.bD)}return this._projectSurfacePointToScreen(em)}_projectSurfacePointToScreen(R){let eu=eh.bE();return eh.aF(eu,[...R,1],this._globeViewProjMatrixNoCorrection),eu[0]/=eu[3],eu[1]/=eu[3],new eh.P((.5*eu[0]+.5)*this.width,(-(.5*eu[1])+.5)*this.height)}screenPointToMercatorCoordinate(R,eu){if(eu){let eh=eu.pointCoordinate(R);if(eh)return eh}return eh.a7.fromLngLat(this.unprojectScreenPoint(R))}screenPointToLocation(R,eh){var eu;return null===(eu=this.screenPointToMercatorCoordinate(R,eh))||void 0===eu?void 0:eu.toLngLat()}isPointOnMapSurface(R,eh){let eu=this._cameraPosition,em=this.getRayDirectionFromPixel(R);return!!this.rayPlanetIntersection(eu,em)}getRayDirectionFromPixel(R){let eu=eh.bE();eu[0]=R.x/this.width*2-1,eu[1]=-1*(R.y/this.height*2-1),eu[2]=1,eu[3]=1,eh.aF(eu,eu,this._globeViewProjMatrixNoCorrectionInverted),eu[0]/=eu[3],eu[1]/=eu[3],eu[2]/=eu[3];let em=eh.bz();em[0]=eu[0]-this._cameraPosition[0],em[1]=eu[1]-this._cameraPosition[1],em[2]=eu[2]-this._cameraPosition[2];let e_=eh.bz();return eh.b2(e_,em),e_}isSurfacePointVisible(R){let eh=this._cachedClippingPlane;return eh[0]*R[0]+eh[1]*R[1]+eh[2]*R[2]+eh[3]>=0}isSurfacePointOnScreen(R){if(!this.isSurfacePointVisible(R))return!1;let eu=eh.bE();return eh.aF(eu,[...R,1],this._globeViewProjMatrixNoCorrection),eu[0]/=eu[3],eu[1]/=eu[3],eu[2]/=eu[3],eu[0]>-1&&eu[0]<1&&eu[1]>-1&&eu[1]<1&&eu[2]>-1&&eu[2]<1}rayPlanetIntersection(R,eu){let em=eh.b4(R,eu),e_=eh.bz(),eg=eh.bz();eh.a_(eg,eu,em),eh.b1(e_,R,eg);let ev=1-eh.b4(e_,e_);if(ev<0)return null;let ex=eh.b4(R,R)-1,eb=-em+(em<0?1:-1)*Math.sqrt(ev),ew=ex/eb;return{tMin:Math.min(ew,eb),tMax:Math.max(ew,eb)}}unprojectScreenPoint(R){let eu=this._cameraPosition,em=this.getRayDirectionFromPixel(R),e_=this.rayPlanetIntersection(eu,em);if(e_){let R=eh.bz();eh.a$(R,eu,[em[0]*e_.tMin,em[1]*e_.tMin,em[2]*e_.tMin]);let eg=eh.bz();return eh.b2(eg,R),fi(eg)}let eg=this._cachedClippingPlane,ev=eg[0]*em[0]+eg[1]*em[1]+eg[2]*em[2],ex=-eh.ba(eg,eu)/ev,eb=eh.bz();if(ex>0)eh.a$(eb,eu,[em[0]*ex,em[1]*ex,em[2]*ex]);else{let R=eh.bz();eh.a$(R,eu,[2*em[0],2*em[1],2*em[2]]);let e_=eh.ba(this._cachedClippingPlane,R);eh.b1(eb,R,[this._cachedClippingPlane[0]*e_,this._cachedClippingPlane[1]*e_,this._cachedClippingPlane[2]*e_])}let ew=function(R){let eu=eh.bz();return eu[0]=-(R[0]*R[3]),eu[1]=-(R[1]*R[3]),eu[2]=-(R[2]*R[3]),{center:eu,radius:Math.sqrt(1-R[3]*R[3])}}(eg);return fi(function(R,eu,em){let e_=eh.bz();eh.b1(e_,em,R);let eg=eh.bz();return eh.bx(eg,R,e_,eu/eh.b8(e_)),eg}(ew.center,ew.radius,eb))}getMatrixForModel(R,eu){let em=eh.W.convert(R),e_=1/eh.bD,eg=eh.bi();return eh.bI(eg,eg,em.lng/180*Math.PI),eh.bg(eg,eg,-em.lat/180*Math.PI),eh.Q(eg,eg,[0,0,1+eu/eh.bD]),eh.bg(eg,eg,.5*Math.PI),eh.S(eg,eg,[e_,e_,e_]),eg}getProjectionDataForCustomLayer(R=!0){let eu=this.getProjectionData({overscaledTileID:new eh.a3(0,0,0,0,0),applyGlobeMatrix:R});return eu.tileMercatorCoords=[0,0,1,1],eu}getFastPathSimpleProjectionMatrix(R){}};let Ei=class Ei{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(R){this._helper.setMinZoom(R)}setMaxZoom(R){this._helper.setMaxZoom(R)}setMinPitch(R){this._helper.setMinPitch(R)}setMaxPitch(R){this._helper.setMaxPitch(R)}setRenderWorldCopies(R){this._helper.setRenderWorldCopies(R)}setBearing(R){this._helper.setBearing(R)}setPitch(R){this._helper.setPitch(R)}setRoll(R){this._helper.setRoll(R)}setFov(R){this._helper.setFov(R)}setZoom(R){this._helper.setZoom(R)}setCenter(R){this._helper.setCenter(R)}setElevation(R){this._helper.setElevation(R)}setMinElevationForCurrentTile(R){this._helper.setMinElevationForCurrentTile(R)}setPadding(R){this._helper.setPadding(R)}interpolatePadding(R,eh,eu){this._helper.interpolatePadding(R,eh,eu)}isPaddingEqual(R){return this._helper.isPaddingEqual(R)}resize(R,eh,eu=!0){this._helper.resize(R,eh,eu)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(R){this._helper.setMaxBounds(R)}setConstrainOverride(R){this._helper.setConstrainOverride(R)}overrideNearFarZ(R,eh){this._helper.overrideNearFarZ(R,eh)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(R){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),R)}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(R,eh){this._globeness=R,this._globeLatitudeErrorCorrectionRadians=eh,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(R){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(R,eh)=>this.currentTransform.defaultConstrain(R,eh),this.applyConstrain=(R,eh)=>this._helper.applyConstrain(R,eh),this._helper=new Ut({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(R,eh)=>this.defaultConstrain(R,eh)},R),this._globeness=1,this._mercatorTransform=new qt,this._verticalPerspectiveTransform=new Si}clone(){let R=new Ei;return R._globeness=this._globeness,R._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,R.apply(this,!1),R}apply(R,eh){this._helper.apply(R,eh),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(R){let eh=this._mercatorTransform.getProjectionData(R),eu=this._verticalPerspectiveTransform.getProjectionData(R);return{mainMatrix:this.isGlobeRendering?eu.mainMatrix:eh.mainMatrix,clippingPlane:eu.clippingPlane,tileMercatorCoords:eu.tileMercatorCoords,projectionTransition:R.applyGlobeMatrix?this._globeness:0,fallbackMatrix:eh.fallbackMatrix}}isLocationOccluded(R){return this.currentTransform.isLocationOccluded(R)}transformLightDirection(R){return this.currentTransform.transformLightDirection(R)}getPixelScale(){return eh.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return eh.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(R,eu,em){let e_=this._mercatorTransform.getPitchedTextCorrection(R,eu,em),eg=this._verticalPerspectiveTransform.getPitchedTextCorrection(R,eu,em);return eh.bt(e_,eg,this._globeness)}projectTileCoordinates(R,eh,eu,em){return this.currentTransform.projectTileCoordinates(R,eh,eu,em)}_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(R){return this.currentTransform.calculateFogMatrix(R)}getVisibleUnwrappedCoordinates(R){return this.currentTransform.getVisibleUnwrappedCoordinates(R)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(R){this._mercatorTransform.recalculateZoomAndCenter(R),this._verticalPerspectiveTransform.recalculateZoomAndCenter(R)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(R,eh){return this.currentTransform.lngLatToCameraDepth(R,eh)}
54populateCache(R){this._mercatorTransform.populateCache(R),this._verticalPerspectiveTransform.populateCache(R)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(R,eh,eu,em){return this._helper.calculateCenterFromCameraLngLatAlt(R,eh,eu,em)}setLocationAtPoint(R,eh){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(R,eh),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(R,eh),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(R,eh){return this.currentTransform.locationToScreenPoint(R,eh)}screenPointToMercatorCoordinate(R,eh){return this.currentTransform.screenPointToMercatorCoordinate(R,eh)}screenPointToLocation(R,eh){return this.currentTransform.screenPointToLocation(R,eh)}isPointOnMapSurface(R,eh){return this.currentTransform.isPointOnMapSurface(R,eh)}getRayDirectionFromPixel(R){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(R)}getMatrixForModel(R,eh){return this.currentTransform.getMatrixForModel(R,eh)}getProjectionDataForCustomLayer(R=!0){let eh=this._mercatorTransform.getProjectionDataForCustomLayer(R);if(!this.isGlobeRendering)return eh;let eu=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(R);return eu.fallbackMatrix=eh.mainMatrix,eu}getFastPathSimpleProjectionMatrix(R){return this.currentTransform.getFastPathSimpleProjectionMatrix(R)}};let zi=class zi{get useGlobeControls(){return!0}handlePanInertia(R,eu){let em=xi(R,eu);return Math.abs(em.lng-eu.center.lng)>180&&(em.lng=eu.center.lng+179.5*Math.sign(em.lng-eu.center.lng)),{easingCenter:em,easingOffset:new eh.P(0,0)}}handleMapControlsRollPitchBearingZoom(R,eu){let em=R.around,e_=eu.screenPointToLocation(em);R.bearingDelta&&eu.setBearing(eu.bearing+R.bearingDelta),R.pitchDelta&&eu.setPitch(eu.pitch+R.pitchDelta),R.rollDelta&&eu.setRoll(eu.roll+R.rollDelta);let eg=eu.zoom;R.zoomDelta&&eu.setZoom(eu.zoom+R.zoomDelta);let ev=eu.zoom-eg;if(0===ev)return;let ex=eh.bJ(eu.center.lng,e_.lng),eb=eh.bJ(eu.center.lat,e_.lat),ew=eu.getRayDirectionFromPixel(em),eT=eu.cameraPosition,eS=-1*eh.b4(eT,ew),eP=eh.bz();eh.a$(eP,eT,[ew[0]*eS,ew[1]*eS,ew[2]*eS]);let eI=eh.b6(eP)-1,eM=mi(eu.worldSize,eu.center.lat)/Math.min(eu.width,eu.height),eE=eh.bw(eM,.9,.5,1,.25),eC=(1-eh.ao(-ev))*Math.min(Math.exp(-(.5*Math.max(eI-.3,0))),eE),eA=eu.center.lat,ez=eu.zoom,eD=new eh.W(eu.center.lng+ex/(Math.abs(ex/180)+1)*eC,eh.al(eu.center.lat+eb*eC,-eh.am,eh.am));eu.setLocationAtPoint(e_,em);let ek=eu.center,eR=eh.bw(Math.abs(ex),45,85,0,1),eL=eh.bw(eM,.75,.35,0,1),eF=Math.pow(Math.max(eR,eL),.25),eB=eh.bJ(ek.lng,eD.lng),eO=eh.bJ(ek.lat,eD.lat);eu.setCenter(new eh.W(ek.lng+eB*eF,ek.lat+eO*eF).wrap()),eu.setZoom(ez+vi(eA,eu.center.lat))}handleMapControlsPan(R,eh,eu){if(!R.panDelta)return;let em=eh.center.lat,e_=eh.zoom;eh.setCenter(xi(R.panDelta,eh).wrap()),eh.setZoom(e_+vi(em,eh.center.lat))}cameraForBoxAndBearing(R,eu,em,e_,eg){let ev=Xt(R,eu,em,e_,eg),ex=eu.left/eg.width*2-1,eb=(eg.width-eu.right)/eg.width*2-1,ew=-(eu.top/eg.height*2)+1,eT=-((eg.height-eu.bottom)/eg.height*2)+1,eS=0>eh.bJ(em.getWest(),em.getEast()),eP=eS?em.getEast():em.getWest(),eI=eS?em.getWest():em.getEast(),eM=Math.max(em.getNorth(),em.getSouth()),eE=Math.min(em.getNorth(),em.getSouth()),eC=eP+.5*eh.bJ(eP,eI),eA=eM+.5*eh.bJ(eM,eE),ez=eg.clone();ez.setCenter(ev.center),ez.setBearing(ev.bearing),ez.setPitch(0),ez.setRoll(0),ez.setZoom(ev.zoom);let eD=ez.modelViewProjectionMatrix,ek=[pi(em.getNorthWest()),pi(em.getNorthEast()),pi(em.getSouthWest
54()),pi(em.getSouthEast()),pi(new eh.W(eI,eA)),pi(new eh.W(eP,eA)),pi(new eh.W(eC,eM)),pi(new eh.W(eC,eE))],eR=pi(ev.center),eL=Number.POSITIVE_INFINITY;for(let R of ek)ex<0&&(eL=zi.getLesserNonNegativeNonNull(eL,zi.solveVectorScale(R,eR,eD,"x",ex))),eb>0&&(eL=zi.getLesserNonNegativeNonNull(eL,zi.solveVectorScale(R,eR,eD,"x",eb))),ew>0&&(eL=zi.getLesserNonNegativeNonNull(eL,zi.solveVectorScale(R,eR,eD,"y",ew))),eT<0&&(eL=zi.getLesserNonNegativeNonNull(eL,zi.solveVectorScale(R,eR,eD,"y",eT)));if(Number.isFinite(eL)&&0!==eL)return ev.zoom=Math.min(ez.zoom+eh.ar(eL),R.maxZoom),ev;$t()}handleJumpToCenterZoom(R,eu){let em=R.center.lat,e_=R.applyConstrain(eu.center?eh.W.convert(eu.center):R.center,R.zoom).center;R.setCenter(e_.wrap());let eg=void 0!==eu.zoom?+eu.zoom:R.zoom+vi(em,e_.lat);R.zoom!==eg&&R.setZoom(eg)}handleEaseTo(R,eu){let em=R.zoom,e_=R.center,eg=R.padding,ev={roll:R.roll,pitch:R.pitch,bearing:R.bearing},ex={roll:void 0===eu.roll?R.roll:eu.roll,pitch:void 0===eu.pitch?R.pitch:eu.pitch,bearing:void 0===eu.bearing?R.bearing:eu.bearing},eb=void 0!==eu.zoom,ew=!R.isPaddingEqual(eu.padding),eT=!1,eS=eu.center?eh.W.convert(eu.center):e_,eP=R.applyConstrain(eS,em).center;Nt(R,eP);let eI=R.clone();eI.setCenter(eP),eI.setZoom(eb?+eu.zoom:em+vi(e_.lat,eS.lat)),eI.setBearing(eu.bearing);let eM=new eh.P(eh.al(R.centerPoint.x+eu.offsetAsPoint.x,0,R.width),eh.al(R.centerPoint.y+eu.offsetAsPoint.y,0,R.height));eI.setLocationAtPoint(eP,eM);let eE=(eu.offset&&eu.offsetAsPoint.mag())>0?eI.center:eP,eC=eb?+eu.zoom:em+vi(e_.lat,eE.lat),eA=em+vi(e_.lat,0),ez=eC+vi(eE.lat,0),eD=eh.bJ(e_.lng,eE.lng),ek=eh.bJ(e_.lat,eE.lat),eR=eh.ao(ez-eA);return{easeFunc:em=>{if(eh.bn(ev,ex)||Ht({startEulerAngles:ev,endEulerAngles:ex,tr:R,k:em,useSlerp:ev.roll!=ex.roll}),ew&&R.interpolatePadding(eg,eu.padding,em),eu.around)eh.w("Easing around a point is not supported under globe projection."),R.setLocationAtPoint(eu.around,eu.aroundPoint);else{let eh=ez>eA?Math.min(2,eR):Math.max(.5,eR),eu=Math.pow(eh,1-em),eg=yi(e_,eD,ek,em*eu);R.setCenter(eg.wrap())}if(eT){let eu=eh.H.number(eA,ez,em)+vi(0,R.center.lat);R.setZoom(eu)}},isZooming:eT=eC!==em,elevationCenter:eE}}handleFlyTo(R,eu){let em;let e_=void 0!==eu.zoom,eg=R.center,ev=R.zoom,ex=R.padding,eb=!R.isPaddingEqual(eu.padding),ew=R.applyConstrain(eh.W.convert(eu.center||eu.locationAtOffset),ev).center,eT=e_?+eu.zoom:R.zoom+vi(R.center.lat,ew.lat),eS=R.clone();eS.setCenter(ew),eS.setZoom(eT),eS.setBearing(eu.bearing);let eP=new eh.P(eh.al(R.centerPoint.x+eu.offsetAsPoint.x,0,R.width),eh.al(R.centerPoint.y+eu.offsetAsPoint.y,0,R.height));eS.setLocationAtPoint(ew,eP);let eI=eS.center;Nt(R,eI);let eM=function(R,eu,em){let e_=pi(eu),eg=pi(em),ev=eh.b4(e_,eg),ex=di(R);return Math.acos(ev)/(2*Math.PI)*ex}(R,eg,eI),eE=ev+vi(eg.lat,0),eC=eT+vi(eI.lat,0),eA=eh.ao(eC-eE);if("number"==typeof eu.minZoom){let e_=+eu.minZoom+vi(eI.lat,0),eg=Math.min(e_,eE,eC)+vi(0,eI.lat),ev=R.applyConstrain(eI,eg).zoom+vi(eI.lat,0);em=eh.ao(ev-eE)}let ez=eh.bJ(eg.lng,eI.lng),eD=eh.bJ(eg.lat,eI.lat);return{easeFunc:(em,e_,ev,ew)=>{let eS=yi(eg,ez,eD,ev);eb&&R.interpolatePadding(ex,eu.padding,em);let eP=1===em?eI:eS;R.setCenter(eP.wrap());let eM=eE+eh.ar(e_);R.setZoom(1===em?eT:eM+vi(0,eP.lat))},scaleOfZoom:eA,targetCenter:eI,scaleOfMinZoom:em,pixelPathLength:eM}}static solveVectorScale(R,eh,eu,em,e_){let eg="x"===em?[eu[0],eu[4],eu[8],eu[12]]:[eu[1],eu[5],eu[9],eu[13]],ev=[eu[3],eu[7],eu[11],eu[15]],ex=R[0]*eg[0]+R[1]*eg[1]+R[2]*eg[2],eb=R[0]*ev[0]+R[1]*ev[1]+R[2]*ev[2],ew=eh[0]*eg[0]+eh[1]*eg[1]+eh[2]*eg[2],eT=eh[0]*ev[0]+eh[1]*ev[1]+eh[2]*ev[2];return ew+e_*eb===ex+e_*eT||ev[3]*(ex-ew)+eg[3]*(eT-eb)+ex*eT==ew*eb?null:(ew+eg[3]-e_*eT-e_*ev[3])/(ew-ex-e_*eT+e_*eb)}static getLesserNonNegativeNonNull(R,eh){return null!==eh&&eh>=0&&eh<R?eh:R}};let Ri=class Ri{constructor(R){this._globe=R,this._mercatorCameraHelper=new Kt,this._verticalPerspectiveCameraHelper=new zi}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(R,eh){return this.currentHelper.handlePanInertia(R,eh)}
54handleMapControlsRollPitchBearingZoom(R,eh){this.currentHelper.handleMapControlsRollPitchBearingZoom(R,eh)}handleMapControlsPan(R,eh,eu){this.currentHelper.handleMapControlsPan(R,eh,eu)}cameraForBoxAndBearing(R,eh,eu,em,e_){return this.currentHelper.cameraForBoxAndBearing(R,eh,eu,em,e_)}handleJumpToCenterZoom(R,eh){this.currentHelper.handleJumpToCenterZoom(R,eh)}handleEaseTo(R,eh){return this.currentHelper.handleEaseTo(R,eh)}handleFlyTo(R,eh){return this.currentHelper.handleFlyTo(R,eh)}};let Di=(R,eu)=>eh.C(R,null==eu?void 0:eu.filter(R=>"source.canvas"!==R.identifier)),eQ=eh.bN();let Li=class Li extends eh.E{constructor(R,eu={}){var em,e_;super(),this._rtlPluginLoaded=()=>{for(let R in this.tileManagers){let eh=this.tileManagers[R].getSource().type;"vector"!==eh&&"geojson"!==eh||this.tileManagers[R].reload()}},this.map=R,this.dispatcher=new F(L(),R._getMapId()),this.dispatcher.registerMessageHandler("GG",(R,eh)=>this.getGlyphs(R,eh)),this.dispatcher.registerMessageHandler("GI",(R,eh)=>this.getImages(R,eh)),this.dispatcher.registerMessageHandler("GDA",(R,eh)=>this.getDashes(R,eh)),this.imageManager=new g,this.imageManager.setEventedParent(this);let eg=(null===(em=R._container)||void 0===em?void 0:em.lang)||"undefined"!=typeof document&&(null===(e_=document.documentElement)||void 0===e_?void 0:e_.lang)||void 0;this.glyphManager=new w(R._requestManager,eu.localIdeographFontFamily,eg),this.lineAtlas=new S(256,512),this.crossTileSymbolIndex=new zt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",eh.bO()),le().on(eB,this._rtlPluginLoaded),this.on("data",R=>{if("source"!==R.dataType||"metadata"!==R.sourceDataType)return;let eh=this.tileManagers[R.sourceId];if(!eh)return;let eu=eh.getSource();if(null==eu?void 0:eu.vectorLayerIds)for(let R in this._layers){let eh=this._layers[R];eh.source===eu.id&&this._validateLayer(eh)}})}_setInitialValues(){var R;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new eh.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(R=this.crossTileSymbolIndex)||void 0===R?void 0:R.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(R,eu){var em,e_,eg;this._checkLoaded();let ev=null===eu?null!==(eg=null===(e_=null===(em=this.stylesheet.state)||void 0===em?void 0:em[R])||void 0===e_?void 0:e_.default)&&void 0!==eg?eg:null:eu;if(eh.bQ(ev,this._globalState[R]))return this;this._globalState[R]=ev,this._applyGlobalStateChanges([R])}getGlobalState(){return this._globalState}setGlobalState(R){this._checkLoaded();let eu=[];for(let em in R)eh.bQ(this._globalState[em],R[em].default)||(eu.push(em),this._globalState[em]=R[em].default);this._applyGlobalStateChanges(eu)}_applyGlobalStateChanges(R){if(0===R.length)return;let eh=new Set,eu={};for(let em of R)for(let R in eu[em]=this._globalState[em],this._layers){let eu=this._layers[R],e_=eu.getLayoutAffectingGlobalStateRefs(),eg=eu.getPaintAffectingGlobalStateRefs(),ev=eu.getVisibilityAffectingGlobalStateRefs();if(e_.has(em)&&eh.add(eu.source),eg.has(em))for(let{name:R,value:eh}of eg.get(em))this._updatePaintProperty(eu,R,eh);(null==ev?void 0:ev.has(em))&&(eu.recalculateVisibility(),this._updateLayer(eu))}for(let R in this.dispatcher.broadcast("UGS",eu),this.tileManagers)eh.has(R)&&(this._reloadSource(R),this._changed=!0)}loadURL(R){return eh._(this,arguments,void 0,function*(R,eu={},em){this.fire(new eh.n("dataloading",{dataType:"style"})),eu.validate="boolean"!=typeof eu.validate||eu.validate,this._loadStyleRequest=new AbortController;let e_=this._loadStyleRequest;try{let eg=yield this.map._requestManager.transformRequest(R,"Style");eh.bR(e_.signal);let ev=yield eh.k(eg,e_);this._loadStyleRequest===e_&&(this._loadStyleRequest=null),this._load(ev.data,eu,em)}catch(R){this._loadStyleRequest===e_&&(this._loadStyleRequest=null),R&&!e_.signal.aborted&&this.fire(new eh.l(eh.d(R)))}})}loadJSON(R,eu={},em){this.fire(new eh.n("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,eA.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,eu.validate=!1!==eu.validate,this._load(R,eu,em)}).catch(()=>{})}loadEmpty(){this.fire(new eh.n("dataloading",{dataType:"style"})),this._load(eQ,{validate:!1})}_load(R,eu,em){var e_,eg;let ev=eu.transformStyle?eu.transformStyle(em,R):R;if(!eu.validate||!Di(this,eh.F(ev))){for(let R in ev=Object.assign({},ev),this._loaded=!0,this.stylesheet=ev,ev.sources)this.addSource(R,ev.sources[R],{validate:!1});ev.sprite?this._loadSprite(ev.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(ev.glyphs),this._createLayers(),this.light=new C(this.stylesheet.light),this._setProjectionInternal((null===(e_=this.stylesheet.projection)||void 0===e_?void 0:e_.type)||"mercator"),this.sky=new M(this.stylesheet.sky),this.map.setTerrain(null!==(eg=this.stylesheet.terrain)&&void 0!==eg?eg:null),this.fire(new eh.n("data",{dataType:"style"})),this.fire(new eh.n("style.load"))}}_createLayers(){var R,eu,em;
54let e_=eh.bS(this.stylesheet.layers);for(let eg of(this.setGlobalState(null!==(R=this.stylesheet.state)&&void 0!==R?R:null),this.dispatcher.broadcast("SL",e_),this._order=e_.map(R=>R.id),this._layers={},this._serializedLayers=null,e_)){let R=eh.bT(eg,this._globalState);if(R.setEventedParent(this,{layer:{id:eg.id}}),this._layers[eg.id]=R,eh.bU(R)&&this.tileManagers[R.source]){let eh=null!==(em=null===(eu=eg.paint)||void 0===eu?void 0:eu["raster-fade-duration"])&&void 0!==em?em:R.paint.get("raster-fade-duration");this.tileManagers[R.source].setRasterFadeDuration(eh)}}}_loadSprite(R,eu=!1,em){let e_;this.imageManager.setLoaded(!1);let eg=new AbortController;this._spriteRequest=eg,(function(R,eu,em,e_){return eh._(this,void 0,void 0,function*(){let eg=p(R),ev=em>1?"@2x":"",ex={},eb={};for(let{id:R,url:em}of eg){let eg=yield eu.transformRequest(m(em,ev,".json"),"SpriteJSON");ex[R]=eh.k(eg,e_);let ew=yield eu.transformRequest(m(em,ev,".png"),"SpriteImage");eb[R]=eI.getImage(ew,e_)}return yield Promise.all([...Object.values(ex),...Object.values(eb)]),function(R,eu){return eh._(this,void 0,void 0,function*(){let eh={};for(let em in R){eh[em]={};let e_=eA.getImageCanvasContext((yield eu[em]).data),eg=(yield R[em]).data;for(let R in eg){let{width:eu,height:ev,x:ex,y:eb,sdf:ew,pixelRatio:eT,stretchX:eS,stretchY:eP,content:eI,textFitWidth:eM,textFitHeight:eE}=eg[R];eh[em][R]={data:null,pixelRatio:eT,sdf:ew,stretchX:eS,stretchY:eP,content:eI,textFitWidth:eM,textFitHeight:eE,spriteData:{width:eu,height:ev,x:ex,y:eb,context:e_}}}}return eh})}(ex,eb)})})(R,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(R=>{if(this._spriteRequest=null,R)for(let eh in R){this._spritesImagesIds[eh]=[];let em=this._spritesImagesIds[eh]?this._spritesImagesIds[eh].filter(eh=>!(eh in R)):[];for(let R of em)this.imageManager.removeImage(R),this._changedImages[R]=!0;for(let em in R[eh]){let e_="default"===eh?em:`${eh}:${em}`;this._spritesImagesIds[eh].push(e_),e_ in this.imageManager.images?this.imageManager.updateImage(e_,R[eh][em],!1):this.imageManager.addImage(e_,R[eh][em]),eu&&(this._changedImages[e_]=!0)}}}).catch(R=>{this._spriteRequest=null,e_=R,eg.signal.aborted||this.fire(new eh.l(e_))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),eu&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new eh.n("data",{dataType:"style"})),em&&em(e_)})}_unloadSprite(){for(let R of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(R),this._changedImages[R]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new eh.n("data",{dataType:"style"}))}_validateLayer(R){let eu=this.tileManagers[R.source];if(!eu)return;let em=R.sourceLayer;if(!em)return;let e_=eu.getSource();("geojson"===e_.type||e_.vectorLayerIds&&!e_.vectorLayerIds.includes(em))&&this.fire(new eh.l(Error(`Source layer "${em}" does not exist on source "${e_.id}" as specified by style layer "${R.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let R in this.tileManagers)if(!this.tileManagers[R].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(R,eu=!1){let em=this._serializedAllLayers();if(!R||0===R.length)return Object.values(eu?eh.bV(em):em);let e_=[];for(let eg of R)if(em[eg]){let R=eu?eh.bV(em[eg]):em[eg];e_.push(R)}return e_}_serializedAllLayers(){let R=this._serializedLayers;if(R)return R;R=this._serializedLayers={};let eh=Object.keys(this._layers);for(let eu of eh){let eh=this._layers[eu];"custom"!==eh.type&&(R[eu]=eh.serialize())}return R}hasTransitions(){var R,eh,eu;if((null===(R=this.light)||void 0===R?void 0:R.hasTransition())||(null===(eh=this.sky)||void 0===eh?void 0:eh.hasTransition())||(null===(eu=this.projection)||void 0===eu?void 0:eu.hasTransition()))return!0;for(let R in this.tileManagers)if(this.tileManagers[R].hasTransition())return!0;for(let R in this._layers)if(this._layers[R].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(R){if(!this._loaded)return;let eu=this._changed;if(eu){let eh=Object.keys(this._updatedLayers),eu=Object.keys(this._removedLayers);for(let R in(eh.length||eu.length)&&this._updateWorkerLayers(eh,eu),this._updatedSources){let eh=this._updatedSources[R];if("reload"===eh)this._reloadSource(R);else{if("clear"!==eh)throw Error(`Invalid action ${eh}`);this._clearSource(R)}}for(let eh in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[eh].updateTransitions(R);this.light.updateTransitions(R),this.sky.updateTransitions(R),this._resetUpdates()}let em={};for(let R in this.tileManagers){let eh=this.tileManagers[R];em[R]=eh.used,eh.used=!1}for(let eh of this._order){let eu=this._layers[eh];eu.recalculate(R,this._availableImages),!eu.isHidden(R.zoom)&&eu.source&&(this.tileManagers[eu.source].used=!0)}for(let R in em){let eu=this.tileManagers[R];!!em[R]!=!!eu.used&&eu.fire(new eh.n("data",{sourceDataType:"visibility",dataType:"source",sourceId:R}))}this.light.recalculate(R),this.sky.recalculate(R),this.projection.recalculate(R),this.z=R.zoom,eu&&this.fire(new eh.n("data",{dataType:"style"}))}_updateTilesForChangedImages(){let R=Object.keys(this._changedImages);if(R.length){for(let eh in this.tileManagers)this.tileManagers[eh].reloadTilesForDependencies(["icons","patterns"],R);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let R in this.tileManagers)this.tileManagers[R].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(R,eh){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(R,!1),removedIds:eh})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(R,eu={}){var em;this._checkLoaded();let e_=this.serialize();if(R=eu.transformStyle?eu.transformStyle(e_,R):R,(null===(em=eu.validate)||void 0===em||em)&&Di(this,eh.F(R)))return!1;(R=eh.bV(R)).layers=eh.bS(R.layers);let eg=eh.bW(e_,R),ev=this._getOperationsToPerform(eg);if(ev.unimplemented.length>0)throw Error(`Unimplemented: ${ev.unimplemented.join(", ")}.`);
54if(0===ev.operations.length)return!1;for(let R of ev.operations)R();return this.stylesheet=R,this._serializedLayers=null,this.fire(new eh.n("style.load",{style:this})),!0}_getOperationsToPerform(R){let eh=[],eu=[];for(let em of R)switch(em.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":eh.push(()=>this.addLayer.apply(this,em.args));break;case"removeLayer":eh.push(()=>this.removeLayer.apply(this,em.args));break;case"setPaintProperty":eh.push(()=>this.setPaintProperty.apply(this,em.args));break;case"setLayoutProperty":eh.push(()=>this.setLayoutProperty.apply(this,em.args));break;case"setFilter":eh.push(()=>this.setFilter.apply(this,em.args));break;case"addSource":eh.push(()=>this.addSource.apply(this,em.args));break;case"removeSource":eh.push(()=>this.removeSource.apply(this,em.args));break;case"setLayerZoomRange":eh.push(()=>this.setLayerZoomRange.apply(this,em.args));break;case"setLight":eh.push(()=>this.setLight.apply(this,em.args));break;case"setGeoJSONSourceData":eh.push(()=>this.setGeoJSONSourceData.apply(this,em.args));break;case"setGlyphs":eh.push(()=>this.setGlyphs.apply(this,em.args));break;case"setSprite":eh.push(()=>this.setSprite.apply(this,em.args));break;case"setTerrain":eh.push(()=>this.map.setTerrain.apply(this,em.args));break;case"setSky":eh.push(()=>this.setSky.apply(this,em.args));break;case"setProjection":this.setProjection.apply(this,em.args);break;case"setGlobalState":eh.push(()=>this.setGlobalState.apply(this,em.args));break;case"setTransition":eh.push(()=>{});break;default:eu.push(em.command)}return{operations:eh,unimplemented:eu}}addImage(R,eu){if(this.getImage(R))return this.fire(new eh.l(Error(`An image named "${R}" already exists.`)));this.imageManager.addImage(R,eu),this._afterImageUpdated(R)}updateImage(R,eh){this.imageManager.updateImage(R,eh)}getImage(R){return this.imageManager.getImage(R)}removeImage(R){if(!this.getImage(R))return this.fire(new eh.l(Error(`An image named "${R}" does not exist.`)));this.imageManager.removeImage(R),this._afterImageUpdated(R)}_afterImageUpdated(R){this._availableImages=this.imageManager.listImages(),this._changedImages[R]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new eh.n("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(R,eu,em={}){var e_;if(this._checkLoaded(),void 0!==this.tileManagers[R])throw Error(`Source "${R}" already exists.`);if(!eu.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(eu).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(eu.type)&&this._validate(eh.F.source,`sources.${R}`,eu,null,em))return;(null===(e_=this.map)||void 0===e_?void 0:e_._collectResourceTiming)&&(eu.collectResourceTiming=!0);let eg=this.tileManagers[R]=new Le(R,eu,this.dispatcher);eg.style=this,eg.setEventedParent(this,()=>({isSourceLoaded:eg.loaded(),source:eg.serialize(),sourceId:R})),eg.onAdd(this.map),this._changed=!0}removeSource(R){if(this._checkLoaded(),void 0===this.tileManagers[R])throw Error(`There is no source with this ID=${R}`);for(let eu in this._layers)if(this._layers[eu].source===R)return this.fire(new eh.l(Error(`Source "${R}" cannot be removed while layer "${eu}" is using it.`)));let eu=this.tileManagers[R];delete this.tileManagers[R],delete this._updatedSources[R],eu.fire(new eh.n("data",{sourceDataType:"metadata",dataType:"source",sourceId:R})),eu.setEventedParent(null),eu.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(R,eh){if(this._checkLoaded(),void 0===this.tileManagers[R])throw Error(`There is no source with this ID=${R}`);let eu=this.tileManagers[R].getSource();if("geojson"!==eu.type)throw Error(`geojsonSource.type is ${eu.type}, which is !== 'geojson`);eu.setData(eh),this._changed=!0}getSource(R){var eh;return null===(eh=this.tileManagers[R])||void 0===eh?void 0:eh.getSource()}addLayer(R,eu,em={}){let e_;this._checkLoaded();let eg=R.id;if(this.getLayer(eg))return void this.fire(new eh.l(Error(`Layer "${eg}" already exists on this map.`)));if("custom"===R.type){if(Di(this,eh.bX(R)))return;e_=eh.bT(R,this._globalState)}else{if("source"in R&&"object"==typeof R.source&&(this.addSource(eg,R.source),R=eh.bV(R),R=eh.e(R,{source:eg}
54)),this._validate(eh.F.layer,`layers.${eg}`,R,{arrayIndex:-1},em))return;e_=eh.bT(R,this._globalState),this._validateLayer(e_),e_.setEventedParent(this,{layer:{id:eg}})}let ev=eu?this._order.indexOf(eu):this._order.length;if(eu&&-1===ev)this.fire(new eh.l(Error(`Cannot add layer "${eg}" before non-existing layer "${eu}".`)));else{if(this._order.splice(ev,0,eg),this._layerOrderChanged=!0,this._layers[eg]=e_,this._removedLayers[eg]&&e_.source&&"custom"!==e_.type){let R=this._removedLayers[eg];delete this._removedLayers[eg],R.type!==e_.type?this._updatedSources[e_.source]="clear":(this._updatedSources[e_.source]="reload",this.tileManagers[e_.source].pause())}this._updateLayer(e_),e_.onAdd&&e_.onAdd(this.map)}}moveLayer(R,eu){if(this._checkLoaded(),this._changed=!0,!this._layers[R])return void this.fire(new eh.l(Error(`The layer '${R}' does not exist in the map's style and cannot be moved.`)));if(R===eu)return;let em=this._order.indexOf(R);this._order.splice(em,1);let e_=eu?this._order.indexOf(eu):this._order.length;eu&&-1===e_?this.fire(new eh.l(Error(`Cannot move layer "${R}" before non-existing layer "${eu}".`))):(this._order.splice(e_,0,R),this._layerOrderChanged=!0)}removeLayer(R){this._checkLoaded();let eu=this._layers[R];if(!eu)return void this.fire(new eh.l(Error(`Cannot remove non-existing layer "${R}".`)));eu.setEventedParent(null);let em=this._order.indexOf(R);this._order.splice(em,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[R]=eu,delete this._layers[R],this._serializedLayers&&delete this._serializedLayers[R],delete this._updatedLayers[R],delete this._updatedPaintProps[R],eu.onRemove&&eu.onRemove(this.map)}getLayer(R){return this._layers[R]}getLayersOrder(){return[...this._order]}hasLayer(R){return R in this._layers}setLayerZoomRange(R,eu,em){this._checkLoaded();let e_=this.getLayer(R);e_?e_.minzoom===eu&&e_.maxzoom===em||(null!=eu&&(e_.minzoom=eu),null!=em&&(e_.maxzoom=em),this._updateLayer(e_)):this.fire(new eh.l(Error(`Cannot set the zoom range of non-existing layer "${R}".`)))}setFilter(R,eu,em={}){this._checkLoaded();let e_=this.getLayer(R);if(e_){if(!eh.bQ(e_.filter,eu))return null==eu?(e_.setFilter(void 0),void this._updateLayer(e_)):void(this._validate(eh.F.filter,`layers.${e_.id}.filter`,eu,null,em)||(e_.setFilter(eh.bV(eu)),this._updateLayer(e_)))}else this.fire(new eh.l(Error(`Cannot filter non-existing layer "${R}".`)))}getFilter(R){return eh.bV(this.getLayer(R).filter)}setLayoutProperty(R,eu,em,e_={}){this._checkLoaded();let eg=this.getLayer(R);eg?eh.bQ(eg.getLayoutProperty(eu),em)||(eg.setLayoutProperty(eu,em,e_),this._updateLayer(eg)):this.fire(new eh.l(Error(`Cannot style non-existing layer "${R}".`)))}getLayoutProperty(R,eu){let em=this.getLayer(R);if(em)return em.getLayoutProperty(eu);this.fire(new eh.l(Error(`Cannot get style of non-existing layer "${R}".`)))}setPaintProperty(R,eu,em,e_={}){this._checkLoaded();let eg=this.getLayer(R);eg?eh.bQ(eg.getPaintProperty(eu),em)||this._updatePaintProperty(eg,eu,em,e_):this.fire(new eh.l(Error(`Cannot style non-existing layer "${R}".`)))}_updatePaintProperty(R,eu,em,e_={}){R.setPaintProperty(eu,em,e_)&&this._updateLayer(R),eh.bU(R)&&"raster-fade-duration"===eu&&this.tileManagers[R.source].setRasterFadeDuration(em),this._changed=!0,this._updatedPaintProps[R.id]=!0,this._serializedLayers=null}getPaintProperty(R,eh){return this.getLayer(R).getPaintProperty(eh)}setFeatureState(R,eu){this._checkLoaded();let em=R.source,e_=R.sourceLayer,eg=this.tileManagers[em];if(void 0===eg)return void this.fire(new eh.l(Error(`The source '${em}' does not exist in the map's style.`)));let ev=eg.getSource().type;"geojson"===ev&&e_?this.fire(new eh.l(Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==ev||e_?(void 0===R.id&&this.fire(new eh.l(Error("The feature id parameter must be provided."))),eg.setFeatureState(e_,R.id,eu)):this.fire(new eh.l(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(R,eu){this._checkLoaded();let em=R.source,e_=this.tileManagers[em];if(void 0===e_)return void this.fire(new eh.l(Error(`The source '${em}' does not exist in the map's style.`)));let eg=e_.getSource().type,ev="vector"===eg?R.sourceLayer:void 0;"vector"!==eg||ev?eu&&"string"!=typeof R.id&&"number"!=typeof R.id?this.fire(new eh.l(Error("A feature id is required to remove its specific state property."))):e_.removeFeatureState(ev,R.id,eu):this.fire(new eh.l(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(R){this._checkLoaded();let eu=R.source,em=R.sourceLayer,e_=this.tileManagers[eu];if(void 0!==e_)return"vector"!==e_.getSource().type||em?(void 0===R.id&&this.fire(new eh.l(Error("The feature id parameter must be provided."))),e_.getFeatureState(em,R.id)):void this.fire(new eh.l(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new eh.l(Error(`The source '${eu}' does not exist in the map's style.`)))}getTransition(){var R;return eh.e({duration:300,delay:0},null===(R=this.stylesheet)||void 0===R?void 0:R.transition)}serialize(){if(!this._loaded)return;let R=eh.bY(this.tileManagers,R=>R.serialize()),eu=this._serializeByIds(this._order,!0),em=this.map.getTerrain()||void 0,e_=this.stylesheet;return eh.bZ({version:e_.version,name:e_.name,metadata:e_.metadata,light:e_.light,sky:e_.sky,center:e_.center,zoom:e_.zoom,bearing:e_.bearing,pitch:e_.pitch,sprite:e_.sprite,glyphs:e_.glyphs,transition:e_.transition,projection:e_.projection,sources:R,layers:eu,terrain:em},R=>void 0!==R)}_updateLayer(R){this._updatedLayers[R.id]=!0,R.source&&!this._updatedSources[R.source]&&"raster"!==this.tileManagers[R.source].getSource().type&&(this._updatedSources[R.source]="reload",this.tileManagers[R.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(R){let t=R=>"fill-extrusion"===this._layers[R].type,eh={},eu=[];for(let em=this._order.length-1;em>=0;em--){let e_=this._order[em];if(t(e_))for(let eg of(eh[e_]=em,R)){let R=eg[e_];if(R)for(let eh of R)eu.push(eh)}}eu.sort((R,eh)=>eh.intersectionZ-R.intersectionZ);let em=[];for(let e_=this._order.length-1;e_>=0;e_--){let eg=this._order[e_];if(t(eg))for(let R=eu.length-1;R>=0;R--){let eg=eu[R].feature;if(eh[eg.layer.id]<e_)break;em.push(eg),eu.pop()}else for(let eh of R){let R=eh[eg];if(R)for(let eh of R)em.push(eh.feature)}}return em}queryRenderedFeatures(R,eu,em){(null==eu?void 0:eu.filter)&&this._val
54idate(eh.F.filter,"queryRenderedFeatures.filter",eu.filter,null,eu);let e_={};if(null==eu?void 0:eu.layers){if(!(Array.isArray(eu.layers)||eu.layers instanceof Set))return this.fire(new eh.l(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let R of eu.layers){let eu=this._layers[R];if(!eu)return this.fire(new eh.l(Error(`The layer '${R}' does not exist in the map's style and cannot be queried for features.`))),[];e_[eu.source]=!0}}let eg=[];eu.availableImages=this._availableImages;let ev=this._serializedAllLayers(),ex=eu.layers instanceof Set?eu.layers:Array.isArray(eu.layers)?new Set(eu.layers):null,eb=Object.assign(Object.assign({},eu),{layers:ex,globalState:this._globalState});for(let ex in this.tileManagers)eu.layers&&!e_[ex]||eg.push(function(R,eu,em,e_,eg,ev,ex){var eb;let ew=function(R,eh,eu){if(R)for(let em of R){let R=eh[em];if((null==R?void 0:R.source)===eu&&"fill-extrusion"===R.type)return!0}else for(let R in eh){let em=eh[R];if(em.source===eu&&"fill-extrusion"===em.type)return!0}return!1}(null!==(eb=null==eg?void 0:eg.layers)&&void 0!==eb?eb:null,eu,R.id),eT=ev.maxPitchScaleFactor(),eS=R.tilesIn(e_,eT,ew);eS.sort(j);let eP=[];for(let e_ of eS)eP.push({wrappedTileID:e_.tileID.wrapped().key,queryResults:e_.tile.queryRenderedFeatures(eu,em,R.getState(),e_.queryGeometry,e_.cameraQueryGeometry,e_.scale,eg,ev,eT,function(R,eu){let em=eh.O();return eh.Q(em,em,[1,1,0]),eh.S(em,em,[.5*R.width,.5*R.height,1]),R.calculatePosMatrix?eh.U(em,em,R.calculatePosMatrix(eu.toUnwrapped())):em}(ev,e_.tileID),ex?(R,eh)=>ex(e_.tileID,R,eh):void 0)});return function(R,eh){for(let eu in R)for(let em of R[eu])N(em,eh);return R}(function(R){let eh={},eu={};for(let em of R){let R=em.queryResults,e_=em.wrappedTileID,eg=eu[e_]=eu[e_]||{};for(let eu in R){let em=R[eu],e_=eg[eu]=eg[eu]||{},ev=eh[eu]=eh[eu]||[];for(let R of em)e_[R.featureIndex]||(e_[R.featureIndex]=!0,ev.push(R))}}return eh}(eP),R)}(this.tileManagers[ex],this._layers,ev,R,eb,em,this.map.terrain?(R,eh,eu)=>this.map.terrain.getElevation(R,eh,eu):void 0));return this.placement&&eg.push(function(R,eh,eu,em,e_,eg,ev){let ex={},eb=eg.queryRenderedSymbols(em),ew=[];for(let R of Object.keys(eb).map(Number))ew.push(ev[R]);for(let eu of(ew.sort(j),ew)){let em=eu.featureIndex.lookupSymbolFeatures(eb[eu.bucketInstanceId],eh,eu.bucketIndex,eu.sourceLayerIndex,{filterSpec:e_.filter,globalState:e_.globalState},e_.layers,e_.availableImages,R);for(let R in em){let eh=ex[R]=ex[R]||[],e_=em[R];for(let R of(e_.sort((R,eh)=>{let em=eu.featureSortOrder;if(em){let eu=em.indexOf(R.featureIndex);return em.indexOf(eh.featureIndex)-eu}return eh.featureIndex-R.featureIndex}),e_))eh.push(R)}}return function(R,eh,eu){for(let em in R)for(let e_ of R[em])N(e_,eu[eh[em].source]);return R}(ex,R,eu)}(this._layers,ev,this.tileManagers,R,eb,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(eg)}querySourceFeatures(R,eu){(null==eu?void 0:eu.filter)&&this._validate(eh.F.filter,"querySourceFeatures.filter",eu.filter,null,eu);let em=this.tileManagers[R];return em?function(R,eh){let eu=R.getRenderableIds().map(eh=>R.getTileByID(eh)),em=[],e_={};for(let R of eu){let eu=R.tileID.canonical.key;e_[eu]||(e_[eu]=!0,R.querySourceFeatures(em,eh))}return em}(em,eu?Object.assign(Object.assign({},eu),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(R,eu={}){this._checkLoaded();let em=this.light.getLight(),e_=!1;for(let eu in R)if(!eh.bQ(R[eu],em[eu])){e_=!0;break}if(!e_)return;let eg={now:c(),transition:eh.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(R,eu),this.light.updateTransitions(eg)}getProjection(){var R;return null===(R=this.stylesheet)||void 0===R?void 0:R.projection}setProjection(R){this._checkLoaded();let eh=null!=R?R:{type:"mercator"};if(this.stylesheet.projection=R,this.projection){if(this.projection.name===eh.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(eh.type)}getSky(){var R;return null===(R=this.stylesheet)||void 0===R?void 0:R.sky}setSky(R,eu={}){this._checkLoaded();let em=this.getSky(),e_=!1;if(!R&&!em)return;if(R&&!em)e_=!0;else if(!R&&em)e_=!0;else for(let eu in R)if(!eh.bQ(R[eu],em[eu])){e_=!0;break}if(!e_)return;let eg={now:c(),transition:eh.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=R,this.sky.setSky(R,eu),this.sky.updateTransitions(eg)}_setProjectionInternal(R){let eu=function(R,eu){let em={constrainOverride:eu};if(Array.isArray(R)){let eh=new ui({type:R});return{projection:eh,transform:new Ei(em),cameraHelper:new Ri(eh)}}switch(R){case"mercator":return{projection:new Ot,transform:new qt(em),cameraHelper:new Kt};case"globe":{let R=new ui({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:R,transform:new Ei(em),cameraHelper:new Ri(R)}}case"vertical-perspective":return{projection:new ci,transform:new Si(em),cameraHelper:new zi};default:return eh.w(`Unknown projection name: ${R}. Falling back to mercator projection.`),{projection:new Ot,transform:new qt(em),cameraHelper:new Kt}}}(R,this.map.transformConstrain);for(let R in this.projection=eu.projection,this.map.migrateProjection(eu.transform,eu.cameraHelper),this.tileManagers)this.tileManagers[R].reload()}_validate(R,eu,em,e_,eg={}){return!1!==(null==eg?void 0:eg.validate)&&Di(this,R.call(eh.F,eh.e({key:eu,style:this.serialize(),value:em,styleSpec:eh.x},e_)))}_remove(R=!0){for(let R in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),le().off(eB,this._rtlPluginLoaded),this._layers)this._layers[R].setEventedParent(null);for(let R in this.tileManagers){let eh=this.tileManagers[R];eh.setEventedParent(null),eh.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),R&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(R)}_clearSource(R){this.tileManagers[R].clearTiles()}_reloadSource(R){this.tileManagers[R].resume(),this.tileManagers[R].reload()}_updateSources(R){for(let eh in this.tileManagers)this.tileManagers[eh].update(R,this.map.terrain)}_generateCollisionBoxes(){for(let R in this.tileManagers)this._reloadSource(R)}_updatePlacement(R,eh,eu,em,e_=!1){let eg=!1,ev=!1,ex={};for(let eh of this._order){let eu=this._layers[eh];if("symbol"!==eu.type)continue;if(!ex[eu.source]){let R=this.tileManagers[eu.source];ex[eu.source]=R.getRenderableIds(!0).map(eh=>R.getTileByID(eh)).sort((R,eh)=>eh.tileID.overscaledZ-R.tileID.overscaledZ||(R.tileID.isLessThan(eh.tileID)?-1:1))}let em=this.crossTileSymbolIndex.addLayer(eu,ex[eu.source],R.center.lng);eg=eg||em}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((e_=e_||this._layerOrderChanged||0===eu)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c(),R.zoom))&&(this.pauseablePlacement=new Ct(R,this.map.terrain,this._order,e_,eh,eu,em,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,ex),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),ev=!0),eg&&this.pauseablePlacement.placement.setStale()),ev||eg)for(let R of this._order){let eh=this._layers[R];"symbol"===eh.type&&this.placement.updateLayerOpacities(eh,ex[eh.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(let R in this.tileManagers)this.tileManagers[R].releaseSymbolFadeTiles()}getImages(R,eu){return eh._(this,void 0,void 0,function*(){let R=yield this.imageManager.getImages(eu.icons);this._updateTilesForChangedImages();let eh=this.tileManagers[eu.source];return eh&&eh.setDependencies(eu.tileID.key,eu.type,eu.icons),R})}getGlyphs(R,eu){return eh._(this,void 0,void 0,function*(){let R=yield this.glyphManager.getGlyphs(eu.stacks),eh=this.tileManagers[eu.source];return eh&&eh.setDependencies(eu.tileID.key,eu.type,[""]),R})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(R,eu={}
54){this._checkLoaded(),R&&this._validate(eh.F.glyphs,"glyphs",R,null,eu)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=R,this.glyphManager.entries={},this.glyphManager.setURL(R))}getDashes(R,eu){return eh._(this,void 0,void 0,function*(){let R={};for(let[eh,em]of Object.entries(eu.dashes))R[eh]=this.lineAtlas.getDash(em.dasharray,em.round);return R})}addSprite(R,eu,em={},e_){this._checkLoaded();let eg=[{id:R,url:eu}],ev=[...p(this.stylesheet.sprite),...eg];this._validate(eh.F.sprite,"sprite",ev,null,em)||(this.stylesheet.sprite=ev,this._loadSprite(eg,!0,e_))}removeSprite(R){this._checkLoaded();let eu=p(this.stylesheet.sprite);if(eu.find(eh=>eh.id===R)){if(this._spritesImagesIds[R])for(let eh of this._spritesImagesIds[R])this.imageManager.removeImage(eh),this._changedImages[eh]=!0;eu.splice(eu.findIndex(eh=>eh.id===R),1),this.stylesheet.sprite=eu.length>0?eu:void 0,delete this._spritesImagesIds[R],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new eh.n("data",{dataType:"style"}))}else this.fire(new eh.l(Error(`Sprite "${R}" doesn't exists on this map.`)))}getSprite(){return p(this.stylesheet.sprite)}setSprite(R,eu={},em){this._checkLoaded(),R&&this._validate(eh.F.sprite,"sprite",R,null,eu)||(this.stylesheet.sprite=R,R?this._loadSprite(R,!0,em):(this._unloadSprite(),em&&em(null)))}destroy(){for(let R in this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),this.tileManagers){let eh=this.tileManagers[R];eh.setEventedParent(null),eh.onRemove(this.map)}for(let R in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy(),this._layers){let eh=this._layers[R];eh.setEventedParent(null),eh.onRemove&&eh.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 e0=eh.aT([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);let ki=class ki{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(R,eh,eu,em,e_,eg,ev,ex,eb){this.context=R;let ew=this.boundPaintVertexBuffers.length!==em.length;for(let R=0;!ew&&R<em.length;R++)this.boundPaintVertexBuffers[R]!==em[R]&&(ew=!0);!this.vao||this.boundProgram!==eh||this.boundLayoutVertexBuffer!==eu||ew||this.boundIndexBuffer!==e_||this.boundVertexOffset!==eg||this.boundDynamicVertexBuffer!==ev||this.boundDynamicVertexBuffer2!==ex||this.boundDynamicVertexBuffer3!==eb?this.freshBind(eh,eu,em,e_,eg,ev,ex,eb):(R.bindVertexArray.set(this.vao),ev&&ev.bind(),(null==e_?void 0:e_.dynamicDraw)&&e_.bind(),ex&&ex.bind(),eb&&eb.bind())}freshBind(R,eh,eu,em,e_,eg,ev,ex){let eb=R.numAttributes,ew=this.context,eT=ew.gl;for(let eb of(this.vao&&this.destroy(),this.vao=ew.createVertexArray(),ew.bindVertexArray.set(this.vao),this.boundProgram=R,this.boundLayoutVertexBuffer=eh,this.boundPaintVertexBuffers=eu,this.boundIndexBuffer=em,this.boundVertexOffset=e_,this.boundDynamicVertexBuffer=eg,this.boundDynamicVertexBuffer2=ev,this.boundDynamicVertexBuffer3=ex,eh.enableAttributes(eT,R),eu))eb.enableAttributes(eT,R);for(let em of(eg&&eg.enableAttributes(eT,R),ev&&ev.enableAttributes(eT,R),ex&&ex.enableAttributes(eT,R),eh.bind(),eh.setVertexAttribPointers(eT,R,e_),eu))em.bind(),em.setVertexAttribPointers(eT,R,e_);eg&&(eg.bind(),eg.setVertexAttribPointers(eT,R,e_)),em&&em.bind(),ev&&(ev.bind(),ev.setVertexAttribPointers(eT,R,e_)),ex&&(ex.bind(),ex.setVertexAttribPointers(eT,R,e_)),ew.currentNumAttributes=eb}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};let Bi=(R,eu,em,e_,eg)=>({u_texture:0,u_ele_delta:R,u_fog_matrix:eu,u_fog_color:em?em.properties.get("fog-color"):eh.bo.white,u_fog_ground_blend:em?em.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:eg?0:em?em.calculateFogBlendOpacity(e_):0,u_horizon_color:em?em.properties.get("horizon-color"):eh.bo.white,u_horizon_fog_blend:em?em.properties.get("horizon-fog-blend"):1,u_is_globe_mode:eg?1:0}),e1={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 ji(R){let eh=[];for(let eu of R){if(null===eu)continue;let R=eu.split(" ");eh.push(R.pop())}return eh}let Ni=class Ni{constructor(R,eu,em,e_,eg,ev,ex,eb,ew=[]){let eT=R.gl;this.program=eT.createProgram();let eS=ji(eu.staticAttributes),eP=em?em.getBinderAttributes():[],eI=eS.concat(eP),eM=eZ.prelude.staticUniforms?ji(eZ.prelude.staticUniforms):[],eE=ex.staticUniforms?ji(ex.staticUniforms):[],eC=eu.staticUniforms?ji(eu.staticUniforms):[],eA=em?em.getBinderUniforms():[],ez=eM.concat(eE).concat(eC).concat(eA),eD=[];for(let R of ez)eD.includes(R)||eD.push(R);let ek=em?em.defines():[];ri(eT)&&ek.unshift("#version 300 es"),eg&&ek.push("#define OVERDRAW_INSPECTOR;"),ev&&ek.push("#define TERRAIN3D;"),eb&&ek.push(eb),ew&&ek.push(...ew);let eR=ek.concat(eZ.prelude.fragmentSource,ex.fragmentSource,eu.fragmentSource).join("\n"),eL=ek.c
54oncat(eZ.prelude.vertexSource,ex.vertexSource,eu.vertexSource).join("\n");ri(eT)||(eR=eR.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D("),eL=eL.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D("));let eF=eT.createShader(eT.FRAGMENT_SHADER);if(eT.isContextLost())return void(this.failedToCreate=!0);if(eT.shaderSource(eF,eR),eT.compileShader(eF),!eT.getShaderParameter(eF,eT.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${eT.getShaderInfoLog(eF)}`);eT.attachShader(this.program,eF);let eB=eT.createShader(eT.VERTEX_SHADER);if(eT.isContextLost())return void(this.failedToCreate=!0);if(eT.shaderSource(eB,eL),eT.compileShader(eB),!eT.getShaderParameter(eB,eT.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${eT.getShaderInfoLog(eB)}`);eT.attachShader(this.program,eB),this.attributes={};let eO={};this.numAttributes=eI.length;for(let R=0;R<this.numAttributes;R++)eI[R]&&(eT.bindAttribLocation(this.program,R,eI[R]),this.attributes[eI[R]]=R);if(eT.linkProgram(this.program),!eT.getProgramParameter(this.program,eT.LINK_STATUS))throw Error(`Program failed to link: ${eT.getProgramInfoLog(this.program)}`);for(let R of(eT.deleteShader(eB),eT.deleteShader(eF),eD))if(R&&!eO[R]){let eh=eT.getUniformLocation(this.program,R);eh&&(eO[R]=eh)}this.fixedUniforms=e_(R,eO),this.terrainUniforms={u_depth:new eh.b_(R,eO.u_depth),u_terrain:new eh.b_(R,eO.u_terrain),u_terrain_dim:new eh.bp(R,eO.u_terrain_dim),u_terrain_matrix:new eh.c0(R,eO.u_terrain_matrix),u_terrain_unpack:new eh.c1(R,eO.u_terrain_unpack),u_terrain_exaggeration:new eh.bp(R,eO.u_terrain_exaggeration)},this.projectionUniforms={u_projection_matrix:new eh.c0(R,eO.u_projection_matrix),u_projection_tile_mercator_coords:new eh.c1(R,eO.u_projection_tile_mercator_coords),u_projection_clipping_plane:new eh.c1(R,eO.u_projection_clipping_plane),u_projection_transition:new eh.bp(R,eO.u_projection_transition),u_projection_fallback_matrix:new eh.c0(R,eO.u_projection_fallback_matrix)},this.binderUniforms=em?em.getUniforms(R,eO):[]}draw(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM,eE,eC,eA,ez){let eD=R.gl;if(this.failedToCreate)return;if(R.program.set(this.program),R.setDepthMode(eu),R.setStencilMode(em),R.setColorMode(e_),R.setCullFace(eg),ex)for(let eh in R.activeTexture.set(eD.TEXTURE2),eD.bindTexture(eD.TEXTURE_2D,ex.depthTexture),R.activeTexture.set(eD.TEXTURE3),eD.bindTexture(eD.TEXTURE_2D,ex.texture),this.terrainUniforms)this.terrainUniforms[eh].set(ex[eh]);if(eb)for(let R in eb)this.projectionUniforms[e1[R]].set(eb[R]);if(ev)for(let R in this.fixedUniforms)this.fixedUniforms[R].set(ev[R]);eE&&eE.setUniforms(R,this.binderUniforms,eI,{zoom:eM});let ek=0;switch(eh){case eD.LINES:ek=2;break;case eD.TRIANGLES:ek=3;break;case eD.LINE_STRIP:ek=1}for(let eu of eP.get()){let em=eu.vaos||(eu.vaos={});(em[ew]||(em[ew]=new ki)).bind(R,this,eT,eE?eE.getPaintVertexBuffers():[],eS,eu.vertexOffset,eC,eA,ez),eD.drawElements(eh,eu.primitiveLength*ek,eD.UNSIGNED_SHORT,eu.primitiveOffset*ek*2)}}};function Zi(R,eu,em){let e_=1/eh.aL(em,1,eu.transform.tileZoom),eg=Math.pow(2,em.tileID.overscaledZ),ev=em.tileSize*Math.pow(2,eu.transform.tileZoom)/eg,ex=ev*(em.tileID.canonical.x+em.tileID.wrap*eg),eb=ev*em.tileID.canonical.y;return{u_image:0,u_texsize:em.imageAtlasTexture.size,u_scale:[e_,R.fromScale,R.toScale],u_fade:R.t,u_pixel_coord_upper:[ex>>16,eb>>16],u_pixel_coord_lower:[65535&ex,65535&eb]}}let Ui=(R,eu,em,e_)=>{let eg=R.style.light,ev=eg.properties.get("position"),ex=[ev.x,ev.y,ev.z],eb=eh.c4();"viewport"===eg.properties.get("anchor")&&eh.c5(eb,R.transform.bearingInRadians),eh.c6(ex,ex,eb);let ew=R.transform.transformLightDirection(ex),eT=eg.properties.get("color");return{u_lightpos:ex,u_lightpos_globe:ew,u_lightintensity:eg.properties.get("intensity"),u_lightcolor:[eT.r,eT.g,eT.b],u_vertical_gradient:+eu,u_opacity:em,u_fill_translate:e_}},Gi=(R,eu,em,e_,eg,ev,ex)=>eh.e(Ui(R,eu,em,e_),Zi(ev,R,ex),{u_height_factor:-Math.pow(2,eg.overscaledZ)/ex.tileSize/8}),Vi=(R,eu,em,e_)=>eh.e(Zi(eu,R,em),{u_fill_translate:e_}),Wi=(R,eh)=>({u_world:R,u_fill_translate:eh}),qi=(R,eu,em,e_,eg)=>eh.e(Vi(R,eu,em,eg),{u_world:e_}),$i=(R,eu,em,e_,eg)=>{let ev=R.transform,ex,eb,ew=0;if("map"===em.paint.get("circle-pitch-alignment")){let R=eh.aL(eu,1,ev.zoom);
54ex=!0,eb=[R,R],ew=R/(eh.a6*Math.pow(2,eu.tileID.overscaledZ))*2*Math.PI*eg}else ex=!1,eb=ev.pixelsToGLUnits;return{u_camera_to_center_distance:ev.cameraToCenterDistance,u_scale_with_map:+("map"===em.paint.get("circle-pitch-scale")),u_pitch_with_map:+ex,u_device_pixel_ratio:R.pixelRatio,u_extrude_scale:eb,u_globe_extrude_scale:ew,u_translate:e_}},Hi=R=>({u_pixel_extrude_scale:[1/R.width,1/R.height]}),Xi=R=>({u_viewport_size:[R.width,R.height]}),Ki=(R,eh=1)=>({u_color:R,u_overlay:0,u_overlay_scale:eh}),Yi=(R,eu,em,e_)=>{let eg=eh.aL(R,1,eu)/(eh.a6*Math.pow(2,R.tileID.overscaledZ))*2*Math.PI*e_;return{u_extrude_scale:eh.aL(R,1,eu),u_intensity:em,u_globe_extrude_scale:eg}},Qi=(R,eu,em,e_)=>{let eg=eh.O();eh.c7(eg,0,R.width,R.height,0,0,1);let ev=R.context.gl;return{u_matrix:eg,u_world:[ev.drawingBufferWidth,ev.drawingBufferHeight],u_image:em,u_color_ramp:e_,u_opacity:eu.paint.get("heatmap-opacity")}},Ji=(R,eu,em)=>{let e_;let eg=em.paint.get("hillshade-accent-color");switch(em.paint.get("hillshade-method")){case"basic":e_=4;break;case"combined":e_=1;break;case"igor":e_=2;break;case"multidirectional":e_=3;break;default:e_=0}let ev=em.getIlluminationProperties();for(let eh=0;eh<ev.directionRadians.length;eh++)"viewport"===em.paint.get("hillshade-illumination-anchor")&&(ev.directionRadians[eh]+=R.transform.bearingInRadians);return{u_image:0,u_latrange:function(R,eu){let em=Math.pow(2,eu.canonical.z),e_=eu.canonical.y;return[new eh.a7(0,e_/em).toLngLat().lat,new eh.a7(0,(e_+1)/em).toLngLat().lat]}(0,eu.tileID),u_exaggeration:em.paint.get("hillshade-exaggeration"),u_altitudes:ev.altitudeRadians,u_azimuths:ev.directionRadians,u_accent:eg,u_method:e_,u_highlights:ev.highlightColor,u_shadows:ev.shadowColor}},eo=(R,eu)=>{let em=eu.stride,e_=eh.O();return eh.c7(e_,0,eh.a6,-eh.a6,0,0,1),eh.Q(e_,e_,[0,-eh.a6,0]),{u_matrix:e_,u_image:1,u_dimension:[em,em],u_zoom:R.overscaledZ,u_unpack:eu.getUnpackVector()}},io=(R,eh,eu=0)=>({u_image:0,u_unpack:eh.getUnpackVector(),u_dimension:[eh.stride,eh.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:eu,u_opacity:R.paint.get("color-relief-opacity")}),oo=(R,eu,em,e_)=>{let eg=R.transform;return{u_translation:co(R,eu,em),u_ratio:e_/eh.aL(eu,1,eg.zoom),u_device_pixel_ratio:R.pixelRatio,u_units_to_pixels:[1/eg.pixelsToGLUnits[0],1/eg.pixelsToGLUnits[1]]}},ro=(R,eu,em,e_,eg)=>eh.e(oo(R,eu,em,e_),{u_image:0,u_image_height:eg}),ao=(R,eu,em,e_,eg)=>{let ev=R.transform,ex=lo(eu,ev);return{u_translation:co(R,eu,em),u_texsize:eu.imageAtlasTexture.size,u_ratio:e_/eh.aL(eu,1,ev.zoom),u_device_pixel_ratio:R.pixelRatio,u_image:0,u_scale:[ex,eg.fromScale,eg.toScale],u_fade:eg.t,u_units_to_pixels:[1/ev.pixelsToGLUnits[0],1/ev.pixelsToGLUnits[1]]}},so=(R,eu,em,e_,eg)=>{let ev=lo(eu,R.transform);return eh.e(oo(R,eu,em,e_),{u_tileratio:ev,u_crossfade_from:eg.fromScale,u_crossfade_to:eg.toScale,u_image:0,u_mix:eg.t,u_lineatlas_width:R.lineAtlas.width,u_lineatlas_height:R.lineAtlas.height})},no=(R,eu,em,e_,eg,ev)=>{let ex=lo(eu,R.transform);return eh.e(oo(R,eu,em,e_),{u_image:0,u_image_height:ev,u_tileratio:ex,u_crossfade_from:eg.fromScale,u_crossfade_to:eg.toScale,u_image_dash:1,u_mix:eg.t,u_lineatlas_width:R.lineAtlas.width,u_lineatlas_height:R.lineAtlas.height})};function lo(R,eu){return 1/eh.aL(R,1,eu.tileZoom)}function co(R,eu,em){return eh.aM(R.transform,eu,em.paint.get("line-translate"),em.paint.get("line-translate-anchor"))}let ho=(R,eh,eu,em,e_)=>{var eg,ev;return{u_tl_parent:R,u_scale_parent:eh,u_buffer_scale:1,u_fade_t:eu.mix,u_opacity:eu.opacity*em.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:em.paint.get("raster-brightness-min"),u_brightness_high:em.paint.get("raster-brightness-max"),u_saturation_factor:(ev=em.paint.get("raster-saturation"))>0?1-1/(1.001-ev):-ev,u_contrast_factor:(eg=em.paint.get("raster-contrast"))>0?1/(1-eg):1+eg,u_spin_weights:function(R){R*=Math.PI/180;let eh=Math.sin(R),eu=Math.cos(R);return[(2*eu+1)/3,(-Math.sqrt(3)*eh-eu+1)/3,(Math.sqrt(3)*eh-eu+1)/3]}(em.paint.get("raster-hue-rotate")),u_coords_top:[e_[0].x,e_[0].y,e_[1].x,e_[1].y],u_coords_bottom:[e_[3].x,e_[3].y,e_[2].x,e_[2].y]}},_o=(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP)=>{let eI=ev.transform;return{u_is_size_zoom_constant:+("constant"===R||"source"===R),u_is_size_feature_constant:+("constant"===R||"camera"===R),u_size_t:eh?eh.uSizeT:0,u_size:eh?eh.uSize:0,u_camera_to_center_distance:eI.cameraToCenterDistance,u_pitch:eI.pitch/360*2*Math.PI,u_rotate_symbol:+eu,u_aspect_ratio:eI.width/eI.height,u_fade_change:ev.options.fadeDuration?ev.symbolFadeChange:1,u_label_plane_matrix:ex,u_coord_matrix:eb,u_is_text:+eT,u_pitch_with_map:+em,u_is_along_line:e_,u_is_variable_anchor:eg,u_texsize:eS,u_texture:0,u_translation:ew,u_pitched_scale:eP}},po=(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI,eM)=>{let eE=ex.transform;return eh.e(_o(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eM),{u_gamma_scale:e_?Math.cos(eE.pitch*Math.PI/180)*eE.cameraToCenterDistance:1,u_device_pixel_ratio:ex.pixelRatio,u_is_halo:1})},mo=(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI)=>eh.e(po(R,eu,em,e_,eg,ev,ex,eb,ew,eT,!0,eS,0,eI),{u_texsize_icon:eP,u_texture_icon:1}),fo=(R,eh)=>({u_opacity:R,u_color:eh}),go=(R,eu,em,e_,eg)=>eh.e(function(R,eu,em,e_){let eg=em.imageManager.getPattern(R.from.toString()),ev=em.imageManager.getPattern(R.to.toString()),{width:ex,height:eb}=em.imageManager.getPixelSize(),ew=Math.pow(2,e_.tileID.overscaledZ
vendor: 7,447 bytes, line 54
54),eT=e_.tileSize*Math.pow(2,em.transform.tileZoom)/ew,eS=eT*(e_.tileID.canonical.x+e_.tileID.wrap*ew),eP=eT*e_.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:eg.tl,u_pattern_br_a:eg.br,u_pattern_tl_b:ev.tl,u_pattern_br_b:ev.br,u_texsize:[ex,eb],u_mix:eu.t,u_pattern_size_a:eg.displaySize,u_pattern_size_b:ev.displaySize,u_scale_a:eu.fromScale,u_scale_b:eu.toScale,u_tile_units_to_pixels:1/eh.aL(e_,1,em.transform.tileZoom),u_pixel_coord_upper:[eS>>16,eP>>16],u_pixel_coord_lower:[65535&eS,65535&eP]}}(em,eg,eu,e_),{u_opacity:R}),vo=(R,eh)=>{},e2={fillExtrusion:(R,eu)=>({u_lightpos:new eh.c2(R,eu.u_lightpos),u_lightpos_globe:new eh.c2(R,eu.u_lightpos_globe),u_lightintensity:new eh.bp(R,eu.u_lightintensity),u_lightcolor:new eh.c2(R,eu.u_lightcolor),u_vertical_gradient:new eh.bp(R,eu.u_vertical_gradient),u_opacity:new eh.bp(R,eu.u_opacity),u_fill_translate:new eh.c3(R,eu.u_fill_translate)}),fillExtrusionPattern:(R,eu)=>({u_lightpos:new eh.c2(R,eu.u_lightpos),u_lightpos_globe:new eh.c2(R,eu.u_lightpos_globe),u_lightintensity:new eh.bp(R,eu.u_lightintensity),u_lightcolor:new eh.c2(R,eu.u_lightcolor),u_vertical_gradient:new eh.bp(R,eu.u_vertical_gradient),u_height_factor:new eh.bp(R,eu.u_height_factor),u_opacity:new eh.bp(R,eu.u_opacity),u_fill_translate:new eh.c3(R,eu.u_fill_translate),u_image:new eh.b_(R,eu.u_image),u_texsize:new eh.c3(R,eu.u_texsize),u_pixel_coord_upper:new eh.c3(R,eu.u_pixel_coord_upper),u_pixel_coord_lower:new eh.c3(R,eu.u_pixel_coord_lower),u_scale:new eh.c2(R,eu.u_scale),u_fade:new eh.bp(R,eu.u_fade)}),fill:(R,eu)=>({u_fill_translate:new eh.c3(R,eu.u_fill_translate)}),fillPattern:(R,eu)=>({u_image:new eh.b_(R,eu.u_image),u_texsize:new eh.c3(R,eu.u_texsize),u_pixel_coord_upper:new eh.c3(R,eu.u_pixel_coord_upper),u_pixel_coord_lower:new eh.c3(R,eu.u_pixel_coord_lower),u_scale:new eh.c2(R,eu.u_scale),u_fade:new eh.bp(R,eu.u_fade),u_fill_translate:new eh.c3(R,eu.u_fill_translate)}),fillOutline:(R,eu)=>({u_world:new eh.c3(R,eu.u_world),u_fill_translate:new eh.c3(R,eu.u_fill_translate)}),fillOutlinePattern:(R,eu)=>({u_world:new eh.c3(R,eu.u_world),u_image:new eh.b_(R,eu.u_image),u_texsize:new eh.c3(R,eu.u_texsize),u_pixel_coord_upper:new eh.c3(R,eu.u_pixel_coord_upper),u_pixel_coord_lower:new eh.c3(R,eu.u_pixel_coord_lower),u_scale:new eh.c2(R,eu.u_scale),u_fade:new eh.bp(R,eu.u_fade),u_fill_translate:new eh.c3(R,eu.u_fill_translate)}),circle:(R,eu)=>({u_camera_to_center_distance:new eh.bp(R,eu.u_camera_to_center_distance),u_scale_with_map:new eh.b_(R,eu.u_scale_with_map),u_pitch_with_map:new eh.b_(R,eu.u_pitch_with_map),u_extrude_scale:new eh.c3(R,eu.u_extrude_scale),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_globe_extrude_scale:new eh.bp(R,eu.u_globe_extrude_scale),u_translate:new eh.c3(R,eu.u_translate)}),collisionBox:(R,eu)=>({u_pixel_extrude_scale:new eh.c3(R,eu.u_pixel_extrude_scale)}),collisionCircle:(R,eu)=>({u_viewport_size:new eh.c3(R,eu.u_viewport_size)}),debug:(R,eu)=>({u_color:new eh.b$(R,eu.u_color),u_overlay:new eh.b_(R,eu.u_overlay),u_overlay_scale:new eh.bp(R,eu.u_overlay_scale)}),depth:vo,clippingMask:vo,heatmap:(R,eu)=>({u_extrude_scale:new eh.bp(R,eu.u_extrude_scale),u_intensity:new eh.bp(R,eu.u_intensity),u_globe_extrude_scale:new eh.bp(R,eu.u_globe_extrude_scale)}),heatmapTexture:(R,eu)=>({u_matrix:new eh.c0(R,eu.u_matrix),u_world:new eh.c3(R,eu.u_world),u_image:new eh.b_(R,eu.u_image),u_color_ramp:new eh.b_(R,eu.u_color_ramp),u_opacity:new eh.bp(R,eu.u_opacity)}),hillshade:(R,eu)=>({u_image:new eh.b_(R,eu.u_image),u_latrange:new eh.c3(R,eu.u_latrange),u_exaggeration:new eh.bp(R,eu.u_exaggeration),u_altitudes:new eh.c9(R,eu.u_altitudes),u_azimuths:new eh.c9(R,eu.u_azimuths),u_accent:new eh.b$(R,eu.u_accent),u_method:new eh.b_(R,eu.u_method),u_shadows:new eh.c8(R,eu.u_shadows),u_highlights:new eh.c8(R,eu.u_highlights)}),hillshadePrepare:(R,eu)=>({u_matrix:new eh.c0(R,eu.u_matrix),u_image:new eh.b_(R,eu.u_image),u_dimension:new eh.c3(R,eu.u_dimension),u_zoom:new eh.bp(R,eu.u_zoom),u_unpack:new eh.c1(R,eu.u_unpack)}),colorRelief:(R,eu)=>({u_image:new eh.b_(R,eu.u_image),u_unpack:new eh.c1(R,eu.u_unpack),u_dimension:new eh.c3(R,eu.u_dimension),u_elevation_stops:new eh.b_(R,eu.u_elevation_stops),u_color_stops:new eh.b_(R,eu.u_color_stops),u_color_ramp_size:new eh.b_(R,eu.u_color_ramp_size),u_opacity:new eh.bp(R,eu.u_opacity)}),line:(R,eu)=>({u_translation:new eh.c3(R,eu.u_translation),u_ratio:new eh.bp(R,eu.u_ratio),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_units_to_pixels:new eh.c3(R,eu.u_units_to_pixels)}),lineGradient:(R,eu)=>({u_translation:new eh.c3(R,eu.u_translation),u_ratio:new eh.bp(R,eu.u_ratio),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_units_to_pixels:new eh.c3(R,eu.u_units_to_pixels),u_image:new eh.b_(R,eu.u_image),u_image_height:new eh.bp(R,eu.u_image_height)}),linePattern:(R,eu)=>({u_translation:new eh.c3(R,eu.u_translation),u_texsize:new eh.c3(R,eu.u_texsize),u_ratio:new eh.bp(R,eu.u_ratio),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_image:new eh.b_(R,eu.u_image),u_units_to_pixels:new eh.c3(R,eu.u_units_to_pixels),u_scale:new eh.c2(R,eu.u_scale),u_fade:new eh.bp(R,eu.u_fade)}),lineSDF:(R,eu)=>({u_translation:new eh.c3(R,eu.u_translation),u_ratio:new eh.bp(R,eu.u_ratio),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_units_to_pixels:new eh.c3(R,eu.u_units_to_pixels),u_image:new eh.b_(R,eu.u_image),u_mix:new eh.bp(R,eu.u_mix),u_tileratio:new eh.bp(R,eu.u_tileratio),u_crossfade_from:new eh.bp(R,eu.u_crossfade_from),u_crossfade_to:new eh.bp(R,eu.u_crossfade_to),u_lineatlas_width:new eh.bp(R,eu.u_lineatlas_width),u_lineatlas_height:new eh.bp(R,eu.u_lineatlas_height)}),lineGradientSDF:(R,eu)=>({u_translation:new eh.c3(R,eu.u_translation),u_ratio:new eh.bp(R,eu.u_ratio),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_units_to_pixels:new eh.c3(R,eu.u_units_to_pixels),u_image:new eh.b_(R,eu.u_image),u_image_height:new eh.bp(R,eu.u_image_height),u_tileratio:new eh.bp(R,eu.u_tileratio),u_crossfade_from:new eh.bp(R,eu.u_crossfade_from),u_crossfade_to:new eh.bp(R,eu.u_crossfade_to),u_image_dash:new eh.b_(R,eu.u_image_dash),u_mix:new eh.bp(R,eu.u_mix),u_lineatlas_width:new eh.bp(R,eu.u_lineatlas_width),u_lineatlas_height:new eh.bp(R,eu.u_lineatlas_height)}),raster:(R,eu)=>({u_tl_parent:new eh.c3(R,eu.u_tl_parent),u_scale_parent:new eh.bp(R,eu.u_scale_parent),u_buffer_scale:new eh.bp(R,eu.u_buffer_scale),u_fade_t:new eh.bp(R,eu.u_fade_t),u_opacity:new eh.bp(R,eu.u_opacity),u_image0:new eh.b_(R,eu.u_image0),u_image1:new eh.b_(R,eu.u_image1),u_brightness_low:new eh.bp(R,eu.u_brightness_low),u_brightness_high:new eh.bp(R,eu.u_brightness_high),u_saturation_factor:new eh.bp(R,eu.u_saturation_factor),u_contrast_factor:new eh.bp(R,eu.u_contrast_factor),u_spin_weights:new eh.c2(R,eu.u_spin_weights),u_coords_top:new eh.c1(R,eu.u_coords_top),u_coords_bottom:new eh.c1(R,eu.u_coords_bottom)}),symbolIcon:(R,eu)=>({u_is_size_zoom_constant:new eh.b_(R,eu.u_is_size_zoom_constant),u_is_size_feature_constant:new eh.b_(R,eu.u_is_size_feature_constant),u_size_t:new eh.bp(R,eu.u_size_t),u_size:new eh.bp(R,eu.u_size),u_camera_to_center_distance:new eh.bp(R,eu.u_camera_to_center_distance),u_pitch:new eh.bp(R,eu.u_pitch),u_rotate_symbol:new eh.b_(R,eu.u_rotate_symbol),u_aspect_ratio:new eh.bp(R,eu.u_aspect_ratio),u_fade_change:new eh.bp(R,eu.u_fade_change),u_label_plane_matrix:new eh.c0(R,eu.u_label_plane_matrix
54),u_coord_matrix:new eh.c0(R,eu.u_coord_matrix),u_is_text:new eh.b_(R,eu.u_is_text),u_pitch_with_map:new eh.b_(R,eu.u_pitch_with_map),u_is_along_line:new eh.b_(R,eu.u_is_along_line),u_is_variable_anchor:new eh.b_(R,eu.u_is_variable_anchor),u_texsize:new eh.c3(R,eu.u_texsize),u_texture:new eh.b_(R,eu.u_texture),u_translation:new eh.c3(R,eu.u_translation),u_pitched_scale:new eh.bp(R,eu.u_pitched_scale)}),symbolSDF:(R,eu)=>({u_is_size_zoom_constant:new eh.b_(R,eu.u_is_size_zoom_constant),u_is_size_feature_constant:new eh.b_(R,eu.u_is_size_feature_constant),u_size_t:new eh.bp(R,eu.u_size_t),u_size:new eh.bp(R,eu.u_size),u_camera_to_center_distance:new eh.bp(R,eu.u_camera_to_center_distance),u_pitch:new eh.bp(R,eu.u_pitch),u_rotate_symbol:new eh.b_(R,eu.u_rotate_symbol),u_aspect_ratio:new eh.bp(R,eu.u_aspect_ratio),u_fade_change:new eh.bp(R,eu.u_fade_change),u_label_plane_matrix:new eh.c0(R,eu.u_label_plane_matrix),u_coord_matrix:new eh.c0(R,eu.u_coord_matrix),u_is_text:new eh.b_(R,eu.u_is_text),u_pitch_with_map:new eh.b_(R,eu.u_pitch_with_map),u_is_along_line:new eh.b_(R,eu.u_is_along_line),u_is_variable_anchor:new eh.b_(R,eu.u_is_variable_anchor),u_texsize:new eh.c3(R,eu.u_texsize),u_texture:new eh.b_(R,eu.u_texture),u_gamma_scale:new eh.bp(R,eu.u_gamma_scale),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_is_halo:new eh.b_(R,eu.u_is_halo),u_translation:new eh.c3(R,eu.u_translation),u_pitched_scale:new eh.bp(R,eu.u_pitched_scale)}),symbolTextAndIcon:(R,eu)=>({u_is_size_zoom_constant:new eh.b_(R,eu.u_is_size_zoom_constant),u_is_size_feature_constant:new eh.b_(R,eu.u_is_size_feature_constant),u_size_t:new eh.bp(R,eu.u_size_t),u_size:new eh.bp(R,eu.u_size),u_camera_to_center_distance:new eh.bp(R,eu.u_camera_to_center_distance),u_pitch:new eh.bp(R,eu.u_pitch),u_rotate_symbol:new eh.b_(R,eu.u_rotate_symbol),u_aspect_ratio:new eh.bp(R,eu.u_aspect_ratio),u_fade_change:new eh.bp(R,eu.u_fade_change),u_label_plane_matrix:new eh.c0(R,eu.u_label_plane_matrix),u_coord_matrix:new eh.c0(R,eu.u_coord_matrix),u_is_text:new eh.b_(R,eu.u_is_text),u_pitch_with_map:new eh.b_(R,eu.u_pitch_with_map),u_is_along_line:new eh.b_(R,eu.u_is_along_line),u_is_variable_anchor:new eh.b_(R,eu.u_is_variable_anchor),u_texsize:new eh.c3(R,eu.u_texsize),u_texsize_icon:new eh.c3(R,eu.u_texsize_icon),u_texture:new eh.b_(R,eu.u_texture),u_texture_icon:new eh.b_(R,eu.u_texture_icon),u_gamma_scale:new eh.bp(R,eu.u_gamma_scale),u_device_pixel_ratio:new eh.bp(R,eu.u_device_pixel_ratio),u_is_halo:new eh.b_(R,eu.u_is_halo),u_translation:new eh.c3(R,eu.u_translation),u_pitched_scale:new eh.bp(R,eu.u_pitched_scale)}),background:(R,eu)=>({u_opacity:new eh.bp(R,eu.u_opacity),u_color:new eh.b$(R,eu.u_color)}),backgroundPattern:(R,eu)=>({u_opacity:new eh.bp(R,eu.u_opacity),u_image:new eh.b_(R,eu.u_image),u_pattern_tl_a:new eh.c3(R,eu.u_pattern_tl_a),u_pattern_br_a:new eh.c3(R,eu.u_pattern_br_a),u_pattern_tl_b:new eh.c3(R,eu.u_pattern_tl_b),u_pattern_br_b:new eh.c3(R,eu.u_pattern_br_b),u_texsize:new eh.c3(R,eu.u_texsize),u_mix:new eh.bp(R,eu.u_mix),u_pattern_size_a:new eh.c3(R,eu.u_pattern_size_a),u_pattern_size_b:new eh.c3(R,eu.u_pattern_size_b),u_scale_a:new eh.bp(R,eu.u_scale_a),u_scale_b:new eh.bp(R,eu.u_scale_b),u_pixel_coord_upper:new eh.c3(R,eu.u_pixel_coord_upper),u_pixel_coord_lower:new eh.c3(R,eu.u_pixel_coord_lower),u_tile_units_to_pixels:new eh.bp(R,eu.u_tile_units_to_pixels)}),terrain:(R,eu)=>({u_texture:new eh.b_(R,eu.u_texture),u_ele_delta:new eh.bp(R,eu.u_ele_delta),u_fog_matrix:new eh.c0(R,eu.u_fog_matrix),u_fog_color:new eh.b$(R,eu.u_fog_color),u_fog_ground_blend:new eh.bp(R,eu.u_fog_ground_blend),u_fog_ground_blend_opacity:new eh.bp(R,eu.u_fog_ground_blend_opacity),u_horizon_color:new eh.b$(R,eu.u_horizon_color),u_horizon_fog_blend:new eh.bp(R,eu.u_horizon_fog_blend),u_is_globe_mode:new eh.bp(R,eu.u_is_globe_mode)}),terrainDepth:(R,eu)=>({u_ele_delta:new eh.bp(R,eu.u_ele_delta)}),terrainCoords:(R,eu)=>({u_texture:new eh.b_(R,eu.u_texture),u_terrain_coords_id:new eh.bp(R,eu.u_terrain_coords_id),u_ele_delta:new eh.bp(R,eu.u_ele_delta)}),projectionErrorMeasurement:(R,eu)=>
54({u_input:new eh.bp(R,eu.u_input),u_output_expected:new eh.bp(R,eu.u_output_expected)}),atmosphere:(R,eu)=>({u_sun_pos:new eh.c2(R,eu.u_sun_pos),u_atmosphere_blend:new eh.bp(R,eu.u_atmosphere_blend),u_globe_position:new eh.c2(R,eu.u_globe_position),u_globe_radius:new eh.bp(R,eu.u_globe_radius),u_inv_proj_matrix:new eh.c0(R,eu.u_inv_proj_matrix)}),sky:(R,eu)=>({u_sky_color:new eh.b$(R,eu.u_sky_color),u_horizon_color:new eh.b$(R,eu.u_horizon_color),u_horizon:new eh.c3(R,eu.u_horizon),u_horizon_normal:new eh.c3(R,eu.u_horizon_normal),u_sky_horizon_blend:new eh.bp(R,eu.u_sky_horizon_blend),u_sky_blend:new eh.bp(R,eu.u_sky_blend)})};let bo=class bo{constructor(R,eh,eu){this.context=R;let em=R.gl;this.buffer=em.createBuffer(),this.dynamicDraw=!!eu,this.context.unbindVAO(),R.bindElementBuffer.set(this.buffer),em.bufferData(em.ELEMENT_ARRAY_BUFFER,eh.arrayBuffer,this.dynamicDraw?em.DYNAMIC_DRAW:em.STATIC_DRAW),this.dynamicDraw||eh.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(R){let eh=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),eh.bufferSubData(eh.ELEMENT_ARRAY_BUFFER,0,R.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}};let e3={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};let wo=class wo{constructor(R,eh,eu,em){this.length=eh.length,this.attributes=eu,this.itemSize=eh.bytesPerElement,this.dynamicDraw=em,this.context=R;let e_=R.gl;this.buffer=e_.createBuffer(),R.bindVertexBuffer.set(this.buffer),e_.bufferData(e_.ARRAY_BUFFER,eh.arrayBuffer,this.dynamicDraw?e_.DYNAMIC_DRAW:e_.STATIC_DRAW),this.dynamicDraw||eh.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(R){if(R.length!==this.length)throw Error(`Length of new data is ${R.length}, which doesn't match current length of ${this.length}`);let eh=this.context.gl;this.bind(),eh.bufferSubData(eh.ARRAY_BUFFER,0,R.arrayBuffer)}enableAttributes(R,eh){for(let eu of this.attributes){let em=eh.attributes[eu.name];void 0!==em&&R.enableVertexAttribArray(em)}}setVertexAttribPointers(R,eh,eu){for(let em of this.attributes){let e_=eh.attributes[em.name];void 0!==e_&&R.vertexAttribPointer(e_,em.components,R[e3[em.type]],!1,this.itemSize,em.offset+this.itemSize*(eu||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}};let To=class To{constructor(R){this.gl=R.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(R){}getDefault(){return this.default}setDefault(){this.set(this.default)}};let Po=class Po extends To{getDefault(){return eh.bo.transparent}set(R){let eh=this.current;(R.r!==eh.r||R.g!==eh.g||R.b!==eh.b||R.a!==eh.a||this.dirty)&&(this.gl.clearColor(R.r,R.g,R.b,R.a),this.current=R,this.dirty=!1)}};let Co=class Co extends To{getDefault(){return 1}set(R){(R!==this.current||this.dirty)&&(this.gl.clearDepth(R),this.current=R,this.dirty=!1)}};let Io=class Io extends To{getDefault(){return 0}set(R){(R!==this.current||this.dirty)&&(this.gl.clearStencil(R),this.current=R,this.dirty=!1)}};let Mo=class Mo extends To{getDefault(){return[!0,!0,!0,!0]}set(R){let eh=this.current;(R[0]!==eh[0]||R[1]!==eh[1]||R[2]!==eh[2]||R[3]!==eh[3]||this.dirty)&&(this.gl.colorMask(R[0],R[1],R[2],R[3]),this.current=R,this.dirty=!1)}};let So=class So extends To{getDefault(){return!0}set(R){(R!==this.current||this.dirty)&&(this.gl.depthMask(R),this.current=R,this.dirty=!1)}};let Eo=class Eo extends To{getDefault(){return 255}set(R){(R!==this.current||this.dirty)&&(this.gl.stencilMask(R),this.current=R,this.dirty=!1)}};let zo=class zo extends To{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(R){let eh=this.current;(R.func!==eh.func||R.ref!==eh.ref||R.mask!==eh.mask||this.dirty)&&(this.gl.stencilFunc(R.func,R.ref,R.mask),this.current=R,this.dirty=!1)}};let Ro=class Ro extends To{getDefault(){let R=this.gl;return[R.KEEP,R.KEEP,R.KEEP]}set(R){let eh=this.current;(R[0]!==eh[0]||R[1]!==eh[1]||R[2]!==eh[2]||this.dirty)&&(this.gl.stencilOp(R[0],R[1],R[2]),this.current=R,this.dirty=!1)}};let Do=class Do extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;R?eh.enable(eh.STENCIL_TEST):eh.disable(eh.STENCIL_TEST),this.current=R,this.dirty=!1}};let Ao=class Ao extends To{getDefault(){return[0,1]}set(R){let eh=this.current;(R[0]!==eh[0]||R[1]!==eh[1]||this.dirty)&&(this.gl.depthRange(R[0],R[1]),this.current=R,this.dirty=!1)}};let Lo=class Lo extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;R?eh.enable(eh.DEPTH_TEST):eh.disable(eh.DEPTH_TEST),this.current=R,this.dirty=!1}};let Fo=class Fo extends To{getDefault(){return this.gl.LESS}set(R){(R!==this.current||this.dirty)&&(this.gl.depthFunc(R),this.current=R,this.dirty=!1)}};let ko=class ko extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;R?eh.enable(eh.BLEND):eh.disable(eh.BLEND),this.current=R,this.dirty=!1}};let Bo=class Bo extends To{getDefault(){let R=this.gl;return[R.ONE,R.ZERO]}set(R){let eh=this.current;(R[0]!==eh[0]||R[1]!==eh[1]||this.dirty)&&(this.gl.blendFunc(R[0],R[1]),this.current=R,this.dirty=!1)}};let Oo=class Oo extends To{getDefault(){return eh.bo.transparent}set(R){let eh=this.current;(R.r!==eh.r||R.g!==eh.g||R.b!==eh.b||R.a!==eh.a||this.dirty)&&(this.gl.blendColor
54(R.r,R.g,R.b,R.a),this.current=R,this.dirty=!1)}};let jo=class jo extends To{getDefault(){return this.gl.FUNC_ADD}set(R){(R!==this.current||this.dirty)&&(this.gl.blendEquation(R),this.current=R,this.dirty=!1)}};let No=class No extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;R?eh.enable(eh.CULL_FACE):eh.disable(eh.CULL_FACE),this.current=R,this.dirty=!1}};let Zo=class Zo extends To{getDefault(){return this.gl.BACK}set(R){(R!==this.current||this.dirty)&&(this.gl.cullFace(R),this.current=R,this.dirty=!1)}};let Uo=class Uo extends To{getDefault(){return this.gl.CCW}set(R){(R!==this.current||this.dirty)&&(this.gl.frontFace(R),this.current=R,this.dirty=!1)}};let Go=class Go extends To{getDefault(){return null}set(R){(R!==this.current||this.dirty)&&(this.gl.useProgram(R),this.current=R,this.dirty=!1)}};let Vo=class Vo extends To{getDefault(){return this.gl.TEXTURE0}set(R){(R!==this.current||this.dirty)&&(this.gl.activeTexture(R),this.current=R,this.dirty=!1)}};let Wo=class Wo extends To{getDefault(){let R=this.gl;return[0,0,R.drawingBufferWidth,R.drawingBufferHeight]}set(R){let eh=this.current;(R[0]!==eh[0]||R[1]!==eh[1]||R[2]!==eh[2]||R[3]!==eh[3]||this.dirty)&&(this.gl.viewport(R[0],R[1],R[2],R[3]),this.current=R,this.dirty=!1)}};let qo=class qo extends To{getDefault(){return null}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.bindFramebuffer(eh.FRAMEBUFFER,R),this.current=R,this.dirty=!1}};let $o=class $o extends To{getDefault(){return null}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.bindRenderbuffer(eh.RENDERBUFFER,R),this.current=R,this.dirty=!1}};let Ho=class Ho extends To{getDefault(){return null}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.bindTexture(eh.TEXTURE_2D,R),this.current=R,this.dirty=!1}};let Xo=class Xo extends To{getDefault(){return null}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.bindBuffer(eh.ARRAY_BUFFER,R),this.current=R,this.dirty=!1}};let Ko=class Ko extends To{getDefault(){return null}set(R){let eh=this.gl;eh.bindBuffer(eh.ELEMENT_ARRAY_BUFFER,R),this.current=R,this.dirty=!1}};let Yo=class Yo extends To{getDefault(){return null}set(R){var eh;if(R===this.current&&!this.dirty)return;let eu=this.gl;ri(eu)?eu.bindVertexArray(R):null===(eh=eu.getExtension("OES_vertex_array_object"))||void 0===eh||eh.bindVertexArrayOES(R),this.current=R,this.dirty=!1}};let Qo=class Qo extends To{getDefault(){return 4}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.pixelStorei(eh.UNPACK_ALIGNMENT,R),this.current=R,this.dirty=!1}};let Jo=class Jo extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.pixelStorei(eh.UNPACK_PREMULTIPLY_ALPHA_WEBGL,R),this.current=R,this.dirty=!1}};let er=class er extends To{getDefault(){return!1}set(R){if(R===this.current&&!this.dirty)return;let eh=this.gl;eh.pixelStorei(eh.UNPACK_FLIP_Y_WEBGL,R),this.current=R,this.dirty=!1}};let tr=class tr extends To{constructor(R,eh){super(R),this.context=R,this.parent=eh}getDefault(){return null}};let ir=class ir extends tr{setDirty(){this.dirty=!0}set(R){if(R===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let eh=this.gl;eh.framebufferTexture2D(eh.FRAMEBUFFER,eh.COLOR_ATTACHMENT0,eh.TEXTURE_2D,R,0),this.current=R,this.dirty=!1}};let or=class or extends tr{set(R){if(R===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let eh=this.gl;eh.framebufferRenderbuffer(eh.FRAMEBUFFER,eh.DEPTH_ATTACHMENT,eh.RENDERBUFFER,R),this.current=R,this.dirty=!1}};let rr=class rr extends tr{set(R){if(R===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let eh=this.gl;eh.framebufferRenderbuffer(eh.FRAMEBUFFER,eh.DEPTH_STENCIL_ATTACHMENT,eh.RENDERBUFFER,R),this.current=R,this.dirty=!1}};let e5="Framebuffer is not complete";let sr=class sr{constructor(R,eh,eu,em,e_){this.context=R,this.width=eh,this.height=eu;let eg=R.gl,ev=this.framebuffer=eg.createFramebuffer();if(this.colorAttachment=new ir(R,ev),em)this.depthAttachment=e_?new rr(R,ev):new or(R,ev);else if(e_)throw Error("Stencil cannot be set without depth");if(eg.checkFramebufferStatus(eg.FRAMEBUFFER)!==eg.FRAMEBUFFER_COMPLETE)throw Error(e5)}destroy(){let R=this.context.gl,eh=this.colorAttachment.get();if(eh&&R.deleteTexture(eh),this.depthAttachment){let eh=this.depthAttachment.get();eh&&R.deleteRenderbuffer(eh)}R.deleteFramebuffer(this.framebuffer)}};let nr=class nr{constructor(R){var eh,eu;if(this.gl=R,this.clearColor=new Po(this),this.clearDepth=new Co(this),this.clearStencil=new Io(this),this.colorMask=new Mo(this),this.depthMask=new So(this),this.stencilMask=new Eo(this),this.stencilFunc=new zo(this),this.stencilOp=new Ro(this),this.stencilTest=new Do(this),this.depthRange=new Ao(this),this.depthTest=new Lo(this),this.depthFunc=new Fo(this),this.blend=new ko(this),this.blendFunc=new Bo(this),this.blendColor=new Oo(this),this.blendEquation=new jo(this),this.cullFace=new No(this),this.cullFaceSide=new Zo(this),this.frontFace=new
54Uo(this),this.program=new Go(this),this.activeTexture=new Vo(this),this.viewport=new Wo(this),this.bindFramebuffer=new qo(this),this.bindRenderbuffer=new $o(this),this.bindTexture=new Ho(this),this.bindVertexBuffer=new Xo(this),this.bindElementBuffer=new Ko(this),this.bindVertexArray=new Yo(this),this.pixelStoreUnpack=new Qo(this),this.pixelStoreUnpackPremultiplyAlpha=new Jo(this),this.pixelStoreUnpackFlipY=new er(this),this.extTextureFilterAnisotropic=R.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=R.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=R.getParameter(R.MAX_TEXTURE_SIZE),ri(R)){this.HALF_FLOAT=R.HALF_FLOAT;let em=R.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(eh=R.RGBA16F)&&void 0!==eh?eh:null==em?void 0:em.RGBA16F_EXT,this.RGB16F=null!==(eu=R.RGB16F)&&void 0!==eu?eu:null==em?void 0:em.RGB16F_EXT,R.getExtension("EXT_color_buffer_float")}else{R.getExtension("EXT_color_buffer_half_float"),R.getExtension("OES_texture_half_float_linear");let eh=R.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==eh?void 0:eh.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(R,eh){return new bo(this,R,eh)}createVertexBuffer(R,eh,eu){return new wo(this,R,eh,eu)}createRenderbuffer(R,eh,eu){let em=this.gl,e_=em.createRenderbuffer();return this.bindRenderbuffer.set(e_),em.renderbufferStorage(em.RENDERBUFFER,R,eh,eu),this.bindRenderbuffer.set(null),e_}createFramebuffer(R,eh,eu,em){return new sr(this,R,eh,eu,em)}clear({color:R,depth:eh,stencil:eu}){let em=this.gl,e_=0;R&&(e_|=em.COLOR_BUFFER_BIT,this.clearColor.set(R),this.colorMask.set([!0,!0,!0,!0])),void 0!==eh&&(e_|=em.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(eh),this.depthMask.set(!0)),void 0!==eu&&(e_|=em.STENCIL_BUFFER_BIT,this.clearStencil.set(eu),this.stencilMask.set(255)),em.clear(e_)}setCullFace(R){!1===R.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(R.mode),this.frontFace.set(R.frontFace))}setDepthMode(R){R.func!==this.gl.ALWAYS||R.mask?(this.depthTest.set(!0),this.depthFunc.set(R.func),this.depthMask.set(R.mask),this.depthRange.set(R.range)):this.depthTest.set(!1)}setStencilMode(R){R.test.func!==this.gl.ALWAYS||R.mask?(this.stencilTest.set(!0),this.stencilMask.set(R.mask),this.stencilOp.set([R.fail,R.depthFail,R.pass]),this.stencilFunc.set({func:R.test.func,ref:R.ref,mask:R.test.mask})):this.stencilTest.set(!1)}setColorMode(R){eh.bQ(R.blendFunction,Yt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(R.blendFunction),this.blendColor.set(R.blendColor)),this.colorMask.set(R.mask)}createVertexArray(){var R;return ri(this.gl)?this.gl.createVertexArray():null===(R=this.gl.getExtension("OES_vertex_array_object"))||void 0===R?void 0:R.createVertexArrayOES()}deleteVertexArray(R){var eh;ri(this.gl)?this.gl.deleteVertexArray(R):null===(eh=this.gl.getExtension("OES_vertex_array_object"))||void 0===eh||eh.deleteVertexArrayOES(R)}unbindVAO(){this.bindVertexArray.set(null)}};function cr(R,eu,em,e_,eg){var ev,ex;
54let ew=R.context,eT=R.transform,eS=ew.gl,eP=R.useProgram("collisionBox"),eI=[],eM=0,eE=0;for(let eh of e_){let e_=eu.getTile(eh).getBucket(em);if(!e_)continue;let ex=eg?e_.textCollisionBox:e_.iconCollisionBox,eb=e_.collisionCircleArray;eb.length>0&&(eI.push({circleArray:eb,circleOffset:eE,coord:eh}),eM+=eb.length/4,eE=eM),ex&&eP.draw(ew,eS.LINES,ei.disabled,ii.disabled,R.colorModeForRenderPass(),Jt.disabled,Hi(R.transform),null===(ev=R.style.map.terrain)||void 0===ev?void 0:ev.getTerrainData(eh),eT.getProjectionData({overscaledTileID:eh,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),em.id,ex.layoutVertexBuffer,ex.indexBuffer,ex.segments,null,R.transform.zoom,null,null,ex.collisionVertexBuffer)}if(!eg||!eI.length)return;let eC=R.useProgram("collisionCircle"),eA=new eh.ca;eA.resize(4*eM),eA._trim();let ez=0;for(let R of eI)for(let eh=0;eh<R.circleArray.length/4;eh++){let eu=4*eh,em=R.circleArray[eu+0],e_=R.circleArray[eu+1],eg=R.circleArray[eu+2],ev=R.circleArray[eu+3];eA.emplace(ez++,em,e_,eg,ev,0),eA.emplace(ez++,em,e_,eg,ev,1),eA.emplace(ez++,em,e_,eg,ev,2),eA.emplace(ez++,em,e_,eg,ev,3)}(!eb||eb.length<2*eM)&&(eb=function(R){let eu=2*R,em=new eh.cc;em.resize(eu),em._trim();for(let R=0;R<eu;R++){let eh=6*R;em.uint16[eh+0]=4*R+0,em.uint16[eh+1]=4*R+1,em.uint16[eh+2]=4*R+2,em.uint16[eh+3]=4*R+2,em.uint16[eh+4]=4*R+3,em.uint16[eh+5]=4*R+0}return em}(eM));let eD=ew.createIndexBuffer(eb,!0),ek=ew.createVertexBuffer(eA,eh.cb.members,!0);for(let eu of eI){let e_=Xi(R.transform);eC.draw(ew,eS.TRIANGLES,ei.disabled,ii.disabled,R.colorModeForRenderPass(),Jt.disabled,e_,null===(ex=R.style.map.terrain)||void 0===ex?void 0:ex.getTerrainData(eu.coord),null,em.id,ek,eD,eh.aW.simpleSegment(0,2*eu.circleOffset,eu.circleArray.length,eu.circleArray.length/2),null,R.transform.zoom,null,null,null)}ek.destroy(),eD.destroy()}let e4=eh.ap(new Float32Array(16));function mr(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI){var eM;let eE=R.context,eC=eE.gl,eA=R.transform,ez="map"===eb,eD="map"===ew,ek="viewport"!==eb&&"point"!==em.layout.get("symbol-placement"),eR=ez&&!eD&&!ek,eL=!em.layout.get("symbol-sort-key").isConstant(),eF=!1,eB=R.getDepthModeForSublayer(0,ei.ReadOnly),eO=em._unevaluatedLayout.hasValue("text-variable-anchor")||em._unevaluatedLayout.hasValue("text-variable-anchor-offset"),eV=[],ej=eA.getCircleRadiusCorrection();for(let eb of e_){let e_;let ew=eu.getTile(eb),eS=ew.getBucket(em);if(!eS)continue;let eP=eg?eS.text:eS.icon;if(!(null==eP?void 0:eP.segments.get().length)||!eP.hasVisibleVertices)continue;let eE=eP.programConfigurations.get(em.id),eB=eg||eS.sdfIcons,eN=eg?eS.textSizeData:eS.iconSizeData,eU=eD||0!==eA.pitch,eG=R.useProgram(eS.iconsInText&&eg?"symbolTextAndIcon":eB?"
54symbolSDF":"symbolIcon",eE),e$=eh.aw(eN,eA.zoom),eZ=null===(eM=R.style.map.terrain)||void 0===eM?void 0:eM.getTerrainData(eb),eq,eW,eX,eH,eY=[0,0],eJ=null;if(eg)eW=ew.glyphAtlasTexture,eX=eC.LINEAR,eq=ew.glyphAtlasTexture.size,eS.iconsInText&&(eY=ew.imageAtlasTexture.size,eJ=ew.imageAtlasTexture,eH=eU||R.options.rotating||R.options.zooming||"composite"===eN.kind||"camera"===eN.kind?eC.LINEAR:eC.NEAREST);else{let eh=1!==em.layout.get("icon-size").constantOr(0)||eS.iconsNeedLinear;eW=ew.imageAtlasTexture,eX=eB||R.options.rotating||R.options.zooming||eh||eU?eC.LINEAR:eC.NEAREST,eq=ew.imageAtlasTexture.size}let eK=eh.aL(ew,1,R.transform.zoom),eQ=Oe(ez,R.transform,eK),e0=eh.O();eh.az(e0,eQ);let e1=function(R,eu,em,e_){if(R){let R=eh.O();if(!eu){let{vecSouth:eh,vecEast:eu}=Ne(em);R[0]=eu[0],R[1]=eu[1],R[4]=eh[0],R[5]=eh[1]}return eh.S(R,R,[e_,e_,1]),R}return em.pixelsToClipSpaceMatrix}(eD,ez,R.transform,eK),e2=eh.aM(eA,ew,ev,ex),e3=eA.getProjectionData({overscaledTileID:eb,applyGlobeMatrix:!eI,applyTerrainMatrix:!0}),e5=eO&&eS.hasTextData(),e6="none"!==em.layout.get("icon-text-fit")&&e5&&eS.hasIconData();if(ek){let eu=R.style.map.terrain?(eh,eu)=>R.style.map.terrain.getElevation(eb,eh,eu):null,e_="map"===em.layout.get("text-rotation-alignment");!function(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP,eI){let eM=em?R.textSizeData:R.iconSizeData,eE=eh.aw(eM,eu.transform.zoom),eC=[256/eu.width*2+1,256/eu.height*2+1],eA=em?R.text.dynamicLayoutVertexArray:R.icon.dynamicLayoutVertexArray;eA.clear();let ez=R.lineVertexArray,eD=em?R.text.placedSymbolArray:R.icon.placedSymbolArray,ek=eu.transform.width/eu.transform.height,eR=!1;for(let em=0;em<eD.length;em++){var eL;let eF=eD.get(em);if(eF.hidden||eF.writingMode===eh.ax.vertical&&!eR){ot(eF.numGlyphs,eA);continue}eR=!1;let eB=new eh.P(eF.anchorX,eF.anchorY),eO={getElevation:eI,pitchedLabelPlaneMatrix:e_,lineVertexArray:ez,pitchWithMap:ev,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:eu.transform,tileAnchorPoint:eB,unwrappedTileID:ew,width:eT,height:eS,translation:eP},eV=Qe(eF.anchorX,eF.anchorY,eO);if(!((eL=eV.point).x>=-eC[0]&&eL.x<=eC[0]&&eL.y>=-eC[1])||!(eL.y<=eC[1])){ot(eF.numGlyphs,eA);continue}let ej=.5+eu.transform.cameraToCenterDistance/eV.signedDistanceFromCamera*.5,eN=eh.ay(eM,eE,eF),eU=ev?eN*eu.transform.getPitchedTextCorrection(eF.anchorX,eF.anchorY,ew)/ej:eN*ej,eG=$e({projectionContext:eO,pitchedLabelPlaneMatrixInverse:eg,symbol:eF,fontSize:eU,flip:!1,keepUpright:ex,glyphOffsetArray:R.glyphOffsetArray,dynamicLayoutVertexArray:eA,aspectRatio:ek,rotateToLine:eb});eR=eG.useVertical,(eG.notEnoughRoom||eR||eG.needsFlipping&&$e({projectionContext:eO,pitchedLabelPlaneMatrixInverse:eg,symbol:eF,fontSize:eU,flip:!0,keepUpright:ex,glyphOffsetArray:R.glyphOffsetArray,dynamicLayoutVertexArray:eA,aspectRatio:ek,rotateToLine:eb}).notEnoughRoom)&&ot(eF.numGlyphs,eA)}em?R.text.dynamicLayoutVertexBuffer.updateData(eA):R.icon.dynamicLayoutVertexBuffer.updateData(eA)}(eS,R,eg,eQ,e0,eD,eT,e_,eb.toUnwrapped(),eA.width,eA.height,e2,eu)}let e8=eg&&eO||e6,e7=ek||e8?e4:eD?eQ:R.transform.clipSpaceToPixelsMatrix,e9=eB&&0!==em.paint.get(eg?"text-halo-width":"icon-halo-width").constantOr(1);e_=eB?eS.iconsInText?mo(eN.kind,e$,eR,eD,ek,e8,R,e7,e1,e2,eq,eY,ej):po(eN.kind,e$,eR,eD,ek,e8,R,e7,e1,e2,eg,eq,0,ej):_o(eN.kind,e$,eR,eD,ek,e8,R,e7,e1,e2,eg,eq,ej);let tl={program:eG,buffers:eP,uniformValues:e_,projectionData:e3,atlasTexture:eW,atlasTextureIcon:eJ,atlasInterpolation:eX,atlasInterpolationIcon:eH,isSDF:eB,hasHalo:e9};if(eL&&eS.canOverlap){eF=!0;let R=eP.segments.get();for(let eu of R)eV.push({segments:new eh.aW([eu]),sortKey:eu.sortKey,state:tl,terrainData:eZ})}else eV.push({segments:eP.segments,sortKey:0,state:tl,terrainData:eZ})}for(let eh of(eF&&eV.sort((R,eh)=>R.sortKey-eh.sortKey),eV)){let eu=eh.state;if(eE.activeTexture.set(eC.TEXTURE0),eu.atlasTexture.bind(eu.atlasInterpolation,eC.CLAMP_TO_EDGE),eu.atlasTextureIcon&&(eE.activeTexture.set(eC.TEXTURE1),eu.atlasTextureIcon&&eu.atlasTextureIcon.bind(eu.atlasInterpolationIcon,eC.CLAMP_TO_EDGE)),eu.isSDF){let e_=eu.uniformValues;eu.hasHalo&&(e_.u_is_halo=1,fr(eu.buffers,eh.segments,em,R,eu.program,eB,eS,eP,e_,eu.projectionData,eh.terrainData)),e_.u_is_halo=0}fr(eu.buffers,eh.segments,em,R,eu.program,eB,eS,eP,eu.uniformValues,eu.projectionData,eh.terrainData)}}function fr(R,eh,eu,em,e_,eg,ev,ex,eb,ew,eT){let eS=em.context;e_.draw(eS,eS.gl.TRIANGLES,eg,ev,ex,Jt.backCCW,eb,eT,ew,eu.id,R.layoutVertexBuffer,R.indexBuffer,eh,eu.paint,em.transform.zoom,R.programConfigurations.get(eu.id),R.dynamicLayoutVertexBuffer,R.opacityVertexBuffer)}function xr(R,eh,eu){var em,e_;let eg=R.gl,ev=eg.createTexture();eg.bindTexture(eg.TEXTURE_2D,ev),eg.texParameteri(eg.TEXTURE_2D,eg.TEXTURE_WRAP_S,eg.CLAMP_TO_EDGE),eg.texParameteri(eg.TEXTURE_2D,eg.TEXTURE_WRAP_T,eg.CLAMP_TO_EDGE),eg.texParameteri(eg.TEXTURE_2D,eg.TEXTURE_MIN_FILTER,eg.LINEAR),eg.texParameteri(eg.TEXTURE_2D,eg.TEXTURE_MAG_FILTER,eg.LINEAR);let ex=null!==(em=R.HALF_FLOAT)&&void 0!==em?em:eg.UNSIGNED_BYTE,eb=null!==(e_=R.RGBA16F)&&void 0!==e_?e_:eg.RGBA;eg.texImage2D(eg.TEXTURE_2D,0,eb,eh,eu,0,eg.RGBA,ex,null);let ew=R.createFramebuffer(eh,eu,!1,!1);return ew.colorAttachment.set(ev),ew}function br(R,eu){return eu.colorRampTexture||(eu.colorRampTexture=new eh.T(R,eu.colorRamp,R.gl.RGBA)),eu.colorRampTexture}function yr(R,eu,em,e_,eg,ev,ex,eb){let ew=256;if(eg.stepInterpolant){let e_=eu.getSource().maxzoom,eg=ex.canonical.z===e_?Math.ceil(1<<R.transform.maxZoom-ex.canonical.z):1;ew=eh.al(eh.ce(ev.maxLineLength/eh.a6*1024*eg),256,em.maxTextureSize)}return eb.gradient=eh.cf({expression:eg.gradientExpression(),evaluationKey:"lineProgress",resolution:ew,image:eb.gradient||void 0,clips:ev.lineClipsArray}),eb.texture?eb.texture.update(eb.gradient):eb.texture=new eh.T(em,eb.gradient,e_.RGBA),eb.version=eg.gradientVersion,eb.texture}function Ir(R,eh,eu,em,e_){if(!eu||!(null==em?void 0:em.imageAtlas))return;let eg=em.imageAtlas.patternPositions,ev=eg[eu.to.toString()],ex=eg[eu.from.toString()];if(!ev&&ex&&(ev=ex),!ex&&ev&&(ex=ev),!ev||!ex){let R=e_.getPaintProperty(eh);ev=eg[R],ex=eg[R]}ev&&ex&&R.setConstantPatternPositions(ev,ex)}function Mr(R,eu,em,e_,eg,ev,ex,eb){var ew;let eT,eS,eP,eI,eM;
54let eE=R.context.gl,eC="fill-pattern",eA=em.paint.get(eC),ez=null==eA?void 0:eA.constantOr(1),eD=em.getCrossfadeParameters(),ek=R.transform,eR=em.paint.get("fill-translate"),eL=em.paint.get("fill-translate-anchor");ex?(eS=ez&&!em.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",eT=eE.LINES):(eS=ez?"fillPattern":"fill",eT=eE.TRIANGLES);let eF=eA.constantOr(null);for(let eA of e_){let e_=eu.getTile(eA);if(ez&&!e_.patternsLoaded())continue;let eB=e_.getBucket(em);if(!eB)continue;let eO=eB.programConfigurations.get(em.id),eV=R.useProgram(eS,eO),ej=null===(ew=R.style.map.terrain)||void 0===ew?void 0:ew.getTerrainData(eA);ez&&(R.context.activeTexture.set(eE.TEXTURE0),e_.imageAtlasTexture.bind(eE.LINEAR,eE.CLAMP_TO_EDGE),eO.updatePaintBuffers(eD)),Ir(eO,eC,eF,e_,em);let eN=ek.getProjectionData({overscaledTileID:eA,applyGlobeMatrix:!eb,applyTerrainMatrix:!0}),eU=eh.aM(ek,e_,eR,eL);if(ex){eI=eB.indexBuffer2,eM=eB.segments2;let eh=[eE.drawingBufferWidth,eE.drawingBufferHeight];eP="fillOutlinePattern"===eS&&ez?qi(R,eD,e_,eh,eU):Wi(eh,eU)}else eI=eB.indexBuffer,eM=eB.segments,eP=ez?Vi(R,eD,e_,eU):{u_fill_translate:eU};let eG=R.stencilModeForClipping(eA);eV.draw(R.context,eT,eg,eG,ev,Jt.backCCW,eP,ej,eN,em.id,eB.layoutVertexBuffer,eI,eM,em.paint,R.transform.zoom,eO)}}function Sr(R,eu,em,e_,eg,ev,ex,eb){var ew;let eT=R.context,eS=eT.gl,eP="fill-extrusion-pattern",eI=em.paint.get(eP),eM=eI.constantOr(1),eE=em.getCrossfadeParameters(),eC=em.paint.get("fill-extrusion-opacity"),eA=eI.constantOr(null),ez=R.transform;for(let eI of e_){let e_=eu.getTile(eI),eD=e_.getBucket(em);if(!eD)continue;let ek=null===(ew=R.style.map.terrain)||void 0===ew?void 0:ew.getTerrainData(eI),eR=eD.programConfigurations.get(em.id),eL=R.useProgram(eM?"fillExtrusionPattern":"fillExtrusion",eR);eM&&(R.context.activeTexture.set(eS.TEXTURE0),e_.imageAtlasTexture.bind(eS.LINEAR,eS.CLAMP_TO_EDGE),eR.updatePaintBuffers(eE));let eF=ez.getProjectionData({overscaledTileID:eI,applyGlobeMatrix:!eb,applyTerrainMatrix:!0});Ir(eR,eP,eA,e_,em);let eB=eh.aM(ez,e_,em.paint.get("fill-extrusion-translate"),em.paint.get("fill-extrusion-translate-anchor")),eO=em.paint.get("fill-extrusion-vertical-gradient"),eV=eM?Gi(R,eO,eC,eB,eI,eE,e_):Ui(R,eO,eC,eB);eL.draw(eT,eT.gl.TRIANGLES,eg,ev,ex,Jt.backCCW,eV,ek,eF,em.id,eD.layoutVertexBuffer,eD.indexBuffer,eD.segments,em.paint,R.transform.zoom,eR,R.style.map.terrain&&eD.centroidVertexBuffer)}}function Er(R,eh,eu,em,e_,eg,ev,ex,eb){var ew;let eT=R.style.projection,eS=R.context,eP=R.transform,eI=eS.gl,eM=[`#define NUM_ILLUMINATION_SOURCES ${eu.paint.get("hillshade-highlight-color").values.length}`],eE=R.useProgram("hillshade",null,!1,eM),eC=!R.options.moving;for(let eM of em){let em=eh.getTile(eM),eA=em.fbo;if(!eA)continue;let ez=eT.getMeshFromTileID(eS,eM.canonical,ex,!0,"raster"),eD=null===(ew=R.style.map.terrain)||void 0===ew?void 0:ew.getTerrainData(eM);eS.activeTexture.set(eI.TEXTURE0),eI.bindTexture(eI.TEXTURE_2D,eA.colorAttachment.get());let ek=eP.getProjectionData({overscaledTileID:eM,aligned:eC,applyGlobeMatrix:!eb,applyTerrainMatrix:!0});eE.draw(eS,eI.TRIANGLES,eg,e_[eM.overscaledZ],ev,Jt.backCCW,Ji(R,em,eu),eD,ek,eu.id,ez.vertexBuffer,ez.indexBuffer,ez.segments)}}function zr(R,eu,em,e_,eg,ev,ex,eb,ew){var eT;let eS=R.style.projection,eP=R.context,eI=R.transform,eM=eP.gl,eE=R.useProgram("colorRelief"),eC=!R.options.moving,eA="nearest"===em.paint.get("resampling")?eM.NEAREST:eM.LINEAR,ez=!0,eD=0;for(let ek of e_){let e_=eu.getTile(ek),eR=e_.dem;if(ez){let R=eM.getParameter(eM.MAX_TEXTURE_SIZE),{elevationTexture:eh,colorTexture:eu}=em.getColorRampTextures(eP,R,eR.getUnpackVector());eP.activeTexture.set(eM.TEXTURE1),eh.bind(eM.NEAREST,eM.CLAMP_TO_EDGE),eP.activeTexture.set(eM.TEXTURE4),eu.bind(eM.LINEAR,eM.CLAMP_TO_EDGE),ez=!1,eD=eh.size[0]}if(!(null==eR?void 0:eR.data))continue;let eL=eR.stride,eF=eR.getPixels();if(eP.activeTexture.set(eM.TEXTURE0),eP.pixelStoreUnpackPremultiplyAlpha.set(!1),e_.demTexture=e_.demTexture||R.getTileTexture(eL),e_.demTexture){let R=e_.demTexture;R.update(eF,{premultiply:!1}),R.bind(eA,eM.CLAMP_TO_EDGE)}else e_.demTexture=new eh.T(eP,eF,eM.RGBA,{premultiply:!1}),e_.demTexture.bind(eA,eM.CLAMP_TO_EDGE);let eB=eS.getMeshFromTileID(eP,ek.canonical,eb,!0,"raster"),eO=null===(eT=R.style.map.terrain)||void 0===eT?void 0:eT.getTerrainData(ek),eV=eI.getProjectionData({overscaledTileID:ek,aligned:eC,applyGlobeMatrix:!ew,applyTerrainMatrix:!0});eE.draw(eP,eM.TRIANGLES,ev,eg[ek.overscaledZ],ex,Jt.backCCW,io(em,e_.dem,eD),eO,eV,em.id,eB.vertexBuffer,eB.indexBuffer,eB.segments)}}let e6=[new eh.P(0,0),new eh.P(eh.a6,0),new eh.P(eh.a6,eh.a6),new eh.P(0,eh.a6)];function Dr(R,eu,em,e_,eg,ev,ex,eb,ew=!1,eT=!1){var eS;let eP=e_[e_.length-1].overscaledZ,eI=R.context,eM=eI.gl,eC=R.useProgram("raster"),eA=R.transform,ez=R.style.projection,eD=R.colorModeForRenderPass(),ek=!R.options.moving,eR=em.paint.get("raster-opacity"),eL="nearest"===em.paint.get("resampling")||"nearest"===em.paint.get("raster-resampling")?eM.NEAREST:eM.LINEAR,eF=em.paint.get("raster-fade-duration"),eB=!!R.style.map.terrain;for(let eO of e_){let e_=R.getDepthModeForSublayer(eO.overscaledZ-eP,1===eR?ei.ReadWrite:ei.ReadOnly,eM.LESS),eV=eu.getTile(eO);eI.activeTexture.set(eM.TEXTURE0),eV.texture.bind(eL,eM.CLAMP_TO_EDGE,eM.LINEAR_MIPMAP_NEAREST),eI.activeTexture.set(eM.TEXTURE1);let{parentTile:ej,parentScaleBy:eN,parentTopLeft:eU,fadeValues:eG}=function(R,eu,em,e_){let eg={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===em||e_)return eg;if(R.fadingParentID){let e_=eu.getLoadedTile(R.fadingParentID);if(!e_)return eg;
54let ev=Math.pow(2,e_.tileID.overscaledZ-R.tileID.overscaledZ),ex=[R.tileID.canonical.x*ev%1,R.tileID.canonical.y*ev%1],eb=function(R,eu,em){let e_=c(),eg=(e_-eu.timeAdded)/em,ev=R.fadingDirection===eE.Incoming,ex=eh.al((e_-R.timeAdded)/em,0,1),eb=eh.al(1-eg,0,1),ew=ev?ex:eb;return{tileOpacity:ew,parentTileOpacity:ev?eb:ex,fadeMix:{opacity:1,mix:1-ew}}}(R,e_,em);return{parentTile:e_,parentScaleBy:ev,parentTopLeft:ex,fadeValues:eb}}if(R.selfFading){let eu=function(R,eu){let em=(c()-R.timeAdded)/eu,e_=eh.al(em,0,1);return{tileOpacity:e_,fadeMix:{opacity:e_,mix:0}}}(R,em);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:eu}}return eg}(eV,eu,eF,eB);eV.fadeOpacity=eG.tileOpacity,ej?(ej.fadeOpacity=eG.parentTileOpacity,ej.texture.bind(eL,eM.CLAMP_TO_EDGE,eM.LINEAR_MIPMAP_NEAREST)):eV.texture.bind(eL,eM.CLAMP_TO_EDGE,eM.LINEAR_MIPMAP_NEAREST),eV.texture.useMipmap&&eI.extTextureFilterAnisotropic&&R.transform.pitch>R.options.anisotropicFilterPitch&&eM.texParameterf(eM.TEXTURE_2D,eI.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,eI.extTextureFilterAnisotropicMax);let e$=null===(eS=R.style.map.terrain)||void 0===eS?void 0:eS.getTerrainData(eO),eZ=eA.getProjectionData({overscaledTileID:eO,aligned:ek,applyGlobeMatrix:!eT,applyTerrainMatrix:!0}),eq=ho(eU,eN,eG.fadeMix,em,eb),eW=ez.getMeshFromTileID(eI,eO.canonical,ev,ex,"raster");eC.draw(eI,eM.TRIANGLES,e_,eg?eg[eO.overscaledZ]:ii.disabled,eD,ew?Jt.frontCCW:Jt.backCCW,eq,e$,eZ,em.id,eW.vertexBuffer,eW.indexBuffer,eW.segments)}}let e8=new eh.bo(1,0,0,1),e7=new eh.bo(0,1,0,1),e9=new eh.bo(0,0,1,1),tl=new eh.bo(1,0,1,1),th=new eh.bo(0,1,1,1);function jr(R,eh,eu,em){Zr(R,0,eh+eu/2,R.transform.width,eu,em)}function Nr(R,eh,eu,em){Zr(R,eh-eu/2,0,eu,R.transform.height,em)}function Zr(R,eh,eu,em,e_,eg){let ev=R.context,ex=ev.gl;ex.enable(ex.SCISSOR_TEST),ex.scissor(eh*R.pixelRatio,eu*R.pixelRatio,em*R.pixelRatio,e_*R.pixelRatio),ev.clear({color:eg}),ex.disable(ex.SCISSOR_TEST)}function Gr(R,eh,eu,em){let{isRenderingGlobe:e_}=em,eg=R.context,ev=eg.gl,ex=R.transform,eb=R.colorModeForRenderPass(),ew=R.getDepthModeFor3D(),eT=R.useProgram("terrain");for(let em of(eg.bindFramebuffer.set(null),eg.viewport.set([0,0,R.width,R.height]),eu)){let eu=eh.getTerrainMesh(em.tileID),eS=R.renderToTexture.getTexture(em),eP=eh.getTerrainData(em.tileID);eg.activeTexture.set(ev.TEXTURE0),ev.bindTexture(ev.TEXTURE_2D,eS.texture);let eI=eh.getMeshFrameDelta(ex.zoom),eM=ex.calculateFogMatrix(em.tileID.toUnwrapped()),eE=Bi(eI,eM,R.style.sky,ex.pitch,e_),eC=ex.getProjectionData({overscaledTileID:em.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});eT.draw(eg,ev.TRIANGLES,ew,ii.disabled,eb,Jt.backCCW,eE,eP,eC,"terrain",eu.vertexBuffer,eu.indexBuffer,eu.segments)}}function Vr(R,eu){if(!eu.mesh){let em=new eh.aV;em.emplaceBack(-1,-1),em.emplaceBack(1,-1),em.emplaceBack(1,1),em.emplaceBack(-1,1);let e_=new eh.aX;e_.emplaceBack(0,1,2),e_.emplaceBack(0,2,3),eu.mesh=new Lt(R.createVertexBuffer(em,eq.members),R.createIndexBuffer(e_),eh.aW.simpleSegment(0,0,em.length,e_.length))}return eu.mesh}let tu={symbol:function(R,eu,em,e_,eg,ev){if("translucent"!==R.renderPass)return;let{isRenderingToTexture:ex}=ev,eb=ii.disabled,ew=R.colorModeForRenderPass();(em._unevaluatedLayout.hasValue("text-variable-anchor")||em._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(R,eu,em,e_,eg,ev,ex,eb,ew){var eT;let eS=eu.transform,eP=eu.style.map.terrain,eI="map"===eg,eM="map"===ev;for(let eg of R){let R=e_.getTile(eg),ev=R.getBucket(em);if(!(null===(eT=null==ev?void 0:ev.text)||void 0===eT?void 0:eT.segments.get().length))continue;let eE=eh.aw(ev.textSizeData,eS.zoom),eC=eh.aL(R,1,eu.transform.zoom),eA=Oe(eI,eu.transform,eC),ez="none"!==em.layout.get("icon-text-fit")&&ev.hasIconData();if(eE){let eu=Math.pow(2,eS.zoom-R.tileID.overscaledZ),em=eP?(R,eh)=>eP.getElevation(eg,R,eh):null;(function(R,eu,em,e_,eg,ev,ex,eb,ew,eT,eS,eP){let eI=R.text.placedSymbolArray,eM=R.text.dynamicLayoutVertexArray,eE=R.icon.dynamicLayoutVertexArray,eC={};eM.clear();for(let eE=0;eE<eI.length;eE++){let eA=eI.get(eE),ez=eA.hidden||!eA.crossTileID||R.allowVerticalPlacement&&!eA.placedOrientation?null:e_[eA.crossTileID];if(ez){let e_=new eh.P(eA.anchorX,eA.anchorY),eI={getElevation:eP,width:eg.width,height:eg.height,pitchedLabelPlaneMatr
54ix:ev,pitchWithMap:em,transform:eg,tileAnchorPoint:e_,translation:eT,unwrappedTileID:eS},eE=em?Qe(e_.x,e_.y,eI):Ke(e_.x,e_.y,eI),eD=.5+eg.cameraToCenterDistance/eE.signedDistanceFromCamera*.5,ek=eh.ay(R.textSizeData,eb,eA)*eD/eh.aK;em&&(ek*=R.tilePixelRatio/ex);let{width:eR,height:eL,anchor:eF,textOffset:eB,textBoxScale:eO}=ez,eV=function(R,eu,em,e_,eg,ev){let{horizontalAlign:ex,verticalAlign:eb}=eh.aQ(R);return new eh.P((-(ex-.5)*eu/eg+e_[0])*ev,(-(eb-.5)*em/eg+e_[1])*ev)}(eF,eR,eL,eB,eO,ek),ej=eg.getPitchedTextCorrection(e_.x+eT[0],e_.y+eT[1],eS),eN=function(R,eu,em,e_,eg,ev){let ex=eu.tileAnchorPoint.add(new eh.P(eu.translation[0],eu.translation[1]));if(eu.pitchWithMap){let R=e_.mult(ev);em||(R=R.rotate(-eg));let eh=ex.add(R);return Ze(eh.x,eh.y,eu.pitchedLabelPlaneMatrix,eu.getElevation).point}if(em){let eh=Ke(eu.tileAnchorPoint.x+1,eu.tileAnchorPoint.y,eu).point.sub(R),em=Math.atan(eh.y/eh.x)+(eh.x<0?Math.PI:0);return R.add(e_.rotate(em))}return R.add(e_)}(eE.point,eI,eu,eV,-eg.bearingInRadians,ej),eU=R.allowVerticalPlacement&&eA.placedOrientation===eh.ax.vertical?Math.PI/2:0;for(let R=0;R<eA.numGlyphs;R++)eh.aE(eM,eN,eU);ew&&eA.associatedIconIndex>=0&&(eC[eA.associatedIconIndex]={shiftedAnchor:eN,angle:eU})}else ot(eA.numGlyphs,eM)}if(ew){eE.clear();let eu=R.icon.placedSymbolArray;for(let R=0;R<eu.length;R++){let em=eu.get(R);if(em.hidden)ot(em.numGlyphs,eE);else{let eu=eC[R];if(eu)for(let R=0;R<em.numGlyphs;R++)eh.aE(eE,eu.shiftedAnchor,eu.angle);else ot(em.numGlyphs,eE)}}R.icon.dynamicLayoutVertexBuffer.updateData(eE)}R.text.dynamicLayoutVertexBuffer.updateData(eM)})(ev,eI,eM,ew,eS,eA,eu,eE,ez,eh.aM(eS,R,ex,eb),eg.toUnwrapped(),em)}}}(e_,R,em,eu,em.layout.get("text-rotation-alignment"),em.layout.get("text-pitch-alignment"),em.paint.get("text-translate"),em.paint.get("text-translate-anchor"),eg),0!==em.paint.get("icon-opacity").constantOr(1)&&mr(R,eu,em,e_,!1,em.paint.get("icon-translate"),em.paint.get("icon-translate-anchor"),em.layout.get("icon-rotation-alignment"),em.layout.get("icon-pitch-alignment"),em.layout.get("icon-keep-upright"),eb,ew,ex),0!==em.paint.get("text-opacity").constantOr(1)&&mr(R,eu,em,e_,!0,em.paint.get("text-translate"),em.paint.get("text-translate-anchor"),em.layout.get("text-rotation-alignment"),em.layout.get("text-pitch-alignment"),em.layout.get("text-keep-upright"),eb,ew,ex),eu.map.showCollisionBoxes&&(cr(R,eu,em,e_,!0),cr(R,eu,em,e_,!1))},circle:function(R,eu,em,e_,eg){var ev;if("translucent"!==R.renderPass)return;let{isRenderingToTexture:ex}=eg,eb=em.paint.get("circle-opacity"),ew=em.paint.get("circle-stroke-width"),eT=em.paint.get("circle-stroke-opacity"),eS=!em.layout.get("circle-sort-key").isConstant();if(0===eb.constantOr(1)&&(0===ew.constantOr(1)||0===eT.constantOr(1)))return;let eP=R.context,eI=eP.gl,eM=R.transform,eE=R.getDepthModeForSublayer(0,ei.ReadOnly),eC=ii.disabled,eA=R.colorModeForRenderPass(),ez=[],eD=eM.getCircleRadiusCorrection();for(let eg of e_){let e_=eu.getTile(eg),eb=e_.getBucket(em);if(!eb)continue;let ew=em.paint.get("circle-translate"),eT=em.paint.get("circle-translate-anchor"),eP=eh.aM(eM,e_,ew,eT),eI=eb.programConfigurations.get(em.id),eE=R.useProgram("circle",eI),eC=eb.layoutVertexBuffer,eA=eb.indexBuffer,ek=null===(ev=R.style.map.terrain)||void 0===ev?void 0:ev.getTerrainData(eg),eR={programConfiguration:eI,program:eE,layoutVertexBuffer:eC,indexBuffer:eA,uniformValues:$i(R,e_,em,eP,eD),terrainData:ek,projectionData:eM.getProjectionData({overscaledTileID:eg,applyGlobeMatrix:!ex,applyTerrainMatrix:!0})};if(eS){let R=eb.segments.get();for(let eu of R)ez.push({segments:new eh.aW([eu]),sortKey:eu.sortKey,state:eR})}else ez.push({segments:eb.segments,sortKey:0,state:eR})}for(let eh of(eS&&ez.sort((R,eh)=>R.sortKey-eh.sortKey),ez)){let{programConfiguration:eu,program:e_,layoutVertexBuffer:eg,indexBuffer:ev,uniformValues:ex,terrainData:eb,projectionData:ew}=eh.state;e_.draw(eP,eI.TRIANGLES,eE,eC,eA,Jt.backCCW,ex,eb,ew,em.id,eg,ev,eh.segments,em.paint,R.transform.zoom,eu)}},heatmap:function(R,eu,em,e_,eg){if(0===em.paint.get("heatmap-opacity"))return;let ev=R.context,{isRenderingToTexture:ex,isRenderingGlobe:eb}=eg;if(R.style.map.terrain){for(let eg of e_){let e_=eu.getTile(eg);eu.hasRenderableParent(eg)||("offscreen"===R.renderPass?function(R,eu,em,e_,eg){let ev=R.context,ex=ev.gl,eb=ii.disabled,ew=new Yt([ex.ONE,ex.ONE],eh.bo.transparent,[!0,!0,!0,!0]),eT=eu.getBucket(em);if(!eT)return;let eS=e_.key,eP=em.heatmapFbos.get(eS);eP||(eP=xr(ev,eu.tileSize,eu.tileSize),em.heatmapFbos.set(eS,eP)),ev.bindFramebuffer.set(eP.framebuffer),ev.viewport.set([0,0,eu.tileSize,eu.tileSize]),ev.clear({color:eh.bo.transparent});let eI=eT.programConfigurations.get(em.id),eM=R.useProgram("heatmap",eI,!eg),eE=R.transform.getProjectionData({overscaledTileID:eu.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),eC=R.style.map.terrain.getTerrainData(e_);eM.draw(ev,ex.TRIANGLES,ei.disabled,eb,ew,Jt.disabled,Yi(eu,R.transform.zoom,em.paint.get("heatmap-intensity"),1),eC,eE,em.id,eT.layoutVertexBuffer,eT.indexBuffer,eT.segments,em.paint,R.transform.zoom,eI)}(R,e_,em,eg,eb):"translucent"===R.renderPass&&function(R,eh,eu,em,e_){let eg=R.context,ev=eg.gl,ex=R.transform;eg.setColorMode(R.colorModeForRenderPass());let eb=br(eg,eh),ew=eu.key,eT=eh.heatmapFbos.get(ew);if(!eT)return;eg.activeTexture.set(ev.TEXTURE0),ev.bindTexture(ev.TEXTURE_2D,eT.colorAttachment.get()),eg.activeTexture.set(ev.TEXTURE1),eb.bind(ev.LINEAR,ev.CLAMP_TO_EDGE);let eS=ex.getProjectionData({overscaledTileID:eu,applyTerrainMatrix:e_,applyGlobeMatrix:!em});R.useProgram("heatmapTexture").draw(eg,ev.TRIANGLES,ei.disabled,ii.disabled,R.colorModeForRenderPass(),Jt.disabled,Qi(R,eh,0,1),null,eS,eh.id,R.rasterBoundsBuffer,R.quadTriangleIndexBuffer,R.rasterBoundsSegments,eh.paint,ex.zoom),eT.destroy(),eh.heatmapFbos.delete(ew)}(R,em,eg,ex,eb))}ev.viewport.set([0,0,R.width,R.height])}else"offscreen"===R.renderPass?function(R,eu,em,e_){let eg=R.context,ev=eg.gl,ex=R.transform,eb=ii.disabled,ew=new Yt([ev.ONE,ev.ONE],eh.bo.transparent,[!0,!0,!0,!0]);for(let eT of(function(R,eu,em){let e_=R.gl;R.activeTexture.set(e_.TEXTURE1),R.viewport.set([0,0,eu.width/4,eu.height/4]);let eg=em.heatmapFbos.get(eh.cd);eg?(e_.bindTexture(e_.TEXTURE_2D,eg.colorAttachment.get()),R.bindFramebuffer.set(eg.framebuffer)):(eg=xr(R,eu.width/4,eu.height/4),em.heatmapFbos.set(eh.c
54d,eg))}(eg,R,em),eg.clear({color:eh.bo.transparent}),e_)){if(eu.hasRenderableParent(eT))continue;let eh=eu.getTile(eT),e_=eh.getBucket(em);if(!e_)continue;let eS=e_.programConfigurations.get(em.id),eP=R.useProgram("heatmap",eS),eI=ex.getProjectionData({overscaledTileID:eT,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),eM=ex.getCircleRadiusCorrection();eP.draw(eg,ev.TRIANGLES,ei.disabled,eb,ew,Jt.backCCW,Yi(eh,ex.zoom,em.paint.get("heatmap-intensity"),eM),null,eI,em.id,e_.layoutVertexBuffer,e_.indexBuffer,e_.segments,em.paint,ex.zoom,eS)}eg.viewport.set([0,0,R.width,R.height])}(R,eu,em,e_):"translucent"===R.renderPass&&function(R,eu){let em=R.context,e_=em.gl;em.setColorMode(R.colorModeForRenderPass());let eg=eu.heatmapFbos.get(eh.cd);eg&&(em.activeTexture.set(e_.TEXTURE0),e_.bindTexture(e_.TEXTURE_2D,eg.colorAttachment.get()),em.activeTexture.set(e_.TEXTURE1),br(em,eu).bind(e_.LINEAR,e_.CLAMP_TO_EDGE),R.useProgram("heatmapTexture").draw(em,e_.TRIANGLES,ei.disabled,ii.disabled,R.colorModeForRenderPass(),Jt.disabled,Qi(R,eu,0,1),null,null,eu.id,R.viewportBuffer,R.quadTriangleIndexBuffer,R.viewportSegments,eu.paint,R.transform.zoom))}(R,em)},line:function(R,eh,eu,em,e_){var eg;let ev;if("translucent"!==R.renderPass)return;let{isRenderingToTexture:ex}=e_,eb=eu.paint.get("line-opacity"),ew=eu.paint.get("line-width");if(0===eb.constantOr(1)||0===ew.constantOr(1))return;let eT=R.getDepthModeForSublayer(0,ei.ReadOnly),eS=R.colorModeForRenderPass(),eP=eu.paint.get("line-dasharray"),eI=eP.constantOr(1),eM=eu.paint.get("line-pattern"),eE=eM.constantOr(1),eC=eu.paint.get("line-gradient"),eA=eu.getCrossfadeParameters();ev=eE?"linePattern":eI&&eC?"lineGradientSDF":eI?"lineSDF":eC?"lineGradient":"line";let ez=R.context,eD=ez.gl,ek=R.transform,eR=!0;for(let e_ of em){let em;let eb=eh.getTile(e_);if(eE&&!eb.patternsLoaded())continue;let ew=eb.getBucket(eu);if(!ew)continue;let eL=ew.programConfigurations.get(eu.id),eF=R.context.program.get(),eB=R.useProgram(ev,eL),eO=eR||eB.program!==eF,eV=null===(eg=R.style.map.terrain)||void 0===eg?void 0:eg.getTerrainData(e_),ej=eM.constantOr(null),eN=null==eP?void 0:eP.constantOr(null);if(ej&&eb.imageAtlas){let R=eb.imageAtlas,eh=R.patternPositions[ej.to.toString()],eu=R.patternPositions[ej.from.toString()];eh&&eu&&eL.setConstantPatternPositions(eh,eu)}else if(eN){let eh="round"===eu.layout.get("line-cap").constantOr(null),em=R.lineAtlas.getDash(eN.to,eh),e_=R.lineAtlas.getDash(eN.from,eh);eL.setConstantDashPositions(em,e_)}let eU=ek.getProjectionData({overscaledTileID:e_,applyGlobeMatrix:!ex,applyTerrainMatrix:!0}),eG=ek.getPixelScale();eE?(em=ao(R,eb,eu,eG,eA),ez.activeTexture.set(eD.TEXTURE0),eb.imageAtlasTexture.bind(eD.LINEAR,eD.CLAMP_TO_EDGE),eL.updatePaintBuffers(eA)):eI&&eC?(em=no(R,eb,eu,eG,eA,ew.lineClipsArray.length),function(R,eh,eu,em,e_,eg,ev,ex,eb){let ew=eg.gradients[e_.id],eT=ew.texture;e_.gradientVersion!==ew.version&&(eT=yr(R,eh,eu,em,e_,eg,ev,ew)),eu.activeTexture.set(em.TEXTURE0),eT.bind(e_.stepInterpolant?em.NEAREST:em.LINEAR,em.CLAMP_TO_EDGE),eu.activeTexture.set(em.TEXTURE1),R.lineAtlas.bind(eu),ex.updatePaintBuffers(eb)}(R,eh,ez,eD,eu,ew,e_,eL,eA)):eI?(em=so(R,eb,eu,eG,eA),(eO||R.lineAtlas.dirty)&&(ez.activeTexture.set(eD.TEXTURE0),R.lineAtlas.bind(ez)),eL.updatePaintBuffers(eA)):eC?(em=ro(R,eb,eu,eG,ew.lineClipsArray.length),function(R,eh,eu,em,e_,eg,ev){let ex=eg.gradients[e_.id],eb=ex.texture;e_.gradientVersion!==ex.version&&(eb=yr(R,eh,eu,em,e_,eg,ev,ex)),eu.activeTexture.set(em.TEXTURE0),eb.bind(e_.stepInterpolant?em.NEAREST:em.LINEAR,em.CLAMP_TO_EDGE)}(R,eh,ez,eD,eu,ew,e_)):em=oo(R,eb,eu,eG);let e$=R.stencilModeForClipping(e_);eB.draw(ez,eD.TRIANGLES,eT,e$,eS,Jt.disabled,em,eV,eU,eu.id,ew.layoutVertexBuffer,ew.indexBuffer,ew.segments,eu.paint,R.transform.zoom,eL,ew.layoutVertexBuffer2),eR=!1}},fill:function(R,eu,em,e_,eg){let ev=em.paint.get("fill-color"),ex=em.paint.get("fill-opacity");if(0===ex.constantOr(1))return;let{isRenderingToTexture:eb}=eg,ew=R.colorModeForRenderPass(),eT=em.paint.get("fill-pattern"),eS=R.opaquePassEnabledForLayer()&&!eT.constantOr(1)&&1===ev.constantOr(eh.bo.transparent).a&&1===ex.constantOr(0)?"opaque":"translucent";if(R.renderPass===eS){let eh=R.getDepthModeForSublayer(1,"opaque"===R.renderPass?ei.ReadWrite:ei.ReadOnly);Mr(R,eu,em,e_,eh,ew,!1,eb)}if("translucent"===R.renderPass&&em.paint.get("fill-antialias")){let eh=R.getDepthModeForSublayer(em.getPaintProperty("fill-outline-color")?2:0,ei.ReadOnly);Mr(R,eu,em,e_,eh,ew,!0,eb)}},fillExtrusion:function(R,eh,eu,em,e_){let eg=eu.paint.get("fill-extrusion-opacity");if(0===eg)return;let{isRenderingToTexture:ev}=e_;if("translucent"===R.renderPass){let e_=new ei(R.context.gl.LEQUAL,ei.ReadWrite,R.depthRangeFor3D);if(1!==eg||eu.paint.get("fill-extrusion-pattern").constantOr(1))Sr(R,eh,eu,em,e_,ii.disabled,Yt.disabled,ev),Sr(R,eh,eu,em,e_,R.stencilModeFor3D(),R.colorModeForRenderPass(),ev);else{let eg=R.colorModeForRenderPass();Sr(R,eh,eu,em,e_,ii.disabled,eg,ev)}}},hillshade:function(R,eu,em,e_,eg){if("offscreen"!==R.renderPass&&"translucent"!==R.renderPass)return;let{isRenderingToTexture:ev}=eg,ex=R.context,eb=R.style.projection.useSubdivision,ew=R.getDepthModeForSublayer(0,ei.ReadOnly),eT=R.colorModeForRenderPass();if("offscreen"===R.renderPass)(function(R,eu,em,e_,eg,ev,ex){let eb=R.context,ew=eb.gl,eT="nearest"===e_.paint.get("resampling")?ew.NEAREST:ew.LINEAR;for(let eS of em){let em=eu.getTile(eS),eP=em.dem;if(!(null==eP?void 0:eP.data)||!em.needsHillshadePrepare)continue;let eI=eP.dim,eM=eP.stride,eE=eP.getPixels();if(eb.activeTexture.set(ew.TEXTURE1),eb.pixelStoreUnpackPremultiplyAlpha.set(!1),em.demTexture=em.demTexture||R.getTileTexture(eM),em.demTexture){let R=em.demTexture;R.update(eE,{premultiply:!1}),R.bind(ew.NEAREST,ew.CLAMP_TO_EDGE)}else em.demTexture=new eh.T(eb,eE,ew.RGBA,{premultiply:!1}),em.demTexture.bind(ew.NEAREST,ew.CLAMP_TO_EDGE);eb.activeTexture.set(ew.TEXTURE0);let eC=em.fbo;if(!eC){let R=new eh.T(eb,{width:eI,height:eI,data:null},ew.RGBA);R.bind(eT,ew.CLAMP_TO_EDGE),(eC=em.fbo=eb.createFramebuffer(eI,eI,!0,
54!1)).colorAttachment.set(R.texture)}eb.bindFramebuffer.set(eC.framebuffer),eb.viewport.set([0,0,eI,eI]),R.useProgram("hillshadePrepare").draw(eb,ew.TRIANGLES,eg,ev,ex,Jt.disabled,eo(em.tileID,eP),null,null,e_.id,R.rasterBoundsBuffer,R.quadTriangleIndexBuffer,R.rasterBoundsSegments),em.needsHillshadePrepare=!1}})(R,eu,e_,em,ew,ii.disabled,eT),ex.viewport.set([0,0,R.width,R.height]);else if("translucent"===R.renderPass){if(eb){let[eh,eg,ex]=R.stencilConfigForOverlapTwoPass(e_);Er(R,eu,em,ex,eh,ew,eT,!1,ev),Er(R,eu,em,ex,eg,ew,eT,!0,ev)}else{let[eh,eg]=R.getStencilConfigForOverlapAndUpdateStencilID(e_);Er(R,eu,em,eg,eh,ew,eT,!1,ev)}}},colorRelief:function(R,eh,eu,em,e_){if("translucent"!==R.renderPass||!em.length)return;let{isRenderingToTexture:eg}=e_,ev=R.style.projection.useSubdivision,ex=R.getDepthModeForSublayer(0,ei.ReadOnly),eb=R.colorModeForRenderPass();if(ev){let[e_,ev,ew]=R.stencilConfigForOverlapTwoPass(em);zr(R,eh,eu,ew,e_,ex,eb,!1,eg),zr(R,eh,eu,ew,ev,ex,eb,!0,eg)}else{let[e_,ev]=R.getStencilConfigForOverlapAndUpdateStencilID(em);zr(R,eh,eu,ev,e_,ex,eb,!1,eg)}},raster:function(R,eh,eu,em,e_){if("translucent"!==R.renderPass||0===eu.paint.get("raster-opacity")||!em.length)return;let{isRenderingToTexture:eg}=e_,ev=eh.getSource(),ex=R.style.projection.useSubdivision;if(ev instanceof ee)Dr(R,eh,eu,em,null,!1,!1,ev.tileCoords,ev.flippedWindingOrder,eg);else if(ex){let[e_,ev,ex]=R.stencilConfigForOverlapTwoPass(em);Dr(R,eh,eu,ex,e_,!1,!0,e6,!1,eg),Dr(R,eh,eu,ex,ev,!0,!0,e6,!1,eg)}else{let[e_,ev]=R.getStencilConfigForOverlapAndUpdateStencilID(em);Dr(R,eh,eu,ev,e_,!1,!0,e6,!1,eg)}},background:function(R,eh,eu,em,e_){var eg;let ev=eu.paint.get("background-color"),ex=eu.paint.get("background-opacity");if(0===ex)return;let{isRenderingToTexture:eb}=e_,ew=R.context,eT=ew.gl,eS=R.style.projection,eP=R.transform,eI=eP.tileSize,eM=eu.paint.get("background-pattern");if(R.isPatternMissing(eM))return;let eE=!eM&&1===ev.a&&1===ex&&R.opaquePassEnabledForLayer()?"opaque":"translucent";if(R.renderPass!==eE)return;let eC=ii.disabled,eA=R.getDepthModeForSublayer(0,"opaque"===eE?ei.ReadWrite:ei.ReadOnly),ez=R.colorModeForRenderPass(),eD=R.useProgram(eM?"backgroundPattern":"background"),ek=em||Ce(eP,{tileSize:eI,terrain:R.style.map.terrain});eM&&(ew.activeTexture.set(eT.TEXTURE0),R.imageManager.bind(R.context));let eR=eu.getCrossfadeParameters();for(let eh of ek){let em=eP.getProjectionData({overscaledTileID:eh,applyGlobeMatrix:!eb,applyTerrainMatrix:!0}),e_=eM?go(ex,R,eM,{tileID:eh,tileSize:eI},eR):fo(ex,ev),eE=null===(eg=R.style.map.terrain)||void 0===eg?void 0:eg.getTerrainData(eh),ek=eS.getMeshFromTileID(ew,eh.canonical,!1,!0,"raster");eD.draw(ew,eT.TRIANGLES,eA,eC,ez,Jt.backCCW,e_,eE,em,eu.id,ek.vertexBuffer,ek.indexBuffer,ek.segments)}},sky:function(R,eh){let eu=R.context,em=eu.gl,e_=((R,eh,eu)=>{let em=Math.cos(eh.rollInRadians),e_=Math.sin(eh.rollInRadians),eg=fe(eh),ev=eh.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:R.properties.get("sky-color"),u_horizon_color:R.properties.get("horizon-color"),u_horizon:[(eh.width/2-eg*e_)*eu,(eh.height/2+eg*em)*eu],u_horizon_normal:[-e_,em],u_sky_horizon_blend:R.properties.get("sky-horizon-blend")*eh.height/2*eu,u_sky_blend:ev}})(eh,R.style.map.transform,R.pixelRatio),eg=new ei(em.LEQUAL,ei.ReadWrite,[0,1]),ev=ii.disabled,ex=R.colorModeForRenderPass(),eb=R.useProgram("sky"),ew=Vr(eu,eh);eb.draw(eu,em.TRIANGLES,eg,ev,ex,Jt.disabled,e_,null,void 0,"sky",ew.vertexBuffer,ew.indexBuffer,ew.segments)},atmosphere:function(R,eu,em){let e_=R.context,eg=e_.gl,ev=R.useProgram("atmosphere"),ex=new ei(eg.LEQUAL,ei.ReadOnly,[0,1]),eb=R.transform,ew=function(R,eu){let em=R.properties.get("position"),e_=[-em.x,-em.y,-em.z],eg=eh.ap(new Float64Array(16));return"map"===R.properties.get("anchor")&&(eh.bf(eg,eg,eu.rollInRadians),eh.bg(eg,eg,-eu.pitchInRadians),eh.bf(eg,eg,eu.bearingInRadians),eh.bg(eg,eg,eu.center.lat*Math.PI/180),eh.bI(eg,eg,-eu.center.lng*Math.PI/180)),eh.cg(e_,e_,eg),e_}(em,R.transform),eT=eb.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),eS=eu.properties.get("atmosphere-blend")*eT.projectionTransition;if(0===eS)return;let eP=mi(eb.worldSize,eb.center.lat),eI=eb.inverseProjectionMatrix,eM=new Float64Array(4);eM[3]=1,eh.aF(eM,eM,eb.modelViewProjectionMatrix),eM[0]/=eM[3],eM[1]/=eM[3],eM[2]/=eM[3],eM[3]=1,eh.aF(eM,eM,eI),eM[0]/=eM[3],eM[1]/=eM[3],eM[2]/=eM[3],eM[3]=1;let eE={u_sun_pos:ew,u_atmosphere_blend:eS,u_globe_position:[eM[0],eM[1],eM[2]],u_globe_radius:eP,u_inv_proj_matrix:eI},eC=Vr(e_,eu);ev.draw(e_,eg.TRIANGLES,ex,ii.disabled,Yt.alphaBlended,Jt.disabled,eE,null,null,"atmosphere",eC.vertexBuffer,eC.indexBuffer,eC.segments)},custom:function(R,eh,eu,em){let{isRenderingGlobe:e_}=em,eg=R.context,ev=eu.implementation,ex=R.style.projection,eb=R.transform,ew=eb.getProjectionDataForCustomLayer(e_),eT={farZ:eb.farZ,nearZ:eb.nearZ,fov:eb.fov*Math.PI/180,modelViewProjectionMatrix:eb.modelViewProjectionMatrix,projectionMatrix:eb.projectionMatrix,shaderData:{variantName:ex.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 55uniform mat4 u_projection_matrix; 56${ex.shaderPreludeCode.vertexSource}`,define:ex.shaderDefine},defaultProjectionData:ew},eS=ev.renderingMode?ev.renderingMode:"2d";if("offscreen"===R.renderPass){let eh=ev.prerender;eh&&(R.setCustomLayerDefaults(),eg.setColorMode(R.colorModeForRenderPass()),eh.call(ev,eg.gl,eT),eg.setDirty(),R.setBaseState())}else if("translucent"===R.renderPass){R.setCustomLayerDefaults(),eg.setColorMode(R.colorModeForRenderPass()),eg.setStencilMode(ii.disabled);let eh="3d"===eS?R.getDepthModeFor3D():R.getDepthModeForSublayer(0,ei.ReadOnly);eg.setDepthMode(eh),ev.render(eg.gl,eT),eg.setDirty(),R.setBaseState(),eg.bindFramebuffer.set(null)}},debug:function(R,eu,em){for(let e_ of em)!function(R,eu,em){var e_;let eg=R.context,ev=eg.gl,ex=R.useProgram("debug"),eb=ei.disabled,ew=ii.disabled,eT=R.colorModeForRenderPass(),eS="$debug",eP=null===(e_=R.style.map.terrain)||void 0===e_?void 0:e_.getTerrainData(em);eg.activeTexture.set(ev.TEXTURE0);let eI=eu.getTileByID(em.key).latestRawTileData,eM=Math.floor(((null==eI?void 0:eI.byteLength)||0)/1024),eE=eu.getTile(em).tileSize,eC=512/Math.min(eE,512)*(em.overscaledZ/R.transform.zoom)*.5,eA=em.canonical.toString();em.overscaledZ!==em.canonical.z&&(eA+=` => ${em.overscaledZ}`),function(R,eh){R.initDebugOverlayCanvas();let eu=R.debugOverlayCanvas,em=R.context.gl,e_=R.debugOverlayCanvas.getContext("2d");e_.clearRect(0,0,eu.width,eu.height),e_.shadowColor="white",e_.shadowBlur=2,e_.lineWidth=1.5,e_.strokeStyle="white",e_.textBaseline="top",e_.font="bold 36px Open Sans, sans-serif",e_.fillText(eh,5,5),e_.strokeText(eh,5,5),R.debugOverlayTexture.update(eu),R.debugOverlayTexture.bind(em.LINEAR,em.CLAMP_TO_EDGE)}(R,`${eA} ${eM}kB`);
56let ez=R.transform.getProjectionData({overscaledTileID:em,applyGlobeMatrix:!0,applyTerrainMatrix:!0});ex.draw(eg,ev.TRIANGLES,eb,ew,Yt.alphaBlended,Jt.disabled,Ki(eh.bo.transparent,eC),null,ez,eS,R.debugBuffer,R.quadTriangleIndexBuffer,R.debugSegments),ex.draw(eg,ev.LINE_STRIP,eb,ew,eT,Jt.disabled,Ki(eh.bo.red),eP,ez,eS,R.debugBuffer,R.tileBorderIndexBuffer,R.debugSegments)}(R,eu,e_)},debugPadding:function(R){var eh,eu;let em=R.transform.padding;jr(R,R.transform.height-(em.top||0),3,e8),jr(R,em.bottom||0,3,e7),Nr(R,em.left||0,3,e9),Nr(R,R.transform.width-(em.right||0),3,tl);let e_=R.transform.centerPoint;eh=e_.x,eu=R.transform.height-e_.y,Zr(R,eh-1,eu-10,2,20,th),Zr(R,eh-10,eu-1,20,2,th)},terrainDepth:function(R,eu){let em=R.context,e_=em.gl,eg=R.transform,ev=Yt.unblended,ex=new ei(e_.LEQUAL,ei.ReadWrite,[0,1]),eb=eu.tileManager.getRenderableTiles(),ew=R.useProgram("terrainDepth");for(let eT of(em.bindFramebuffer.set(eu.getFramebuffer("depth").framebuffer),em.viewport.set([0,0,R.width/devicePixelRatio,R.height/devicePixelRatio]),em.clear({color:eh.bo.transparent,depth:1}),eb)){let R=eu.getTerrainMesh(eT.tileID),eh=eu.getTerrainData(eT.tileID),eb=eg.getProjectionData({overscaledTileID:eT.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),eS={u_ele_delta:eu.getMeshFrameDelta(eg.zoom)};ew.draw(em,e_.TRIANGLES,ex,ii.disabled,ev,Jt.backCCW,eS,eh,eb,"terrain",R.vertexBuffer,R.indexBuffer,R.segments)}em.bindFramebuffer.set(null),em.viewport.set([0,0,R.width,R.height])},terrainCoords:function(R,eu){let em=R.context,e_=em.gl,eg=R.transform,ev=Yt.unblended,ex=new ei(e_.LEQUAL,ei.ReadWrite,[0,1]),eb=eu.getCoordsTexture(),ew=eu.tileManager.getRenderableTiles(),eT=R.useProgram("terrainCoords");for(let eS of(em.bindFramebuffer.set(eu.getFramebuffer("coords").framebuffer),em.viewport.set([0,0,R.width/devicePixelRatio,R.height/devicePixelRatio]),em.clear({color:eh.bo.transparent,depth:1}),eu.coordsIndex=[],ew)){let R=eu.getTerrainMesh(eS.tileID),eh=eu.getTerrainData(eS.tileID);em.activeTexture.set(e_.TEXTURE0),e_.bindTexture(e_.TEXTURE_2D,eb.texture);let ew={u_terrain_coords_id:(255-eu.coordsIndex.length)/255,u_texture:0,u_ele_delta:eu.getMeshFrameDelta(eg.zoom)},eP=eg.getProjectionData({overscaledTileID:eS.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});eT.draw(em,e_.TRIANGLES,ex,ii.disabled,ev,Jt.backCCW,ew,eh,eP,"terrain",R.vertexBuffer,R.indexBuffer,R.segments),eu.coordsIndex.push(eS.tileID.key)}em.bindFramebuffer.set(null),em.viewport.set([0,0,R.width,R.height])}};let qr=class qr{constructor(R,eu){this.drawFunctions=tu,this.context=new nr(R),this.transform=eu,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:eh.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Le.maxOverzooming+Le.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new zt}resize(R,eh,eu){if(this.width=Math.floor(R*eu),this.height=Math.floor(eh*eu),this.pixelRatio=eu,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let R of this.style._order)this.style._layers[R].resize()}setup(){let R=this.context,eu=new eh.aV;eu.emplaceBack(0,0),eu.emplaceBack(eh.a6,0),eu.emplaceBack(0,eh.a6),eu.emplaceBack(eh.a6,eh.a6),this.tileExtentBuffer=R.createVertexBuffer(eu,eq.members),this.tileExtentSegments=eh.aW.simpleSegment(0,0,4,2);let em=new eh.aV;em.emplaceBack(0,0),em.emplaceBack(eh.a6,0),em.emplaceBack(0,eh.a6),em.emplaceBack(eh.a6,eh.a6),this.debugBuffer=R.createVertexBuffer(em,eq.members),this.debugSegments=eh.aW.simpleSegment(0,0,4,5);let e_=new eh.ch;e_.emplaceBack(0,0,0,0),e_.emplaceBack(eh.a6,0,eh.a6,0),e_.emplaceBack(0,eh.a6,0,eh.a6),e_.emplaceBack(eh.a6,eh.a6,eh.a6,eh.a6),this.rasterBoundsBuffer=R.createVertexBuffer(e_,e0.members),this.rasterBoundsSegments=eh.aW.simpleSegment(0,0,4,2);let eg=new eh.aV;eg.emplaceBack(0,0),eg.emplaceBack(eh.a6,0),eg.emplaceBack(0,eh.a6),eg.emplaceBack(eh.a6,eh.a6),this.rasterBoundsBufferPosOnly=R.createVertexBuffer(eg,eq.members),this.rasterBoundsSegmentsPosOnly=eh.aW.simpleSegment(0,0,4,5);let ev=new eh.aV;ev.emplaceBack(0,0),ev.emplaceBack(1,0),ev.emplaceBack(0,1),ev.emplaceBack(1,1),this.viewportBuffer=R.createVertexBuffer(ev,eq.members),this.viewportSegments=eh.aW.simpleSegment(0,0,4,2);let ex=new eh.ci;ex.emplaceBack(0),ex.emplaceBack(1),ex.emplaceBack(3),ex.emplaceBack(2),ex.emplaceBack(0),this.tileBorderIndexBuffer=R.createIndexBuffer(ex);let eb=new eh.aX;
56eb.emplaceBack(1,0,2),eb.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=R.createIndexBuffer(eb);let ew=this.context.gl;this.stencilClearMode=new ii({func:ew.ALWAYS,mask:0},0,255,ew.ZERO,ew.ZERO,ew.ZERO),this.tileExtentMesh=new Lt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let R=this.context,eu=R.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let em=eh.O();eh.c7(em,0,this.width,this.height,0,0,1),eh.S(em,em,[eu.drawingBufferWidth,eu.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(R,eu.TRIANGLES,ei.disabled,this.stencilClearMode,Yt.disabled,Jt.disabled,null,null,{mainMatrix:em,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:em},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(R,eh,eu){if(this.currentStencilSource===R.source||!R.isTileClipped()||!(null==eh?void 0:eh.length))return;this.currentStencilSource=R.source,this.nextStencilID+eh.length>256&&this.clearStencil();let em=this.context;em.setColorMode(Yt.disabled),em.setDepthMode(ei.disabled);let e_={};for(let R of eh)e_[R.key]=this.nextStencilID++;this._renderTileMasks(e_,eh,eu,!0),this._renderTileMasks(e_,eh,eu,!1),this._tileClippingMaskIDs=e_}_renderTileMasks(R,eh,eu,em){var e_;let eg=this.context,ev=eg.gl,ex=this.style.projection,eb=this.transform,ew=this.useProgram("clippingMask");for(let eT of eh){let eh=R[eT.key],eS=null===(e_=this.style.map.terrain)||void 0===e_?void 0:e_.getTerrainData(eT),eP=ex.getMeshFromTileID(this.context,eT.canonical,em,!0,"stencil"),eI=eb.getProjectionData({overscaledTileID:eT,applyGlobeMatrix:!eu,applyTerrainMatrix:!0});ew.draw(eg,ev.TRIANGLES,ei.disabled,new ii({func:ev.ALWAYS,mask:0},eh,255,ev.KEEP,ev.KEEP,ev.REPLACE),Yt.disabled,eu?Jt.disabled:Jt.backCCW,null,eS,eI,"$clipping",eP.vertexBuffer,eP.indexBuffer,eP.segments)}}_renderTilesDepthBuffer(){var R;let eh=this.context,eu=eh.gl,em=this.style.projection,e_=this.transform,eg=this.useProgram("depth"),ev=this.getDepthModeFor3D(),ex=Ce(e_,{tileSize:e_.tileSize});for(let eb of ex){let ex=null===(R=this.style.map.terrain)||void 0===R?void 0:R.getTerrainData(eb),ew=em.getMeshFromTileID(this.context,eb.canonical,!0,!0,"raster"),eT=e_.getProjectionData({overscaledTileID:eb,applyGlobeMatrix:!0,applyTerrainMatrix:!0});eg.draw(eh,eu.TRIANGLES,ev,ii.disabled,Yt.disabled,Jt.backCCW,null,ex,eT,"$clipping",ew.vertexBuffer,ew.indexBuffer,ew.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let R=this.nextStencilID++,eh=this.context.gl;return new ii({func:eh.NOTEQUAL,mask:255},R,255,eh.KEEP,eh.KEEP,eh.REPLACE)}stencilModeForClipping(R){let eh=this.context.gl;return new ii({func:eh.EQUAL,mask:255},this._tileClippingMaskIDs[R.key],0,eh.KEEP,eh.KEEP,eh.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(R){let eh=this.context.gl,eu=R.sort((R,eh)=>eh.overscaledZ-R.overscaledZ),em=eu[eu.length-1].overscaledZ,e_=eu[0].overscaledZ-em+1;if(e_>1){this.currentStencilSource=void 0,this.nextStencilID+e_>256&&this.clearStencil();let R={};for(let eu=0;eu<e_;eu++)R[eu+em]=new ii({func:eh.GEQUAL,mask:255},eu+this.nextStencilID,255,eh.KEEP,eh.KEEP,eh.REPLACE);return this.nextStencilID+=e_,[R,eu]}return[{[em]:ii.disabled},eu]}stencilConfigForOverlapTwoPass(R){let eh=this.context.gl,eu=R.sort((R,eh)=>eh.overscaledZ-R.overscaledZ),em=eu[eu.length-1].overscaledZ,e_=eu[0].overscaledZ-em+1;if(this.clearStencil(),e_>1){let R={},eg={};for(let eu=0;eu<e_;eu++)R[eu+em]=new ii({func:eh.GREATER,mask:255},e_+1+eu,255,eh.KEEP,eh.KEEP,eh.REPLACE),eg[eu+em]=new ii({func:eh.GREATER,mask:255},1+eu,255,eh.KEEP,eh.KEEP,eh.REPLACE);return this.nextStencilID=2*e_+1,[R,eg,eu]}return this.nextStencilID=3,[{[em]:new ii({func:eh.GREATER,mask:255},2,255,eh.KEEP,eh.KEEP,eh.REPLACE)},{[em]:new ii({func:eh.GREATER,mask:255},1,255,eh.KEEP,eh.KEEP,eh.REPLACE)},eu]}colorModeForRenderPass(){let R=this.context.gl;if(this._showOverdrawInspector){let eu=1/8;return new Yt([R.CONSTANT_COLOR,R.ONE],new eh.bo(eu,eu,eu,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Yt.unblended:Yt.alphaBlended}getDepthModeForSublayer(R,eh,eu){if(!this.opaquePassEnabledForLayer())return ei.disabled;let em=1-((1+this.currentLayer)*this.numSublayers+R)*this.depthEpsilon;return new ei(eu||this.context.gl.LEQUAL,eh,[em,em])}getDepthModeFor3D(){return new ei(this.context.gl.LEQUAL,ei.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(R,eu){var em,e_,eg;this.style=R,this.options=eu,this.lineAtlas=R.lineAtlas,this.imageManager=R.imageManager,this.glyphManager=R.glyphManager,this.symbolFadeChange=R.placement.symbolFadeChange(c()),this.imageManager.beginFrame();let ev=this.style._order,ex=this.style.tileManagers,eb={},ew={},eT={},eS={isRenderingToTexture:!1,isRenderingGlobe:(null===(em=R.projection)||void 0===em?void 0:em.transitionState)>0};for(let R in ex){let eh=ex[R];eh.used&&eh.prepare(this.context),eb[R]=eh.getVisibleCoordinates(!1),ew[R]=eb[R].slice().reverse(),eT[R]=eh.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let R=0;R<ev.length;R++)if(this.style._layers[ev[R]].is3D()){this.opaquePassCutoff=R;break}for(let R of(this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen",ev)){let eh=this.style._layers[R];if(!eh.hasOffscreenPass()||eh.isHidden(this.transform.zoom))continue;let eu=ew[eh.source];("custom"===eh.type||eu.length)&&this.renderLayer(this,ex[eh.source],eh,eu,eS)}if(null===(e_=this.style.projection)||void 0===e_||e_.updateGPUdependent({context:this.context,useProgram:R=>this.useProgram(R)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:eu.showOverdrawInspector?eh.bo.black:eh.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=eu.showOverdrawInspector,this.depthRangeFor3D=[0,1-(R._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=ev.length-1;this.currentLayer>=0;this.currentLayer--){let R=this.style._layers[ev[this.currentLayer]],eh=ex[R.source],eu=eb[R.source];this._renderTileClippingMasks(R,eu,!1),this.renderLayer(this,eh,R,eu,eS)}this.renderPass="translucent";let eP=!1;for(this.currentLayer=0;this.currentLayer<ev.length;this.currentLayer++){let R=this.style._layers[ev[this.currentLayer]],eh=ex[R.source];if(null===(eg=this.renderToTexture)||void 0===eg?void 0:eg.renderLayer(R,eS))continue;this.opaquePassEnabledForLayer()||eP||(eP=!0,eS.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let eu=("symbol"===R.type?eT:ew)[R.source];this._renderTileClippingMasks(R,eb[R.source],!!this.renderToTexture),this.renderLayer(this,eh,R,eu,eS)}if(eS.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let R=function(R,eh){let eu=null,em=Object.values(R._layers).flatMap(eu=>eu.source&&!eu.isHidden(eh)?[R.tileManagers[eu.source]]:[]),e_=em.filter(R=>"vector"===R.getSource().type),eg=em.filter(R=>"vector"!==R.getSource().type),s=R=>{(!eu||eu.getSource().maxzoom<R.getSource().maxzoom)&&(eu=R)};for(let R of e_)s(R);if(!eu)for(let R of eg)s(R);return eu}(this.style,this.transform.zoom);R&&this.drawFunctions.debug(this,R,R.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(R){var eu,em;if(!(null===(em=null===(eu=this.style)||void 0===eu?void 0:eu.map)||void 0===em?void 0:em.terrain))return;let e_=this.terrainFacilitator.matrix,eg=this.transform.modelViewProjectionMatrix,ev=this.terrainFacilitator.depthDirty;ev||(ev=R?!eh.cj(e_,eg):!eh.ck(e_,eg)),ev||(ev=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),ev&&(eh.cl(e_,eg),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var R,eh;(null===(eh=null===(R=this.style)||void 0===R?void 0:R.map)||void 0===eh?void 0:eh.terrain)&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(R,eu,em,e_,eg){if(em.isHidden(this.transform.zoom)||"background"!==em.type&&"custom"!==em.type&&!(e_||[]).length)return;this.id=em.id;let ev=this.drawFunctions;eh.aR(em)?ev.symbol(R,eu,em,e_,this.style.placement.variableOffsets,eg):eh.cm(em)?ev.circle(R,eu,em,e_,eg):eh.cn(em)?ev.heatmap(R,eu,em,e_,eg):eh.co(em)?ev.line(R,eu,em,e_,eg):eh.cp(em)?ev.fill(R,eu,em,e_,eg):eh.cq(em)?ev.fillExtrusion(R,eu,em,e_,eg):eh.cr(em)?ev.hillshade(R,eu,em,e_,eg):eh.cs(em)?ev.colorRelief(R,eu,em,e_,eg):eh.bU(em)?ev.raster(R,eu,em,e_,eg):eh.ct(em)?ev.background(R,eu,em,e_,eg):eh.cu(em)&&ev.custom(R,eu,em,eg)}saveTileTexture(R){let eh=this._tileTextures[R.size[0]];
56eh?eh.length<qr.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?eh.push(R):R.destroy():this._tileTextures[R.size[0]]=[R]}getTileTexture(R){let eh=this._tileTextures[R];return eh&&eh.length>0?eh.pop():null}isPatternMissing(R){if(!R)return!1;if(!R.from||!R.to)return!0;let eh=this.imageManager.getPattern(R.from.toString()),eu=this.imageManager.getPattern(R.to.toString());return!eh||!eu}useProgram(R,eh,eu=!1,em=[]){this.cache=this.cache||{};let e_=!!this.style.map.terrain,eg=this.style.projection,ev=eu?eZ.projectionMercator:eg.shaderPreludeCode,ex=eu?eW:eg.shaderDefine,eb=R+(eh?eh.cacheKey:"")+`/${eu?eX:eg.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(e_?"/terrain":"")+(em?`/${em.join("/")}`:"");return this.cache[eb]||(this.cache[eb]=new Ni(this.context,eZ[R],eh,e2[R],this._showOverdrawInspector,e_,ev,ex,em)),this.cache[eb]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let R=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(R.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new eh.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var R,eh;if(this._tileTextures){for(let R in this._tileTextures){let eh=this._tileTextures[R];if(eh)for(let R of eh)R.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(R=this.tileExtentMesh.vertexBuffer)||void 0===R||R.destroy()),this.tileExtentMesh&&(null===(eh=this.tileExtentMesh.indexBuffer)||void 0===eh||eh.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let R in this.cache){let eh=this.cache[R];(null==eh?void 0:eh.program)&&this.context.gl.deleteProgram(eh.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:R,drawingBufferHeight:eh}=this.context.gl;return this.width!==R||this.height!==eh}};function $r(R,eh){let eu,em=!1,e_=null,a=()=>{e_=null,em&&(R(...eu),e_=setTimeout(a,eh),em=!1)};return(...R)=>(em=!0,eu=R,e_||a(),e_)}qr.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;let Hr=class Hr{constructor(R){this._getCurrentHash=()=>{let R=window.location.hash.replace("#","");if(this._hashName){let eh;let eu=R.split("&").map(R=>R.split("="));for(let R of eu)R[0]===this._hashName&&(eh=R);return(eh&&eh[1]||"").split("/")}return R.split("/")},this._onHashChange=()=>{let R=this._getCurrentHash();if(!this._isValidHash(R))return!1;let eh=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(R[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+R[2],+R[1]],zoom:+R[0],bearing:eh,pitch:+(R[4]||0)}),!0},this._updateHashUnthrottled=()=>{let R=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,R)},this._removeHash=()=>{let R=this._getCurrentHash();if(0===R.length)return;let eh=R.join("/"),eu=eh;eu.split("&").length>0&&(eu=eu.split("&")[0]),this._hashName&&(eu=`${this._hashName}=${eh}`);let em=window.location.hash.replace(eu,"");em.startsWith("#&")?em=em.slice(0,1)+em.slice(2):"#"===em&&(em="");let e_=window.location.href.replace(/(#.+)?$/,em);e_=e_.replace("&&","&"),window.history.replaceState(window.history.state,null,e_)},this._updateHash=$r(this._updateHashUnthrottled,300),this._hashName=R&&encodeURIComponent(R)}addTo(R){return this._map=R,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(R){let eh=this._map.getCenter(),eu=Math.round(100*this._map.getZoom())/100,em=Math.pow(10,Math.ceil((eu*Math.LN2+Math.log(512/360/.5))/Math.LN10)),e_=Math.round(eh.lng*em)/em,eg=Math.round(eh.lat*em)/em,ev=this._map.getBearing(),ex=this._map.getPitch(),eb="";if(eb+=R?`/${e_}/${eg}/${eu}`:`${eu}/${eg}/${e_}`,(ev||ex)&&(eb+="/"+Math.round(10*ev)/10),ex&&(eb+=`/${Math.round(ex)}`),this._hashName){let R=this._hashName,eh=!1,eu=window.location.hash.slice(1).split("&").map(eu=>{let em=eu.split("=")[0];return em===R?(eh=!0,`${em}=${eb}`):eu}).filter(R=>R);return eh||eu.push(`${R}=${eb}`),`#${eu.join("&")}`}return`#${eb}`}_isValidHash(R){if(R.length<3||R.some(isNaN))return!1;try{new eh.W(+R[2],+R[1])}catch(R){return!1}let eu=+R[0],em=+(R[3]||0),e_=+(R[4]||0);return eu>=this._map.getMinZoom()&&eu<=this._map.getMaxZoom()&&em>=-180&&em<=180&&e_>=this._map.getMinPitch()&&e_<=this._map.getMaxPitch()}};let tc={linearity:.3,easing:eh.cv(0,0,.3,1)},tm=eh.e({deceleration:2500,maxSpeed:1400},tc),t_=eh.e({deceleration:20,maxSpeed:1400},tc),tg=eh.e({deceleration:1e3,maxSpeed:360},tc),tv=eh.e({deceleration:1e3,maxSpeed:90},tc),tx=eh.e({deceleration:1e3,maxSpeed:360},tc);let ta=class ta{constructor(R){this._map=R,this.clear()}clear(){this._inertiaBuffer=[]}record(R){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:R})}_drainInertiaBuffer(){let R=this._inertiaBuffer,eh=c();for(;R.length>0&&eh-R[0].time>160;)R.shift()}_onMoveEnd(R){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let eu={zoom:0,bearing:0,pitch:0,roll:0,pan:new eh.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:R}of this._inertiaBuffer)eu.zoom+=R.zoomDelta||0,eu.bearing+=R.bearingDelta||0,eu.pitch+=R.pitchDelta||0,eu.roll+=R.rollDelta||0,R.panDelta&&eu.pan._add(R.panDelta),R.around&&(eu.around=R.around),R.pinchAround&&(eu.pinchAround=R.pinchAround);let em=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,e_={};if(eu.pan.mag()){let eg=oa(eu.pan.mag(),em,eh.e({},tm,R||{})),ev=eu.pan.mult(eg.amount/eu.pan.mag()),ex=this._map.cameraHelper.handlePanInertia(ev,this._map.transform);e_.center=ex.easingCenter,e_.offset=ex.easingOffset,ia(e_,eg)}if(eu.zoom){let R=oa(eu.zoom,em,t_);e_.zoom=eh.cw(this._map.transform.zoom+R.amount,this._map.getZoomSnap(),R.amount),ia(e_,R)}if(eu.bearing){let R=oa(eu.bearing,em,tg);
56e_.bearing=this._map.transform.bearing+eh.al(R.amount,-179,179),ia(e_,R)}if(eu.pitch){let R=oa(eu.pitch,em,tv);e_.pitch=this._map.transform.pitch+R.amount,ia(e_,R)}if(eu.roll){let R=oa(eu.roll,em,tx);e_.roll=this._map.transform.roll+eh.al(R.amount,-179,179),ia(e_,R)}if(e_.zoom||e_.bearing){let R=void 0===eu.pinchAround?eu.around:eu.pinchAround;e_.around=R?this._map.unproject(R):this._map.getCenter()}return this.clear(),eh.e(e_,{noMoveStart:!0})}};function ia(R,eh){(!R.duration||R.duration<eh.duration)&&(R.duration=eh.duration,R.easing=eh.easing)}function oa(R,eu,em){let{maxSpeed:e_,linearity:eg,deceleration:ev}=em,ex=eh.al(R*eg/(eu/1e3),-e_,e_),eb=Math.abs(ex)/(ev*eg);return{easing:em.easing,duration:1e3*eb,amount:ex*(eb/2)}}let ra=class ra extends eh.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(R,eu,em,e_={}){em=em instanceof MouseEvent?em:new MouseEvent(R,em);let eg=d.mousePos(eu.getCanvas(),em),ev=eu.unproject(eg);super(R,eh.e({point:eg,lngLat:ev,originalEvent:em},e_)),this._defaultPrevented=!1,this.target=eu}};let aa=class aa extends eh.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(R,eu,em){let e_="touchend"===R?em.changedTouches:em.touches,eg=d.touchPos(eu.getCanvasContainer(),e_),ev=eg.map(R=>eu.unproject(R)),ex=eg.reduce((R,eh,eu,em)=>R.add(eh.div(em.length)),new eh.P(0,0));super(R,{points:eg,point:ex,lngLats:ev,lngLat:eu.unproject(ex),originalEvent:em}),this._defaultPrevented=!1}};let sa=class sa extends eh.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(R,eh,eu){super(R,{originalEvent:eu}),this._defaultPrevented=!1}};let na=class na{constructor(R,eh){this._map=R,this._clickTolerance=eh.clickTolerance}reset(){delete this._mousedownPos}wheel(R){return this._firePreventable(new sa(R.type,this._map,R))}mousedown(R,eh){return this._mousedownPos=eh,this._firePreventable(new ra(R.type,this._map,R))}mouseup(R){this._map.fire(new ra(R.type,this._map,R))}click(R,eh){this._mousedownPos&&this._mousedownPos.dist(eh)>=this._clickTolerance||this._map.fire(new ra(R.type,this._map,R))}dblclick(R){return this._firePreventable(new ra(R.type,this._map,R))}mouseover(R){this._map.fire(new ra(R.type,this._map,R))}mouseout(R){this._map.fire(new ra(R.type,this._map,R))}touchstart(R){return this._firePreventable(new aa(R.type,this._map,R))}touchmove(R){this._map.fire(new aa(R.type,this._map,R))}touchend(R){this._map.fire(new aa(R.type,this._map,R))}touchcancel(R){this._map.fire(new aa(R.type,this._map,R))}_firePreventable(R){if(this._map.fire(R),R.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};let la=class la{constructor(R){this._map=R}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(R){this._map.fire(new ra(R.type,this._map,R))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ra("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(R){this._delayContextMenu?this._contextMenuEvent=R:this._ignoreContextMenu||this._map.fire(new ra(R.type,this._map,R)),this._map.listens("contextmenu")&&R.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};let ca=class ca{constructor(R){this._map=R}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(R){return this.transform.screenPointToLocation(eh.P.convert(R),this._map.terrain)}};let ha=class ha{constructor(R,eh){this._map=R,this._tr=new ca(R),this._el=R.getCanvasContainer(),this._container=R.getContainer(),this._clickTolerance=eh.clickTolerance||1,eh.boxZoom&&"object"==typeof eh.boxZoom&&(this._boxZoomEnd=eh.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(R,eh){this.isEnabled()&&R.shiftKey&&0===R.button&&(d.disableDrag(),this._startPos=this._lastPos=eh,this._active=!0)}mousemoveWindow(R,eh){if(!this._active||this._lastPos.equals(eh)||!this._box&&eh.dist(this._startPos)<this._clickTolerance)return;let eu=this._startPos;this._lastPos=eh,this._box||(this._box=d.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",R));let em=Math.min(eu.x,eh.x),e_=Math.max(eu.x,eh.x),eg=Math.min(eu.y,eh.y),ev=Math.max(eu.y,eh.y);this._box.style.transform=`translate(${em}px,${eg}px)`,this._box.style.width=e_-em+"px",this._box.style.height=ev-eg+"px"}mouseupWindow(R,eu){if(!this._active||0!==R.button)return;let em=this._startPos;if(this.reset(),d.suppressClick(),em.x!==eu.x||em.y!==eu.y)return this._map.fire(new eh.n("boxzoomend",{originalEvent:R})),this._boxZoomEnd?void this._boxZoomEnd(this._map,em,eu,R):{cameraAnimation:R=>R.fitScreenCoordinates(em,eu,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",R)}keydown(R){this._active&&27===R.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",R))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),d.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(R,eu){return this._map.fire(new eh.n(R,{originalEvent:eu}))}};function ua(R,eh){if(R.length!==eh.length)throw Error(`The number of touches and points are not equal - touches ${R.length}, points ${eh.length}`);let eu={};for(let em=0;em<R.length;em++)eu[R[em].identifier]=eh[em];return eu}let da=class da{constructor(R){this.reset(),this.numTouches=R.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(R,eu,em){(this.centroid||em.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=R.timeStamp),em.length===this.numTouches&&(this.centroid=function(R){let eu=new eh.P(0,0);for(let eh of R)eu._add(eh);return eu.div(R.length)}(eu),this.touches=ua(em,eu)))}touchmove(R,eh,eu){if(this.aborted||!this.centroid)return;let em=ua(eu,eh);
56for(let R in this.touches){let eh=em[R];(!eh||eh.dist(this.touches[R])>30)&&(this.aborted=!0)}}touchend(R,eh,eu){if((!this.centroid||R.timeStamp-this.startTime>500)&&(this.aborted=!0),0===eu.length){let R=!this.aborted&&this.centroid;if(this.reset(),R)return R}}};let _a=class _a{constructor(R){this.singleTap=new da(R),this.numTaps=R.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(R,eh,eu){this.singleTap.touchstart(R,eh,eu)}touchmove(R,eh,eu){this.singleTap.touchmove(R,eh,eu)}touchend(R,eh,eu){let em=this.singleTap.touchend(R,eh,eu);if(em){let eh=R.timeStamp-this.lastTime<500,eu=!this.lastTap||30>this.lastTap.dist(em);if(eh&&eu||this.reset(),this.count++,this.lastTime=R.timeStamp,this.lastTap=em,this.count===this.numTaps)return this.reset(),em}}};let pa=class pa{constructor(R){this._tr=new ca(R),this._zoomIn=new _a({numTouches:1,numTaps:2}),this._zoomOut=new _a({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(R,eh,eu){this._zoomIn.touchstart(R,eh,eu),this._zoomOut.touchstart(R,eh,eu)}touchmove(R,eh,eu){this._zoomIn.touchmove(R,eh,eu),this._zoomOut.touchmove(R,eh,eu)}touchend(R,eu,em){let e_=this._zoomIn.touchend(R,eu,em),eg=this._zoomOut.touchend(R,eu,em),ev=this._tr;return e_?(this._active=!0,R.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:eu=>eu.easeTo({duration:300,zoom:eh.cw(ev.zoom+1,eu.getZoomSnap()),around:ev.unproject(e_)},{originalEvent:R})}):eg?(this._active=!0,R.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:eu=>eu.easeTo({duration:300,zoom:eh.cw(ev.zoom-1,eu.getZoomSnap()),around:ev.unproject(eg)},{originalEvent:R})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};let ma=class ma{constructor(R){this._enabled=!!R.enable,this._moveStateManager=R.moveStateManager,this._clickTolerance=R.clickTolerance||1,this._moveFunction=R.move,this._activateOnStart=!!R.activateOnStart,R.assignEvents(this),this.reset()}reset(R){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(R)}_move(...R){let eh=this._moveFunction(...R);if(eh.bearingDelta||eh.pitchDelta||eh.rollDelta||eh.around||eh.panDelta)return this._active=!0,eh}dragStart(R,eh){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(R)&&(this._moveStateManager.startMove(R),this._lastPoint=Array.isArray(eh)?eh[0]:eh,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(R,eh){if(!this.isEnabled())return;let eu=this._lastPoint;if(!eu)return;if(R.preventDefault(),!this._moveStateManager.isValidMoveEvent(R))return void this.reset(R);let em=Array.isArray(eh)?eh[0]:eh;return!this._moved&&em.dist(eu)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=em,this._move(eu,em))}dragEnd(R){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(R)&&(this._moved&&d.suppressClick(),this.reset(R))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};let tb={0:1,2:2};let xa=class xa{constructor(R){this._correctEvent=R.checkCorrectEvent}startMove(R){this._eventButton=R.button}endMove(R){delete this._eventButton}isValidStartEvent(R){return this._correctEvent(R)}isValidMoveEvent(R){return!function(R,eh){let eu=tb[eh];return void 0===R.buttons||(R.buttons&eu)!==eu}(R,this._eventButton)}isValidEndEvent(R){return R.button===this._eventButton}};let ba=class ba{constructor(){this._firstTouch=void 0}_isOneFingerTouch(R){return 1===R.targetTouches.length}_isSameTouchEvent(R){return R.targetTouches[0].identifier===this._firstTouch}startMove(R){this._firstTouch=R.targetTouches[0].identifier}endMove(R){delete this._firstTouch}isValidStartEvent(R){return this._isOneFingerTouch(R)}isValidMoveEvent(R){return this._isOneFingerTouch(R)&&this._isSameTouchEvent(R)}isValidEndEvent(R){return this._isOneFingerTouch(R)&&this._isSameTouchEvent(R)}};let ya=class ya{constructor(R=new xa({checkCorrectEvent:()=>!0}),eh=new ba){this.mouseMoveStateManager=R,this.oneFingerTouchMoveStateManager=eh}_executeRelevantHandler(R,eh,eu){return R instanceof MouseEvent?eh(R):"undefined"!=typeof TouchEvent&&R instanceof TouchEvent?eu(R):void 0}startMove(R){this._executeRelevantHandler(R,R=>{this.mouseMoveStateManager.startMove(R)},R=>{this.oneFingerTouchMoveStateManager.startMove(R)})}
56endMove(R){this._executeRelevantHandler(R,R=>{this.mouseMoveStateManager.endMove(R)},R=>{this.oneFingerTouchMoveStateManager.endMove(R)})}isValidStartEvent(R){return this._executeRelevantHandler(R,R=>this.mouseMoveStateManager.isValidStartEvent(R),R=>this.oneFingerTouchMoveStateManager.isValidStartEvent(R))}isValidMoveEvent(R){return this._executeRelevantHandler(R,R=>this.mouseMoveStateManager.isValidMoveEvent(R),R=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(R))}isValidEndEvent(R){return this._executeRelevantHandler(R,R=>this.mouseMoveStateManager.isValidEndEvent(R),R=>this.oneFingerTouchMoveStateManager.isValidEndEvent(R))}};let wa=R=>{R.mousedown=R.dragStart,R.mousemoveWindow=R.dragMove,R.mouseup=R.dragEnd,R.contextmenu=R=>{R.preventDefault()}};let Ta=class Ta{constructor(R,eh){this._clickTolerance=R.clickTolerance||1,this._map=eh,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new eh.P(0,0)}_shouldBePrevented(R){return R<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(R,eh,eu){return this._calculateTransform(R,eh,eu)}touchmove(R,eh,eu){if(this._active){if(!this._shouldBePrevented(eu.length))return R.preventDefault(),this._calculateTransform(R,eh,eu);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",R)}}touchend(R,eh,eu){this._calculateTransform(R,eh,eu),this._active&&this._shouldBePrevented(eu.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(R,eu,em){em.length>0&&(this._active=!0);let e_=ua(em,eu),eg=new eh.P(0,0),ev=new eh.P(0,0),ex=0;for(let R in e_){let eh=e_[R],eu=this._touches[R];eu&&(eg._add(eh),ev._add(eh.sub(eu)),ex++,e_[R]=eh)}if(this._touches=e_,this._shouldBePrevented(ex)||!ev.mag())return;let eb=ev.div(ex);return this._sum._add(eb),this._sum.mag()<this._clickTolerance?void 0:{around:eg.div(ex),panDelta:eb}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};let Pa=class Pa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(R,eh,eu){this._firstTwoTouches||eu.length<2||(this._firstTwoTouches=[eu[0].identifier,eu[1].identifier],this._start([eh[0],eh[1]]))}touchmove(R,eh,eu){if(!this._firstTwoTouches)return;R.preventDefault();let[em,e_]=this._firstTwoTouches,eg=Ca(eu,eh,em),ev=Ca(eu,eh,e_);if(!eg||!ev)return;let ex=this._aroundCenter?null:eg.add(ev).div(2);return this._move([eg,ev],ex,R)}touchend(R,eh,eu){if(!this._firstTwoTouches)return;let[em,e_]=this._firstTwoTouches,eg=Ca(eu,eh,em),ev=Ca(eu,eh,e_);eg&&ev||(this._active&&d.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(R){this._enabled=!0,this._aroundCenter=!!R&&"center"===R.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Ca(R,eh,eu){for(let em=0;em<R.length;em++)if(R[em].identifier===eu)return eh[em]}function Ia(R,eh){return Math.log(R/eh)/Math.LN2}let Ma=class Ma extends Pa{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(R){this._zoomRate=null!=R?R:1}setZoomThreshold(R){this._zoomThreshold=null!=R?R:.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(R){this._startDistance=this._distance=R[0].dist(R[1])}_move(R,eh){let eu=this._distance;if(this._distance=R[0].dist(R[1]),this._active||!(Math.abs(Ia(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Ia(this._distance,eu)*this._zoomRate,pinchAround:eh}}};function Sa(R,eh){return 180*R.angleWith(eh)/Math.PI}let Ea=class Ea extends Pa{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(R){this._startVector=this._vector=R[0].sub(R[1]),this._minDiameter=R[0].dist(R[1])}_move(R,eh,eu){let em=this._vector;if(this._vector=R[0].sub(R[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Sa(this._vector,em),pinchAround:eh}}_isBelowThreshold(R){this._minDiameter=Math.min(this._minDiameter,R.mag());let eh=25/(Math.PI*this._minDiameter)*360,eu=Sa(R,this._startVector);return Math.abs(eu)<eh}};function za(R){return Math.abs(R.y)>Math.abs(R.x)}let Ra=class Ra extends Pa{constructor(R){super(),this._currentTouchCount=0,this._map=R}
56reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(R,eh,eu){super.touchstart(R,eh,eu),this._currentTouchCount=eu.length}_start(R){this._lastPoints=R,za(R[0].sub(R[1]))&&(this._valid=!1)}_move(R,eh,eu){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let em=R[0].sub(this._lastPoints[0]),e_=R[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(em,e_,eu.timeStamp),this._valid?(this._lastPoints=R,this._active=!0,{pitchDelta:-((em.y+e_.y)/2*.5)}):void 0}gestureBeginsVertically(R,eh,eu){if(void 0!==this._valid)return this._valid;let em=R.mag()>=2,e_=eh.mag()>=2;if(!em&&!e_)return;if(!em||!e_)return void 0===this._firstMove&&(this._firstMove=eu),eu-this._firstMove<100&&void 0;let eg=R.y>0==eh.y>0;return za(R)&&za(eh)&&eg}};let Aa=class Aa{constructor(R){this._tr=new ca(R),this._panStep=100,this._bearingStep=15,this._pitchStep=10,this._rotationDisabled=!1}reset(){this._active=!1}keydown(R){if(R.altKey||R.ctrlKey||R.metaKey)return;let eu=0,em=0,e_=0,eg=0,ev=0;switch(R.keyCode){case 61:case 107:case 171:case 187:eu=1;break;case 189:case 109:case 173:eu=-1;break;case 37:R.shiftKey?em=-1:(R.preventDefault(),eg=-1);break;case 39:R.shiftKey?em=1:(R.preventDefault(),eg=1);break;case 38:R.shiftKey?e_=1:(R.preventDefault(),ev=-1);break;case 40:R.shiftKey?e_=-1:(R.preventDefault(),ev=1);break;default:return}return this._rotationDisabled&&(em=0,e_=0),{cameraAnimation:ex=>{let eb=this._tr;ex.easeTo({duration:300,easeId:"keyboardHandler",easing:La,zoom:eu?eh.cw(eb.zoom+eu*(R.shiftKey?2:1),ex.getZoomSnap()):eb.zoom,bearing:eb.bearing+em*this._bearingStep,pitch:eb.pitch+e_*this._pitchStep,offset:[-eg*this._panStep,-ev*this._panStep],center:eb.center},{originalEvent:R})}}}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 La(R){return R*(2-R)}let tw=1/450;let Ba=class Ba{constructor(R,eh){this._onTimeout=R=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(R)},this._map=R,this._tr=new ca(R),this._triggerRenderFrame=eh,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=tw}setZoomRate(R){this._defaultZoomRate=R}setWheelZoomRate(R){this._wheelZoomRate=R}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(R){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!R&&"center"===R.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(R){return!!this._map.cooperativeGestures.isEnabled()&&!(R.ctrlKey||this._map.cooperativeGestures.isBypassed(R))}wheel(R){if(!this.isEnabled())return;if(this._shouldBePrevented(R))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",R);let eh=R.deltaMode===WheelEvent.DOM_DELTA_LINE?40*R.deltaY:R.deltaY,eu=c(),em=eu-(this._lastWheelEventTime||0);this._lastWheelEventTime=eu,0!==eh&&eh%4.000244140625==0?this._type="wheel":0!==eh&&4>Math.abs(eh)?this._type="trackpad":em>400?(this._type=null,this._lastValue=eh,this._timeout=setTimeout(this._onTimeout,40,R)):this._type||(this._type=200>Math.abs(em*eh)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,eh+=this._lastValue)),R.shiftKey&&eh&&(eh/=4),this._type&&(this._lastWheelEvent=R,this._delta-=eh,this._active||this._start(R)),R.preventDefault()}_start(R){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let eu=d.mousePos(this._map.getCanvas(),R),em=this._tr;this._aroundPoint=this._aroundCenter?em.transform.locationToScreenPoint(eh.W.convert(em.center)):eu,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let R=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let eh=R.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=eh),"number"==typeof this._targetZoom&&(this._targetZoom+=eh)}if(0!==this._delta){let eu="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,em=2/(1+Math.exp(-Math.abs(this._delta*eu)));this._delta<0&&0!==em&&(em=1/em);let e_="number"!=typeof this._targetZoom?R.scale:eh.ao(this._targetZoom),eg=R.applyConstrain(R.getCameraLngLat(),eh.ar(e_*em)).zoom,ev=this._map.getZoomSnap();if("wheel"===this._type&&ev>0){let eu=eh.cw(R.zoom,ev);this._targetZoom=eh.cw(eg,ev,eg-eu)}else this._targetZoom=eg;"wheel"===this._type&&(this._startZoom=R.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let eu="number"!=typeof this._targetZoom?R.zoom:this._targetZoom,em=this._startZoom,e_=this._easing,eg,ev=!1;if("wheel"===this._type&&em&&e_){let R=c()-this._lastWheelEventTime,ex=Math.min((R+5)/200,1),eb=e_(ex);eg=eh.H.number(em,eu,eb),ex<1?this._frameId||(this._frameId=!0):ev=!0}else eg=eu,ev=!0;return this._active=!0,ev&&(this._active=!1,this._finishTimeout=setTimeout(()=>
56{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=eg,{noInertia:!0,needsRenderFrame:!ev,zoomDelta:eg-R.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(R){let eu=eh.cy;if(this._prevEase){let R=this._prevEase,em=(c()-R.start)/R.duration,e_=R.easing(em+.01)-R.easing(em),eg=.27/Math.sqrt(e_*e_+1e-4)*.01,ev=Math.sqrt(.0729-eg*eg);eu=eh.cv(eg,ev,.25,1)}return this._prevEase={start:c(),duration:R,easing:eu},eu}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};let Oa=class Oa{constructor(R,eh){this._clickZoom=R,this._tapZoom=eh}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()}};let ja=class ja{constructor(R){this._tr=new ca(R),this.reset()}reset(){this._active=!1}dblclick(R,eu){return R.preventDefault(),{cameraAnimation:em=>{em.easeTo({duration:300,zoom:eh.cw(this._tr.zoom+(R.shiftKey?-1:1),em.getZoomSnap()),around:this._tr.unproject(eu)},{originalEvent:R})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};let Na=class Na{constructor(){this._tap=new _a({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(R){this._zoomRate=null!=R?R:1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(R,eh,eu){if(!this._swipePoint){if(this._tapTime){let em=eh[0],e_=R.timeStamp-this._tapTime<500,eg=30>this._tapPoint.dist(em);e_&&eg?eu.length>0&&(this._swipePoint=em,this._swipeTouch=eu[0].identifier):this.reset()}else this._tap.touchstart(R,eh,eu)}}touchmove(R,eh,eu){if(this._tapTime){if(this._swipePoint){if(eu[0].identifier!==this._swipeTouch)return;let em=eh[0],e_=em.y-this._swipePoint.y;return this._swipePoint=em,R.preventDefault(),this._active=!0,{zoomDelta:e_/128*this._zoomRate}}}else this._tap.touchmove(R,eh,eu)}touchend(R,eh,eu){if(this._tapTime)this._swipePoint&&0===eu.length&&this.reset();else{let em=this._tap.touchend(R,eh,eu);em&&(this._tapTime=R.timeStamp,this._tapPoint=em)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};let Za=class Za{constructor(R,eh,eu){this._el=R,this._mousePan=eh,this._touchPan=eu}enable(R){this._inertiaOptions=R||{},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()}};let Ua=class Ua{constructor(R,eh,eu,em){this._pitchWithRotate=R.pitchWithRotate,this._rollEnabled=R.rollEnabled,this._mouseRotate=eh,this._mousePitch=eu,this._mouseRoll=em}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()}};let Ga=class Ga{constructor(R,eh,eu,em){this._el=R,this._touchZoom=eh,this._touchRotate=eu,this._tapDragZoom=em,this._rotationDisabled=!1,this._enabled=!0}enable(R){this._touchZoom.enable(R),this._rotationDisabled||this._touchRotate.enable(R),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(R){this._touchZoom.setZoomRate(R),this._tapDragZoom.setZoomRate(R)}setZoomThreshold(R){this._touchZoom.setZoomThreshold(R)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}};let Va=class Va{constructor(R,eh){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=R,this._options=eh,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let R=this._map.getCanvasContainer();
56R.classList.add("maplibregl-cooperative-gestures"),this._container=d.create("div","maplibregl-cooperative-gesture-screen",R);let eh=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(eh=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let eu=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),em=document.createElement("div");em.className="maplibregl-desktop-message",em.textContent=eh,this._container.appendChild(em);let e_=document.createElement("div");e_.className="maplibregl-mobile-message",e_.textContent=eu,this._container.appendChild(e_),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(R){return R[this._bypassKey]}notifyGestureBlocked(R,eu){this._enabled&&(this._map.fire(new eh.n("cooperativegestureprevented",{gestureType:R,originalEvent:eu})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};let Wa=R=>R.zoom||R.drag||R.roll||R.pitch||R.rotate;let qa=class qa extends eh.n{};function $a(R){var eh;return(null===(eh=R.panDelta)||void 0===eh?void 0:eh.mag())||R.zoomDelta||R.bearingDelta||R.pitchDelta||R.rollDelta}let Ha=class Ha{get _ownerDocument(){var R;return(null===(R=this._el)||void 0===R?void 0:R.ownerDocument)||document}get _ownerWindow(){var R,eh;return(null===(eh=null===(R=this._el)||void 0===R?void 0:R.ownerDocument)||void 0===eh?void 0:eh.defaultView)||window}constructor(R,eu){this.handleWindowEvent=R=>{this.handleEvent(R,`${R.type}Window`)},this.handleEvent=(R,eu)=>{if("blur"===R.type)return void this.stop(!0);this._updatingCamera=!0;let em="renderFrame"===R.type?void 0:R,e_={needsRenderFrame:!1},eg={},ev={};for(let{handlerName:ex,handler:eb,allowed:ew}of this._handlers){let eT;if(eb.isEnabled()){if(this._blockedByActive(ev,ew,ex))eb.reset();else if(eb[eu||R.type]){if(eh.cz(R,eu||R.type)){let eh=d.mousePos(this._map.getCanvas(),R);eT=eb[eu||R.type](R,eh)}else if(eh.cA(R,eu||R.type)){let eh=this._getMapTouches(R.touches),em=d.touchPos(this._map.getCanvas(),eh);eT=eb[eu||R.type](R,em,eh)}else eh.cB(eu||R.type)||(eT=eb[eu||R.type](R));this.mergeHandlerResult(e_,eg,eT,ex,em),(null==eT?void 0:eT.needsRenderFrame)&&this._triggerRenderFrame()}(eT||eb.isActive())&&(ev[ex]=eb)}}let ex={};for(let R in this._previousActiveHandlers)ev[R]||(ex[R]=em);this._previousActiveHandlers=ev,(Object.keys(ex).length||$a(e_))&&(this._changes.push([e_,eg,ex]),this._triggerRenderFrame()),(Object.keys(ev).length||$a(e_))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:eb}=e_;eb&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],eb(this._map))},this._map=R,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ta(R),this._bearingSnap=eu.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(eu);let em=this._el;for(let[R,eh,eu]of(this._listeners=[[em,"touchstart",{passive:!0}],[em,"touchmove",{passive:!1}],[em,"touchend",void 0],[em,"touchcancel",void 0],[em,"mousedown",void 0],[em,"mousemove",void 0],[em,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[em,"mouseover",void 0],[em,"mouseout",void 0],[em,"dblclick",void 0],[em,"click",void 0],[em,"keydown",{capture:!1}],[em,"keyup",void 0],[em,"wheel",{passive:!1}],[em,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))R.addEventListener(eh,R===this._ownerDocument?this.handleWindowEvent:this.handleEvent,eu)}destroy(){for(let[R,eh,eu]of this._listeners)R.removeEventListener(eh,R===this._ownerDocument?this.handleWindowEvent:this.handleEvent,eu)}_addDefaultHandlers(R){let eu=this._map,em=eu.getCanvasContainer();this._add("mapEvent",new na(eu,R));let e_=eu.boxZoom=new ha(eu,R);this._add("boxZoom",e_),R.interactive&&R.boxZoom&&e_.enable();let eg=eu.cooperativeGestures=new Va(eu,R.cooperativeGestures);this._add("cooperativeGestures",eg),R.cooperativeGestures&&eg.enable();let ev=new pa(eu),ex=new ja(eu);eu.doubleClickZoom=new Oa(ex,ev),this._add("tapZoom",ev),this._add("clickZoom",ex),R.interactive&&R.doubleClickZoom&&eu.doubleClickZoom.enable();let eb=new Na;this._add("tapDragZoom",eb);let ew=eu.touchPitch=new Ra(eu);this._add("touchPitch",ew),R.interactive&&R.touchPitch&&eu.touchPitch.enable(R.touchPitch);let h=()=>eu.project(eu.getCenter()),eT=function({enable:R,clickTolerance:eu,aroundCenter:em=!0,minPixelCenterThreshold:e_=100,rotateDegreesPerPixelMoved:eg=.8},ev){let ex=new xa({checkCorrectEvent:R=>0===R.button&&R.ctrlKey||2===R.button&&!R.ctrlKey});return new ma({clickTolerance:eu,move:(R,eu)=>{let ex=ev();if(em&&Math.abs(ex.y-R.y)>e_)return{bearingDelta:eh.cx(new eh.P(R.x,eu.y),eu,ex)};let eb=(eu.x-R.x)*eg;return em&&eu.y<ex.y&&(eb=-eb),{bearingDelta:eb}},moveStateManager:ex,enable:R,assignEvents:wa})}(R,h),eS=function({enable:R,clickTolerance:eh,pitchDegreesPerPixelMoved:eu=-.5}){let em=new xa({checkCorrectEvent:R=>0===R.button&&R.ctrlKey||2===R.button});return new ma({clickTolerance:eh,move:(R,eh)=>({pitchDelta:(eh.y-R.y)*eu}),moveStateManager:em,enable:R,assignEvents:wa})}(R),eP=function({enable:R,clickTolerance:eh,rollDegreesPerPixelMoved:eu=.3},em){let e_=new xa({checkCorrectEvent:R=>2===R.button&&R.ctrlKey});return new ma({clickTolerance:eh,move:(R,eh)=>{let e_=em(),eg=(eh.x-R.x)*eu;return eh.y<e_.y&&(eg=-eg),{rollDelta:eg}},moveStateManager:e_,enable:R,assignEvents:wa})}(R,h);eu.dragRotate=new Ua(R,eT,eS,eP),this._add("mouseRotate",eT,["mousePitch"]),this._add("mousePitch",eS,["mouseRotate","mouseRoll"]),this._add("mouseRoll",eP,["mousePitch"]),R.interactive&&R.dragRotate&&eu.dragRotate.enable();let eI=function({enable:R,clickTolerance:eh}){let eu=new xa({checkCorrectEvent:R=>0===R.button&&!R.ctrlKey});return new ma({clickTolerance:eh,move:(R,eh)=>({around:eh,panDelta:eh.sub(R)}),activateOnStart:!0,moveStateManager:eu,enable:R,assignEvents:wa})}(R),eM=new Ta(R,eu);eu.dragPan=new Za(em,eI,eM),this._add("mousePan",eI),this._add("touchPan",eM,["touchZoom","touchRotate"]),R.interactive&&R.dragPan&&eu.dragPan.enable(R.dragPan);let eE=new Ea,eC=new Ma;eu.touchZoomRotate=new Ga(em,eC,eE,eb),this._add("touchRotate",eE,["touchPan","touchZoom"]),this._add("touchZoom",eC,["touchPan","touchRotate"]),R.interactive&&R.touchZoomRotate&&eu.touchZoomRotate.enable(R.touchZoomRotate),this._add("blockableMapEvent",new la(eu));let eA=eu.scrollZoom=new Ba(eu,()=>
56this._triggerRenderFrame());this._add("scrollZoom",eA,["mousePan"]),R.interactive&&R.scrollZoom&&eu.scrollZoom.enable(R.scrollZoom);let ez=eu.keyboard=new Aa(eu);this._add("keyboard",ez),R.interactive&&R.keyboard&&eu.keyboard.enable()}_add(R,eh,eu){this._handlers.push({handlerName:R,handler:eh,allowed:eu}),this._handlersById[R]=eh}stop(R){if(!this._updatingCamera){for(let{handler:R}of this._handlers)R.reset();this._inertia.clear(),this._fireEvents({},{},R),this._changes=[]}}isActive(){for(let{handler:R}of this._handlers)if(R.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Wa(this._eventsInProgress)||this.isZooming()}_blockedByActive(R,eh,eu){for(let em in R)if(em!==eu&&!(null==eh?void 0:eh.includes(em)))return!0;return!1}_getMapTouches(R){let eh=[];for(let eu of R)this._el.contains(eu.target)&&eh.push(eu);return eh}mergeHandlerResult(R,eu,em,e_,eg){if(!em)return;eh.e(R,em);let ev={handlerName:e_,originalEvent:em.originalEvent||eg};void 0!==em.zoomDelta&&(eu.zoom=ev),void 0!==em.panDelta&&(eu.drag=ev),void 0!==em.rollDelta&&(eu.roll=ev),void 0!==em.pitchDelta&&(eu.pitch=ev),void 0!==em.bearingDelta&&(eu.rotate=ev)}_applyChanges(){let R={},eu={},em={};for(let[e_,eg,ev]of this._changes)e_.panDelta&&(R.panDelta=(R.panDelta||new eh.P(0,0))._add(e_.panDelta)),e_.zoomDelta&&(R.zoomDelta=(R.zoomDelta||0)+e_.zoomDelta),e_.bearingDelta&&(R.bearingDelta=(R.bearingDelta||0)+e_.bearingDelta),e_.pitchDelta&&(R.pitchDelta=(R.pitchDelta||0)+e_.pitchDelta),e_.rollDelta&&(R.rollDelta=(R.rollDelta||0)+e_.rollDelta),void 0!==e_.around&&(R.around=e_.around),void 0!==e_.pinchAround&&(R.pinchAround=e_.pinchAround),e_.noInertia&&(R.noInertia=e_.noInertia),eh.e(eu,eg),eh.e(em,ev);this._updateMapTransform(R,eu,em),this._changes=[]}_updateMapTransform(R,eh,eu){let em=this._map,e_=em._getTransformForUpdate(),eg=em.terrain;if(!($a(R)||eg&&this._terrainMovement))return void this._fireEvents(eh,eu,!0);em._stop(!0);let{panDelta:ev,zoomDelta:ex,bearingDelta:eb,pitchDelta:ew,rollDelta:eT,around:eS,pinchAround:eP}=R;void 0!==eP&&(eS=eP),eS=eS||em.transform.centerPoint,eg&&!e_.isPointOnMapSurface(eS)&&(eS=e_.centerPoint);let eI={panDelta:ev,zoomDelta:ex,rollDelta:eT,pitchDelta:ew,bearingDelta:eb,around:eS};this._map.cameraHelper.useGlobeControls&&!e_.isPointOnMapSurface(eS)&&(eS=e_.centerPoint);let eM=.01>eS.distSqr(e_.centerPoint)?e_.center:e_.screenPointToLocation(ev?eS.sub(ev):eS);this._handleMapControls({terrain:eg,tr:e_,deltasForHelper:eI,preZoomAroundLoc:eM,combinedEventsInProgress:eh,panDelta:ev}),em._applyUpdatedTransform(e_),this._map._update(),R.noInertia||this._inertia.record(R),this._fireEvents(eh,eu,!0)}_handleMapControls({terrain:R,tr:eh,deltasForHelper:eu,preZoomAroundLoc:em,combinedEventsInProgress:e_,panDelta:eg}){let ev=this._map.cameraHelper;if(ev.handleMapControlsRollPitchBearingZoom(eu,eh),R)return ev.useGlobeControls?(!this._terrainMovement&&(e_.drag||e_.zoom)&&(this._terrainMovement=!0,this._map._elevationFreeze=!0),void ev.handleMapControlsPan(eu,eh,em)):!this._terrainMovement&&(e_.drag||e_.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,void ev.handleMapControlsPan(eu,eh,em)):void(e_.drag&&this._terrainMovement&&eg?eh.setCenter(eh.screenPointToLocation(eh.centerPoint.sub(eg))):ev.handleMapControlsPan(eu,eh,em));ev.handleMapControlsPan(eu,eh,em)}_fireEvents(R,eu,em){let e_;let eg=Wa(this._eventsInProgress),ev=Wa(R),ex={};for(let eh in R){let{originalEvent:eu}=R[eh];this._eventsInProgress[eh]||(ex[`${eh}start`]=eu),this._eventsInProgress[eh]=R[eh]}for(let R in!eg&&ev&&this._fireEvent("movestart",ev.originalEvent),ex)this._fireEvent(R,ex[R]);for(let eh in ev&&this._fireEvent("move",ev.originalEvent),R){let{originalEvent:eu}=R[eh];this._fireEvent(eh,eu)}let eb={};for(let R in this._eventsInProgress){let{handlerName:eh,originalEvent:em}=this._eventsInProgress[R];this._handlersById[eh].isActive()||(delete this._eventsInProgress[R],e_=eu[eh]||em,eb[`${R}end`]=e_)}for(let R in eb)this._fireEvent(R,eb[R]);let ew=Wa(this._eventsInProgress),eT=(eg||ev)&&!ew;if(eT&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let R=this._map._getTransformForUpdate();
56this._map.getCenterClampedToGround()&&R.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(R)}if(em&&eT){var eS,eP;this._updatingCamera=!0;let R=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);R&&(R.essential||!eA.prefersReducedMotion)?(0!==(eS=R.bearing||this._map.getBearing())&&-this._bearingSnap<eS&&eS<this._bearingSnap&&(R.bearing=0),R.freezeElevation=!0,this._map.easeTo(R,{originalEvent:e_})):(this._map.fire(new eh.n("moveend",{originalEvent:e_})),0!==(eP=this._map.getBearing())&&-this._bearingSnap<eP&&eP<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(R,eu){this._map.fire(new eh.n(R,eu?{originalEvent:eu}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(R=>{delete this._frameId,this.handleEvent(new qa("renderFrame",{timeStamp:R})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}};let Xa=class Xa extends eh.E{constructor(R,eh,eu){super(),this._renderFrameCallback=()=>{let R=Math.min((c()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(R)),R<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=R,this._bearingSnap=eu.bearingSnap,this._zoomSnap=eu.zoomSnap,this.cameraHelper=eh,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(R,eh){R.apply(this.transform,!0),this.transform=R,this.cameraHelper=eh}getCenter(){return new eh.W(this.transform.center.lng,this.transform.center.lat)}setCenter(R,eh){return this.jumpTo({center:R},eh)}getCenterElevation(){return this.transform.elevation}setCenterElevation(R,eh){return this.jumpTo({elevation:R},eh),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(R){this._centerClampedToGround=R}panBy(R,eu,em){return R=eh.P.convert(R).mult(-1),this.panTo(this.transform.center,eh.e({offset:R},eu),em)}panTo(R,eu,em){return this.easeTo(eh.e({center:R},eu),em)}getZoom(){return this.transform.zoom}setZoom(R,eh){return this.jumpTo({zoom:R},eh),this}zoomTo(R,eu,em){return this.easeTo(eh.e({zoom:R},eu),em)}zoomIn(R,eu){return this.zoomTo(eh.cw(this.getZoom()+1,this._zoomSnap),R,eu),this}zoomOut(R,eu){return this.zoomTo(eh.cw(this.getZoom()-1,this._zoomSnap),R,eu),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(R,eu){return R!=this.transform.fov&&(this.transform.setFov(R),this.fire(new eh.n("movestart",eu)).fire(new eh.n("move",eu)).fire(new eh.n("moveend",eu))),this}getBearing(){return this.transform.bearing}setZoomSnap(R){return this._zoomSnap=R,this}getZoomSnap(){return this._zoomSnap}setBearing(R,eh){return this.jumpTo({bearing:R},eh),this}getPadding(){return this.transform.padding}setPadding(R,eh){return this.jumpTo({padding:R},eh),this}rotateTo(R,eu,em){return this.easeTo(eh.e({bearing:R},eu),em)}resetNorth(R,eu){return this.rotateTo(0,eh.e({duration:1e3},R),eu),this}resetNorthPitch(R,eu){return this.easeTo(eh.e({bearing:0,pitch:0,roll:0,duration:1e3},R),eu),this}snapToNorth(R,eh){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(R,eh):this}getPitch(){return this.transform.pitch}setPitch(R,eh){return this.jumpTo({pitch:R},eh),this}getRoll(){return this.transform.roll}setRoll(R,eh){return this.jumpTo({roll:R},eh),this}cameraForBounds(R,eh){R=U.convert(R).adjustAntiMeridian();let eu=(null==eh?void 0:eh.bearing)||0;return this._cameraForBoxAndBearing(R.getNorthWest(),R.getSouthEast(),eu,eh)}_cameraForBoxAndBearing(R,eu,em,e_){let eg={top:0,bottom:0,right:0,left:0};if("number"==typeof(e_=eh.e({padding:eg,offset:[0,0],maxZoom:this.transform.maxZoom},e_)).padding){let R=e_.padding;e_.padding={top:R,bottom:R,right:R,left:R}}let ev=eh.e(eg,e_.padding);e_.padding=ev;let ex=this.transform,eb=new U(R,eu),ew=this.cameraHelper.cameraForBoxAndBearing(e_,ev,eb,em,ex);return ew&&this._zoomSnap&&(ew.zoom=eh.cw(ew.zoom,this._zoomSnap,-1)),ew}fitBounds(R,eh,eu){return this._fitInternal(this.cameraForBounds(R,eh),eh,eu)}fitScreenCoordinates(R,eu,em,e_,eg){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(eh.P.convert(R)),this.transform.screenPointToLocation(eh.P.convert(eu)),em,e_),e_,eg)}_fitInternal(R,eu,em){return R?(delete(eu=eh.e(R,eu)).padding,eu.linear?this.easeTo(eu,em):this.flyTo(eu,em)):this}jumpTo(R,eu){this.stop(),"zoom"in R&&this._zoomSnap&&(R.zoom=eh.cw(R.zoom,this._zoomSnap));let em=this._getTransformForUpdate(),e_=!1,eg=!1,ev=!1,ex=em.zoom;this.terrain&&em.setElevation(this.terrain.getElevationForLngLatZoom(R.center?eh.W.convert(R.center):em.center,R.zoom||em.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(em,R);let eb=em.zoom!==ex;return"elevation"in R&&em.elevation!==+R.elevation&&em.setElevation(+R.elevation),"bearing"in R&&em.bearing!==+R.bearing&&(e_=!0,em.setBearing(+R.bearing)),"pitch"in R&&em.pitch!==+R.pitch&&(eg=!0,em.setPitch(+R.pitch)),"roll"in R&&em.roll!==+R.roll&&(ev=!0,em.setRoll(+R.roll)),null==R.padding||em.isPaddingEqual(R.padding)||em.setPadding(R.padding),this._applyUpdatedTransform(em),this.fire(new eh.n("movestart",eu)).fire(new eh.n("move",eu)),eb&&this.fire(new eh.n("zoomstart",eu)).fire(new eh.n("zoom",eu)).fire(new eh.n("zoomend",eu)),e_&&this.fire(new eh.n("rotatestart",eu)).fire(new eh.n("rotate",eu)).fire(new eh.n("rotateend",eu)),eg&&this.fire(new eh.n("pitchstart",eu)).fire(new eh.n("pitch",eu)).fire(new eh.n("pitchend",eu)),ev&&this.fire(new eh.n("rollstart",eu)).fire(new eh.n("roll",eu)).fire(new eh.n("rollend",eu)),this.fire(new eh.n("moveend",eu))}calculateCameraOptionsFromTo(R,eu,em,e_=0){let eg=eh.a7.fromLngLat(R,eu),ev=eh.a7.fromLngLat(em,e_),ex=ev.x-eg.x,eb=ev.y-eg.y,ew=ev.z-eg.z,eT=Math.hypot(ex,eb,ew);if(0===eT)throw Error("Can't calculate camera options with same From and To");let eS=Math.hypot(ex,eb),eP=eh.ar(this.transform.cameraToCenterDistance/eT/this.transform.tileSize),eI=180*Math.atan2(ex,-eb)/Math.PI,eM=180*Math.acos(eS/eT)/Math.PI;return eM=ew<0?90-eM:90+eM,{center:ev.toLngLat(),elevation:e_,zoom:eP,pitch:eM,bearing:eI}}calculateCameraOptionsFromCameraLngLatAltRotation(R,eh,eu,em,e_){let eg=this.transform.calculateCenterFromCameraLngLatAlt(R,eh,eu,em);return{center:eg.center,elevation:eg.elevation,zoom:eg.zoom,bearing:eu,pitch:em,roll:e_}}easeTo(R,eu){let em,e_;this._stop(!1,R.easeId),"zoom"in(R=eh.e({offset:[0,0],duration:500,easing:eh.cy},R))&&this._zoomSnap&&(R.zoom=eh.cw(R.zoom,this._zoomSnap)),(!1===R.animate||!R.essential&&eA.prefersReducedMotion)&&(R.duration=0);let eg=this._getTransformForUpdate(),ev=this.getBearing(),ex=eg.pitch,eb=eg.roll,ew="bearing"in R?this._normalizeBearing(R.bearing,ev):ev,eT="pitch"in R?+R.pitch:ex,eS="roll"in R?this._normalizeBearing(R.roll,eb):eb,eP="padding"in R?R.padding:eg.padding,eI=eh.P.convert(R.offset);R.around&&(em=eh.W.convert(R.around),e_=eg.locationToScreenPoint(em));let eM={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},eE=this.cameraHelper.handleEaseTo(eg,{bearing:ew,pitch:eT,roll:eS,padding:eP,around:em,aroundPoint:e_,offsetAsPoint:eI,offset:R.offset,zoom:R.zoom,center:R.center});return this._rotating=this._rotating||ev!==ew,this._pitching=this._pitching||eT!==ex,this._rolling=this._rolling||eS!==eb,this._padding=!eg.isPaddingEqual(eP),this._zooming=this._zooming||eE.isZ
56ooming,this._easeId=R.easeId,this._prepareEase(eu,R.noMoveStart,eM),this.terrain&&this._prepareElevation(eE.elevationCenter),this._ease(eh=>{eE.easeFunc(eh),this.terrain&&!R.freezeElevation&&this._updateElevation(eh),this._applyUpdatedTransform(eg),this._fireMoveEvents(eu)},eh=>{this.terrain&&R.freezeElevation&&this._finalizeElevation(),this._afterEase(eu,eh)},R),this}_prepareEase(R,eu,em={}){this._moving=!0,eu||em.moving||this.fire(new eh.n("movestart",R)),this._zooming&&!em.zooming&&this.fire(new eh.n("zoomstart",R)),this._rotating&&!em.rotating&&this.fire(new eh.n("rotatestart",R)),this._pitching&&!em.pitching&&this.fire(new eh.n("pitchstart",R)),this._rolling&&!em.rolling&&this.fire(new eh.n("rollstart",R))}_prepareElevation(R){this._elevationCenter=R,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(R,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(R){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let eu=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(R<1&&eu!==this._elevationTarget){let eh=this._elevationTarget-this._elevationStart;this._elevationStart+=R*(eh-(eu-(eh*R+this._elevationStart))/(1-R)),this._elevationTarget=eu}this.transform.setElevation(eh.H.number(this._elevationStart,this._elevationTarget,R))}_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(R){if(!this.terrain&&R.elevation>=0&&R.pitch<=90)return{};let eh=R.getCameraLngLat(),eu=R.getCameraAltitude(),em=this.terrain?this.terrain.getElevationForLngLatZoom(eh,R.zoom):0;if(eu<em){let eu=this.calculateCameraOptionsFromTo(eh,em,R.center,R.elevation);return{pitch:eu.pitch,zoom:eu.zoom}}return{}}_applyUpdatedTransform(R){let eh=[];if(eh.push(R=>this._elevateCameraIfInsideTerrain(R)),this.transformCameraUpdate&&eh.push(R=>this.transformCameraUpdate(R)),!eh.length)return;let eu=R.clone();for(let R of eh){let eh=eu.clone(),{center:em,zoom:e_,roll:eg,pitch:ev,bearing:ex,elevation:eb}=R(eh);em&&eh.setCenter(em),void 0!==eb&&eh.setElevation(eb),void 0!==e_&&eh.setZoom(e_),void 0!==eg&&eh.setRoll(eg),void 0!==ev&&eh.setPitch(ev),void 0!==ex&&eh.setBearing(ex),eu.apply(eh,!1)}this.transform.apply(eu,!1)}_fireMoveEvents(R){this.fire(new eh.n("move",R)),this._zooming&&this.fire(new eh.n("zoom",R)),this._rotating&&this.fire(new eh.n("rotate",R)),this._pitching&&this.fire(new eh.n("pitch",R)),this._rolling&&this.fire(new eh.n("roll",R))}_afterEase(R,eu){if(this._easeId&&eu&&this._easeId===eu)return;delete this._easeId;let em=this._zooming,e_=this._rotating,eg=this._pitching,ev=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,em&&this.fire(new eh.n("zoomend",R)),e_&&this.fire(new eh.n("rotateend",R)),eg&&this.fire(new eh.n("pitchend",R)),ev&&this.fire(new eh.n("rollend",R)),this.fire(new eh.n("moveend",R))}flyTo(R,eu){if(!R.essential&&eA.prefersReducedMotion){let em=eh.V(R,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(em,eu)}this.stop(),"zoom"in(R=eh.e({offset:[0,0],speed:1.2,curve:1.42,easing:eh.cy},R))&&this._zoomSnap&&(R.zoom=eh.cw(R.zoom,this._zoomSnap));let em=this._getTransformForUpdate(),e_=em.bearing,eg=em.pitch,ev=em.roll,ex=em.padding,eb="bearing"in R?this._normalizeBearing(R.bearing,e_):e_,ew="pitch"in R?+R.pitch:eg,eT="roll"in R?this._normalizeBearing(R.roll,ev):ev,eS="padding"in R?R.padding:em.padding,eP=eh.P.convert(R.offset),eI=em.centerPoint.add(eP),eM=em.screenPointToLocation(eI),eE=this.cameraHelper.handleFlyTo(em,{bearing:eb,pitch:ew,roll:eT,padding:eS,locationAtOffset:eM,offsetAsPoint:eP,center:R.center,minZoom:R.minZoom,zoom:R.zoom}),eC=R.curve,ez=Math.max(em.width,em.height),eD=ez/eE.scaleOfZoom,ek=eE.pixelPathLength;"number"==typeof eE.scaleOfMinZoom&&(eC=Math.sqrt(ez/eE.scaleOfMinZoom/ek*2));let eR=eC*eC;function w(R){let eh=(eD*eD-ez*ez+(R?-1:1)*eR*eR*ek*ek)/(2*(R?eD:ez)*eR*ek);return Math.log(Math.sqrt(eh*eh+1)-eh)}function T(R){return(Math.exp(R)-Math.exp(-R))/2}function P(R){return(Math.exp(R)+Math.exp(-R))/2}let eL=w(!1),I=function(R){return P(eL)/P(eL+eC*R)},M=function(R){var eh;return ez*((P(eL)*(T(eh=eL+eC*R)/P(eh))-T(eL))/eR)/ek},eF=(w(!0)-eL)/eC;if(2e-6>
56Math.abs(ek)||!isFinite(eF)){if(1e-6>Math.abs(ez-eD))return this.easeTo(R,eu);let eh=eD<ez?-1:1;eF=Math.abs(Math.log(eD/ez))/eC,M=()=>0,I=R=>Math.exp(eh*eC*R)}return R.duration="duration"in R?+R.duration:1e3*eF/("screenSpeed"in R?+R.screenSpeed/eC:+R.speed),R.maxDuration&&R.duration>R.maxDuration&&(R.duration=0),this._zooming=!0,this._rotating=e_!==eb,this._pitching=ew!==eg,this._rolling=eT!==ev,this._padding=!em.isPaddingEqual(eS),this._prepareEase(eu,!1),this.terrain&&this._prepareElevation(eE.targetCenter),this._ease(eM=>{let eC=eM*eF,eA=1/I(eC),ez=M(eC);this._rotating&&em.setBearing(eh.H.number(e_,eb,eM)),this._pitching&&em.setPitch(eh.H.number(eg,ew,eM)),this._rolling&&em.setRoll(eh.H.number(ev,eT,eM)),this._padding&&(em.interpolatePadding(ex,eS,eM),eI=em.centerPoint.add(eP)),eE.easeFunc(eM,eA,ez,eI),this.terrain&&!R.freezeElevation&&this._updateElevation(eM),this._applyUpdatedTransform(em),this._fireMoveEvents(eu)},()=>{this.terrain&&R.freezeElevation&&this._finalizeElevation(),this._afterEase(eu)},R),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(R,eh){var eu;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let R=this._onEaseEnd;delete this._onEaseEnd,R.call(this,eh)}return R||null===(eu=this.handlers)||void 0===eu||eu.stop(!1),this}_ease(R,eh,eu){!1===eu.animate||0===eu.duration?(R(1),eh()):(this._easeStart=c(),this._easeOptions=eu,this._onEaseFrame=R,this._onEaseEnd=eh,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(R,eu){R=eh.X(R,-180,180);let em=Math.abs(R-eu);return Math.abs(R-360-eu)<em&&(R-=360),Math.abs(R+360-eu)<em&&(R+=360),R}queryTerrainElevation(R){return this.terrain?this.terrain.getElevationForLngLat(eh.W.convert(R),this.transform):null}};let tT={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};let Ya=class Ya{constructor(R=tT){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=R=>{R&&("metadata"===R.sourceDataType||"visibility"===R.sourceDataType||"style"===R.dataType||"terrain"===R.type)&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=R}getDefaultPosition(){return"bottom-right"}onAdd(R){return this._map=R,this._compact=this.options.compact,this._container=d.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=d.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=d.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(R,eh){let eu=this._map._getUIString(`AttributionControl.${eh}`);R.title=eu,R.setAttribute("aria-label",eu)}_updateAttributions(){if(!this._map.style)return;let R=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?R=R.concat(this.options.customAttribution.map(R=>"string"!=typeof R?"":R)):"string"==typeof this.options.customAttribution&&R.push(this.options.customAttribution)),this._map.style.stylesheet){let R=this._map.style.stylesheet;this.styleOwner=R.owner,this.styleId=R.id}let eh=this._map.style.tileManagers;for(let eu in eh){let em=eh[eu];if(em.used||em.usedForTerrain){let eh=em.getSource();eh.attribution&&!R.includes(eh.attribution)&&R.push(eh.attribution)}}(R=R.filter(R=>String(R).trim())).sort((R,eh)=>R.length-eh.length),R=R.filter((eh,eu)=>{for(let em=eu+1;em<R.length;em++)if(R[em].includes(eh))return!1;return!0});let eu=R.join(" | ");eu!==this._attribHTML&&(this._attribHTML=eu,R.length?(this._innerContainer.innerHTML=d.sanitize(eu),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};let Qa=class Qa{constructor(R={}){this._updateCompact=()=>{let R=this._container.children;if(R.length){let eh=R[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&eh.classList.add("maplibregl-compact"):eh.classList.remove("maplibregl-compact")}},this.options=R}getDefaultPosition(){return"bottom-left"}onAdd(R){var eh;this._map=R,this._compact=null===(eh=this.options)||void 0===eh?void 0:eh.compact,this._container=d.create("div","maplibregl-ctrl");let eu=d.create("a","maplibregl-ctrl-logo");return eu.target="_blank",eu.rel="noopener nofollow",eu.href="https://maplibre.org/",eu.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),eu.setAttribute("rel","noopener nofollow"),this._container.appendChild(eu),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};let Ja=class Ja{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(R){let eh=++this._id;return this._queue.push({callback:R,id:eh,cancelled:!1}),eh}remove(R){let eh=this._currentlyRunning,eu=eh?this._queue.concat(eh):this._queue;
56for(let eh of eu)if(eh.id===R)return void(eh.cancelled=!0)}run(R=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let eh=this._currentlyRunning=this._queue;for(let eu of(this._queue=[],eh))if(!eu.cancelled&&(eu.callback(R),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};var tS=eh.aT([{name:"a_pos3d",type:"Int16",components:3}]);let ts=class ts extends eh.E{constructor(R){super(),this._lastTilesetChange=c(),this.tileManager=R,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=R._source.tileSize*2**this.deltaZoom,R.usedForTerrain=!0,R.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(R,eu){this.tileManager.update(R,eu),this._renderableTilesKeys=[];let em={};for(let e_ of Ce(R,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:eu,calculateTileZoom:this.tileManager._source.calculateTileZoom}))em[e_.key]=!0,this._renderableTilesKeys.push(e_.key),this._tiles[e_.key]||(e_.terrainRttPosMatrix32f=new Float64Array(16),eh.c7(e_.terrainRttPosMatrix32f,0,eh.a6,eh.a6,0,0,1),this._tiles[e_.key]=new ue(e_,this.tileSize),this._lastTilesetChange=c());for(let R in this._tiles)em[R]||delete this._tiles[R]}freeRtt(R){for(let eh in this._tiles){let eu=this._tiles[eh];(!R||eu.tileID.equals(R)||eu.tileID.isChildOf(R)||R.isChildOf(eu.tileID))&&(eu.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(R=>this.getTileByID(R))}getTileByID(R){return this._tiles[R]}getTerrainCoords(R,eh){return eh?this._getTerrainCoordsForTileRanges(R,eh):this._getTerrainCoordsForRegularTile(R)}_getTerrainCoordsForRegularTile(R){let eu={};for(let em of this._renderableTilesKeys){let e_=this._tiles[em].tileID,eg=R.clone(),ev=eh.bj();if(e_.canonical.equals(R.canonical))eh.c7(ev,0,eh.a6,eh.a6,0,0,1);else if(e_.canonical.isChildOf(R.canonical)){let eu=e_.canonical.z-R.canonical.z,em=e_.canonical.x-(e_.canonical.x>>eu<<eu),eg=e_.canonical.y-(e_.canonical.y>>eu<<eu),ex=eh.a6>>eu;eh.c7(ev,0,ex,ex,0,0,1),eh.Q(ev,ev,[-em*ex,-eg*ex,0])}else{if(!R.canonical.isChildOf(e_.canonical))continue;{let eu=R.canonical.z-e_.canonical.z,em=R.canonical.x-(R.canonical.x>>eu<<eu),eg=R.canonical.y-(R.canonical.y>>eu<<eu),ex=eh.a6>>eu;eh.c7(ev,0,eh.a6,eh.a6,0,0,1),eh.Q(ev,ev,[em*ex,eg*ex,0]),eh.S(ev,ev,[1/2**eu,1/2**eu,0])}}eg.terrainRttPosMatrix32f=new Float32Array(ev),eu[em]=eg}return eu}_getTerrainCoordsForTileRanges(R,eu){let em={};for(let e_ of this._renderableTilesKeys){let eg=this._tiles[e_].tileID;if(!this._isWithinTileRanges(eg,eu))continue;let ev=R.clone(),ex=eh.bj();if(eg.canonical.z===R.canonical.z){let eu=R.canonical.x-eg.canonical.x+R.wrap*(1<<R.canonical.z),em=R.canonical.y-eg.canonical.y;eh.c7(ex,0,eh.a6,eh.a6,0,0,1),eh.Q(ex,ex,[eu*eh.a6,em*eh.a6,0])}else if(eg.canonical.z>R.canonical.z){let eu=eg.canonical.z-R.canonical.z,em=eg.canonical.x-(eg.canonical.x>>eu<<eu)+R.wrap*(1<<eg.canonical.z),e_=eg.canonical.y-(eg.canonical.y>>eu<<eu),ev=R.canonical.x-(eg.canonical.x>>eu),eb=R.canonical.y-(eg.canonical.y>>eu),ew=eh.a6>>eu;eh.c7(ex,0,ew,ew,0,0,1),eh.Q(ex,ex,[-em*ew+ev*eh.a6,-e_*ew+eb*eh.a6,0])}else{let eu=R.canonical.z-eg.canonical.z,em=R.canonical.x-(R.canonical.x>>eu<<eu)+R.wrap*(1<<R.canonical.z),e_=R.canonical.y-(R.canonical.y>>eu<<eu),ev=(R.canonical.x>>eu)-eg.canonical.x,eb=(R.canonical.y>>eu)-eg.canonical.y,ew=eh.a6<<eu;eh.c7(ex,0,ew,ew,0,0,1),eh.Q(ex,ex,[em*eh.a6+ev*ew,e_*eh.a6+eb*ew,0])}ev.terrainRttPosMatrix32f=new Float32Array(ex),em[e_]=ev}return em}getSourceTile(R,eh){let eu=this.tileManager._source,em=R.overscaledZ-this.deltaZoom;if(em>eu.maxzoom&&(em=eu.maxzoom),em<eu.minzoom)return;this._sourceTileCache[R.key]||(this._sourceTileCache[R.key]=R.scaledTo(em).key);let e_=this.findTileInCaches(this._sourceTileCache[R.key]);if(!(null==e_?void 0:e_.dem)&&eh)for(;em>=eu.minzoom&&!(null==e_?void 0:e_.dem);)e_=this.findTileInCaches(R.scaledTo(em--).key);return e_}findTileInCaches(R){let eh=this.tileManager.getTileByID(R);return eh||(eh=this.tileManager._outOfViewCache.getByKey(R))}anyTilesAfterTime(R=Date.now()){return this._lastTilesetChange>=R}_isWithinTileRanges(R,eh){let eu=eh[R.canonical.z];return!!eu&&(R.wrap>eu.minWrap||R.wrap<eu.maxWrap||R.canonical.x>=eu.minTileXWrapped&&R.canonical.x<=eu.maxTileXWrapped&&R.canonical.y>=eu.minTileY&&R.canonical.y<=eu.maxTileY)}};let is=class is{constructor(R,eh,eu){this._meshCache={},this.painter=R,this.tileManager=new ts(eh),this.options=eu,this.exaggeration="number"==typeof eu.exaggeration?eu.exaggeration:1,this.qual
vendor: 10,305 bytes, line 56
56ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){for(let R in this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null),this._meshCache)this._meshCache[R].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(R,eu,em,e_=eh.a6){var eg;let ev=R.normalizeCoordinates(eu,em,e_);if(!ev)return 0;let ex=this.getTerrainData(ev.tileID),eb=null===(eg=ex.tile)||void 0===eg?void 0:eg.dem;if(!eb)return 0;let ew=eh.cC([],[ev.x/e_*eh.a6,ev.y/e_*eh.a6],ex.u_terrain_matrix),eT=[ew[0]*eb.dim,ew[1]*eb.dim],eS=Math.floor(eT[0]),eP=Math.floor(eT[1]),eI=eT[0]-eS,eM=eT[1]-eP;return eb.get(eS,eP)*(1-eI)*(1-eM)+eb.get(eS+1,eP)*eI*(1-eM)+eb.get(eS,eP+1)*(1-eI)*eM+eb.get(eS+1,eP+1)*eI*eM}getElevationForLngLatZoom(R,eu){if(!eh.cD(eu,R.wrap()))return 0;let{tileID:em,mercatorX:e_,mercatorY:eg}=this._getOverscaledTileIDFromLngLatZoom(R,eu);return this.getElevation(em,e_%eh.a6,eg%eh.a6,eh.a6)}getElevationForLngLat(R,eh){let eu=Ce(eh,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),em=0;for(let R of eu)R.canonical.z>em&&(em=Math.min(R.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(R,em)}getElevation(R,eu,em,e_=eh.a6){return this.getDEMElevation(R,eu,em,e_)*this.exaggeration}getTerrainData(R){var eu,em;if(!this._emptyDemTexture){let R=this.painter.context,eu=new eh.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new eh.T(R,eu,R.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new eh.T(R,new eh.R({width:1,height:1}),R.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(R.gl.NEAREST,R.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=eh.ap([])}let e_=this.tileManager.getSourceTile(R,!0);if((null==e_?void 0:e_.dem)&&(!e_.demTexture||e_.needsTerrainPrepare)){let R=this.painter.context;e_.demTexture=this.painter.getTileTexture(e_.dem.stride),e_.demTexture?e_.demTexture.update(e_.dem.getPixels(),{premultiply:!1}):e_.demTexture=new eh.T(R,e_.dem.getPixels(),R.gl.RGBA,{premultiply:!1}),e_.demTexture.bind(R.gl.NEAREST,R.gl.CLAMP_TO_EDGE),e_.needsTerrainPrepare=!1}let eg=e_&&e_.toString()+e_.tileID.key+R.key;if(eg&&!this._demMatrixCache[eg]){let eu=this.tileManager.getSource().maxzoom,em=R.canonical.z-e_.tileID.canonical.z;R.overscaledZ>R.canonical.z&&(R.canonical.z>=eu?em=R.canonical.z-eu:eh.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let ev=R.canonical.x-(R.canonical.x>>em<<em),ex=R.canonical.y-(R.canonical.y>>em<<em),eb=eh.cE(new Float64Array(16),[1/(eh.a6<<em),1/(eh.a6<<em),0]);eh.Q(eb,eb,[ev*eh.a6,ex*eh.a6,0]),this._demMatrixCache[eg]={matrix:eb,coord:R}}return{u_depth:2,u_terrain:3,u_terrain_dim:(null===(eu=null==e_?void 0:e_.dem)||void 0===eu?void 0:eu.dim)||1,u_terrain_matrix:eg?this._demMatrixCache[eg].matrix:this._emptyDemMatrix,u_terrain_unpack:(null===(em=null==e_?void 0:e_.dem)||void 0===em?void 0:em.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((null==e_?void 0:e_.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:e_}}getFramebuffer(R){let eu=this.painter,em=eu.width/devicePixelRatio,e_=eu.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==em||this._fbo.height!==e_)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new eh.T(eu.context,{width:em,height:e_,data:null},eu.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(eu.context.gl.NEAREST,eu.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new eh.T(eu.context,{width:em,height:e_,data:null},eu.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(eu.context.gl.NEAREST,eu.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=eu.context.createFramebuffer(em,e_,!0,!1),this._fbo.depthAttachment.set(eu.context.createRenderbuffer(eu.context.gl.DEPTH_COMPONENT16,em,e_))),this._fbo.colorAttachment.set("coords"===R?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let R=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let eu=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let R=0,eh=0;R<this._coordsTextureSize;R++)for(let em=0;em<this._coordsTextureSize;em++,eh+=4)eu[eh+0]=255&em,eu[eh+1]=255&R,eu[eh+2]=em>>8<<4|R>>8,eu[eh+3]=0;let em=new eh.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(eu.buffer)),e_=new eh.T(R,em,R.gl.RGBA,{premultiply:!1});return e_.bind(R.gl.NEAREST,R.gl.CLAMP_TO_EDGE),this._coordsTexture=e_,e_}pointCoordinate(R){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let eu=new Uint8Array(4),em=this.painter.context,e_=em.gl,eg=Math.round(R.x*this.painter.pixelRatio/devicePixelRatio),ev=Math.round(R.y*this.painter.pixelRatio/devicePixelRatio),ex=Math.round(this.painter.height/devicePixelRatio);em.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),e_.readPixels(eg,ex-ev-1,1,1,e_.RGBA,e_.UNSIGNED_BYTE,eu),em.bindFramebuffer.set(null);let eb=eu[0]+(eu[2]>>4<<8),ew=eu[1]+((15&eu[2])<<8),eT=this.coordsIndex[255-eu[3]],eS=eT&&this.tileManager.getTileByID(eT);if(!eS)return null;let eP=this._coordsTextureSize,eI=(1<<eS.tileID.canonical.z)*eP;return new eh.a7((eS.tileID.canonical.x*eP+eb)/eI+eS.tileID.wrap,(eS.tileID.canonical.y*eP+ew)/eI,this.getElevation(eS.tileID,eb,ew,eP))}depthAtPoint(R){let eh=new Uint8Array(4),eu=this.painter.context,em=eu.gl;return eu.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),em.readPixels(R.x,this.painter.height/devicePixelRatio-R.y-1,1,1,em.RGBA,em.UNSIGNED_BYTE,eh),eu.bindFramebuffer.set(null),(eh[0]/16777216+eh[1]/65536+eh[2]/256+eh[3])/256}getTerrainMesh(R){var eu;let em=(null===(eu=this.painter.style.projection)||void 0===eu?void 0:eu.transitionState)>0,e_=em&&0===R.canonical.y,eg=em&&R.canonical.y===(1<<R.canonical.z)-1,ev=`m_${e_?"n":""}_${eg?"s":""}`;if(this._meshCache[ev])return this._meshCache[ev];let ex=this.painter.context,eb=new eh.cF,ew=new eh.aX,eT=this.meshSize,eS=eh.a6/eT,eP=eT*eT;for(let R=0;R<=eT;R++)for(let eh=0;eh<=eT;eh++)eb.emplaceBack(eh*eS,R*eS,0);for(let R=0;R<eP;R+=eT+1)for(let eh=0;eh<eT;eh++)ew.emplaceBack(eh+R,eT+eh+R+1,eT+eh+R+2),ew.emplaceBack(eh+R,eT+eh+R+2,eh+R+1);let eI=eb.length,eM=eI+(eT+1),eE=(eT+1)*eT,eC=e_?eh.bq:0,eA=e_?0:1,ez=eg?eh.br:eh.a6,eD=eg?0:1;for(let R=0;R<=eT;R++)eb.emplaceBack(R*eS,eC,eA);for(let R=0;R<=eT;R++)eb.emplaceBack(R*eS,ez,eD);for(let R=0;R<eT;R++)ew.emplaceBack(eE+R,eM+R,eM+R+1),ew.emplaceBack(eE+R,eM+R+1,eE+R+1),ew.emplaceBack(0+R,eI+R+1,eI+R),ew.emplaceBack(0+R,0+R+1,eI+R+1);let ek=eb.length,eR=ek+2*(eT+1);for(let R of[0,1])for(let eu=0;eu<=eT;eu++)for(let em of[0,1])eb.emplaceBack(R*eh.a6,eu*eS,em);for(let R=0;R<2*eT;R+=2)ew.emplaceBack(ek+R,ek+R+1,ek+R+3),ew.emplaceBack(ek+R,ek+R+3,ek+R+2),ew.emplaceBack(eR+R,eR+R+3,eR+R+1),ew.emplaceBack(eR+R,eR+R+2,eR+R+3);let eL=new Lt(ex.createVertexBuffer(eb,tS.members),ex.createIndexBuffer(ew),eh.aW.simpleSegment(0,0,eb.length,ew.length));return this._meshCache[ev]=eL,eL}getMeshFrameDelta(R){return 2*Math.PI*eh.bD/Math.pow(2,Math.max(R,0))/5}getMinTileElevationForLngLatZoom(R,eu){var em;if(!eh.cD(eu,R.wrap()))return 0;let{tileID:e_}=this._getOverscaledTileIDFromLngLatZoom(R,eu);return null!==(em=this.getMinMaxElevation(e_).minElevation)&&void 0!==em?em:0}getMinMaxElevation(R){let eh=this.getTerrainData(R).tile,eu={minElevation:null,maxElevation:null};return(null==eh?void 0:eh.dem)&&(eu.minElevation=eh.dem.min*this.exaggeration,eu.maxElevation=eh.dem.max*this.exaggeration),eu}_getOverscaledTileIDFromLngLatZoom(R,eu){let em=eh.a7.fromLngLat(R.wrap()),e_=(1<<eu)*eh.a6,eg=em.x*e_,ev=em.y*e_,ex=Math.floor(eg/eh.a6),eb=Math.floor(ev/eh.a6);return{tileID:new eh.a3(eu,0,eu,ex,eb),mercatorX:eg,mercatorY:ev}}};let os=class os{constructor(R,eh,eu){this._context=R,this._size=eh,this._tileSize=eu,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let R of this._objects)R.texture.destroy(),R.fbo.destroy()}_createObject(R){let eu=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),em=new eh.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return em.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),eu.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),eu.colorAttachment.set(em.texture),{id:R,fbo:eu,texture:em,stamp:-1,inUse:!1}}getObjectForId(R){return this._objects[R]}useObject(R){R.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(eh=>R.id!==eh),this._recentlyUsed.push(R.id)}stampObject(R){R.stamp=++this._stamp}getOrCreateFreeObject(){for(let R of this._recentlyUsed)if(!this._objects[R].inUse)return this._objects[R];if(this._objects.length>=this._size)throw Error("No free RenderPool available, call freeAllObjects() required!");let R=this._createObject(this._objects.length);return this._objects.push(R),R}freeObject(R){R.inUse=!1}freeAllObjects(){for(let R of this._objects)this.freeObject(R)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(R=>!R.inUse)}};let tP={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};let as=class as{constructor(R,eh){this.painter=R,this.terrain=eh,this.pool=new os(R.context,30,eh.tileManager.tileSize*eh.qualityFactor)}destruct(){this.pool.destruct()}getTexture(R){return this.pool.getObjectForId(R.rtt[this._stacks.length-1].id).texture}
56prepareForRender(R,eh){var eu,em;for(let eu in this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=R._order.filter(eu=>!R._layers[eu].isHidden(eh)),this._coordsAscending={},R.tileManagers){this._coordsAscending[eu]={};let eh=R.tileManagers[eu].getVisibleCoordinates(),em=R.tileManagers[eu].getSource(),e_=em instanceof ee?em.terrainTileRanges:null;for(let R of eh){let eh=this.terrain.tileManager.getTerrainCoords(R,e_);for(let R in eh)this._coordsAscending[eu][R]||(this._coordsAscending[eu][R]=[]),this._coordsAscending[eu][R].push(eh[R])}}for(let eh of(this._rttFingerprints={},R._order)){let e_=R._layers[eh],eg=e_.source;if(tP[e_.type]&&!this._rttFingerprints[eg]){this._rttFingerprints[eg]={};let eh=null!==(em=null===(eu=R.tileManagers[eg])||void 0===eu?void 0:eu.getState().revision)&&void 0!==em?em:0;for(let R in this._coordsAscending[eg])this._rttFingerprints[eg][R]=`${this._coordsAscending[eg][R].map(R=>R.key).sort().join()}#${eh}`}}for(let R of this._renderableTiles)for(let eh in this._rttFingerprints){let eu=this._rttFingerprints[eh][R.tileID.key];eu&&eu!==R.rttFingerprint[eh]&&(R.rtt=[])}}renderLayer(R,eu){if(R.isHidden(this.painter.transform.zoom))return!1;let em=Object.assign(Object.assign({},eu),{isRenderingToTexture:!0}),e_=R.type,eg=this.painter,ev=this._renderableLayerIds[this._renderableLayerIds.length-1]===R.id;if(tP[e_]&&(this._prevType&&tP[this._prevType]||this._stacks.push([]),this._prevType=e_,this._stacks[this._stacks.length-1].push(R.id),!ev))return!0;if(tP[this._prevType]||tP[e_]&&ev){this._prevType=e_;let R=this._stacks.length-1,eu=this._stacks[R]||[];for(let e_ of this._renderableTiles){if(this.pool.isFull()&&(Gr(this.painter,this.terrain,this._rttTiles,em),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(e_),e_.rtt[R]){let eh=this.pool.getObjectForId(e_.rtt[R].id);if(eh.stamp===e_.rtt[R].stamp){this.pool.useObject(eh);continue}}let ev=this.pool.getOrCreateFreeObject();for(let ex of(this.pool.useObject(ev),this.pool.stampObject(ev),e_.rtt[R]={id:ev.id,stamp:ev.stamp},eg.context.bindFramebuffer.set(ev.fbo.framebuffer),eg.context.clear({color:eh.bo.transparent,stencil:0}),eg.currentStencilSource=void 0,eu)){let R=eg.style._layers[ex],eh=R.source?this._coordsAscending[R.source][e_.tileID.key]:[e_.tileID];eg.context.viewport.set([0,0,ev.fbo.width,ev.fbo.height]),eg._renderTileClippingMasks(R,eh,!0),eg.renderLayer(eg,eg.style.tileManagers[R.source],R,eh,em),R.source&&(e_.rttFingerprint[R.source]=this._rttFingerprints[R.source][e_.tileID.key])}}return Gr(this.painter,this.terrain,this._rttTiles,em),this._rttTiles=[],this.pool.freeAllObjects(),tP[e_]}return!1}};let tI={"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"},tM={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:tT,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,maxTileC
56acheSize:null,maxTileCacheZoomLevels:eh.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},tE=class extends Xa{get _ownerWindow(){var R,eh;return(null===(eh=null===(R=this._container)||void 0===R?void 0:R.ownerDocument)||void 0===eh?void 0:eh.defaultView)||window}constructor(R){var eu,em,e_;let eg=Object.assign(Object.assign(Object.assign({},tM),R),{canvasContextAttributes:Object.assign(Object.assign({},tM.canvasContextAttributes),R.canvasContextAttributes)});if(null!=eg.minZoom&&null!=eg.maxZoom&&eg.minZoom>eg.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=eg.minPitch&&null!=eg.maxPitch&&eg.minPitch>eg.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=eg.minPitch&&eg.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=eg.maxPitch&&eg.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");let ev=new qt,ex=new Kt;void 0!==eg.minZoom&&ev.setMinZoom(eg.minZoom),void 0!==eg.maxZoom&&ev.setMaxZoom(eg.maxZoom),void 0!==eg.minPitch&&ev.setMinPitch(eg.minPitch),void 0!==eg.maxPitch&&ev.setMaxPitch(eg.maxPitch),void 0!==eg.renderWorldCopies&&ev.setRenderWorldCopies(eg.renderWorldCopies),null!==eg.transformConstrain&&ev.setConstrainOverride(eg.transformConstrain),super(ev,ex,{bearingSnap:eg.bearingSnap,zoomSnap:eg.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ja,this._controls=[],this._mapId=eh.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=R=>{if(R.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let R of Object.values(this.style._layers))if("custom"===R.type&&console.warn(`Custom layer with id '${R.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),R._listeners)for(let[eh]of Object.entries(R._listeners))console.warn(`Custom layer with id '${R.id}' had event listeners for event '${eh}' 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 eh.n("webglcontextlost",{originalEvent:R}))}else this.fire(new eh.n("webglcontextlost",{originalEvent:R}))},this._contextRestored=R=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new eh.n("webglcontextrestored",{originalEvent:R}))},this._onMapScroll=R=>{if(R.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=eg.interactive,this._maxTileCacheSize=eg.maxTileCacheSize,this._maxTileCacheZoomLevels=eg.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},eg.canvasContextAttributes),this._trackResize=!0===eg.trackResize,this._bearingSnap=eg.bearingSnap,this._zoomSnap=eg.zoomSnap,this._centerClampedToGround=eg.centerClampedToGround,this._refreshExpiredTiles=!0===eg.refreshExpiredTiles,this._fadeDuration=eg.fadeDuration,this._crossSourceCollisions=!0===eg.crossSourceCollisions,this._collectResourceTiming=!0===eg.collectResourceTiming,this._locale=Object.assign(Object.assign({},tI),eg.locale),this._clickTolerance=eg.clickTolerance,this._overridePixelRatio=eg.pixelRatio,this._maxCanvasSize=eg.maxCanvasSize,this._zoomLevelsToOverscale=eg.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=eg.transformCameraUpdate,this.transformConstrain=eg.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===eg.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(eg.anisotropicFilterPitch),void 0!==eg.reduceMotion&&(eA.prefersReducedMotion=eg.reduceMotion),this._imageQueueHandle=eI.addThrottleControl(()=>this.isMoving()),this._requestManager=new _(eg.transformRequest),this._container=this._resolveContainer(eg.container),eg.max
56Bounds&&this.setMaxBounds(eg.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),"undefined"!=typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Ha(this,eg),this._hash=eg.hash?new Hr("string"==typeof eg.hash&&eg.hash||void 0).addTo(this):void 0,(null===(eu=this._hash)||void 0===eu?void 0:eu._onHashChange())||(this.jumpTo({center:eg.center,elevation:eg.elevation,zoom:eg.zoom,bearing:eg.bearing,pitch:eg.pitch,roll:eg.roll}),eg.bounds&&(this.resize(),this.fitBounds(eg.bounds,eh.e({},eg.fitBoundsOptions,{duration:0}))));let eb="string"==typeof eg.style||"globe"!==(null===(e_=null===(em=eg.style)||void 0===em?void 0:em.projection)||void 0===e_?void 0:e_.type);this.resize(null,eb),this._localIdeographFontFamily=eg.localIdeographFontFamily,this._validateStyle=eg.validateStyle,eg.style&&this.setStyle(eg.style,{localIdeographFontFamily:eg.localIdeographFontFamily}),eg.attributionControl&&this.addControl(new Ya("boolean"==typeof eg.attributionControl?void 0:eg.attributionControl)),eg.maplibreLogo&&this.addControl(new Qa,eg.logoPosition),this.on("style.load",()=>{if(eb||this._resizeTransform(),this.transform.unmodified){let R=eh.V(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(R)}}),this.on("data",R=>{this._update("style"===R.dataType),this.fire(new eh.n(`${R.dataType}data`,R))}),this.on("dataloading",R=>{this.fire(new eh.n(`${R.dataType}dataloading`,R))}),this.on("dataabort",R=>{this.fire(new eh.n("sourcedataabort",R))})}_getMapId(){return this._mapId}setGlobalStateProperty(R,eh){return this.style.setGlobalStateProperty(R,eh),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(R,eu){if(void 0===eu&&(eu=R.getDefaultPosition?R.getDefaultPosition():"top-right"),!(null==R?void 0:R.onAdd))return this.fire(new eh.l(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let em=R.onAdd(this);this._controls.push(R);let e_=this._controlPositions[eu];return eu.includes("bottom")?e_.insertBefore(em,e_.firstChild):e_.appendChild(em),this}removeControl(R){if(!(null==R?void 0:R.onRemove))return this.fire(new eh.l(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let eu=this._controls.indexOf(R);return eu>-1&&this._controls.splice(eu,1),R.onRemove(this),this}hasControl(R){return this._controls.includes(R)}coveringTiles(R){return Ce(this.transform,R)}calculateCameraOptionsFromTo(R,eh,eu,em){return null==em&&this.terrain&&(em=this.terrain.getElevationForLngLat(eu,this.transform)),super.calculateCameraOptionsFromTo(R,eh,eu,em)}resize(R,eu=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(eu);let em=!this._moving;return em&&(this.stop(),this.fire(new eh.n("movestart",R)).fire(new eh.n("move",R))),this.fire(new eh.n("resize",R)),em&&this.fire(new eh.n("moveend",R)),this}_resizeInternal(R=!0){let[eh,eu]=this._containerDimensions(),em=this._getClampedPixelRatio(eh,eu);if(this._resizeCanvas(eh,eu,em),this.painter.resize(eh,eu,em),this.painter.overLimit()){let R=this.painter.context.gl;this._maxCanvasSize=[R.drawingBufferWidth,R.drawingBufferHeight];let em=this._getClampedPixelRatio(eh,eu);this._resizeCanvas(eh,eu,em),this.painter.resize(eh,eu,em)}this._resizeTransform(R)}_resizeTransform(R=!0){var eh;let[eu,em]=this._containerDimensions();this.transform.resize(eu,em,R),null===(eh=this._requestedCameraState)||void 0===eh||eh.resize(eu,em,R)}_getClampedPixelRatio(R,eh){let{0:eu,1:em}=this._maxCanvasSize,e_=this.getPixelRatio(),eg=R*e_,ev=eh*e_;return Math.min(eg>eu?eu/eg:1,ev>em?em/ev:1)*e_}getPixelRatio(){var R;return null!==(R=this._overridePixelRatio)&&void 0!==R?R:devicePixelRatio}setPixelRatio(R){this._overridePixelRatio=R,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(R){return this.transform.setMaxBounds(U.convert(R)),this._update()}setMinZoom(R){if((R=null==R?-2:R)>=-2&&R<=this.transform.maxZoom){let eu=this.transform.zoom,em=this._getTransformForUpdate();return em.setMinZoom(R),this._applyUpdatedTransform(em),this._update(),eu!==this.transform.zoom&&this.fire(new eh.n("zoomstart")).fire(new eh.n("zoom")).fire(new eh.n("zoomend")).fire(new eh.n("movestart")).fire(new eh.n("move")).fire(new eh.n("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(R){if((R=null==R?22:R)>=this.transform.minZoom){let eu=this.transform.zoom,em=this._getTransformForUpdate();return em.setMaxZoom(R),this._applyUpdatedTransform(em),this._update(),eu!==this.transform.zoom&&this.fire(new eh.n("zoomstart")).fire(new eh.n("zoom")).fire(new eh.n("zoomend")).fire(new eh.n("movestart")).fire(new eh.n("move")).fire(new eh.n("moveend")),this}
56throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(R){if((R=null==R?0:R)<0)throw Error("minPitch must be greater than or equal to 0");if(R>=0&&R<=this.transform.maxPitch){let eu=this.transform.pitch,em=this._getTransformForUpdate();return em.setMinPitch(R),this._applyUpdatedTransform(em),this._update(),eu!==this.transform.pitch&&this.fire(new eh.n("pitchstart")).fire(new eh.n("pitch")).fire(new eh.n("pitchend")).fire(new eh.n("movestart")).fire(new eh.n("move")).fire(new eh.n("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(R){if((R=null==R?60:R)>180)throw Error("maxPitch must be less than or equal to 180");if(R>=this.transform.minPitch){let eu=this.transform.pitch,em=this._getTransformForUpdate();return em.setMaxPitch(R),this._applyUpdatedTransform(em),this._update(),eu!==this.transform.pitch&&this.fire(new eh.n("pitchstart")).fire(new eh.n("pitch")).fire(new eh.n("pitchend")).fire(new eh.n("movestart")).fire(new eh.n("move")).fire(new eh.n("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(R){if((R=null==R?20:R)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(R<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=R,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(R){return this.transform.setRenderWorldCopies(R),this._update()}setTransformConstrain(R){return this.transform.setConstrainOverride(R),this._update()}project(R){return this.transform.locationToScreenPoint(eh.W.convert(R),this.style&&this.terrain)}unproject(R){return this.transform.screenPointToLocation(eh.P.convert(R),this.terrain)}isMoving(){var R;return this._moving||(null===(R=this.handlers)||void 0===R?void 0:R.isMoving())}isZooming(){var R;return this._zooming||(null===(R=this.handlers)||void 0===R?void 0:R.isZooming())}isRotating(){var R;return this._rotating||(null===(R=this.handlers)||void 0===R?void 0:R.isRotating())}_createDelegatedListener(R,eh,eu){if("mouseenter"===R||"mouseover"===R){let em=!1;return{layers:eh,listener:eu,delegates:{mousemove:e_=>{let eg=eh.filter(R=>this.getLayer(R)),ev=0!==eg.length?this.queryRenderedFeatures(e_.point,{layers:eg}):[];ev.length?em||(em=!0,eu.call(this,new ra(R,this,e_.originalEvent,{features:ev}))):em=!1},mouseout:()=>{em=!1}}}}if("mouseleave"===R||"mouseout"===R){let em=!1;return{layers:eh,listener:eu,delegates:{mousemove:e_=>{let eg=eh.filter(R=>this.getLayer(R));(0!==eg.length?this.queryRenderedFeatures(e_.point,{layers:eg}):[]).length?em=!0:em&&(em=!1,eu.call(this,new ra(R,this,e_.originalEvent)))},mouseout:eh=>{em&&(em=!1,eu.call(this,new ra(R,this,eh.originalEvent)))}}}}return{layers:eh,listener:eu,delegates:{[R]:R=>{let em=eh.filter(R=>this.getLayer(R)),e_=0!==em.length?this.queryRenderedFeatures(R.point,{layers:em}):[];e_.length&&(R.features=e_,eu.call(this,R),delete R.features)}}}}_saveDelegatedListener(R,eh){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[R]=this._delegatedListeners[R]||[],this._delegatedListeners[R].push(eh)}_removeDelegatedListener(R,eh,eu){var em;if(!(null===(em=this._delegatedListeners)||void 0===em?void 0:em[R]))return;let e_=this._delegatedListeners[R];for(let R=0;R<e_.length;R++){let em=e_[R];if(em.listener===eu&&em.layers.length===eh.length&&em.layers.every(R=>eh.includes(R))){for(let R in em.delegates)this.off(R,em.delegates[R]);return void e_.splice(R,1)}}}on(R,eh,eu){if(void 0===eu)return super.on(R,eh);let em="string"==typeof eh?[eh]:eh,e_=this._createDelegatedListener(R,em,eu);for(let eh in this._saveDelegatedListener(R,e_),e_.delegates)this.on(eh,e_.delegates[eh]);return{unsubscribe:()=>{this._removeDelegatedListener(R,em,eu)}}}once(R,eh,eu){if(void 0===eu)return super.once(R,eh);let em="string"==typeof eh?[eh]:eh,e_=this._createDelegatedListener(R,em,eu);for(let eh in e_.delegates){let eg=e_.delegates[eh];e_.delegates[eh]=(...eh)=>{this._removeDelegatedListener(R,em,eu),eg(...eh)}}for(let eh in this._saveDelegatedListener(R,e_),e_.delegates)this.once(eh,e_.delegates[eh]);return this}off(R,eh,eu){return void 0===eu?super.off(R,eh):(this._removeDelegatedListener(R,"string"==typeof eh?[eh]:eh,eu),this)}queryRenderedFeatures(R,eu){let em;if(!this.style)return[];let e_=R instanceof eh.P||Array.isArray(R),eg=e_?R:[[0,0],[this.transform.width,this.transform.height]];if(eu=eu||(e_?{}:R)||{},eg instanceof eh.P||"number"==typeof eg[0])em=[eh.P.convert(eg)];else{let R=eh.P.convert(eg[0]),eu=eh.P.convert(eg[1]);em=[R,new eh.P(eu.x,R.y),eu,new eh.P(R.x,eu.y),R]}return this.style.queryRenderedFeatures(em,eu,this.transform)}querySourceFeatures(R,eh){return this.style.querySourceFeatures(R,eh)}setStyle(R,eu){return!1!==(eu=eh.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
56idateStyle},eu)).diff&&eu.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&R?(this._diffStyle(R,eu),this):(this._localIdeographFontFamily=eu.localIdeographFontFamily,this._updateStyle(R,eu))}setTransformRequest(R){return this._requestManager.setTransformRequest(R),this}_getUIString(R){let eh=this._locale[R];if(null==eh)throw Error(`Missing UI string '${R}'`);return eh}_updateStyle(R,eh){var eu,em,e_;if(null===(eu=this._diffStyleRequest)||void 0===eu||eu.abort(),this._diffStyleRequest=null,eh.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(R,eh));let eg=this.style&&eh.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!R)),R?(this.style=new Li(this,eh||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof R?this.style.loadURL(R,eh,eg):this.style.loadJSON(R,eh,eg)):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),null===(e_=null===(em=this.style)||void 0===em?void 0:em.projection)||void 0===e_||e_.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new Li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(R,eu){return eh._(this,void 0,void 0,function*(){var em;if(null===(em=this._diffStyleRequest)||void 0===em||em.abort(),"string"==typeof R){this._diffStyleRequest=new AbortController;let em=this._diffStyleRequest;try{let e_=yield this._requestManager.transformRequest(R,"Style");if(em.signal.aborted)return void(this._diffStyleRequest=null);let eg=yield eh.k(e_,em);this._diffStyleRequest=null,this._updateDiff(eg.data,eu)}catch(R){this._diffStyleRequest=null,eh.$(R)||this.fire(new eh.l(eh.d(R)))}}else"object"==typeof R&&(this._diffStyleRequest=null,this._updateDiff(R,eu))})}_updateDiff(R,eu){try{this.style.setState(R,eu)&&this._update(!0)}catch(em){eh.w(`Unable to perform style diff: ${eh.d(em).message}. Rebuilding the style from scratch.`),this._updateStyle(R,eu)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();eh.w("There is no style added to the map.")}addSource(R,eh){return this._lazyInitEmptyStyle(),this.style.addSource(R,eh),this._update(!0)}isSourceLoaded(R){var eu;let em=null===(eu=this.style)||void 0===eu?void 0:eu.tileManagers[R];if(void 0!==em)return em.loaded();this.fire(new eh.l(Error(`There is no tile manager with ID '${R}'`)))}setTerrain(R){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),R){let eu=this.style.tileManagers[R.source];if(!eu)throw Error(`cannot load terrain, because there exists no source with ID: ${R.source}`);for(let em in null===this.terrain&&eu.reload(),this.style._layers){let eu=this.style._layers[em];"hillshade"===eu.type&&eu.source===R.source&&eh.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===eu.type&&eu.source===R.source&&eh.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 is(this.painter,eu,R),this.painter.renderToTexture=new as(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=eh=>{var eu;"style"===eh.dataType?this.terrain.tileManager.freeRtt():"source"===eh.dataType&&eh.tile&&(eh.sourceId!==R.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGroun
56d&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(eu=eh.source)||void 0===eu?void 0:eu.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(eh.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new eh.n("terrain",{terrain:R})),this}getTerrain(){var R,eh;return null!==(eh=null===(R=this.terrain)||void 0===R?void 0:R.options)&&void 0!==eh?eh:null}areTilesLoaded(){var R;let eh=null===(R=this.style)||void 0===R?void 0:R.tileManagers;for(let R of Object.values(eh))if(!R.areTilesLoaded())return!1;return!0}removeSource(R){return this.style.removeSource(R),this._update(!0)}getSource(R){return this.style.getSource(R)}setSourceTileLodParams(R,eh,eu){if(eu){let em=this.getSource(eu);if(!em)throw Error(`There is no source with ID "${eu}", cannot set LOD parameters`);em.calculateTileZoom=we(Math.max(1,R),Math.max(1,eh))}else for(let eu in this.style.tileManagers)this.style.tileManagers[eu].getSource().calculateTileZoom=we(Math.max(1,R),Math.max(1,eh));return this._update(!0),this}refreshTiles(R,eu){let em=this.style.tileManagers[R];if(!em)throw Error(`There is no tile manager with ID "${R}", cannot refresh tile`);void 0===eu?em.reload(!0):em.refreshTiles(eu.map(R=>new eh.aa(R.z,R.x,R.y)))}addImage(R,eu,em={}){let{pixelRatio:e_=1,sdf:eg=!1,stretchX:ev,stretchY:ex,content:eb,textFitWidth:ew,textFitHeight:eT}=em;if(this._lazyInitEmptyStyle(),!(eu instanceof HTMLImageElement||eh.b(eu))){if(void 0===eu.width||void 0===eu.height)return this.fire(new eh.l(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:em,height:eS,data:eP}=eu;return this.style.addImage(R,{data:new eh.R({width:em,height:eS},new Uint8Array(eP)),pixelRatio:e_,stretchX:ev,stretchY:ex,content:eb,textFitWidth:ew,textFitHeight:eT,sdf:eg,version:0,userImage:eu}),eu.onAdd&&eu.onAdd(this,R),this}}{let{width:em,height:eS,data:eP}=eA.getImageData(eu);this.style.addImage(R,{data:new eh.R({width:em,height:eS},eP),pixelRatio:e_,stretchX:ev,stretchY:ex,content:eb,textFitWidth:ew,textFitHeight:eT,sdf:eg,version:0})}}updateImage(R,eu){let em=this.style.getImage(R);if(!em)return this.fire(new eh.l(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let e_=eu instanceof HTMLImageElement||eh.b(eu)?eA.getImageData(eu):eu,{width:eg,height:ev,data:ex}=e_;if(void 0===eg||void 0===ev)return this.fire(new eh.l(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(eg!==em.data.width||ev!==em.data.height)return this.fire(new eh.l(Error("The width and height of the updated image must be that same as the previous version of the image")));let eb=!(eu instanceof HTMLImageElement||eh.b(eu));return em.data.replace(ex,eb),this.style.updateImage(R,em),this}getImage(R){return this.style.getImage(R)}hasImage(R){return R?!!this.style.getImage(R):(this.fire(new eh.l(Error("Missing required image id"))),!1)}removeImage(R){this.style.removeImage(R)}loadImage(R){return eh._(this,void 0,void 0,function*(){return eI.getImage((yield this._requestManager.transformRequest(R,"Image")),new AbortController)})}listImages(){return this.style.listImages()}addLayer(R,eh){return this._lazyInitEmptyStyle(),this.style.addLayer(R,eh),this._update(!0)}moveLayer(R,eh){return this.style.moveLayer(R,eh),this._update(!0)}removeLayer(R){return this.style.removeLayer(R),this._update(!0)}getLayer(R){return this.style.getLayer(R)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(R,eh,eu){return this.style.setLayerZoomRange(R,eh,eu),this._update(!0)}setFilter(R,eh,eu={}){return this.style.setFilter(R,eh,eu),this._update(!0)}getFilter(R){return this.style.getFilter(R)}setPaintProperty(R,eh,eu,em={}){return this.style.setPaintProperty(R,eh,eu,em),this._update(!0)}getPaintProperty(R,eh){return this.style.getPaintProperty(R,eh)}setLayoutProperty(R,eh,eu,em={}){return this.style.setLayoutProperty(R,eh,eu,em),this._update(!0)}getLayoutProperty(R,eh){return this.style.getLayoutProperty(R,eh)}setGlyphs(R,eh={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(R,eh),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(R,eh,eu={}){return this._lazyInitEmptyStyle(),this.style.addSprite(R,eh,eu,R=>{R||this._update(!0)}),this}removeSprite(R){return this._lazyInitEmptyStyle(),this.style.removeSprite(R),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(R,eh={}){return this._lazyInitEmptyStyle(),this.style.setSprite(R,eh,R=>{R||this._update(!0)}),this}setLight(R,eh={}){return this._lazyInitEmptyStyle(),this.style.setLight(R,eh),this._update(!0)}getLight(){return this.style.getLight()}setSky(R,eh={}){return this._lazyInitEmptyStyle(),this.style.setSky(R,eh),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(R,eh){return this.style.setFeatureState(R,eh),this._update()}removeFeatureState(R,eh){return this.style.removeFeatureState(R,eh),this._update()}getFeatureState(R){return this.style.getFeatureState(R)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let R=0,eh=0;return this._container&&(R=this._container.clientWidth||400,eh=this._container.clientHeight||300),[R,eh]}_setupResizeObserver(){var R;let eh=!1,eu=$r(R=>{this._trackResize&&!this._removed&&(this.resize(R),this.redraw())},50),em=null!==(R=this._ownerWindow.ResizeObserver)&&void 0!==R?R:ResizeObserver;this._resizeObserver=new em(R=>{eh?eu(R):eh=!0}),this._resizeObserver.observe(this._container)}
56_resolveContainer(R){if("string"==typeof R){let eh=document.getElementById(R);if(!eh)throw Error(`Container '${R}' not found.`);return eh}if(R instanceof HTMLElement||R&&"object"==typeof R&&1===R.nodeType)return R;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let R=this._container;R.classList.add("maplibregl-map");let eh=this._canvasContainer=d.create("div","maplibregl-canvas-container",R);this._interactive&&eh.classList.add("maplibregl-interactive"),this._canvas=d.create("canvas","maplibregl-canvas",eh),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let eu=this._containerDimensions(),em=this._getClampedPixelRatio(eu[0],eu[1]);this._resizeCanvas(eu[0],eu[1],em);let e_=this._controlContainer=d.create("div","maplibregl-control-container",R),eg=this._controlPositions={};for(let R of["top-left","top-right","bottom-left","bottom-right"])eg[R]=d.create("div",`maplibregl-ctrl-${R} `,e_);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(R,eh,eu){this._canvas.width=Math.floor(eu*R),this._canvas.height=Math.floor(eu*eh),this._canvas.style.width=`${R}px`,this._canvas.style.height=`${eh}px`}_setupPainter(){let R=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),eh=null;this._canvas.addEventListener("webglcontextcreationerror",eu=>{eh={requestedAttributes:R},eu&&(eh.statusMessage=eu.statusMessage,eh.type=eu.type)},{once:!0});let eu=null;if(!(eu=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,R):this._canvas.getContext("webgl2",R)||this._canvas.getContext("webgl",R))){let R="Failed to initialize WebGL";throw eh?(eh.message=R,Error(JSON.stringify(eh))):Error(R)}this.painter=new qr(eu,this.transform)}migrateProjection(R,eu){super.migrateProjection(R,eu),this.painter.transform=R,this.fire(new eh.n("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(R){var eh;return(null===(eh=this.style)||void 0===eh?void 0:eh._loaded)&&(this._styleDirty=this._styleDirty||R,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(R){return this._update(),this._renderTaskQueue.add(R)}_cancelRenderFrame(R){this._renderTaskQueue.remove(R)}_render(R){var eu,em,e_,eg,ev,ex;let eb=this._idleTriggered?this._fadeDuration:0,ew=(null===(eu=this.style.projection)||void 0===eu?void 0:eu.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(R),this._removed)return;let eT=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let R=this.transform.zoom,eu=c();this.style.zoomHistory.update(R,eu);let em=new eh.J(R,{now:eu,fadeDuration:eb,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),e_=em.crossFadingFactor();1===e_&&e_===this._crossFadingFactor||(eT=!0,this._crossFadingFactor=e_),this.style.update(em)}let eS=(null===(em=this.style.projection)||void 0===em?void 0:em.transitionState)>0!==ew;null===(e_=this.style.projection)||void 0===e_||e_.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(eg=this.style.projection)||void 0===eg?void 0:eg.transitionState,null===(ev=this.style.projection)||void 0===ev?void 0:ev.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||eS)&&(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._centerClampedToGroun
56d&&this.transform.setElevation(0)),this._placementDirty=null===(ex=this.style)||void 0===ex?void 0:ex._updatePlacement(this.transform,this.showCollisionBoxes,eb,this._crossSourceCollisions,eS),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:eb,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new eh.n("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new eh.n("load"))),this.style&&(this.style.hasTransitions()||eT)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let eP=this._sourcesDirty||this._styleDirty||this._placementDirty;return eP||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new eh.n("idle")),!this._loaded||this._fullyLoaded||eP||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var R,eu;for(let R of(this._hash&&this._hash.remove(),this._controls))R.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),null===(R=this._diffStyleRequest)||void 0===R||R.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),eI.removeThrottleControl(this._imageQueueHandle),null===(eu=this._resizeObserver)||void 0===eu||eu.disconnect();let em=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==em?void 0:em.loseContext)&&em.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new eh.n("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,eA.frame(this._frameRequest,R=>{this._frameRequest=null;try{this._render(R)}catch(R){if(!eh.$(R)&&R.message!==e5)throw R}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(R){this._showTileBoundaries!==R&&(this._showTileBoundaries=R,this._update())}get showPadding(){return!!this._showPadding}set showPadding(R){this._showPadding!==R&&(this._showPadding=R,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(R){this._showCollisionBoxes!==R&&(this._showCollisionBoxes=R,R?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(R){this._showOverdrawInspector!==R&&(this._showOverdrawInspector=R,this._update())}get repaint(){return!!this._repaint}set repaint(R){this._repaint!==R&&(this._repaint=R,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(R){this._vertices=R,this._update()}get version(){return eC}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(R){return this._lazyInitEmptyStyle(),this.style.setProjection(R),this._update(!0)}},tC={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};let us=class us{constructor(R,eu,em=!1){this.mousedown=R=>{this.startMove(R,d.mousePos(this.element,R)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=R=>{this.move(R,d.mousePos(this.element,R))},this.mouseup=R=>{this._rotatePitchHandler.dragEnd(R),this.offTemp()},this.touchstart=R=>{1!==R.targetTouches.length?this.reset():(this._startPos=this._lastPos=d.touchPos(this.element,R.targetTouches)[0],this.startMove(R,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=R=>{1!==R.targetTouches.length?this.reset():(this._lastPos=d.touchPos(this.element,R.targetTouches)[0],this.move(R,this._lastPos))},this.touchend=R=>{0===R.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=eu;let e_=new ya;this._rotatePitchHandler=new ma({clickTolerance:3,move:(R,e_)=>{let eg=eu.getBoundingClientRect(),ev=new eh.P((eg.bottom-eg.top)/2,(eg.right-eg.left)/2);return{bearingDelta:eh.cx(new eh.P(R.x,e_.y),e_,ev),pitchDelta:em?-.5*(e_.y-R.y):void 0}},moveStateManager:e_,enable:!0,assignEvents:()=>{}}),this.map=R,eu.addEventListener("mousedown",this.mousedown),eu.addEventListener("touchstart",this.touchstart,{passive:!1}),eu.addEventListener("touchcancel",this.reset)}startMove(R,eh){this._rotatePitchHandler.dragStart(R,eh),d.disableDrag()}move(R,eh){let eu=this.map,{bearingDelta:em,pitchDelta:e_}=this._rotatePitchHandler.dragMove(R,eh)||{};em&&eu.setBearing(eu.getBearing()+em),e_&&eu.setPitch(eu.getPitch()+e_)}off(){let R=this.element;R.removeEventListener("mousedown",this.mousedown),R.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),R.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){d.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};function _s(R,eu,em,e_=!1){if(e_||!em.getCoveringTilesDetailsProvider().allowWorldCopies())return null==R?void 0:R.wrap();let eg=new eh.W(R.lng,R.lat);if(R=new eh.W(R.lng,R.lat),eu){let e_=new eh.W(R.lng-360,R.lat),eg=new eh.W(R.lng+360,R.lat),ev=em.locationToScreenPoint(R).distSqr(eu);em.locationToScreenPoint(e_).distSqr(eu)<ev?R=e_:em.locationToScreenPoint(eg).distSqr(eu)<ev&&(R=eg)}for(;Math.abs(R.lng-em.center.lng)>180;){let eh=em.locationToScreenPoint(R);if(eh.x>=0&&eh.y>=0&&eh.x<=em.width&&eh.y<=em.height)break;R.lng>em.center.lng?R.lng-=360:R.lng+=360}
56return R.lng!==eg.lng&&em.isPointOnMapSurface(em.locationToScreenPoint(R))?R:eg}let tA={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 ms(R,eh,eu){let em=R.classList;for(let R in tA)em.remove(`maplibregl-${eu}-anchor-${R}`);em.add(`maplibregl-${eu}-anchor-${eh}`)}let fs=class fs extends eh.E{constructor(R){if(super(),this._onClick=R=>{this.fire(new eh.n("click",{originalEvent:R}))},this._onKeyPress=R=>{"Space"!==R.code&&"Enter"!==R.code||this.togglePopup()},this._onMapClick=R=>{let eh=R.originalEvent.target,eu=this._element;this._popup&&(eh===eu||eu.contains(eh))&&this.togglePopup()},this._update=R=>{if(!this._map)return;let eh=this._map.loaded()&&!this._map.isMoving();"terrain"!==(null==R?void 0:R.type)&&("render"!==(null==R?void 0:R.type)||eh)||this._map.once("render",this._update),this._lngLat=_s(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let eu="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?eu=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(eu=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let em="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?em="rotateX(0deg)":"map"===this._pitchAlignment&&(em=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||R&&"moveend"!==R.type||(this._pos=this._pos.round()),this._element.style.transform=`${tA[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${em} ${eu}`,eA.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===(null==R?void 0:R.type))}).catch(()=>{})},this._onMove=R=>{if(!this._isDragging){let eh=this._clickTolerance||this._map._clickTolerance;this._isDragging=R.point.dist(this._pointerdownPos)>=eh}this._isDragging&&(this._pos=R.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new eh.n("dragstart"))),this.fire(new eh.n("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new eh.n("dragend")),this._state="inactive"},this._addDragHandler=R=>{this._element.contains(R.originalEvent.target)&&(R.preventDefault(),this._positionDelta=R.point.sub(this._pos).add(this._offset),this._pointerdownPos=R.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=(null==R?void 0:R.anchor)||"center",this._color=(null==R?void 0:R.color)||"#3FB1CE",this._scale=(null==R?void 0:R.scale)||1,this._draggable=(null==R?void 0:R.draggable)||!1,this._clickTolerance=(null==R?void 0:R.clickTolerance)||0,this._subpixelPositioning=(null==R?void 0:R.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(null==R?void 0:R.rotation)||0,this._rotationAlignment=(null==R?void 0:R.rotationAlignment)||"auto",this._pitchAlignment=(null==R?void 0:R.pitchAlignment)&&"auto"!==R.pitchAlignment?R.pitchAlignment:this._rotationAlignment,this.setOpacity(null==R?void 0:R.opacity,null==R?void 0:R.opacityWhenCovered),null==R?void 0:R.element)this._element=R.element,this._offset=eh.P.convert((null==R?void 0:R.offset)||[0,0]);else{this._defaultMarker=!0,this._element=d.create("div");let eu=d.createNS("http://www.w3.org/2000/svg","svg");eu.setAttributeNS(null,"display","block"),eu.setAttributeNS(null,"height","41px"),eu.setAttributeNS(null,"width","27px"),eu.setAttributeNS(null,"viewBox","0 0 27 41");let em=d.createNS("http://www.w3.org/2000/svg","g");
56em.setAttributeNS(null,"stroke","none"),em.setAttributeNS(null,"stroke-width","1"),em.setAttributeNS(null,"fill","none"),em.setAttributeNS(null,"fill-rule","evenodd");let e_=d.createNS("http://www.w3.org/2000/svg","g");e_.setAttributeNS(null,"fill-rule","nonzero");let eg=d.createNS("http://www.w3.org/2000/svg","g");for(let R of(eg.setAttributeNS(null,"transform","translate(3.0, 29.0)"),eg.setAttributeNS(null,"fill","#000000"),[{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"}])){let eh=d.createNS("http://www.w3.org/2000/svg","ellipse");eh.setAttributeNS(null,"opacity","0.04"),eh.setAttributeNS(null,"cx","10.5"),eh.setAttributeNS(null,"cy","5.80029008"),eh.setAttributeNS(null,"rx",R.rx),eh.setAttributeNS(null,"ry",R.ry),eg.appendChild(eh)}let ev=d.createNS("http://www.w3.org/2000/svg","g");ev.setAttributeNS(null,"fill",this._color);let ex=d.createNS("http://www.w3.org/2000/svg","path");ex.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"),ev.appendChild(ex);let eb=d.createNS("http://www.w3.org/2000/svg","g");eb.setAttributeNS(null,"opacity","0.25"),eb.setAttributeNS(null,"fill","#000000");let ew=d.createNS("http://www.w3.org/2000/svg","path");ew.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"),eb.appendChild(ew);let eT=d.createNS("http://www.w3.org/2000/svg","g");eT.setAttributeNS(null,"transform","translate(6.0, 7.0)"),eT.setAttributeNS(null,"fill","#FFFFFF");let eS=d.createNS("http://www.w3.org/2000/svg","g");eS.setAttributeNS(null,"transform","translate(8.0, 8.0)");let eP=d.createNS("http://www.w3.org/2000/svg","circle");eP.setAttributeNS(null,"fill","#000000"),eP.setAttributeNS(null,"opacity","0.25"),eP.setAttributeNS(null,"cx","5.5"),eP.setAttributeNS(null,"cy","5.5"),eP.setAttributeNS(null,"r","5.4999962");let eI=d.createNS("http://www.w3.org/2000/svg","circle");eI.setAttributeNS(null,"fill","#FFFFFF"),eI.setAttributeNS(null,"cx","5.5"),eI.setAttributeNS(null,"cy","5.5"),eI.setAttributeNS(null,"r","5.4999962"),eS.appendChild(eP),eS.appendChild(eI),e_.appendChild(eg),e_.appendChild(ev),e_.appendChild(eb),e_.appendChild(eT),e_.appendChild(eS),eu.appendChild(e_),eu.setAttributeNS(null,"height",41*this._scale+"px"),eu.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(eu),this._offset=eh.P.convert((null==R?void 0:R.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",R=>{R.preventDefault()}),this._element.addEventListener("mousedown",R=>{R.preventDefault()}),ms(this._element,this._anchor,"marker"),null==R?void 0:R.className)for(let eh of R.className.split(" "))this._element.classList.add(eh);this._popup=null}addTo(R){return this.remove(),this._map=R,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",R._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),R.getCanvasContainer().appendChild(this._element),R.on("move",this._update),R.on("moveend",this._update),R.on("terrain",this._update),R.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(R){return this._lngLat=eh.W.convert(R),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(R){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),R){if(!("offset"in R.options)){let eh=Math.abs(13.5)/Math.SQRT2;R.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
560,-38.1],"bottom-left":[eh,-1*(24.6+eh)],"bottom-right":[-eh,-1*(24.6+eh)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=R,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(R){return this._subpixelPositioning=R,this}getPopup(){return this._popup}togglePopup(){let R=this._popup;return this._element.style.opacity===this._opacityWhenCovered||R&&(R.isOpen()?R.remove():(R.setLngLat(this._lngLat),R.addTo(this._map))),this}_updateOpacity(R=!1){var eu,em;let e_=null===(eu=this._map)||void 0===eu?void 0:eu.terrain,eg=this._map.transform.isLocationOccluded(this._lngLat);if(!e_||eg){let R=eg?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==R&&(this._element.style.opacity=R,this._element.classList.toggle("maplibregl-marker-covered",eg)))}if(R)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let ev=this._map,ex=ev.terrain.depthAtPoint(this._pos),eb=ev.terrain.getElevationForLngLat(this._lngLat,ev.transform);if(ev.transform.lngLatToCameraDepth(this._lngLat,eb)-ex<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let ew=-this._offset.y/ev.transform.pixelsPerMeter,eT=Math.sin(ev.getPitch()*Math.PI/180)*ew,eS=ev.terrain.depthAtPoint(new eh.P(this._pos.x,this._pos.y-this._offset.y)),eP=ev.transform.lngLatToCameraDepth(this._lngLat,eb+eT)-eS>.006;(null===(em=this._popup)||void 0===em?void 0:em.isOpen())&&eP&&this._popup.remove(),this._element.style.opacity=eP?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",eP)}getOffset(){return this._offset}setOffset(R){return this._offset=eh.P.convert(R),this._update(),this}addClassName(R){this._element.classList.add(R)}removeClassName(R){this._element.classList.remove(R)}toggleClassName(R){return this._element.classList.toggle(R)}setDraggable(R){return this._draggable=!!R,this._map&&(R?(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(R){return this._rotation=R||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(R){return this._rotationAlignment=R||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(R){return this._pitchAlignment=R&&"auto"!==R?R:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(R,eh){return(void 0===this._opacity||void 0===R&&void 0===eh)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==R&&(this._opacity=String(R)),void 0!==eh&&(this._opacityWhenCovered=String(eh)),this._map&&this._updateOpacity(!0),this}};let tz={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},tD=0,tk=!1,tR={maxWidth:100,unit:"metric"};function ys(R,eh,eu){let em=(null==eu?void 0:eu.maxWidth)||100,e_=R._container.clientHeight/2,eg=R._container.clientWidth/2,ev=R.unproject([eg-em/2,e_]),ex=R.unproject([eg+em/2,e_]),eb=Math.round(R.project(ex).x-R.project(ev).x),ew=Math.min(em,eb,R._container.clientWidth),eT=ev.distanceTo(ex);if("imperial"===(null==eu?void 0:eu.unit)){let eu=3.2808*eT;eu>5280?ws(eh,ew,eu/5280,R._getUIString("ScaleControl.Miles")):ws(eh,ew,eu,R._getUIString("ScaleControl.Feet"))}else"nautical"===(null==eu?void 0:eu.unit)?ws(eh,ew,eT/1852,R._getUIString("ScaleControl.NauticalMiles")):eT>=1e3?ws(eh,ew,eT/1e3,R._getUIString("ScaleControl.Kilometers")):ws(eh,ew,eT,R._getUIString("ScaleControl.Meters"))}function ws(R,eh,eu,em){let e_=function(R){let eh=Math.pow(10,`${Math.floor(R)}`.length-1),eu=R/eh;return eh*(eu=eu>=10?10:eu>=5?5:eu>=3?3:eu>=2?2:eu>=1?1:function(R){let eh=Math.pow(10,Math.ceil(-Math.log(R)/Math.LN10));return Math.round(R*eh)/eh}(eu))}(eu);R.style.width=eh*(e_/eu)+"px",R.innerHTML=`${e_} ${em}`}let tL={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0};R.AJAXError=eh.cG,R.EXTENT=eh.a6,R.Event=eh.n,R.Evented=eh.E,R.LngLat=eh.W,R.MercatorCoordinate=eh.a7,R.Point=eh.P,R.addProtocol=eh.cH,R.config=eh.c,R.removeProtocol=eh.cI,R.AttributionControl
56=Ya,R.BoxZoomHandler=ha,R.CanvasSource=ie,R.CooperativeGesturesHandler=Va,R.DoubleClickZoomHandler=Oa,R.DragPanHandler=Za,R.DragRotateHandler=Ua,R.EdgeInsets=jt,R.FullscreenControl=class extends eh.E{constructor(R={}){var eu;super(),this._onFullscreenChange=()=>{var R;let eh=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null===(R=null==eh?void 0:eh.shadowRoot)||void 0===R?void 0:R.fullscreenElement;)eh=eh.shadowRoot.fullscreenElement;eh===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!==(eu=R.pseudo)&&void 0!==eu&&eu,(null==R?void 0:R.container)&&(R.container instanceof HTMLElement?this._container=R.container:eh.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(R){return this._map=R,this._container||(this._container=this._map.getContainer()),this._controlContainer=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let R=this._fullscreenButton=d.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);d.create("span","maplibregl-ctrl-icon",R).setAttribute("aria-hidden","true"),R.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let R=this._getTitle();this._fullscreenButton.setAttribute("aria-label",R),this._fullscreenButton.title=R}_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 eh.n("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new eh.n("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},R.GeoJSONSource=J,R.GeolocateControl=class extends eh.E{constructor(R){super(),this._onSuccess=R=>{if(this._map){if(this._isOutOfMapMaxBounds(R))return this._setErrorState(),this.fire(new eh.n("outofmaxbounds",R)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=R,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(R),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(R),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new eh.n("geolocate",R)),this._finish()}},this._updateCamera=R=>{let eu=new eh.W(R.coords.longitude,R.coords.latitude),em=R.coords.accuracy,e_=this._map.getBearing(),eg=eh.e({bearing:e_},this.options.fitBoundsOptions),ev=U.fromLngLat(eu,em);this._map.fitBounds(ev,eg,{geolocateSource:!0})},this._updateMarker=R=>{if(R){let eu=new eh.W(R.coords.longitude,R.coords.latitude);this._accuracyCircleMarker.setLngLat(eu).addTo(this._map),this._userLocationDotMarker.setLngLat(eu).addTo(this._map),this._accuracy=R.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=R=>{if(this._map){if(1===R.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let R=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=R,this._geolocateButton.setAttribute("aria-label",R),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===R.code&&tk)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new eh.n("error",R)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=R=>{if(!this._map)return;let eu=(null==R?void 0:R[0])instanceof ResizeObserverEntry;R.geolocateSource||"ACTIVE_LOCK"!==this._watchState||eu||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 eh.n("trackuserlocationend")),this.fire(new eh.n("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",R=>{R.preventDefault()}),this._geolocateButton=d.create("button","maplibregl-ctrl-geolocate",this._container),d.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=R=>
56{if(this._map){if(!1===R){eh.w("Geolocation support is not available so the GeolocateControl will be disabled.");let R=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=R,this._geolocateButton.setAttribute("aria-label",R)}else{let R=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=R,this._geolocateButton.setAttribute("aria-label",R)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new fs({element:this._dotElement}),this._circleElement=d.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new fs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=eh.e({},tz,R)}onAdd(R){return this._map=R,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return eh._(this,arguments,void 0,function*(R=!1){if(void 0!==ew&&!R)return ew;if(void 0===window.navigator.permissions)return ew=!!window.navigator.geolocation;try{let R=yield window.navigator.permissions.query({name:"geolocation"});ew="denied"!==R.state}catch(R){ew=!!window.navigator.geolocation}return ew})})().then(R=>this._finishSetupUI(R)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,tD=0,tk=!1}_isOutOfMapMaxBounds(R){let eh=this._map.getMaxBounds(),eu=R.coords;return eh&&(eu.longitude<eh.getWest()||eu.longitude>eh.getEast()||eu.latitude<eh.getSouth()||eu.latitude>eh.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 Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let R=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&R))return;let eh=this._map.project(R),eu=this._map.unproject([eh.x+100,eh.y]),em=R.distanceTo(eu)/100,e_=2*this._accuracy/em;this._circleElement.style.width=`${e_.toFixed(2)}px`,this._circleElement.style.height=`${e_.toFixed(2)}px`}trigger(){if(!this._setup)return eh.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 eh.n("trackuserlocationstart"));break;
56case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":tD--,tk=!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 eh.n("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new eh.n("trackuserlocationstart")),this.fire(new eh.n("userlocationfocus"));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let R;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++tD>1?(R={maximumAge:6e5,timeout:0},tk=!0):(R=this.options.positionOptions,tk=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,R)}}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)}},R.GlobeControl=class{constructor(){this._toggleProjection=()=>{var R;let eh=null===(R=this._map.getProjection())||void 0===R?void 0:R.type;this._map.setProjection("mercator"!==eh&&eh?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var R;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(R=this._map.getProjection())||void 0===R?void 0:R.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(R){return this._map=R,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=d.create("button","maplibregl-ctrl-globe",this._container),d.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},R.Hash=Hr,R.ImageSource=ee,R.KeyboardHandler=Aa,R.LngLatBounds=U,R.LogoControl=Qa,R.Map=tE,R.MapLibreMap=tE,R.MapMouseEvent=ra,R.MapTouchEvent=aa,R.MapWheelEvent=sa,R.Marker=fs,R.NavigationControl=class{constructor(R){this._updateZoomButtons=()=>{let R=this._map.getZoom(),eh=R===this._map.getMaxZoom(),eu=R===this._map.getMinZoom();this._zoomInButton.disabled=eh,this._zoomOutButton.disabled=eu,this._zoomInButton.setAttribute("aria-disabled",eh.toString()),this._zoomOutButton.setAttribute("aria-disabled",eu.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=(R,eh)=>{let eu=this._map._getUIString(`NavigationControl.${eh}`);R.title=eu,R.setAttribute("aria-label",eu)},this.options=eh.e({},tC,R),this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",R=>R.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",R=>this._map.zoomIn({},{originalEvent:R})),d.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",R=>this._map.zoomOut({},{originalEvent:R})),d.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",R=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:R}):this._map.resetNorth({},{originalEvent:R})}),this._compassIcon=d.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(R){return this._map=R,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 us(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(R,eh){let eu=d.create("button",R,this._container);return eu.type="button",eu.addEventListener("click",eh),eu}},R.Popup=class extends eh.E{constructor(R){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new eh.n("close"))),this),this._update=R=>{let eu;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=d.create("div","maplibregl-popup",this._map.getContainer()),this._tip=d.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let R of this.options.className.split(" "))this._container.classList.add(R);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=_s(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),R&&"point"in R&&R.point&&(eu=R.point),this._trackPointer&&!eu)return;let em=this._flatPos=this._pos=this._trackPointer&&eu?eu:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&eu?eu:this._map.transform.locationToScreenPoint(this._lngLat));let e_=this.options.anchor,eg=function Cs(R){if(R){if("number"==typeof R){let eu=Math.round(Math.abs(R)/Math.SQRT2);return{center:new eh.P(0,0),top:new eh.P(0,R),"top-left":new eh.P(eu,eu),"top-right":new eh.P(-eu,eu),bottom:new eh.P(0,-R),"bottom-left":new eh.P(eu,-eu),"bottom-right":new eh.P(-eu,-eu),left:new eh.P(R,0),right:new eh.P(-R,0)}}if(R instanceof eh.P||Array.isArray(R)){let eu=eh.P.convert(R);return{center:eu,top:eu,"top-left":eu,"top-right":eu,bottom:eu,"bottom-left":eu,"bottom-right":eu,left:eu,right:eu}}return{center:eh.P.convert(R.center||[0,0]),top:eh.P.convert(R.top||[0,0]),"top-left":eh.P.convert(R["top-left"]||[0,0]),"top-right":eh.P.convert(R["top-right"]||[0,0]),bottom:eh.P.convert(R.bottom||[0,0]),"bottom-left":eh.P.convert(R["bottom-left"]||[0,0]),"bottom-right":eh.P.convert(R["bottom-right"]||[0,0]),left:eh.P.convert(R.left||[0,0]),right:eh.P.convert(R.right||[0,0])}}return Cs(new eh.P(0,0))}(this.options.offset);if(!e_){var ev,ex,eb,ew,eT;let R;let eh=this._container.offsetWidth,eu=this._container.offsetHeight,eS=(ev=this.options.padding)?{top:null!==(ex=ev.top)&&void 0!==ex?ex:0,right:null!==(eb=ev.right)&&void 0!==eb?eb:0,bottom:null!==(ew=ev.bottom)&&void 0!==ew?ew:0,left:null!==(eT=ev.left)&&void 0!==eT?eT:0}:{top:0,right:0,bottom:0,left:0};R=em.y+eg.bottom.y<eu+eS.top?["top"]:em.y>this._map.transform.height-eu-eS.bottom?["bottom"]:[],em.x<eh/2+eS.left?R.push("left"):em.x>this._map.transform.width-eh/2-eS.right&&R.push("right"),e_=0===R.length?"bottom":R.join("-")}let eS=em.add(eg[e_]);this.options.subpixelPositioning||(eS=eS.round()),this._container.style.transform=`${tA[e_]} translate(${eS.x}px,${eS.y}px)`,ms(this._container,e_,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=eh.e(Object.create(tL),R)}
vendor: 4,706 bytes, line 56
56addTo(R){return this._map&&this.remove(),this._map=R,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._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new eh.n("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(R){return this._lngLat=eh.W.convert(R),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(R){return this.setDOMContent(document.createTextNode(R))}setHTML(R){let eh;let eu=document.createDocumentFragment(),em=document.createElement("body");for(em.innerHTML=R;eh=em.firstChild;)eu.appendChild(eh);return this.setDOMContent(eu)}getMaxWidth(){var R;return null===(R=this._container)||void 0===R?void 0:R.style.maxWidth}setMaxWidth(R){return this.options.maxWidth=R,this._update(),this}setDOMContent(R){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=d.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(R),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(R){return this._container&&this._container.classList.add(R),this}removeClassName(R){return this._container&&this._container.classList.remove(R),this}setOffset(R){return this.options.offset=R,this._update(),this}toggleClassName(R){if(this._container)return this._container.classList.toggle(R)}setSubpixelPositioning(R){this.options.subpixelPositioning=R}setPadding(R){this.options.padding=R,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=d.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let R=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");R&&R.focus()}},R.RasterDEMTileSource=q,R.RasterTileSource=W,R.ScaleControl=class{constructor(R){this._onMove=()=>{ys(this._map,this._container,this.options)},this.setUnit=R=>{this.options.unit=R,ys(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},tR),R)}getDefaultPosition(){return"bottom-left"}onAdd(R){return this._map=R,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-scale",R.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},R.ScrollZoomHandler=Ba,R.Style=Li,R.TerrainControl=class{constructor(R){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=R}onAdd(R){return this._map=R,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=d.create("button","maplibregl-ctrl-terrain",this._container),d.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
56ype="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},R.TwoFingersTouchPitchHandler=Ra,R.TwoFingersTouchRotateHandler=Ea,R.TwoFingersTouchZoomHandler=Ma,R.TwoFingersTouchZoomRotateHandler=Ga,R.VectorTileSource=V,R.VideoSource=te,R.addSourceType=(R,eu)=>eh._(void 0,void 0,void 0,function*(){if(re(R))throw Error(`A source type called "${R}" already exists.`);eF[R]=eu}),R.clearPrewarmedResources=function(){let R=ev;R&&(R.isPreloaded()&&1===R.numActive()?(R.release(eR),ev=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()"))},R.createTileMesh=ni,R.getGlobalDispatcher=k,R.getMaxParallelImageRequests=function(){return eh.c.MAX_PARALLEL_IMAGE_REQUESTS},R.getRTLTextPluginStatus=function(){return le().getRTLTextPluginStatus()},R.getVersion=function(){return eC},R.getWorkerCount=function(){return z.workerCount},R.getWorkerUrl=function(){return eh.c.WORKER_URL},R.importScriptInWorkers=function(R){return k().broadcast("IS",R)},R.isTimeFrozen=function(){return ez.isFrozen()},R.now=c,R.prewarm=function(){L().acquire(eR)},R.restoreNow=function(){ez.restoreNow()},R.setMaxParallelImageRequests=function(R){eh.c.MAX_PARALLEL_IMAGE_REQUESTS=R},R.setNow=function(R){ez.setNow(R)},R.setRTLTextPlugin=function(R,eh){return le().setRTLTextPlugin(R,eh)},R.setWorkerCount=function(R){z.workerCount=R},R.setWorkerUrl=function(R){eh.c.WORKER_URL=R}}),R}()}}]);
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.