PageSourceSearch

https://www.landvandepeel.nl/build/2254.e85cc49d4b2f5b67c03c.bundle.js

js landvandepeel.nl collected 2026-10-02 06:15:31 UTC 878,818 bytes, 2 lines download raw bytes

1/*! For license information please see 2254.e85cc49d4b2f5b67c03c.bundle.js.LICENSE.txt */
2(self.webpackChunkkunstmaan_edition=self.webpackChunkkunstmaan_edition||[]).push([[2254],{2254:function(t,e,i){!function(t,e,r){"use strict";function s(t,i,r){const s=i.token?{token:i.token}:{};e.request(t,s,r)}function n(t,i,r){const s=i.token?{token:i.token}:{},n=`${i.portalUrl}/sharing/rest/content/items/${t}`;e.request(n,s,r)}function o(t,e,i){s(t,e,(r,s)=>{if(r)return void i(r);let n,o=t;"/"===t.charAt(t.length-1)&&(o=t.slice(0,t.length-1)),n="/"===s.defaultStyles.charAt(0)?`${o+s.defaultStyles}/root.json`:`${o}/${s.defaultStyles}/root.json`,a(n,e,(e,r)=>{e?i(e):i(null,r,n,s,t)})})}function a(t,i,r){const s=i.token?{token:i.token}:{};e.request(t,s,r)}function l(t,e){return new URL(t).hostname===new URL(e).hostname}function c(t){if(!t)return t||null;let e=t;return e&&(e=function(t){const e=/^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i,i=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,r=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return e.test(t)?t=t.replace(e,"https://www.arcgis.com"):i.test(t)?t=t.replace(i,"https://devext.arcgis.com"):r.test(t)&&(t=t.replace(r,"https://qaext.arcgis.com")),t}(e),e=e.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),e=e.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),e=e.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),e}function h(t,e,i,r){const s=Object.keys(t.sources);for(let n=0;n<s.length;n++){const o=t.sources[s[n]];-1===o.url.indexOf("http")&&(o.url=e.replace("/resources/styles/root.json","")),"/"===o.url.charAt(o.url.length-1)&&(o.url=o.url.slice(0,o.url.length-1)),o.tiles||(i.tiles&&"/"!==i.tiles[0].charAt(0)&&(i.tiles[0]=`/${i.tiles[0]}`),o.tiles=[o.url+i.tiles[0]]),o.url+="?f=json",o.url+=r?`&token=${r}`:"",o.tiles[0]+=r?`?token=${r}`:"",o.minzoom=i.minLOD||i.tileInfo.lods[0].level,o.maxzoom=i.maxLOD||i.tileInfo.lods[i.tileInfo.lods.length-1].level}const n=t.sources[s[s.length-1]];n.attribution=i.copyrightText||"",n.copyrightText=i.copyrightText||"";for(let e=0;e<t.layers.length;e++){const i=t.layers[e];i.layout&&i.layout["text-font"]&&i.layout["text-font"].length>1&&(i.layout["text-font"]=[i.layout["text-font"][0]])}return t.sprite&&-1===t.sprite.indexOf("http")&&(t.sprite=e.replace("styles/root.json",t.sprite.replace("../",""))),t.glyphs&&(t.glyphs=c(t.glyphs)),t.sprite&&(t.sprite=c(t.sprite)),t.sprite&&r&&(l(e,t.sprite)?t.sprite+=`?token=${r}`:console.warn("Passing a token but sprite URL is not on same base URL, so you must pass the token manually.")),t.glyphs&&-1===t.glyphs.indexOf("http")&&(t.glyphs=e.replace("styles/root.json",t.glyphs.replace("../",""))),t.glyphs&&r&&(l(e,t.glyphs)?t.glyphs+=`?token=${r}`:console.warn("Passing a token but glyph URL is not on same base URL, so you must pass the token manually.")),t}function u(t,i){e.Support.cors&&e.request(t,{},(t,s)=>{if(t)return;i._esriAttributions=i._esriAttributions||[];for(let t=0;t<s.contributors.length;t++){const e=s.contributors[t];for(let t=0;t<e.coverageAreas.length;t++){const s=e.coverageAreas[t],n=r.latLng(s.bbox[0],s.bbox[1]),o=r.latLng(s.bbox[2],s.bbox[3]);i._esriAttributions.push({attribution:e.attribution,score:s.score,boun
vendor: 11,106 bytes, line 2
2ds:r.latLngBounds(n,o),minZoom:s.zoomMin,maxZoom:s.zoomMax})}}i._esriAttributions.sort((t,e)=>e.score-t.score);const n={target:i};e.Util._updateMapAttribution(n)})}const p=[3857,102100,102113],d={formatStyle:h};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==i.g?i.g:"undefined"!=typeof self&&self;var m={exports:{}};!function(t){t.exports=function(){var t={},e={};function i(i,r,s){if(e[i]=s,"index"===i){var n="var sharedModule = {}; ("+e.shared+")(sharedModule); ("+e.worker+")(sharedModule);",o={};return e.shared(o),e.index(t,o),"undefined"!=typeof window&&t.setWorkerUrl(window.URL.createObjectURL(new Blob([n],{type:"text/javascript"}))),t}}return i("shared",0,function(t){function e(t,e,i,r){return new(i||(i=Promise))(function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(o,a)}l((r=r.apply(t,e||[])).next())})}function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError;var r=s;function s(t,e){this.x=t,this.y=e}s.prototype={clone:function(){return new s(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),s=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},s.convert=function(t){return t instanceof s?t:Array.isArray(t)?new s(t[0],t[1]):t};var n=i(r),o=a;function a(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}a.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var s=this.sampleCurveX(i)-t;if(Math.abs(s)<e)return i;var n=this.sampleCurveDerivativeX(i);if(Math.abs(n)<1e-6)break;i-=s/n}var o=0,a=1;for(i=t,r=0;r<20&&(s=this.sampleCurveX(i),!(Math.abs(s-t)<e));r++)t>s?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=i(o);let c,h;function u(){return null==c&&(c="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),c}function p(){if(null==h&&(h=!1,u())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<t*t;i++){const r=4*i;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%t,Math.floor(i/t),1,1)}const i=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&i[e]!==e){h=!0;break}}}return h||!1}function d(t,e,i,r){const s=new l(t,e,i,r);return t=>s.solve(t)}const m=d(.25,.1,.25,1);function f(t,e,i){return Math.min(i,Math.max(e,t))}function _(t,e,i){const r=i-e,s=((t-e)%r+r)%r+e;return s===e?i:s}function g(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let y=1;function x(t,e,i){const r={};for(const i in t)r[i]=e.call(this,t[i],i,t);return r}function v(t,e,i){const r={};for(const i in t)e.call(this,t[i],i,t)&&(r[i]=t[i]);return r}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?x(t,b):t}const w={};function T(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function S(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function I(t){return"undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let A=null;function P(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const C="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function M(t,i,r,s,n){return e(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const o=null==e?void 0:e.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const a=o.startsWith("BGR"),l=new Uint8ClampedArray(s*n*4);if(yield e.copyTo(l,function(t,e,i,r,s){const n=4*Math.max(-e,0),o=(Math.max(0,i)-i)*r*4+n,a=4*r,l=Math.max(0,e),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,i+s)-c},layout:[{offset:o,stride:a}]}}(t,i,r,s,n)),a)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e}return l}finally{e.close()}})}let k,z;const E="AbortError";function D(){return new Error(E)}const L={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function R(t){return L.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const B="global-dispatcher";class F extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}const O=()=>I(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,V=function(t,i){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=R(t.url);if(e)return e(t,i);if(I(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:B},i)}if(!(/^file:/.test(r=t.url)||/^file:/.test(O())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,i){return e(this,void 0,void 0,function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:O(),signal:i.signal});"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");const r=yield fetch(e);if(!r.ok){const e=yield r.blob();throw new F(r.status,r.statusText,t.url,e)}let s;s="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();const n=yield s;if(i.signal.aborted)throw D();return{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})}(t,i);if(I(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:B},i)}var r;return function(t,e){return new Promise((i,r)=>{var s;const n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(n.responseType="arraybuffer");for(const e in t.headers)n.setRequestHeader(e,t.headers[e]);"json"===t.type&&(n.responseType="text",(null===(s=t.headers)||void 0===s?void 0:s.Accept)||n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===t.credentials,n.onerror=()=>{r(new Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let e=n.response;if("json"===t.type)try{e=JSON.parse(n.response)}catch(t){return void r(t)}i({data:e,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{const e=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});r(new F(n.status,n.statusText,t.url,e))}},e.signal.addEventListener("abort",()=>{n.abort(),r(D())}),n.send(t.body)})}(t,i)};function U(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return!0;const e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function N(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function j(t,e,i){if(i&&i[t]){const r=i[t].indexOf(e);-1!==r&&i[t].splice(r,1)}}class ${constructor(t,e={}){g(this,e),this.type=t}}class q extends ${constructor(t,e={}){super("error",g({error:t},e))}}class Z{on(t,e){return this._listeners=this._listeners||{},N(t,e,this._listeners),this}off(t,e){return j(t,e,this._listeners),j(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},N(t,e,this._oneTimeListeners),this):new Promise(e=>this.once(t,e))}fire(t,e){"string"==typeof t&&(t=new $(t,e||{}));const i=t.type;if(this.listens(i)){t.target=this;const e=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of e)i.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of r)j(i,e,this._oneTimeListeners),e.call(this,t);const s=this._eventedParent;s&&(g(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),s.fire(t))}else t instanceof q&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var G={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection
vendor: 7,595 bytes, line 2
2"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},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},"*":{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:"*"},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:{},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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","property-type":"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","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"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"}
vendor: 4,312 bytes, line 2
2,"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"}
vendor: 8,873 bytes, line 2
2,"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},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:"*",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:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}
vendor: 9,830 bytes, line 2
2,"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},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"},"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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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"}}};const 
vendor: 1,540 bytes, line 2
2W=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function H(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return W.forEach(t=>{t in e&&(i[t]=e[t])}),i}function X(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!X(t[i],e[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const i in t)if(!X(t[i],e[i]))return!1;return!0}return t===e}function J(t,e){t.push(e)}function K(t,e,i){J(i,{command:"addSource",args:[t,e[t]]})}function Y(t,e,i){J(e,{command:"removeSource",args:[t]}),i[t]=!0}function Q(t,e,i,r){Y(t,i,r),K(t,e,i)}function tt(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!X(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!X(t[i][r],e[i][r]))return!1;return!0}function et(t,e,i,r,s,n){t=t||{},e=e||{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(X(t[o],e[o])||i.push({command:n,args:[r,o,e[o],s]}));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(X(t[o],e[o])||i.push({command:n,args:[r,o,e[o],s]}))}function it(t){return t.id}function rt(t,e){return t[e.id]=e,t}class st{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__)}}function nt(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}
vendor: 2,403 bytes, line 2
2class ot extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class at{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new at(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const lt={kind:"null"},ct={kind:"number"},ht={kind:"string"},ut={kind:"boolean"},pt={kind:"color"},dt={kind:"object"},mt={kind:"value"},ft={kind:"collator"},_t={kind:"formatted"},gt={kind:"padding"},yt={kind:"resolvedImage"},xt={kind:"variableAnchorOffsetCollection"};function vt(t,e){return{kind:"array",itemType:t,N:e}}function bt(t){if("array"===t.kind){const e=bt(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const wt=[lt,ct,ht,ut,pt,_t,dt,vt(mt),gt,yt,xt];function Tt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Tt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of wt)if(!Tt(t,e))return null}return`Expected ${bt(t)} but found ${bt(e)} instead.`}function St(t,e){return e.some(e=>e.kind===t.kind)}function It(t,e){return e.some(e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t)}function At(t,e){return"array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const Pt=.96422,Ct=.82521,Mt=4/29,kt=6/29,zt=3*kt*kt,Et=kt*kt*kt,Dt=Math.PI/180,Lt=180/Math.PI;function Rt(t){return(t%=360)<0&&(t+=360),t}function Bt([t,e,i,r]){let s,n;const o=Ot((.2225045*(t=Ft(t))+.7168786*(e=Ft(e))+.0606169*(i=Ft(i)))/1);t===e&&e===i?s=n=o:(s=Ot((.4360747*t+.3850649*e+.1430804*i)/Pt),n=Ot((.0139322*t+.0971045*e+.7141733*i)/Ct));const a=116*o-16;return[a<0?0:a,500*(s-o),200*(o-n),r]}function Ft(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ot(t){return t>Et?Math.pow(t,1/3):t/zt+Mt}function Vt([t,e,i,r]){let s=(t+16)/116,n=isNaN(e)?s:s+e/500,o=isNaN(i)?s:s-i/200;return s=1*Nt(s),n=Pt*Nt(n),o=Ct*Nt(o),[Ut(3.1338561*n-1.6168667*s-.4906146*o),Ut(-.9787684*n+1.9161415*s+.033454*o),Ut(.0719453*n-.2289914*s+1.4052427*o),r]}
vendor: 28,623 bytes, line 2
2function Ut(t){return(t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Nt(t){return t>kt?t*t*t:zt*(t-Mt)}function jt(t){return parseInt(t.padEnd(2,t),16)/255}function $t(t,e){return qt(e?t/100:t,0,1)}function qt(t,e,i){return Math.min(Math.max(e,t),i)}function Zt(t){return!t.some(Number.isNaN)}const Gt={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]};class Wt{constructor(t,e,i,r=1,s=!0){this.r=t,this.g=e,this.b=i,this.a=r,s||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof Wt)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];const e=Gt[t];if(e){const[t,i,r]=e;return[t/255,i/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let i=1;return[jt(t.slice(i,i+=e)),jt(t.slice(i,i+=e)),jt(t.slice(i,i+=e)),jt(t.slice(i,i+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,i,r,s,n,o,a,l,c,h,u,p]=e,d=[s||" ",a||" ",h].join("");if("  "===d||"  /"===d||",,"===d||",,,"===d){const t=[r,o,c].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[qt(+i/e,0,1),qt(+n/e,0,1),qt(+l/e,0,1),u?$t(+u,p):1];if(Zt(t))return t}}return}}const i=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[t,e,r,s,n,o,a,l,c]=i,h=[r||" ",n||" ",a].join("");if("  "===h||"  /"===h||",,"===h||",,,"===h){const t=[+e,qt(+s,0,100),qt(+o,0,100),l?$t(+l,c):1];if(Zt(t))return function([t,e,i,r]){function s(r){const s=(r+t/30)%12,n=e*Math.min(i,1-i);return i-n*Math.max(-1,Math.min(s-3,9-s,1))}return t=Rt(t),e/=100,i/=100,[s(0),s(8),s(4),r]}(t)}}}(t);return e?new Wt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:i,a:r}=this,s=r||1/0;return this.overwriteGetter("rgb",[t/s,e/s,i/s,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,i,r,s]=Bt(t),n=Math.sqrt(i*i+r*r);return[Math.round(1e4*n)?Rt(Math.atan2(r,i)*Lt):NaN,n,e,s]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Bt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map(t=>Math.round(255*t)).join(",")},${r})`}}Wt.black=new Wt(0,0,0,1),Wt.white=new Wt(1,1,1,1),Wt.transparent=new Wt(0,0,0,0),Wt.red=new Wt(1,0,0,1);class Ht{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xt{constructor(t,e,i,r,s){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=s}}class Jt{constructor(t){this.sections=t}static fromString(t){return new Jt([new Xt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(t=>0!==t.text.length||t.image&&0!==t.image.name.length)}static factory(t){return t instanceof Jt?t:Jt.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(t=>t.text).join("")}}class Kt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Kt)return t;if("number"==typeof t)return new Kt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Kt(t)}}toString(){return JSON.stringify(this.values)}}const Yt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Qt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Qt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const i=t[e],r=t[e+1];if("string"!=typeof i||!Yt.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Qt(t)}}toString(){return JSON.stringify(this.values)}}class te{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new te({name:t,available:!1}):null}}function ee(t,e,i,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ie(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof Wt||t instanceof Ht||t instanceof Jt||t instanceof Kt||t instanceof Qt||t instanceof te)return!0;if(Array.isArray(t)){for(const e of t)if(!ie(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!ie(t[e]))return!1;return!0}return!1}function re(t){if(null===t)return lt;if("string"==typeof t)return ht;if("boolean"==typeof t)return ut;if("number"==typeof t)return ct;if(t instanceof Wt)return pt;if(t instanceof Ht)return ft;if(t instanceof Jt)return _t;if(t instanceof Kt)return gt;if(t instanceof Qt)return xt;if(t instanceof te)return yt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=re(e);if(i){if(i===t)continue;i=mt;break}i=t}return vt(i||mt,e)}return dt}function se(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Wt||t instanceof Jt||t instanceof Kt||t instanceof Qt||t instanceof te?t.toString():JSON.stringify(t)}class ne{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!ie(t[1]))return e.error("invalid value");const i=t[1];let r=re(i);const s=e.expectedType;return"array"!==r.kind||0!==r.N||!s||"array"!==s.kind||"number"==typeof s.N&&0!==s.N||(r=s),new ne(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class oe{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const ae={string:ht,number:ct,boolean:ut,object:dt};class le{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1;const s=t[0];if("array"===s){let s,n;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in ae)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=ae[i],r++}else s=mt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2],r++}i=vt(s,n)}else{if(!ae[s])throw new Error(`Types doesn't contain name = ${s}`);i=ae[s]}const n=[];for(;r<t.length;r++){const i=e.parse(t[r],r,mt);if(!i)return null;n.push(i)}return new le(i,n)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!Tt(this.type,re(i)))return i;if(e===this.args.length-1)throw new oe(`Expected value to be of type ${bt(this.type)}, but found ${bt(re(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ce={"to-boolean":ut,"to-color":pt,"to-number":ct,"to-string":ht};class he{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(!ce[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const r=ce[i],s=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],i,mt);if(!r)return null;s.push(r)}return new he(r,s)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(const r of this.args){if(e=r.evaluate(t),i=null,e instanceof Wt)return e;if("string"==typeof e){const i=t.parseColor(e);if(i)return i}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ee(e[0],e[1],e[2],e[3]),!i))return new Wt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new oe(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"padding":{let e;for(const i of this.args){e=i.evaluate(t);const r=Kt.parse(e);if(r)return r}throw new oe(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(const i of this.args){e=i.evaluate(t);const r=Qt.parse(e);if(r)return r}throw new oe(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new oe(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return Jt.fromString(se(this.args[0].evaluate(t)));case"resolvedImage":return te.fromString(se(this.args[0].evaluate(t)));default:return se(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ue=["Unknown","Point","LineString","Polygon"];class pe{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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?ue[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(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Wt.parse(t)),e}}class de{constructor(t,e,i=[],r,s=new at,n=[]){this.registry=t,this.path=i,this.key=i.map(t=>`[${t}]`).join(""),this.scope=s,this.errors=n,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,s={}){return e?this.concat(e,i,r)._parse(t,s):this._parse(t,s)}_parse(t,e){function i(t,e,i){return"assert"===i?new le(e,[t]):"coerce"===i?new he(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[r];if(s){let r=s.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,s=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==s.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==s.kind&&"string"!==s.kind)if("padding"!==t.kind||"value"!==s.kind&&"number"!==s.kind&&"array"!==s.kind)if("variableAnchorOffsetCollection"!==t.kind||"value"!==s.kind&&"array"!==s.kind){if(this.checkSubtype(t,s))return null}else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"coerce");else r=i(r,t,e.typeAnnotation||"assert")}if(!(r instanceof ne)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new pe;try{r=new ne(r.type,r.evaluate(e))}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const r="number"==typeof t?this.path.concat(t):this.path,s=i?this.scope.concat(i):this.scope;return new de(this.registry,this._isConstant,r,e||null,s,this.errors)}error(t,...e){const i=`${this.key}${e.map(t=>`[${t}]`).join("")}`;this.errors.push(new ot(i,t))}checkSubtype(t,e){const i=Tt(t,e);return i&&this.error(i),i}}class me{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let r=1;r<t.length-1;r+=2){const s=t[r];if("string"!=typeof s)return e.error(`Expected string, but found ${typeof s} instead.`,r);if(/[^a-zA-Z0-9_]/.test(s))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const n=e.parse(t[r+1],r+1);if(!n)return null;i.push([s,n])}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new me(i,r):null}outputDefined(){return this.result.outputDefined()}}class fe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new fe(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class _e{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ct),r=e.parse(t[2],2,vt(e.expectedType||mt));return i&&r?new _e(r.type.itemType,i,r):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new oe(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new oe(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new oe(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class ge{constructor(t,e){this.type=ut,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,mt),r=e.parse(t[2],2,mt);return i&&r?St(i.type,[ut,ht,ct,lt,mt])?new ge(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!It(e,["boolean","string","number","null"]))throw new oe(`Expected first argument to be of type boolean, string, number or null, but found ${bt(re(e))} instead.`);if(!It(i,["string","array"]))throw new oe(`Expected second argument to be of type array or string, but found ${bt(re(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ye{constructor(t,e,i){this.type=ct,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,mt),r=e.parse(t[2],2,mt);if(!i||!r)return null;if(!St(i.type,[ut,ht,ct,lt,mt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===t.length){const s=e.parse(t[3],3,ct);return s?new ye(i,r,s):null}return new ye(i,r)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!It(e,["boolean","string","number","null"]))throw new oe(`Expected first argument to be of type boolean, string, number or null, but found ${bt(re(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),It(i,["string"])){const t=i.indexOf(e,r);return-1===t?-1:[...i.slice(0,t)].length}if(It(i,["array"]))return i.indexOf(e,r);throw new oe(`Expected second argument to be of type array or string, but found ${bt(re(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class xe{constructor(t,e,i,r,s,n){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=s,this.otherwise=n}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const s={},n=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const c=e.concat(o);if(0===a.length)return c.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return c.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,re(t)))return null}else i=re(t);if(void 0!==s[String(t)])return c.error("Branch labels must be unique.");s[String(t)]=n.length}const h=e.parse(l,o,r);if(!h)return null;r=r||h.type,n.push(h)}const o=e.parse(t[1],1,mt);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new xe(i,r,o,s,n,a):null}evaluate(t){const e=this.input.evaluate(t);return(re(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class ve{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const r=[];for(let s=1;s<t.length-1;s+=2){const n=e.parse(t[s],s,ut);if(!n)return null;const o=e.parse(t[s+1],s+1,i);if(!o)return null;r.push([n,o]),i=i||o.type}const s=e.parse(t[t.length-1],t.length-1,i);if(!s)return null;if(!i)throw new Error("Can't infer output type");return new ve(i,r,s)}evaluate(t){for(const[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class be{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,mt),r=e.parse(t[2],2,ct);if(!i||!r)return null;if(!St(i.type,[vt(mt),ht,mt]))return e.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===t.length){const s=e.parse(t[3],3,ct);return s?new be(i.type,i,r,s):null}return new be(i.type,i,r)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);let r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),It(e,["string"]))return[...e].slice(i,r).join("");if(It(e,["array"]))return e.slice(i,r);throw new oe(`Expected first argument to be of type array or string, but found ${bt(re(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function we(t,e){const i=t.length-1;let r,s,n=0,o=i,a=0;for(;n<=o;)if(a=Math.floor((n+o)/2),r=t[a],s=t[a+1],r<=e){if(a===i||e<s)return a;n=a+1}else{if(!(r>e))throw new oe("Input is not a number.");o=a-1}return 0}class Te{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const i=e.parse(t[1],1,ct);if(!i)return null;const r=[];let s=null;e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(let i=1;i<t.length;i+=2){const n=1===i?-1/0:t[i],o=t[i+1],a=i,l=i+1;if("number"!=typeof n)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=n)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(o,l,s);if(!c)return null;s=s||c.type,r.push([n,c])}return new Te(s,i,r)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const s=e.length;return r>=e[s-1]?i[s-1].evaluate(t):i[we(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}var Se=Ie;function Ie(t,e,i,r){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=r}Ie.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,r=0;r<8;r++){var s=this.sampleCurveX(i)-t;if(Math.abs(s)<e)return i;var n=this.sampleCurveDerivativeX(i);if(Math.abs(n)<1e-6)break;i-=s/n}var o=0,a=1;for(i=t,r=0;r<20&&(s=this.sampleCurveX(i),!(Math.abs(s-t)<e));r++)t>s?o=i:a=i,i=.5*(a-o)+o;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Ae=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(Se);function Pe(t,e,i){return t+i*(e-t)}function Ce(t,e,i){return t.map((t,r)=>Pe(t,e[r],i))}const Me={number:Pe,color:function(t,e,i,r="rgb"){switch(r){case"rgb":{const[r,s,n,o]=Ce(t.rgb,e.rgb,i);return new Wt(r,s,n,o,!1)}case"hcl":{const[r,s,n,o]=t.hcl,[a,l,c,h]=e.hcl;let u,p;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?u=NaN:(u=a,1!==n&&0!==n||(p=l)):(u=r,1!==c&&0!==c||(p=s));else{let t=a-r;a>r&&t>180?t-=360:a<r&&r-a>180&&(t+=360),u=r+i*t}const[d,m,f,_]=function([t,e,i,r]){return t=isNaN(t)?0:t*Dt,Vt([i,Math.cos(t)*e,Math.sin(t)*e,r])}([u,null!=p?p:Pe(s,l,i),Pe(n,c,i),Pe(o,h,i)]);return new Wt(d,m,f,_,!1)}case"lab":{const[r,s,n,o]=Vt(Ce(t.lab,e.lab,i));return new Wt(r,s,n,o,!1)}}},array:Ce,padding:function(t,e,i){return new Kt(Ce(t.values,e.values,i))},variableAnchorOffsetCollection:function(t,e,i){const r=t.values,s=e.values;if(r.length!==s.length)throw new oe(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const n=[];for(let t=0;t<r.length;t+=2){if(r[t]!==s[t])throw new oe(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${r[t]}, to[${t}]: ${s[t]}`);n.push(r[t]);const[e,o]=r[t+1],[a,l]=s[t+1];n.push([Pe(e,a,i),Pe(o,l,i)])}return new Qt(n)}};class ke{constructor(t,e,i,r,s){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of s)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,r){let s=0;if("exponential"===t.name)s=ze(e,t.base,i,r);else if("linear"===t.name)s=ze(e,1,i,r);else if("cubic-bezier"===t.name){const n=t.controlPoints;s=new Ae(n[0],n[1],n[2],n[3]).solve(ze(e,1,i,r))}return s}static parse(t,e){let[i,r,s,...n]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some(t=>"number"!=typeof t||t<0||t>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(s=e.parse(s,2,ct),!s)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=pt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<n.length;t+=2){const i=n[t],r=n[t+1],s=t+3,l=t+4;if("number"!=typeof i)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
2omputed expressions) for the input values.',s);if(o.length&&o[o.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',s);const c=e.parse(r,l,a);if(!c)return null;a=a||c.type,o.push([i,c])}return At(a,ct)||At(a,pt)||At(a,gt)||At(a,xt)||At(a,vt(ct))?new ke(a,i,r,s,o):e.error(`Type ${bt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);const s=e.length;if(r>=e[s-1])return i[s-1].evaluate(t);const n=we(e,r),o=ke.interpolationFactor(this.interpolation,r,e[n],e[n+1]),a=i[n].evaluate(t),l=i[n+1].evaluate(t);switch(this.operator){case"interpolate":return Me[this.type.kind](a,l,o);case"interpolate-hcl":return Me.color(a,l,o,"hcl");case"interpolate-lab":return Me.color(a,l,o,"lab")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function ze(t,e,i,r){const s=r-i,n=t-i;return 0===s?0:1===e?n/s:(Math.pow(e,n)-1)/(Math.pow(e,s)-1)}class Ee{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let i=null;const r=e.expectedType;r&&"value"!==r.kind&&(i=r);const s=[];for(const r of t.slice(1)){const t=e.parse(r,1+s.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,s.push(t)}if(!i)throw new Error("No output type");const n=r&&s.some(t=>Tt(r,t.type));return new Ee(n?mt:i,s)}evaluate(t){let e,i=null,r=0;for(const s of this.args)if(r++,i=s.evaluate(t),i&&i instanceof te&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function De(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Le(t,e,i,r){return 0===r.compare(e,i)}function Re(t,e,i){const r="=="!==t&&"!="!==t;return class s{constructor(t,e,i){this.type=ut,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let n=e.parse(t[1],1,mt);if(!n)return null;if(!De(i,n.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${bt(n.type)}'.`);let o=e.parse(t[2],2,mt);if(!o)return null;if(!De(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${bt(o.type)}'.`);if(n.type.kind!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${bt(n.type)}' and '${bt(o.type)}'.`);r&&("value"===n.type.kind&&"value"!==o.type.kind?n=new le(o.type,[n]):"value"!==n.type.kind&&"value"===o.type.kind&&(o=new le(n.type,[o])));let a=null;if(4===t.length){if("string"!==n.type.kind&&"string"!==o.type.kind&&"value"!==n.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,ft),!a)return null}return new s(n,o,a)}evaluate(s){const n=this.lhs.evaluate(s),o=this.rhs.evaluate(s);if(r&&this.hasUntypedArgument){const e=re(n),i=re(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new oe(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=re(n),i=re(o);if("string"!==t.kind||"string"!==i.kind)return e(s,n,o)}return this.collator?i(s,n,o,this.collator.evaluate(s)):e(s,n,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Be=Re("==",function(t,e,i){return e===i},Le),Fe=Re("!=",function(t,e,i){return e!==i},function(t,e,i,r){return!Le(0,e,i,r)}),Oe=Re("<",function(t,e,i){return e<i},function(t,e,i,r){return r.compare(e,i)<0}),Ve=Re(">",function(t,e,i){return e>i}
vendor: 43,690 bytes, line 2
2,function(t,e,i,r){return r.compare(e,i)>0}),Ue=Re("<=",function(t,e,i){return e<=i},function(t,e,i,r){return r.compare(e,i)<=0}),Ne=Re(">=",function(t,e,i){return e>=i},function(t,e,i,r){return r.compare(e,i)>=0});class je{constructor(t,e,i){this.type=ft,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ut);if(!r)return null;const s=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ut);if(!s)return null;let n=null;return i.locale&&(n=e.parse(i.locale,1,ht),!n)?null:new je(r,s,n)}evaluate(t){return new Ht(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class $e{constructor(t,e,i,r,s){this.type=ht,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ct);if(!i)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let s=null;if(r.locale&&(s=e.parse(r.locale,1,ht),!s))return null;let n=null;if(r.currency&&(n=e.parse(r.currency,1,ht),!n))return null;let o=null;if(r["min-fraction-digits"]&&(o=e.parse(r["min-fraction-digits"],1,ct),!o))return null;let a=null;return r["max-fraction-digits"]&&(a=e.parse(r["max-fraction-digits"],1,ct),!a)?null:new $e(i,s,n,o,a)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class qe{constructor(t){this.type=_t,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const r=[];let s=!1;for(let i=1;i<=t.length-1;++i){const n=t[i];if(s&&"object"==typeof n&&!Array.isArray(n)){s=!1;let t=null;if(n["font-scale"]&&(t=e.parse(n["font-scale"],1,ct),!t))return null;let i=null;if(n["text-font"]&&(i=e.parse(n["text-font"],1,vt(ht)),!i))return null;let o=null;if(n["text-color"]&&(o=e.parse(n["text-color"],1,pt),!o))return null;const a=r[r.length-1];a.scale=t,a.font=i,a.textColor=o}else{const n=e.parse(t[i],1,mt);if(!n)return null;const o=n.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,r.push({content:n,scale:null,font:null,textColor:null})}}return new qe(r)}evaluate(t){return new Jt(this.sections.map(e=>{const i=e.content.evaluate(t);return re(i)===yt?new Xt("",i,null,null,null):new Xt(se(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)}))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}}class Ze{constructor(t){this.type=yt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ht);return i?new Ze(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=te.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ge{constructor(t){this.type=ct,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new Ge(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return[...e].length;if(Array.isArray(e))return e.length;throw new oe(`Expected value to be of type string or array, but found ${bt(re(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const We=8192;function He(t,e){const i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(i*s*We),Math.round(r*s*We)]}function Xe(t,e){const i=Math.pow(2,e.z);return[(s=(t[0]/We+e.x)/i,360*s-180),(r=(t[1]/We+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,s}function Je(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ke(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ye(t,e,i){const r=t[0]-e[0],s=t[1]-e[1],n=t[0]-i[0],o=t[1]-i[1];return r*o-n*s==0&&r*n<=0&&s*o<=0}function Qe(t,e,i,r){return 0!=(s=[r[0]-i[0],r[1]-i[1]])[0]*(n=[e[0]-t[0],e[1]-t[1]])[1]-s[1]*n[0]&&!(!ni(t,e,i,r)||!ni(i,r,t,e));var s,n}function ti(t,e,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(Qe(t,e,r[i],r[i+1]))return!0;return!1}function ei(t,e,i=!1){let r=!1;for(const a of e)for(let e=0;e<a.length-1;e++){if(Ye(t,a[e],a[e+1]))return i;(n=a[e])[1]>(s=t)[1]!=(o=a[e+1])[1]>s[1]&&s[0]<(o[0]-n[0])*(s[1]-n[1])/(o[1]-n[1])+n[0]&&(r=!r)}var s,n,o;return r}function ii(t,e){for(const i of e)if(ei(t,i))return!0;return!1}function ri(t,e){for(const i of t)if(!ei(i,e))return!1;for(let i=0;i<t.length-1;++i)if(ti(t[i],t[i+1],e))return!1;return!0}function si(t,e){for(const i of e)if(ri(t,i))return!0;return!1}function ni(t,e,i,r){const s=r[0]-i[0],n=r[1]-i[1],o=(t[0]-i[0])*n-s*(t[1]-i[1]),a=(e[0]-i[0])*n-s*(e[1]-i[1]);return o>0&&a<0||o<0&&a>0}function oi(t,e,i){const r=[];for(let s=0;s<t.length;s++){const n=[];for(let r=0;r<t[s].length;r++){const o=He(t[s][r],i);Je(e,o),n.push(o)}r.push(n)}return r}function ai(t,e,i){const r=[];for(let s=0;s<t.length;s++){const n=oi(t[s],e,i);r.push(n)}return r}function li(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){const e=.5*r;let s=t[0]-i[0]>e?-r:i[0]-t[0]>e?r:0;0===s&&(s=t[0]-i[2]>e?-r:i[2]-t[0]>e?r:0),t[0]+=s}Je(e,t)}function ci(t,e,i,r){const s=Math.pow(2,r.z)*We,n=[r.x*We,r.y*We],o=[];for(const r of t)for(const t of r){const r=[t.x+n[0],t.y+n[1]];li(r,e,i,s),o.push(r)}return o}function hi(t,e,i,r){const s=Math.pow(2,r.z)*We,n=[r.x*We,r.y*We],o=[];for(const i of t){const t=[];for(const r of i){const i=[r.x+n[0],r.y+n[1]];Je(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=s/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)li(r,e,i,s)}var a;return o}class ui{constructor(t,e){this.type=ut,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ie(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const i of e.features){const{type:e,coordinates:r}=i.geometry;"Polygon"===e&&t.push(r),"MultiPolygon"===e&&t.push(...r)}if(t.length)return new ui(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ui(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new ui(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],s=t.canonicalID();if("Polygon"===e.type){const n=oi(e.coordinates,r,s),o=ci(t.geometry(),i,r,s);if(!Ke(i,r))return!1;for(const t of o)if(!ei(t,n))return!1}if("MultiPolygon"===e.type){const n=ai(e.coordinates,r,s),o=ci(t.geometry(),i,r,s);if(!Ke(i,r))return!1;for(const t of o)if(!ii(t,n))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],s=t.canonicalID();if("Polygon"===e.type){const n=oi(e.coordinates,r,s),o=hi(t.geometry(),i,r,s);if(!Ke(i,r))return!1;for(const t of o)if(!ri(t,n))return!1}if("MultiPolygon"===e.type){const n=ai(e.coordinates,r,s),o=hi(t.geometry(),i,r,s);if(!Ke(i,r))return!1;for(const t of o)if(!si(t,n))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let pi=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const s=t-1>>1,n=e[s];if(i(r,n)>=0)break;e[t]=n,t=s}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,s=e[t];for(;t<r;){let r=1+(t<<1);const n=r+1;if(n<this.length&&i(e[n],e[r])<0&&(r=n),i(e[r],s)>=0)break;e[t]=e[r],t=r}e[t]=s}};function di(t,e,i,r,s){mi(t,e,i,r||t.length-1,s||_i)}function mi(t,e,i,r,s){for(;r>i;){if(r-i>600){var n=r-i+1,o=e-i+1,a=Math.log(n),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(n-l)/n)*(o-n/2<0?-1:1);mi(t,e,Math.max(i,Math.floor(e-o*l/n+c)),Math.min(r,Math.floor(e+(n-o)*l/n+c)),s)}var h=t[e],u=i,p=r;for(fi(t,i,e),s(t[r],h)>0&&fi(t,i,r);u<p;){for(fi(t,u,p),u++,p--;s(t[u],h)<0;)u++;for(;s(t[p],h)>0;)p--}0===s(t[i],h)?fi(t,i,p):fi(t,++p,r),p<=e&&(i=p+1),e<=p&&(r=p-1)}}function fi(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function _i(t,e){return t<e?-1:t>e?1:0}function gi(t,e){if(t.length<=1)return[t];const i=[];let r,s;for(const e of t){const t=xi(e);0!==t&&(e.area=Math.abs(t),void 0===s&&(s=t<0),s===t<0?(r&&i.push(r),r=[e]):r.push(e))}if(r&&i.push(r),e>1)for(let t=0;t<i.length;t++)i[t].length<=e||(di(i[t],e,1,i[t].length-1,yi),i[t]=i[t].slice(0,e));return i}function yi(t,e){return e.area-t.area}function xi(t){let e=0;for(let i,r,s=0,n=t.length,o=n-1;s<n;o=s++)i=t[s],r=t[o],e+=(r.x-i.x)*(i.y+r.y);return e}const vi=1/298.257223563,bi=vi*(2-vi),wi=Math.PI/180;class Ti{constructor(t){const e=6378.137*wi*1e3,i=Math.cos(t*wi),r=1/(1-bi*(1-i*i)),s=Math.sqrt(r);this.kx=e*s*i,this.ky=e*s*r*(1-bi)}distance(t,e){const i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,s,n,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],c=t[a][1],h=this.wrap(t[a+1][0]-l)*this.kx,u=(t[a+1][1]-c)*this.ky,p=0;0===h&&0===u||(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-c)*this.ky*u)/(h*h+u*u),p>1?(l=t[a+1][0],c=t[a+1][1]):p>0&&(l+=h/this.kx*p,c+=u/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,u=(e[1]-c)*this.ky;const d=h*h+u*u;d<o&&(o=d,i=l,r=c,s=a,n=p)}return{point:[i,r],index:s,t:Math.max(0,Math.min(1,n))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Si(t,e){return e[0]-t[0]}function Ii(t){return t[1]-t[0]+1}function Ai(t,e){return t[1]>=t[0]&&t[1]<e}function Pi(t,e){if(t[0]>t[1])return[null,null];const i=Ii(t);if(e){if(2===i)return[t,null];const e=Math.floor(i/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===i)return[t,null];const r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function Ci(t,e){if(!Ai(e,t.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Je(i,t[r]);return i}function Mi(t){const e=[1/0,1/0,-1/0,-1/0];for(const i of t)for(const t of i)Je(e,t);return e}function ki(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function zi(t,e,i){if(!ki(t)||!ki(e))return NaN;let r=0,s=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(s=t[1]-e[3]),t[3]<e[1]&&(s=e[1]-t[3]),i.distance([0,0],[r,s])}function Ei(t,e,i){const r=i.pointOnLine(e,t);return i.distance(t,r.point)}function Di(t,e,i,r,s){const n=Math.min(Ei(t,[i,r],s),Ei(e,[i,r],s)),o=Math.min(Ei(i,[t,e],s),Ei(r,[t,e],s));return Math.min(n,o)}function Li(t,e,i,r,s){if(!Ai(e,t.length)||!Ai(r,i.length))return 1/0;let n=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=r[0];t<r[1];++t){const r=i[t],o=i[t+1];if(Qe(e,a,r,o))return 0;n=Math.min(n,Di(e,a,r,o,s))}}return n}function Ri(t,e,i,r,s){if(!Ai(e,t.length)||!Ai(r,i.length))return NaN;let n=1/0;for(let o=e[0];o<=e[1];++o)for(let e=r[0];e<=r[1];++e)if(n=Math.min(n,s.distance(t[o],i[e])),0===n)return n;return n}function Bi(t,e,i){if(ei(t,e,!0))return 0;let r=1/0;for(const s of e){const e=s[0],n=s[s.length-1];if(e!==n&&(r=Math.min(r,Ei(t,[n,e],i)),0===r))return r;const o=i.pointOnLine(s,t);if(r=Math.min(r,i.distance(t,o.point)),0===r)return r}return r}function Fi(t,e,i,r){if(!Ai(e,t.length))return NaN;for(let r=e[0];r<=e[1];++r)if(ei(t[r],i,!0))return 0;let s=1/0;for(let n=e[0];n<e[1];++n){const e=t[n],o=t[n+1];for(const t of i)for(let i=0,n=t.length,a=n-1;i<n;a=i++){const n=t[a],l=t[i];if(Qe(e,o,n,l))return 0;s=Math.min(s,Di(e,o,n,l,r))}}return s}function Oi(t,e){for(const i of t)for(const t of i)if(ei(t,e,!0))return!0;return!1}function Vi(t,e,i,r=1/0){const s=Mi(t),n=Mi(e);if(r!==1/0&&zi(s,n,i)>=r)return r;if(Ke(s,n)){if(Oi(t,e))return 0}else if(Oi(e,t))return 0;let o=1/0;for(const r of t)for(let t=0,s=r.length,n=s-1;t<s;n=t++){const s=r[n],a=r[t];for(const t of e)for(let e=0,r=t.length,n=r-1;e<r;n=e++){const r=t[n],l=t[e];if(Qe(s,a,r,l))return 0;o=Math.min(o,Di(s,a,r,l,i))}}return o}function Ui(t,e,i,r,s,n){if(!n)return;const o=zi(Ci(r,n),s,i);o<e&&t.push([o,n,[0,0]])}function Ni(t,e,i,r,s,n,o){if(!n||!o)return;const a=zi(Ci(r,n),Ci(s,o),i);a<e&&t.push([a,n,o])}function ji(t,e,i,r,s=1/0){let n=Math.min(r.distance(t[0],i[0][0]),s);if(0===n)return n;const o=new pi([[0,[0,t.length-1],[0,0]]],Si),a=Mi(i);for(;o.length>0;){const s=o.pop();if(s[0]>=n)continue;const l=s[1],c=e?50:100;if(Ii(l)<=c){if(!Ai(l,t.length))return NaN;if(e){const e=Fi(t,l,i,r);if(isNaN(e)||0===e)return e;n=Math.min(n,e)}else for(let e=l[0];e<=l[1];++e){const s=Bi(t[e],i,r);if(n=Math.min(n,s),0===n)return 0}}else{const i=Pi(l,e);Ui(o,n,r,t,a,i[0]),Ui(o,n,r,t,a,i[1])}}return n}function $i(t,e,i,r,s,n=1/0){let o=Math.min(n,s.distance(t[0],i[0]));if(0===o)return o;const a=new pi([[0,[0,t.length-1],[0,i.length-1]]],Si);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=n[2],h=e?50:100,u=r?50:100;if(Ii(l)<=h&&Ii(c)<=u){if(!Ai(l,t.length)&&Ai(c,i.length))return NaN;let n;if(e&&r)n=Li(t,l,i,c,s),o=Math.min(o,n);else if(e&&!r){const e=t.slice(l[0],l[1]+1);for(let t=c[0];t<=c[1];++t)if(n=Ei(i[t],e,s),o=Math.min(o,n),0===o)return o}else if(!e&&r){const e=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(n=Ei(t[i],e,s),o=Math.min(o,n),0===o)return o}else n=Ri(t,l,i,c,s),o=Math.min(o,n)}else{const n=Pi(l,e),h=Pi(c,r);Ni(a,o,s,t,i,n[0],h[0]),Ni(a,o,s,t,i,n[0],h[1]),Ni(a,o,s,t,i,n[1],h[0]),Ni(a,o,s,t,i,n[1],h[1])}}return o}function qi(t){return"MultiPolygon"===t.type?t.coordinates.map(t=>({type:"Polygon",coordinates:t})):"MultiLineString"===t.type?t.coordinates.map(t=>({type:"LineString",coordinates:t})):"MultiPoint"===t.type?t.coordinates.map(t=>({type:"Point",coordinates:t})):[t]}class Zi{constructor(t,e){this.type=ct,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ie(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Zi(e,e.features.map(t=>qi(t.geometry)).flat());if("Feature"===e.type)return new Zi(e,qi(e.geometry));if("type"in e&&"coordinates"in e)return new Zi(e,qi(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const i=t.geometry(),r=i.flat().map(e=>Xe([e.x,e.y],t.canonical));if(0===i.length)return NaN;const s=new Ti(r[0][1]);let n=1/0;for(const t of e){switch(t.type){case"Point":n=Math.min(n,$i(r,!1,[t.coordinates],!1,s,n));break;case"LineString":n=Math.min(n,$i(r,!1,t.coordinates,!0,s,n));break;case"Polygon":n=Math.min(n,ji(r,!1,t.coordinates,s,n))}if(0===n)return n}return n}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const i=t.geometry(),r=i.flat().map(e=>Xe([e.x,e.y],t.canonical));if(0===i.length)return NaN;const s=new Ti(r[0][1]);let n=1/0;for(const t of e){switch(t.type){case"Point":n=Math.min(n,$i(r,!0,[t.coordinates],!1,s,n));break;case"LineString":n=Math.min(n,$i(r,!0,t.coordinates,!0,s,n));break;case"Polygon":n=Math.min(n,ji(r,!0,t.coordinates,s,n))}if(0===n)return n}return n}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const i=t.geometry();if(0===i.length||0===i[0].length)return NaN;const r=gi(i,0).map(e=>e.map(e=>e.map(e=>Xe([e.x,e.y],t.canonical)))),s=new Ti(r[0][0][0][1]);let n=1/0;for(const t of e)for(const e of r){switch(t.type){case"Point":n=Math.min(n,ji([t.coordinates],!1,e,s,n));break;case"LineString":n=Math.min(n,ji(t.coordinates,!0,e,s,n));break;case"Polygon":n=Math.min(n,Vi(e,t.coordinates,s,n))}if(0===n)return n}return n}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Gi={"==":Be,"!=":Fe,">":Ve,"<":Oe,">=":Ne,"<=":Ue,array:le,at:_e,boolean:le,case:ve,coalesce:Ee,collator:je,format:qe,image:Ze,in:ge,"index-of":ye,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:Ge,let:me,literal:ne,match:xe,number:le,"number-format":$e,object:le,slice:be,step:Te,string:le,"to-boolean":he,"to-color":he,"to-number":he,"to-string":he,var:fe,within:ui,distance:Zi};class Wi{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){const i=t[0],r=Wi.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(r)?r[0]:r.type,n=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=n.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let a=null;for(const[r,n]of o){a=new de(e.registry,Yi,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],s=Array.isArray(r)?r[e-1]:r.type,n=a.parse(i,1+o.length,s);if(!n){l=!0;break}o.push(n)}if(!l)if(Array.isArray(r)&&r.length!==o.length)a.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let t=0;t<o.length;t++){const e=Array.isArray(r)?r[t]:r.type,i=o[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new Wi(i,s,n,o)}}if(1===o.length)e.errors.push(...a.errors);else{const i=(o.length?o:n).map(([t])=>{return e=t,Array.isArray(e)?`(${e.map(bt).join(", ")})`:`(${bt(e.type)}...)`;var e}).join(" | "),r=[];for(let i=1;i<t.length;i++){const s=e.parse(t[i],1+r.length);if(!s)return null;r.push(bt(s.type))}e.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(t,e){Wi.definitions=e;for(const i in e)t[i]=Wi}}function Hi(t,[e,i,r,s]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);const n=s?s.evaluate(t):1,o=ee(e,i,r,n);if(o)throw new oe(o);return new Wt(e/255,i/255,r/255,n,!1)}function Xi(t,e){return t in e}function Ji(t,e){const i=e[t];return void 0===i?null:i}function Ki(t){return{type:t}}function Yi(t){if(t instanceof fe)return Yi(t.boundExpression);if(t instanceof Wi&&"error"===t.name)return!1;if(t instanceof je)return!1;if(t instanceof ui)return!1;if(t instanceof Zi)return!1;const e=t instanceof he||t instanceof le;let i=!0;return t.eachChild(t=>{i=e?i&&Yi(t):i&&t instanceof ne}),!!i&&Qi(t)&&er(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Qi(t){if(t instanceof Wi){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof ui)return!1;if(t instanceof Zi)return!1;let e=!0;return t.eachChild(t=>{e&&!Qi(t)&&(e=!1)}),e}function tr(t){if(t instanceof Wi&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild(t=>{e&&!tr(t)&&(e=!1)}),e}function er(t,e){if(t instanceof Wi&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(t=>{i&&!er(t,e)&&(i=!1)}),i}function ir(t){return{result:"success",value:t}}function rr(t){return{result:"error",value:t}}function sr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function nr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function or(t){return!!t.expression&&t.expression.interpolated}function ar(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function lr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function cr(t){return t}function hr(t,e){const i="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],s=r||!(r||void 0!==t.property),n=t.type||(or(e)?"exponential":"interval");if(i||"padding"===e.type){const r=i?Wt.parse:Kt.parse;(t=nt({},t)).stops&&(t.stops=t.stops.map(t=>[t[0],r(t[1])])),t.default=r(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;let a,l,c;if("exponential"===n)a=mr;else if("interval"===n)a=dr;else if("categorical"===n){a=pr,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==n)throw new Error(`Unknown function type "${n}"`);a=fr}if(r){const i={},r=[];for(let e=0;e<t.stops.length;e++){const s=t.stops[e],n=s[0].zoom;void 0===i[n]&&(i[n]={zoom:n,type:t.type,property:t.property,default:t.default,stops:[]},r.push(n)),i[n].stops.push([s[0].value,s[1]])}const s=[];for(const t of r)s.push([i[t].zoom,hr(i[t],e)]);const n={name:"linear"};return{kind:"composite",interpolationType:n,interpolationFactor:ke.interpolationFactor.bind(void 0,n),zoomStops:s.map(t=>t[0]),evaluate:({zoom:i},r)=>mr({stops:s,base:t.base},e,i).evaluate(i,r)}}if(s){const i="exponential"===n?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ke.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map(t=>t[0]),evaluate:({zoom:i})=>a(t,e,i,l,c)}}return{kind:"source",evaluate(i,r){const s=r&&r.properties?r.properties[t.property]:void 0;return void 0===s?ur(t.default,e.default):a(t,e,s,l,c)}}}function ur(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function pr(t,e,i,r,s){return ur(typeof i===s?r[i]:void 0,t.default,e.default)}function dr(t,e,i){if("number"!==ar(i))return ur(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];const s=we(t.stops.map(t=>t[0]),i);return t.stops[s][1]}function mr(t,e,i){const r=void 0!==t.base?t.base:1;if("number"!==ar(i))return ur(t.default,e.default);const s=t.stops.length;if(1===s)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[s-1][0])return t.stops[s-1][1];const n=we(t.stops.map(t=>t[0]),i),o=function(t,e,i,r){const s=r-i,n=t-i;return 0===s?0:1===e?n/s:(Math.pow(e,n)-1)/(Math.pow(e,s)-1)}(i,r,t.stops[n][0],t.stops[n+1][0]),a=t.stops[n][1],l=t.stops[n+1][1],c=Me[e.type]||cr;return"function"==typeof a.evaluate?{evaluate(...e){const i=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,o,t.colorSpace)}}:c(a,l,o,t.colorSpace)}function fr(t,e,i){switch(e.type){case"color":i=Wt.parse(i);break;case"formatted":i=Jt.fromString(i.toString());break;case"resolvedImage":i=te.fromString(i.toString());break;case"padding":i=Kt.parse(i);break;default:ar(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return ur(i,t.default,e.default)}Wi.register(Gi,{error:[{kind:"error"},[ht],(t,[e])=>{throw new oe(e.evaluate(t))}],typeof:[ht,[mt],(t,[e])=>bt(re(e.evaluate(t)))],"to-rgba":[vt(ct,4),[pt],(t,[e])=>{const[i,r,s,n]=e.evaluate(t).rgb;return[255*i,255*r,255*s,n]}],rgb:[pt,[ct,ct,ct],Hi],rgba:[pt,[ct,ct,ct,ct],Hi],has:{type:ut,overloads:[[[ht],(t,[e])=>Xi(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Xi(e.evaluate(t),i.evaluate(t))]]},get:{type:mt,overloads:[[[ht],(t,[e])=>Ji(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Ji(e.evaluate(t),i.evaluate(t))]]},"feature-state":[mt,[ht],(t,[e])=>Ji(e.evaluate(t),t.featureState||{})],properties:[dt,[],t=>t.properties()],"geometry-type":[ht,[],t=>t.geometryType()],id:[mt,[],t=>t.id()],zoom:[ct,[],t=>t.globals.zoom],"heatmap-density":[ct,[],t=>t.globals.heatmapDensity||0],"line-progress":[ct,[],t=>t.globals.lineProgress||0],accumulated:[mt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[ct,Ki(ct),(t,e)=>{let i=0;for(const r of e)i+=r.evaluate(t);return i}],"*":[ct,Ki(ct),(t,e)=>{let i=1;for(const r of e)i*=r.evaluate(t);return i}],"-":{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[ct],(t,[e])=>-e.evaluate(t)]]},"/":[ct,[ct,ct],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[ct,[ct,ct],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[ct,[ct],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))],log2:[ct,[ct],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ct,[ct],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ct,[ct],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ct,[ct],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ct,[ct],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ct,[ct],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ct,[ct],(t,[e])=>Math.atan(e.evaluate(t))],min:[ct,Ki(ct),(t,e)=>Math.min(...e.map(e=>e.evaluate(t)))],max:[ct,Ki(ct),(t,e)=>Math.max(...e.map(e=>e.evaluate(t)))],abs:[ct,[ct],(t,[e])=>Math.abs(e.evaluate(t))],round:[ct,[ct],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[ct,[ct],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ct,[ct],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ut,[ht,mt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ut,[mt],(t,[e])=>t.id()===e.value],"filter-type-==":[ut,[ht],(t,[e])=>t.geometryType()===e.value],"filter-<":[ut,[ht,mt],(t,[e,i])=>{const r=t.properties()[e.value],s=i.value;return typeof r==typeof s&&r<s}],"filter-id-<":[ut,[mt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[ut,[ht,mt],(t,[e,i])=>{const r=t.properties()[e.value],s=i.value;return typeof r==typeof s&&r>s}],"filter-id->":[ut,[mt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[ut,[ht,mt],(t,[e,i])=>{const r=t.properties()[e.value],s=i.value;return typeof r==typeof s&&r<=s}],"filter-id-<=":[ut,[mt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[ut,[ht,mt],(t,[e,i])=>{const r=t.properties()[e.value],s=i.value;return typeof r==typeof s&&r>=s}],"filter-id->=":[ut,[mt],(t,[e])=>{const i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[ut,[mt],(t,[e])=>e.value in t.properties()],"filter-has-id":[ut,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ut,[vt(ht)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ut,[vt(mt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ut,[ht,vt(mt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ut,[ht,vt(mt)],(t,[e,i])=>function(t,e,i,r){for(;i<=r;){const s=i+r>>1;if(e[s]===t)return!0;e[s]>t?r=s-1:i=s+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Ki(ut),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Ki(ut),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ut,[ut],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ut,[ht],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ht,[ht],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ht,[ht],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ht,Ki(mt),(t,e)=>e.map(e=>se(e.evaluate(t))).join("")],"resolved-locale":[ht,[ft],(t,[e])=>e.evaluate(t).resolvedLocale()]});class _r{constructor(t,e){var i;this.expression=t,this._warningHistory={},this._evaluator=new pe,this._defaultValue=e?"color"===(i=e).type&&lr(i.default)?new Wt(0,0,0,0):"color"===i.type?Wt.parse(i.default)||null:"padding"===i.type?Kt.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?Qt.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,r,s,n){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,s,n){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new oe(`Expected value to be one of ${Object.keys(this._enumValues).map(t=>JSON.stringify(t)).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function gr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Gi}function yr(t,e){const i=new de(Gi,Yi,[],e?function(t){const e={color:pt,string:ht,number:ct,enum:ht,boolean:ut,formatted:_t,padding:gt,resolvedImage:yt,variableAnchorOffsetCollection:xt};return"array"===t.type?vt(e[t.value]||mt,t.length):e[t.type]}(e):void 0),r=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return r?ir(new _r(r,e)):rr(i.errors)}class xr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!tr(e.expression)}evaluateWithoutErrorHandling(t,e,i,r,s,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,s,n)}evaluate(t,e,i,r,s,n){return this._styleExpression.evaluate(t,e,i,r,s,n)}}class vr{constructor(t,e,i,r){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!tr(e.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,e,i,r,s,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,s,n)}evaluate(t,e,i,r,s,n){return this._styleExpression.evaluate(t,e,i,r,s,n)}interpolationFactor(t,e,i){return this.interpolationType?ke.interpolationFactor(this.interpolationType,t,e,i):0}}function br(t,e){const i=yr(t,e);if("error"===i.result)return i;const r=i.value.expression,s=Qi(r);if(!s&&!sr(e))return rr([new ot("","data expressions not supported")]);const n=er(r,["zoom"]);if(!n&&!nr(e))return rr([new ot("","zoom expressions not supported")]);const o=Tr(r);return o||n?o instanceof ot?rr([o]):o instanceof ke&&!or(e)?rr([new ot("",'"interpolate" expressions cannot be used with this property')]):ir(o?new vr(s?"camera":"composite",i.value,o.labels,o instanceof ke?o.interpolation:void 0):new xr(s?"constant":"source",i.value)):rr([new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class wr{constructor(t,e){this._parameters=t,this._specification=e,nt(this,hr(this._parameters,this._specification))}static deserialize(t){return new wr(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Tr(t){let e=null;if(t instanceof me)e=Tr(t.result);else if(t instanceof Ee){for(const i of t.args)if(e=Tr(i),e)break}else(t instanceof Te||t instanceof ke)&&t.input instanceof Wi&&"zoom"===t.input.name&&(e=t);return e instanceof ot||t.eachChild(t=>{const i=Tr(t);i instanceof ot?e=i:!e&&i?e=new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new ot("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Sr(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Sr(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Ir={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ar(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Sr(t)||(t=Mr(t));const e=yr(t,Ir);if("error"===e.result)throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));return{filter:(t,i,r)=>e.value.evaluate(t,i,{},r),needGeometry:Cr(t)}}function Pr(t,e){return t<e?-1:t>e?1:0}function Cr(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Cr(t[e]))return!0;return!1}function Mr(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?kr(t[1],t[2],"=="):"!="===e?Dr(kr(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?kr(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Mr))):"all"===e?["all"].concat(t.slice(1).map(Mr)):"none"===e?["all"].concat(t.slice(1).map(Mr).map(Dr)):"in"===e?zr(t[1],t.slice(2)):"!in"===e?Dr(zr(t[1],t.slice(2))):"has"===e?Er(t[1]):"!has"!==e||Dr(Er(t[1]));var i}function kr(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function zr(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",t,["literal",e.sort(Pr)]]:["filter-in-small",t,["literal",e]]}}function Er(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Dr(t){return["!",t]}function Lr(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const i of t)e+=`${Lr(i)},`;return`${e}]`}const i=Object.keys(t).sort();let r="{";for(let e=0;e<i.length;e++)r+=`${JSON.stringify(i[e])}:${Lr(t[i[e]])},`;return`${r}}`}function Rr(t){let e="";for(const i of W)e+=`/${Lr(t[i])}`;return e}function Br(t){const e=t.value;return e?[new st(t.key,e,"constants have been deprecated as of v8")]:[]}function Fr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Or(t){if(Array.isArray(t))return t.map(Or);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Or(t[i]);return e}return Fr(t)}function Vr(t){const e=t.key,i=t.value,r=t.valueSpec||{},s=t.objectElementValidators||{},n=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const c=ar(i);if("object"!==c)return[new st(e,i,`object expected, ${c} found`)];for(const t in i){const c=t.split(".")[0],h=r[c]||r["*"];let u;if(s[c])u=s[c];else if(r[c])u=a;else if(s["*"])u=s["*"];else{if(!r["*"]){l.push(new st(e,i[t],`unknown property "${t}"`));continue}u=a}l=l.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:h,style:n,styleSpec:o,object:i,objectKey:t,validateSpec:a},i))}for(const t in r)s[t]||r[t].required&&void 0===r[t].default&&void 0===i[t]&&l.push(new st(e,i,`missing required property "${t}"`));return l}function Ur(t){const e=t.value,i=t.valueSpec,r=t.style,s=t.styleSpec,n=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==ar(e))return[new st(n,e,`array expected, ${ar(e)} found`)];if(i.length&&e.length!==i.length)return[new st(n,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new st(n,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};s.$version<7&&(a.function=i.function),"object"===ar(i.value)&&(a=i.value);let l=[];for(let i=0;i<e.length;i++)l=l.concat(o({array:e,arrayIndex:i,value:e[i],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:s,key:`${n}[${i}]`}));return l}function Nr(t){const e=t.key,i=t.value,r=t.valueSpec;let s=ar(i);return"number"===s&&i!=i&&(s="NaN"),"number"!==s?[new st(e,i,`number expected, ${s} found`)]:"minimum"in r&&i<r.minimum?[new st(e,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new st(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function jr(t){const e=t.valueSpec,i=Fr(t.value.type);let r,s,n,o={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===ar(t.value.stops)&&"array"===ar(t.value.stops[0])&&"object"===ar(t.value.stops[0][0]),h=Vr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new st(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(Ur({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:u})),"array"===ar(r)&&0===r.length&&e.push(new st(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&h.push(new st(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||h.push(new st(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!or(t.valueSpec)&&h.push(new st(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!sr(t.valueSpec)?h.push(new st(t.key,t.value,"property functions not supported")):a&&!nr(t.valueSpec)&&h.push(new st(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||h.push(new st(t.key,t.value,'"property" property is required')),h;function u(t){let i=[];const r=t.value,a=t.key;if("array"!==ar(r))return[new st(a,r,`array expected, ${ar(r)} found`)];if(2!==r.length)return[new st(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==ar(r[0]))return[new st(a,r,`object expected, ${ar(r[0])} found`)];if(void 0===r[0].zoom)return[new st(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new st(a,r,"object stop key must have value")];if(n&&n>Fr(r[0].zoom))return[new st(a,r[0].zoom,"stop zoom values must appear in ascending order")];Fr(r[0].zoom)!==n&&(n=Fr(r[0].zoom),s=void 0,o={}),i=i.concat(Vr({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Nr,value:p}}))}else i=i.concat(p({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return gr(Or(r[1]))?i.concat([new st(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(t.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,n){const a=ar(t.value),l=Fr(t.value),c=null!==t.value?t.value:n;if(r){if(a!==r)return[new st(t.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new st(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let r=`number expected, ${a} found`;return sr(e)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new st(t.key,c,r)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==s&&l<s?[new st(t.key,c,"stop domain values must appear in ascending order")]:(s=l,"categorical"===i&&l in o?[new st(t.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new st(t.key,c,`integer expected, found ${l}`)]}}function $r(t){const e=("property"===t.expressionContext?br:yr)(Or(t.value),t.valueSpec);if("error"===e.result)return e.value.map(e=>new st(`${t.key}${e.key}`,t.value,e.message));const i=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!i.outputDefined())return[new st(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!tr(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!tr(i))return[new st(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!er(i,["zoom","feature-state"]))return[new st(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Qi(i))return[new st(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qr(t){const e=t.key,i=t.value,r=t.valueSpec,s=[];return Array.isArray(r.values)?-1===r.values.indexOf(Fr(i))&&s.push(new st(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(Fr(i))&&s.push(new st(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),s}function Zr(t){return Sr(Or(t.value))?$r(nt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Gr(t)}function Gr(t){const e=t.value,i=t.key;if("array"!==ar(e))return[new st(i,e,`array expected, ${ar(e)} found`)];const r=t.styleSpec;let s,n=[];if(e.length<1)return[new st(i,e,"filter array must have at least 1 element")];switch(n=n.concat(qr({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Fr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Fr(e[1])&&n.push(new st(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&n.push(new st(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(s=ar(e[1]),"string"!==s&&n.push(new st(`${i}[1]`,e[1],`string expected, ${s} found`)));for(let o=2;o<e.length;o++)s=ar(e[o]),"$type"===Fr(e[1])?n=n.concat(qr({key:`${i}[${o}]`,value:e[o],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==s&&"number"!==s&&"boolean"!==s&&n.push(new st(`${i}[${o}
2]`,e[o],`string, number, or boolean expected, ${s} found`));break;case"any":case"all":case"none":for(let r=1;r<e.length;r++)n=n.concat(Gr({key:`${i}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":s=ar(e[1]),2!==e.length?n.push(new st(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==s&&n.push(new st(`${i}[1]`,e[1],`string expected, ${s} found`))}return n}function Wr(t,e){const i=t.key,r=t.validateSpec,s=t.style,n=t.styleSpec,o=t.value,a=t.objectKey,l=n[`${e}_${t.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===e&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:o,valueSpec:n.transition,style:s,styleSpec:n});const h=t.valueSpec||l[a];if(!h)return[new st(i,o,`unknown property "${a}"`)];let u;if("string"===ar(o)&&sr(h)&&!h.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new st(i,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const p=[];return"symbol"===t.layerType&&("text-field"===a&&s&&!s.glyphs&&p.push(new st(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&lr(Or(o))&&"identity"===Fr(o.type)&&p.push(new st(i,o,'"text-font" does not support identity functions'))),p.concat(r({key:t.key,value:o,valueSpec:h,style:s,styleSpec:n,expressionContext:"property",propertyType:e,propertyKey:a}))}function Hr(t){return Wr(t,"paint")}function Xr(t){return Wr(t,"layout")}function Jr(t){let e=[];const i=t.value,r=t.key,s=t.style,n=t.styleSpec;i.type||i.ref||e.push(new st(r,i,'either "type" or "ref" is required'));let o=Fr(i.type);const a=Fr(i.ref);if(i.id){const n=Fr(i.id);for(let o=0;o<t.arrayIndex;o++){const t=s.layers[o];Fr(t.id)===n&&e.push(new st(r,i.id,`duplicate layer id "${i.id}", previously used at line ${t.id.__line__}`))}}if("ref"in i){let t;["type","source","source-layer","filter","layout"].forEach(t=>{t in i&&e.push(new st(r,i[t],`"${t}" is prohibited for ref layers`))}),s.layers.forEach(e=>{Fr(e.id)===a&&(t=e)}),t?t.ref?e.push(new st(r,i.ref,"ref cannot reference another ref layer")):o=Fr(t.type):e.push(new st(r,i.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(i.source){const t=s.sources&&s.sources[i.source],n=t&&Fr(t.type);t?"vector"===n&&"raster"===o?e.push(new st(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==n&&"hillshade"===o?e.push(new st(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===n&&"raster"!==o?e.push(new st(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==n||i["source-layer"]?"raster-dem"===n&&"hillshade"!==o?e.push(new st(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==o||!i.paint||!i.paint["line-gradient"]||"geojson"===n&&t.lineMetrics||e.push(new st(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new st(r,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new st(r,i.source,`source "${i.source}" not found`))}else e.push(new st(r,i,'missing required property "source"'));return e=e.concat(Vr({key:r,value:i,valueSpec:n.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${r}.type`,value:i.type,valueSpec:n.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:Zr,layout:t=>Vr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Xr(nt({layerType:o},t))}}),paint:t=>Vr({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Hr(nt({layerType:o},t))}})}})),e}function Kr(t){const e=t.value,i=t.key,r=ar(e);return"string"!==r?[new st(i,e,`string expected, ${r} found`)]:[]}const Yr={promoteId:function({key:t,value:e}){if("string"===ar(e))return Kr({key:t,value:e});{const i=[];for(const r in e)i.push(...Kr({key:`${t}.${r}`,value:e[r]}));return i}}};function Qr(t){const e=t.value,i=t.key,r=t.styleSpec,s=t.style,n=t.validateSpec;if(!e.type)return[new st(i,e,'"type" is required')];const o=Fr(e.type);let a;switch(o){case"vector":case"raster":return a=Vr({key:i,value:e,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Yr,validateSpec:n}),a;case"raster-dem":return a=function(t){var e;const i=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,s=t.styleSpec,n=s.source_raster_dem,o=t.style;let a=[];const l=ar(r);if(void 0===r)return a;
vendor: 62,614 bytes, line 2
2if("object"!==l)return a.push(new st("source_raster_dem",r,`object expected, ${l} found`)),a;const c="custom"===Fr(r.encoding),h=["redFactor","greenFactor","blueFactor","baseShift"],u=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in r)!c&&h.includes(e)?a.push(new st(e,r[e],`In "${i}": "${e}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):n[e]?a=a.concat(t.validateSpec({key:e,value:r[e],valueSpec:n[e],validateSpec:t.validateSpec,style:o,styleSpec:s})):a.push(new st(e,r[e],`unknown property "${e}"`));return a}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:n}),a;case"geojson":if(a=Vr({key:i,value:e,valueSpec:r.source_geojson,style:s,styleSpec:r,validateSpec:n,objectElementValidators:Yr}),e.cluster)for(const t in e.clusterProperties){const[r,s]=e.clusterProperties[t],o="string"==typeof r?[r,["accumulated"],["get",t]]:r;a.push(...$r({key:`${i}.${t}.map`,value:s,validateSpec:n,expressionContext:"cluster-map"})),a.push(...$r({key:`${i}.${t}.reduce`,value:o,validateSpec:n,expressionContext:"cluster-reduce"}))}return a;case"video":return Vr({key:i,value:e,valueSpec:r.source_video,style:s,validateSpec:n,styleSpec:r});case"image":return Vr({key:i,value:e,valueSpec:r.source_image,style:s,validateSpec:n,styleSpec:r});case"canvas":return[new st(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qr({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:s,validateSpec:n,styleSpec:r})}}function ts(t){const e=t.value,i=t.styleSpec,r=i.light,s=t.style;let n=[];const o=ar(e);if(void 0===e)return n;if("object"!==o)return n=n.concat([new st("light",e,`object expected, ${o} found`)]),n;for(const o in e){const a=o.match(/^(.*)-transition$/);n=n.concat(a&&r[a[1]]&&r[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:i.transition,validateSpec:t.validateSpec,style:s,styleSpec:i}):r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:s,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)])}return n}function es(t){const e=t.value,i=t.styleSpec,r=i.sky,s=t.style,n=ar(e);if(void 0===e)return[];if("object"!==n)return[new st("sky",e,`object expected, ${n} found`)];let o=[];for(const n in e)o=o.concat(r[n]?t.validateSpec({key:n,value:e[n],valueSpec:r[n],style:s,styleSpec:i}):[new st(n,e[n],`unknown property "${n}"`)]);return o}function is(t){const e=t.value,i=t.styleSpec,r=i.terrain,s=t.style;let n=[];const o=ar(e);if(void 0===e)return n;if("object"!==o)return n=n.concat([new st("terrain",e,`object expected, ${o} found`)]),n;for(const o in e)n=n.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:s,styleSpec:i}):[new st(o,e[o],`unknown property "${o}"`)]);return n}function rs(t){let e=[];const i=t.value,r=t.key;if(Array.isArray(i)){const s=[],n=[];for(const o in i)i[o].id&&s.includes(i[o].id)&&e.push(new st(r,i,`all the sprites' ids must be unique, but ${i[o].id} is duplicated`)),s.push(i[o].id),i[o].url&&n.includes(i[o].url)&&e.push(new st(r,i,`all the sprites' URLs must be unique, but ${i[o].url} is duplicated`)),n.push(i[o].url),e=e.concat(Vr({key:`${r}[${o}]`,value:i[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Kr({key:r,value:i})}const ss={"*":()=>[],array:Ur,boolean:function(t){const e=t.value,i=t.key,r=ar(e);return"boolean"!==r?[new st(i,e,`boolean expected, ${r} found`)]:[]},number:Nr,color:function(t){const e=t.key,i=t.value,r=ar(i);return"string"!==r?[new st(e,i,`color expected, ${r} found`)]:Wt.parse(String(i))?[]:[new st(e,i,`color expected, "${i}" found`)]},constants:Br,enum:qr,filter:Zr,function:jr,layer:Jr,object:Vr,source:Qr,light:ts,sky:es,terrain:is,projection:function(t){const e=t.value,i=t.styleSpec,r=i.projection,s=t.style,n=ar(e);if(void 0===e)return[];if("object"!==n)return[new st("projection",e,`object expected, ${n} found`)];let o=[];for(const n in e)o=o.concat(r[n]?t.validateSpec({key:n,value:e[n],valueSpec:r[n],style:s,styleSpec:i}):[new st(n,e[n],`unknown property "${n}"`)]);return o},string:Kr,formatted:function(t){return 0===Kr(t).length?[]:$r(t)},resolvedImage:function(t){return 0===Kr(t).length?[]:$r(t)},padding:function(t){const e=t.key,i=t.value;if("array"===ar(i)){if(i.length<1||i.length>4)return[new st(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let s=[];for(let n=0;n<i.length;n++)s=s.concat(t.validateSpec({key:`${e}[${n}]`,value:i[n],validateSpec:t.validateSpec,valueSpec:r}));return s}return Nr({key:e,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(t){const e=t.key,i=t.value,r=ar(i),s=t.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new st(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let n=[];for(let r=0;r<i.length;r+=2)n=n.concat(qr({key:`${e}[${r}]`,value:i[r],valueSpec:s.layout_symbol["text-anchor"]})),n=n.concat(Ur({key:`${e}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:s}));return n},sprite:rs};function ns(t){const e=t.value,i=t.valueSpec,r=t.styleSpec;return t.validateSpec=ns,i.expression&&lr(Fr(e))?jr(t):i.expression&&gr(Or(e))?$r(t):i.type&&ss[i.type]?ss[i.type](t):Vr(nt({},t,{valueSpec:i.type?r[i.type]:i}))}function os(t){const e=t.value,i=t.key,r=Kr(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new st(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new st(i,e,'"glyphs" url must include a "{range}" token'))),r}function as(t,e=G){let i=[];return i=i.concat(ns({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:ns,objectElementValidators:{glyphs:os,"*":()=>[]}})),t.constants&&(i=i.concat(Br({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:ns}))),cs(i)}function ls(t){return function(e){return t({...e,validateSpec:ns})}}function cs(t){return[].concat(t).sort((t,e)=>t.line-e.line)}function hs(t){return function(...e){return cs(t.apply(this,e))}}as.source=hs(ls(Qr)),as.sprite=hs(ls(rs)),as.glyphs=hs(ls(os)),as.light=hs(ls(ts)),as.sky=hs(ls(es)),as.terrain=hs(ls(is)),as.layer=hs(ls(Jr)),as.filter=hs(ls(Zr)),as.paintProperty=hs(ls(Hr)),as.layoutProperty=hs(ls(Xr));const us=as,ps=us.light,ds=us.sky,ms=us.paintProperty,fs=us.layoutProperty;function _s(t,e){let i=!1;if(e&&e.length)for(const r of e)t.fire(new q(new Error(r.message))),i=!0;return i}class gs{constructor(t,e,i){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(e=s[1])+2*(i=s[2]);for(let t=0;t<this.d*this.d;t++){const e=s[3+t],i=s[3+t+1];r.push(e===i?null:s.subarray(e,i))}const n=s[3+r.length+1];this.keys=s.subarray(s[3+r.length],n),this.bboxes=s.subarray(n),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const s=i/e*t;this.min=-s,this.max=t+s}insert(t,e,i,r,s){this._forEachCell(e,i,r,s,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(s)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,s,n){this.cells[s].push(n)}query(t,e,i,r,s){const n=this.min,o=this.max;if(t<=n&&e<=n&&o<=i&&o<=r&&!s)return Array.prototype.slice.call(this.keys);{const n=[];return this._forEachCell(t,e,i,r,this._queryCell,n,{},s),n}}_queryCell(t,e,i,r,s,n,o,a){const l=this.cells[s];if(null!==l){const s=this.keys,c=this.bboxes;for(let h=0;h<l.length;h++){const u=l[h];if(void 0===o[u]){const l=4*u;(a?a(c[l+0],c[l+1],c[l+2],c[l+3]):t<=c[l+2]&&e<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(o[u]=!0,n.push(s[u])):o[u]=!1}}}}_forEachCell(t,e,i,r,s,n,o,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),h=this._convertToCellCoord(i),u=this._convertToCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++){const c=this.d*l+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&s.call(this,t,e,i,r,c,n,o,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let i=0;for(let t=0;t<this.cells.length;t++)i+=this.cells[t].length;const r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let s=e;for(let e=0;e<t.length;e++){const i=t[e];r[3+e]=s,r.set(i,s),s+=i.length}return r[3+t.length]=s,r.set(this.keys,s),s+=this.keys.length,r[3+t.length+1]=s,r.set(this.bboxes,s),s+=this.bboxes.length,r.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new gs(t.buffer)}}const ys={};function xs(t,e,i={}){if(ys[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ys[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}xs("Object",Object),xs("TransferableGridIndex",gs),xs("Color",Wt),xs("Error",Error),xs("AJAXError",F),xs("ResolvedImage",te),xs("StylePropertyFunction",wr),xs("StyleExpression",_r,{omit:["_evaluator"]}),xs("ZoomDependentExpression",vr),xs("ZoomConstantExpression",xr),xs("CompoundExpression",Wi,{omit:["_evaluate"]});for(const t in Gi)Gi[t]._classRegistryKey||xs(`Expression_${t}`,Gi[t]);function vs(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function bs(t){return t.$name||t.constructor._classRegistryKey}function ws(t){return!function(t){if(null===t||"object"!=typeof t)return!1;const e=bs(t);return!(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||vs(t)||P(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Ts(t,e){if(ws(t))return(vs(t)||P(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const r of t)i.push(Ts(r,e));return i}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const i=bs(t);if(!i)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!ys[i])throw new Error(`${i} is not registered.`);const{klass:r}=ys[i],s=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&s===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in t){if(!t.hasOwnProperty(r))continue;if(ys[i].omit.indexOf(r)>=0)continue;const n=t[r];s[r]=ys[i].shallow.indexOf(r)>=0?n:Ts(n,e)}t instanceof Error&&(s.message=t.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(s.$name=i),s}function Ss(t){if(ws(t))return t;if(Array.isArray(t))return t.map(Ss);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=bs(t)||"Object";if(!ys[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=ys[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const r=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const s=t[i];r[i]=ys[e].shallow.indexOf(i)>=0?s:Ss(s)}return r}class Is{constructor(){this.first=!0}update(t,e){const i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}const As=t=>t>=128&&t<=255,Ps=t=>t>=6016&&t<=6143,Cs=t=>t>=8192&&t<=8303,Ms=t=>t>=8448&&t<=8527,ks=t=>t>=8528&&t<=8591,zs=t=>t>=8960&&t<=9215,Es=t=>t>=9216&&t<=9279,Ds=t=>t>=9280&&t<=9311,Ls=t=>t>=9312&&t<=9471,Rs=t=>t>=9632&&t<=9727,Bs=t=>t>=9728&&t<=9983,Fs=t=>t>=11008&&t<=11263,Os=t=>t>=12272&&t<=12287,Vs=t=>t>=12288&&t<=12351,Us=t=>t>=12448&&t<=12543,Ns=t=>t>=12688&&t<=12703,js=t=>t>=12736&&t<=12783,$s=t=>t>=12800&&t<=13055,qs=t=>t>=13056&&t<=13311,Zs=t=>t>=19904&&t<=19967,Gs=t=>t>=57344&&t<=63743,Ws=t=>t>=65040&&t<=65055,Hs=t=>t>=65072&&t<=65103,Xs=t=>t>=65104&&t<=65135,Js=t=>t>=65280&&t<=65519;function Ks(t){for(const e of t)if(sn(e.charCodeAt(0)))return!0;return!1}function Ys(t){for(const e of t)if(!en(e.charCodeAt(0)))return!1;return!0}function Qs(t){const e=t.map(t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}}).filter(t=>t);return new RegExp(e.join("|"),"u")}const tn=Qs(["Arab","Dupl","Mong","Ougr","Syrc"]);function en(t){return!tn.test(String.fromCodePoint(t))}const rn=Qs(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function sn(t){return!(746!==t&&747!==t&&(t<4352||!(Hs(t)&&!(t>=65097&&t<=65103)||qs(t)||js(t)||!(!Vs(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||$s(t)||Os(t)||Ns(t)||Us(t)&&12540!==t||!(!Js(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Xs(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Ws(t)||Zs(t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||rn.test(String.fromCodePoint(t)))))}function nn(t){return!(sn(t)||function(t){return!!(As(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Cs(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Ms(t)||ks(t)||zs(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Es(t)&&9251!==t||Ds(t)||Ls(t)||Rs(t)||Bs(t)&&!(t>=9754&&t<=9759)||Fs(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vs(t)||Us(t)||Gs(t)||Hs(t)||Xs(t)||Js(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}const on=Qs(["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 an(t){return on.test(String.fromCodePoint(t))}function ln(t,e){return!(!e&&an(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Ps(t))}function cn(t){for(const e of t)if(an(e.charCodeAt(0)))return!0;return!1}const hn=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class un{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Is,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!ln(i.charCodeAt(0),e))return!1;return!0}(t,"loaded"===hn.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*e}}}class pn{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(lr(t))return new wr(t,e);if(gr(t)){const i=br(t,e);if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));return i.value}{let i=t;return"color"===e.type&&"string"==typeof t?i=Wt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)&&(i=Qt.parse(t)):i=Kt.parse(t),{kind:"constant",evaluate:()=>i}}}(void 0===e?t.specification.default:e,t.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class dn{constructor(t){this.property=t,this.value=new pn(t,void 0)}transitioned(t,e){return new fn(this.property,this.value,e,g({},t.transition,this.transition),t.now)}untransitioned(){return new fn(this.property,this.value,null,{},0)}}class mn{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return b(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new dn(this._values[t].property)),this._values[t].value=new pn(this._values[t].property,null===e?void 0:b(e))}getTransition(t){return b(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new dn(this._values[t].property)),this._values[t].transition=b(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i);const r=this.getTransition(e);void 0!==r&&(t[`${e}-transition`]=r)}return t}transitioned(t,e){const i=new _n(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){const t=new _n(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class fn{constructor(t,e,i,r,s){this.property=t,this.value=e,this.begin=s+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const r=t.now||0,s=this.value.possiblyEvaluate(t,e,i),n=this.prior;if(n){if(r>this.end)return this.prior=null,s;if(this.value.isDataDriven())return this.prior=null,s;if(r<this.begin)return n.possiblyEvaluate(t,e,i);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(t,e,i),s,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}(o))}}return s}}class _n{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const r=new xn(this._properties);for(const s of Object.keys(this._values))r._values[s]=this._values[s].possiblyEvaluate(t,e,i);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class gn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return void 0!==this._values[t].value}getValue(t){return b(this._values[t].value)}setValue(t,e){this._values[t]=new pn(this._values[t].property,null===e?void 0:b(e))}serialize(){const t={};for(const e of Object.keys(this._values)){const i=this.getValue(e);void 0!==i&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){const r=new xn(this._properties);for(const s of Object.keys(this._values))r._values[s]=this._values[s].possiblyEvaluate(t,e,i);return r}}class yn{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class xn{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class vn{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){const r=Me[this.specification.type];return r?r(t,e,i):t}}class bn{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new yn(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new yn(this,{kind:"constant",value:void 0},t.parameters);const r=Me[this.specification.type];if(r){const s=r(t.value.value,e.value.value,i);return new yn(this,{kind:"constant",value:s},t.parameters)}return t}evaluate(t,e,i,r,s,n){return"constant"===t.kind?t.value:t.evaluate(e,i,r,s,n)}}class wn extends bn{possiblyEvaluate(t,e,i,r){if(void 0===t.value)return new yn(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const s=t.expression.evaluate(e,null,{},i,r),n="resolvedImage"===t.property.specification.type&&"string"!=typeof s?s.name:s,o=this._calculate(n,n,n,e);return new yn(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const i=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new yn(this,{kind:"constant",value:i},e)}return new yn(this,t.expression,e)}evaluate(t,e,i,r,s,n){if("source"===t.kind){const o=t.evaluate(e,i,r,s,n);return this._calculate(o,o,o,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Tn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(void 0!==t.value){if("constant"===t.expression.kind){const s=t.expression.evaluate(e,null,{},i,r);return this._calculate(s,s,s,e)}return this._calculate(t.expression.evaluate(new un(Math.floor(e.zoom-1),e)),t.expression.evaluate(new un(Math.floor(e.zoom),e)),t.expression.evaluate(new un(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class Sn{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class In{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const i=t[e];i.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new pn(i,void 0),s=this.defaultTransitionablePropertyValues[e]=new dn(i);this.defaultTransitioningPropertyValues[e]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}xs("DataDrivenProperty",bn),xs("DataConstantProperty",vn),xs("CrossFadedDataDrivenProperty",wn),xs("CrossFadedProperty",Tn),xs("ColorRampProperty",Sn);const An="-transition";class Pn extends Z{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,"background"!==t.type&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new gn(e.layout)),e.paint)){this._transitionablePaint=new mn(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new xn(e.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,i={}){null!=e&&this._validate(fs,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(An)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(ms,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(An))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const i=this._transitionablePaint._values[t],r="cross-faded-data-driven"===i.property.specification["property-type"],s=i.value.isDataDriven(),n=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||s||r||this._handleOverridablePaintPropertyUpdate(t,n,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),v(t,(t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length))}_validate(t,e,i,r,s={}){return(!s||!1!==s.validate)&&_s(this,t.call(us,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:G,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof yn&&sr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const Cn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Mn{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class kn{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function zn(t,e=1){let i=0,r=0;return{members:t.map(t=>{const s=Cn[t.type].BYTES_PER_ELEMENT,n=i=En(i,Math.max(e,s)),o=t.components||1;return r=Math.max(r,s),i+=s*o,{name:t.name,type:t.type,components:o,offset:n}}),size:En(i,Math.max(r,e)),alignment:e}}function En(t,e){return Math.ceil(t/e)*e}class Dn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Dn.prototype.bytesPerElement=4,xs("StructArrayLayout2i4",Dn);class Ln extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const s=3*t;return this.int16[s+0]=e,this.int16[s+1]=i,this.int16[s+2]=r,t}}Ln.prototype.bytesPerElement=6,xs("StructArrayLayout3i6",Ln);class Rn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r)}emplace(t,e,i,r,s){const n=4*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,this.int16[n+3]=s,t}}Rn.prototype.bytesPerElement=8,xs("StructArrayLayout4i8",Rn);class Bn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,s,n)}emplace(t,e,i,r,s,n,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=s,this.int16[a+4]=n,this.int16[a+5]=o,t}}Bn.prototype.bytesPerElement=12,xs("StructArrayLayout2i4i12",Bn);class Fn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,s,n)}emplace(t,e,i,r,s,n,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=s,this.uint8[l+6]=n,this.uint8[l+7]=o,t}}Fn.prototype.bytesPerElement=8,xs("StructArrayLayout2i4ub8",Fn);class On extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}On.prototype.bytesPerElement=8,xs("StructArrayLayout2f8",On);class Vn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n,o,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,i,r,s,n,o,a,l,c)}emplace(t,e,i,r,s,n,o,a,l,c,h){const u=10*t;return this.uint16[u+0]=e,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=s,this.uint16[u+4]=n,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,this.uint16[u+8]=c,this.uint16[u+9]=h,t}}Vn.prototype.bytesPerElement=20,xs("StructArrayLayout10ui20",Vn);class Un extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n,o,a,l,c,h,u){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,s,n,o,a,l,c,h,u)}emplace(t,e,i,r,s,n,o,a,l,c,h,u,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=s,this.uint16[d+4]=n,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=h,this.int16[d+10]=u,this.int16[d+11]=p,t}}Un.prototype.bytesPerElement=24,xs("StructArrayLayout4i4ui4i24",Un);class Nn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const s=3*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,t}}Nn.prototype.bytesPerElement=12,xs("StructArrayLayout3f12",Nn);class jn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}jn.prototype.bytesPerElement=4,xs("StructArrayLayout1ul4",jn);class $n extends kn{_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(t,e,i,r,s,n,o,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,s,n,o,a,l)}emplace(t,e,i,r,s,n,o,a,l,c){const h=10*t,u=5*t;return this.int16[h+0]=e,this.int16[h+1]=i,this.int16[h+2]=r,this.int16[h+3]=s,this.int16[h+4]=n,this.int16[h+5]=o,this.uint32[u+3]=a,this.uint16[h+8]=l,this.uint16[h+9]=c,t}}$n.prototype.bytesPerElement=20,xs("StructArrayLayout6i1ul2ui20",$n);class qn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,s,n)}emplace(t,e,i,r,s,n,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=s,this.int16[a+4]=n,this.int16[a+5]=o,t}}qn.prototype.bytesPerElement=12,xs("StructArrayLayout2i2i2i12",qn);class Zn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r,s)}emplace(t,e,i,r,s,n){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[a+6]=s,this.int16[a+7]=n,t}}Zn.prototype.bytesPerElement=16,xs("StructArrayLayout2f1f2i16",Zn);class Gn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,s,n){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,s,n)}emplace(t,e,i,r,s,n,o){const a=16*t,l=4*t,c=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[l+1]=r,this.float32[l+2]=s,this.int16[c+6]=n,this.int16[c+7]=o,t}}Gn.prototype.bytesPerElement=16,xs("StructArrayLayout2ub2f2i16",Gn);class Wn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const s=3*t;return this.uint16[s+0]=e,this.uint16[s+1]=i,this.uint16[s+2]=r,t}}Wn.prototype.bytesPerElement=6,xs("StructArrayLayout3ui6",Wn);class Hn extends kn{_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(t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_)}emplace(t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g){const y=24*t,x=12*t,v=48*t;return this.int16[y+0]=e,this.int16[y+1]=i,this.uint16[y+2]=r,this.uint16[y+3]=s,this.uint32[x+2]=n,this.uint32[x+3]=o,this.uint32[x+4]=a,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=h,this.float32[x+7]=u,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=m,this.uint8[v+38]=f,this.uint32[x+10]=_,this.int16[y+22]=g,t}}Hn.prototype.bytesPerElement=48,xs("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Hn);class Xn extends kn{_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(t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g,y,x,v,b,w,T,S,I,A,P){const C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g,y,x,v,b,w,T,S,I,A,P)}emplace(t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g,y,x,v,b,w,T,S,I,A,P,C){const M=32*t,k=16*t;return this.int16[M+0]=e,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=s,this.int16[M+4]=n,this.int16[M+5]=o,this.int16[M+6]=a,this.int16[M+7]=l,this.uint16[M+8]=c,this.uint16[M+9]=h,this.uint16[M+10]=u,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=m,this.uint16[M+14]=f,this.uint16[M+15]=_,this.uint16[M+16]=g,this.uint16[M+17]=y,this.uint16[M+18]=x,this.uint16[M+19]=v,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=T,this.uint32[k+12]=S,this.float32[k+13]=I,this.float32[k+14]=A,this.uint16[M+30]=P,this.uint16[M+31]=C,t}}Xn.prototype.bytesPerElement=64,xs("StructArrayLayout8i15ui1ul2f2ui64",Xn);class Jn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Jn.prototype.bytesPerElement=4,xs("StructArrayLayout1f4",Jn);class Kn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const s=3*t;return this.uint16[6*t+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,t}}Kn.prototype.bytesPerElement=12,xs("StructArrayLayout1ui2f12",Kn);class Yn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){const s=4*t;return this.uint32[2*t+0]=e,this.uint16[s+2]=i,this.uint16[s+3]=r,t}}Yn.prototype.bytesPerElement=8,xs("StructArrayLayout1ul2ui8",Yn);class Qn extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}Qn.prototype.bytesPerElement=4,xs("StructArrayLayout2ui4",Qn);class to extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}to.prototype.bytesPerElement=2,xs("StructArrayLayout1ui2",to);class eo extends kn{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r)}emplace(t,e,i,r,s){const n=4*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,this.float32[n+3]=s,t}}eo.prototype.bytesPerElement=16,xs("StructArrayLayout4f16",eo);class io extends Mn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}io.prototype.size=20;class ro extends $n{get(t){return new io(this,t)}}xs("CollisionBoxArray",ro);class so extends Mn{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}so.prototype.size=48;class no extends Hn{get(t){return new so(this,t)}}xs("PlacedSymbolArray",no);class oo extends Mn{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(t){this._structArray.uint32[this._pos4+12]=t}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;class ao extends Xn{get(t){return new oo(this,t)}}xs("SymbolInstanceArray",ao);class lo extends Jn{getoffsetX(t){return this.float32[1*t+0]}}xs("GlyphOffsetArray",lo);class co extends Ln{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}xs("SymbolLineVertexArray",co);class ho extends Mn{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]}}ho.prototype.size=12;class uo extends Kn{get(t){return new ho(this,t)}}xs("TextAnchorOffsetArray",uo);class po extends Mn{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]}}po.prototype.size=8;class mo extends Yn{get(t){return new po(this,t)}}xs("FeatureIndexArray",mo);class fo extends Dn{}class _o extends Dn{}class go extends Dn{}class yo extends Bn{}class xo extends Fn{}class vo extends On{}class bo extends Vn{}class wo extends Un{}class To extends Nn{}class So extends jn{}class Io extends qn{}class Ao extends Gn{}class Po extends Wn{}class Co extends Qn{}const Mo=zn([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=Mo;class zo{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,r){let s=this.segments[this.segments.length-1];return t>zo.MAX_VERTEX_ARRAY_LENGTH&&T(`Max vertices per segment is ${zo.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!s||s.vertexLength+t>zo.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==r)&&(s={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==r&&(s.sortKey=r),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new zo([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Eo(t,e){return 256*(t=f(Math.floor(t),0,255))+f(Math.floor(e),0,255)}zo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,xs("SegmentVector",zo);const Do=zn([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Lo={exports:{}},Ro=function(t,e){var i,r,s,n,o,a,l,c;for(r=t.length-(i=3&t.length),s=e,o=3432918353,a=461845907,c=0;c<r;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,s=27492+(65535&(n=5*(65535&(s=(s^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&t.charCodeAt(c+2))<<16;case 2:l^=(255&t.charCodeAt(c+1))<<8;case 1:s^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return s^=t.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0},Bo=function(t,e){for(var i,r=t.length,s=e^r,n=0;r>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(n)|(255&t.charCodeAt(++n))<<8|(255&t.charCodeAt(++n))<<16|(255&t.charCodeAt(++n))<<24))+((1540483477*(i>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++n;switch(r){case 3:s^=(255&t.charCodeAt(n+2))<<16;case 2:s^=(255&t.charCodeAt(n+1))<<8;case 1:s=1540483477*(65535&(s^=255&t.charCodeAt(n)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0};Lo.exports=Ro,Lo.exports.murmur3=Ro,Lo.exports.murmur2=Bo;var Fo=i(Lo.exports);class Oo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(Vo(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=Vo(t);let i=0,r=this.ids.length-1;for(;i<r;){const t=i+r>>1;this.ids[t]>=e?r=t:i=t+1}const s=[];for(;this.ids[i]===e;)s.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return s}static serialize(t,e){const i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return Uo(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){const e=new Oo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Vo(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Fo(String(t))}function Uo(t,e,i,r){for(;i<r;){const s=t[i+r>>1];let n=i-1,o=r+1;for(;;){do{n++}while(t[n]<s);do{o--}while(t[o]>s);if(n>=o)break;No(t,n,o),No(e,3*n,3*o),No(e,3*n+1,3*o+1),No(e,3*n+2,3*o+2)}o-i<r-o?(Uo(t,e,i,o),i=o+1):(Uo(t,e,o+1,r),r=o)}}function No(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}xs("FeaturePositionMap",Oo);class jo{constructor(t,e){this.gl=t.gl,this.location=e}}class $o extends jo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class qo extends jo{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Zo extends jo{constructor(t,e){super(t,e),this.current=Wt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Go=new Float32Array(16);function Wo(t){return[Eo(255*t.r,255*t.g),Eo(255*t.b,255*t.a)]}class Ho{constructor(t,e,i){this.value=t,this.uniformNames=e.map(t=>`u_${t}`),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return"color"===this.type?new Zo(t,e):new $o(t,e)}}class Xo{constructor(t,e){this.uniformNames=e.map(t=>`u_${t}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,i,r){const s="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;s&&t.set(s)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new qo(t,e):new $o(t,e)}}class Jo{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(t,e,i,r,s){const n=this.paintVertexArray.length,o=this.expression.evaluate(new un(0),e,{},r,[],s);this.paintVertexArray.resize(t),this._setPaintValue(n,t,o)}updatePaintArray(t,e,i,r){const s=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(t,e,s)}_setPaintValue(t,e,i){if("color"===this.type){const r=Wo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ko{constructor(t,e,i,r,s,n){this.expression=t,this.uniformNames=e.map(t=>`u_${t}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=e.map(t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new n}populatePaintArray(t,e,i,r,s){const n=this.expression.evaluate(new un(this.zoom),e,{},r,[],s),o=this.expression.evaluate(new un(this.zoom+1),e,{},r,[],s),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,n,o)}updatePaintArray(t,e,i,r){const s=this.expression.evaluate({zoom:this.zoom},i,r),n=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(t,e,s,n)}_setPaintValue(t,e,i,r){if("color"===this.type){const s=Wo(i),n=Wo(r);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,s[0],s[1],n[0],n[1])}else{for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){const i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=f(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new $o(t,e)}}class Yo{constructor(t,e,i,r,s,n){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=n,this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(t,e,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,r,s){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],s)}_setPaintValues(t,e,i,r){if(!r||!i)return;const{min:s,mid:n,max:o}=i,a=r[s],l=r[n],c=r[o];if(a&&l&&c)for(let i=t;i<e;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],l.pixelRatio,a.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Do.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Do.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Qo{constructor(t,e,i){this.binders={},this._buffers=[];const r=[];for(const s in t.paint._values){if(!i(s))continue;const n=t.paint.get(s);if(!(n instanceof yn&&sr(n.property.specification)))continue;const o=ea(s,t.type),a=n.value,l=n.property.specification.type,c=n.property.useIntegerZoom,h=n.property.specification["property-type"],u="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===a.kind)this.binders[s]=u?new Xo(a.value,o):new Ho(a.value,o,l),r.push(`/u_${s}`);else if("source"===a.kind||u){const i=ia(s,l,"source");this.binders[s]=u?new Yo(a,l,c,e,i,t.id):new Jo(a,o,l,i),r.push(`/a_${s}`)}else{const t=ia(s,l,"composite");this.binders[s]=new Ko(a,o,l,c,e,t),r.push(`/z_${s}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Jo||e instanceof Ko?e.maxValue:0}populatePaintArrays(t,e,i,r,s){for(const n in this.binders){const o=this.binders[n];(o instanceof Jo||o instanceof Ko||o instanceof Yo)&&o.populatePaintArray(t,e,i,r,s)}}setConstantPatternPositions(t,e){for(const i in this.binders){const r=this.binders[i];r instanceof Xo&&r.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,r,s){let n=!1;for(const o in t){const a=e.getPositions(o);for(const e of a){const a=i.feature(e.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Jo||l instanceof Ko||l instanceof Yo)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,a,t[o],s),n=!0}}}}return n}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Ho||i instanceof Xo)&&t.push(...i.uniformNames.map(t=>`#define HAS_UNIFORM_${t}`))}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Jo||i instanceof Ko)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Yo)for(let e=0;e<Do.members.length;e++)t.push(Do.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Ho||i instanceof Xo||i instanceof Ko)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof Ho||s instanceof Xo||s instanceof Ko)for(const n of s.uniformNames)if(e[n]){const o=s.getBinding(t,e[n],n);i.push({name:n,property:r,binding:o})}}return i}setUniforms(t,e,i,r){for(const{name:t,property:s,binding:n}of e)this.binders[s].setUniform(n,r,i.get(s),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Yo){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Jo||i instanceof Ko)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Jo||i instanceof Ko||i instanceof Yo)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Jo||e instanceof Ko||e instanceof Yo)&&e.destroy()}}}class ta{constructor(t,e,i=()=>!0){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new Qo(r,e,i);this.needsUpload=!1,this._featureMap=new Oo,this._bufferOffset=0}populatePaintArrays(t,e,i,r,s,n){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,r,s,n);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(const s of i)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t,this._featureMap,e,s,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function ea(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function ia(t,e,i){const r={color:{source:On,composite:eo},number:{source:Jn,composite:On}},s=function(t){return{"line-pattern":{source:bo,composite:bo},"fill-pattern":{source:bo,composite:bo},"fill-extrusion-pattern":{source:bo,composite:bo}}[t]}(t);return s&&s[i]||r[e][i]}xs("ConstantBinder",Ho),xs("CrossFadedConstantBinder",Xo),xs("SourceExpressionBinder",Jo),xs("CrossFadedCompositeBinder",Yo),xs("CompositeExpressionBinder",Ko),xs("ProgramConfiguration",Qo,{omit:["_buffers"]}),xs("ProgramConfigurationSet",ta);const ra=8192,sa=Math.pow(2,14)-1,na=-sa-1;function oa(t){const e=ra/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const r=i[t];for(let t=0;t<r.length;t++){const i=r[t],s=Math.round(i.x*e),n=Math.round(i.y*e);i.x=f(s,na,sa),i.y=f(n,na,sa),(s<i.x||s>i.x+1||n<i.y||n>i.y+1)&&T("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function aa(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?oa(t):[]}}function la(t,e,i,r,s){t.emplaceBack(2*e+(r+1)/2,2*i+(s+1)/2)}class ca{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new _o,this.indexArray=new Po,this.segments=new zo,this.programConfigurations=new ta(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){const r=this.layers[0],s=[];let n=null,o=!1;"circle"===r.type&&(n=r.layout.get("circle-sort-key"),o=!n.isConstant());for(const{feature:e,id:r,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=aa(e,t);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),c,i))continue;const h=o?n.evaluate(c,{},i):void 0,u={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:oa(e),patterns:{},sortKey:h};s.push(u)}o&&s.sort((t,e)=>t.sortKey-e.sortKey);for(const r of s){const{geometry:s,index:n,sourceLayerIndex:o}=r,a=t[n].feature;this.addFeature(r,s,n,i),e.featureIndex.insert(a,s,n,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ko),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r){for(const i of e)for(const e of i){const i=e.x,r=e.y;if(i<0||i>=ra||r<0||r>=ra)continue;const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),n=s.vertexLength;la(this.layoutVertexArray,i,r,-1,-1),la(this.layoutVertexArray,i,r,1,-1),la(this.layoutVertexArray,i,r,1,1),la(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(n,n+1,n+2),this.indexArray.emplaceBack(n,n+3,n+2),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},r)}}function ha(t,e){for(let i=0;i<t.length;i++)if(xa(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(xa(t,e[i]))return!0;return!!ma(t,e)}
vendor: 1,771 bytes, line 2
2function ua(t,e,i){return!!xa(t,e)||!!_a(e,t,i)}function pa(t,e){if(1===t.length)return ya(e,t[0]);for(let i=0;i<e.length;i++){const r=e[i];for(let e=0;e<r.length;e++)if(xa(t,r[e]))return!0}for(let i=0;i<t.length;i++)if(ya(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ma(t,e[i]))return!0;return!1}function da(t,e,i){if(t.length>1){if(ma(t,e))return!0;for(let r=0;r<e.length;r++)if(_a(e[r],t,i))return!0}for(let r=0;r<t.length;r++)if(_a(t[r],e,i))return!0;return!1}function ma(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const r=t[i],s=t[i+1];for(let t=0;t<e.length-1;t++)if(fa(r,s,e[t],e[t+1]))return!0}return!1}function fa(t,e,i,r){return S(t,i,r)!==S(e,i,r)&&S(t,e,i)!==S(t,e,r)}function _a(t,e,i){const r=i*i;if(1===e.length)return t.distSqr(e[0])<r;for(let i=1;i<e.length;i++)if(ga(t,e[i-1],e[i])<r)return!0;return!1}function ga(t,e,i){const r=e.distSqr(i);if(0===r)return t.distSqr(e);const s=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(s<0?e:s>1?i:i.sub(e)._mult(s)._add(e))}function ya(t,e){let i,r,s,n=!1;for(let o=0;o<t.length;o++){i=t[o];for(let t=0,o=i.length-1;t<i.length;o=t++)r=i[t],s=i[o],r.y>e.y!=s.y>e.y&&e.x<(s.x-r.x)*(e.y-r.y)/(s.y-r.y)+r.x&&(n=!n)}return n}function xa(t,e){let i=!1;for(let r=0,s=t.length-1;r<t.length;s=r++){const n=t[r],o=t[s];n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(i=!i)}return i}function va(t,e,i){const r=i[0],s=i[2];if(t.x<r.x&&e.x<r.x||t.x>s.x&&e.x>s.x||t.y<r.y&&e.y<r.y||t.y>s.y&&e.y>s.y)return!1;const n=S(t,e,i[0]);return n!==S(t,e,i[1])||n!==S(t,e,i[2])||n!==S(t,e,i[3])}function ba(t,e,i){const r=e.paint.get(t).value;return"constant"===r.kind?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function wa(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}
vendor: 46,169 bytes, line 2
2function Ta(t,e,i,r,s){if(!e[0]&&!e[1])return t;const o=n.convert(e)._mult(s);"viewport"===i&&o._rotate(-r);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}let Sa,Ia;xs("CircleBucket",ca,{omit:["layers"]});var Aa={get paint(){return Ia=Ia||new In({"circle-radius":new bn(G.paint_circle["circle-radius"]),"circle-color":new bn(G.paint_circle["circle-color"]),"circle-blur":new bn(G.paint_circle["circle-blur"]),"circle-opacity":new bn(G.paint_circle["circle-opacity"]),"circle-translate":new vn(G.paint_circle["circle-translate"]),"circle-translate-anchor":new vn(G.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new vn(G.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new vn(G.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new bn(G.paint_circle["circle-stroke-width"]),"circle-stroke-color":new bn(G.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new bn(G.paint_circle["circle-stroke-opacity"])})},get layout(){return Sa=Sa||new In({"circle-sort-key":new bn(G.layout_circle["circle-sort-key"])})}},Pa=1e-6,Ca="undefined"!=typeof Float32Array?Float32Array:Array;function Ma(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ka(t,e,i){var r=e[0],s=e[1],n=e[2],o=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],f=e[12],_=e[13],g=e[14],y=e[15],x=i[0],v=i[1],b=i[2],w=i[3];return t[0]=x*r+v*a+b*u+w*f,t[1]=x*s+v*l+b*p+w*_,t[2]=x*n+v*c+b*d+w*g,t[3]=x*o+v*h+b*m+w*y,t[4]=(x=i[4])*r+(v=i[5])*a+(b=i[6])*u+(w=i[7])*f,t[5]=x*s+v*l+b*p+w*_,t[6]=x*n+v*c+b*d+w*g,t[7]=x*o+v*h+b*m+w*y,t[8]=(x=i[8])*r+(v=i[9])*a+(b=i[10])*u+(w=i[11])*f,t[9]=x*s+v*l+b*p+w*_,t[10]=x*n+v*c+b*d+w*g,t[11]=x*o+v*h+b*m+w*y,t[12]=(x=i[12])*r+(v=i[13])*a+(b=i[14])*u+(w=i[15])*f,t[13]=x*s+v*l+b*p+w*_,t[14]=x*n+v*c+b*d+w*g,t[15]=x*o+v*h+b*m+w*y,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var za,Ea=ka;function Da(t,e,i){var r=e[0],s=e[1],n=e[2],o=e[3];return t[0]=i[0]*r+i[4]*s+i[8]*n+i[12]*o,t[1]=i[1]*r+i[5]*s+i[9]*n+i[13]*o,t[2]=i[2]*r+i[6]*s+i[10]*n+i[14]*o,t[3]=i[3]*r+i[7]*s+i[11]*n+i[15]*o,t}za=new Ca(4),Ca!=Float32Array&&(za[0]=0,za[1]=0,za[2]=0,za[3]=0);class La extends Pn{constructor(t){super(t,Aa)}createBucket(t){return new ca(t)}queryRadius(t){const e=t;return ba("circle-radius",this,e)+ba("circle-stroke-width",this,e)+wa(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,r,s,n,o,a){const l=Ta(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),n.angle,o),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),h="map"===this.paint.get("circle-pitch-alignment"),u=h?l:function(t,e){return t.map(t=>Ra(t,e))}(l,a),p=h?c*o:c;for(const t of r)for(const e of t){const t=h?e:Ra(e,a);let i=p;const r=Da([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r[3]/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r[3]),ua(u,t,i))return!0}return!1}}function Ra(t,e){const i=Da([],[t.x,t.y,0,1],e);return new n(i[0]/i[3],i[1]/i[3])}class Ba extends ca{}let Fa;xs("HeatmapBucket",Ba,{omit:["layers"]});var Oa={get paint(){return Fa=Fa||new In({"heatmap-radius":new bn(G.paint_heatmap["heatmap-radius"]),"heatmap-weight":new bn(G.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new vn(G.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Sn(G.paint_heatmap["heatmap-color"]),"heatmap-opacity":new vn(G.paint_heatmap["heatmap-opacity"])})}};function Va(t,{width:e,height:i},r,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*i*r)throw new RangeError(`mismatched image size. expected: ${s.length} but got: ${e*i*r}`)}else s=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=s,t}function Ua(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;const s=Va({},{width:e,height:i},r);Na(t,s,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=s.data}function Na(t,e,i,r,s,n){if(0===s.width||0===s.height)return e;if(s.width>t.width||s.height>t.height||i.x>t.width-s.width||i.y>t.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||r.x>e.width-s.width||r.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;if(o===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<s.height;l++){const c=((i.y+l)*t.width+i.x)*n,h=((r.y+l)*e.width+r.x)*n;for(let t=0;t<s.width*n;t++)a[h+t]=o[c+t]}return e}class ja{constructor(t,e){Va(this,t,1,e)}resize(t){Ua(this,t,1)}clone(){return new ja({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,s){Na(t,e,i,r,s,1)}}class $a{constructor(t,e){Va(this,t,4,e)}resize(t){Ua(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new $a({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,s){Na(t,e,i,r,s,4)}}function qa(t){const e={},i=t.resolution||256,r=t.clips?t.clips.length:1,s=t.image||new $a({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const n=(i,r,n)=>{e[t.evaluationKey]=n;const o=t.expression.evaluate(e);s.data[i+r+0]=Math.floor(255*o.r/o.a),s.data[i+r+1]=Math.floor(255*o.g/o.a),s.data[i+r+2]=Math.floor(255*o.b/o.a),s.data[i+r+3]=Math.floor(255*o.a)};if(t.clips)for(let e=0,s=0;e<r;++e,s+=4*i)for(let r=0,o=0;r<i;r++,o+=4){const a=r/(i-1),{start:l,end:c}=t.clips[e];n(s,o,l*(1-a)+c*a)}else for(let t=0,e=0;t<i;t++,e+=4)n(0,e,t/(i-1));return s}xs("AlphaImage",ja),xs("RGBAImage",$a);const Za="big-fb";class Ga extends Pn{createBucket(t){return new Ba(t)}constructor(t){super(t,Oa),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=qa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Za)&&this.heatmapFbos.delete(Za)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Wa;var Ha={get paint(){return Wa=Wa||new In({"hillshade-illumination-direction":new vn(G.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new vn(G.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new vn(G.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new vn(G.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new vn(G.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new vn(G.paint_hillshade["hillshade-accent-color"])})}};class Xa extends Pn{constructor(t){super(t,Ha)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Ja=zn([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ka}=Ja;function Ya(t,e,i=2){const r=e&&e.length,s=r?e[0]*i:t.length;let n=Qa(t,0,s,i,!0);const o=[];if(!n||n.next===n.prev)return o;let a,l,c;if(r&&(n=function(t,e,i,r){const s=[];for(let i=0,n=e.length;i<n;i++){const o=Qa(t,e[i]*r,i<n-1?e[i+1]*r:t.length,r,!1);o===o.next&&(o.steiner=!0),s.push(hl(o))}s.sort(ol);for(let t=0;t<s.length;t++)i=al(s[t],i);return i}(t,e,n,i)),t.length>80*i){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let n=i;n<s;n+=i){const i=t[n],s=t[n+1];i<a&&(a=i),s<l&&(l=s),i>e&&(e=i),s>r&&(r=s)}c=Math.max(e-a,r-l),c=0!==c?32767/c:0}return el(n,o,i,a,l,c,0),o}function Qa(t,e,i,r,s){let n;if(s===function(t,e,i,r){let s=0;for(let n=e,o=i-r;n<i;n+=r)s+=(t[o]-t[n])*(t[n+1]+t[o+1]),o=n;return s}(t,e,i,r)>0)for(let s=e;s<i;s+=r)n=vl(s/r|0,t[s],t[s+1],n);else for(let s=i-r;s>=e;s-=r)n=vl(s/r|0,t[s],t[s+1],n);return n&&ml(n,n.next)&&(bl(n),n=n.next),n}function tl(t,e){if(!t)return t;e||(e=t);let i,r=t;do{if(i=!1,r.steiner||!ml(r,r.next)&&0!==dl(r.prev,r,r.next))r=r.next;else{if(bl(r),r=e=r.prev,r===r.next)break;i=!0}}while(i||r!==e);return e}function el(t,e,i,r,s,n,o){if(!t)return;!o&&n&&function(t,e,i,r){let s=t;do{0===s.z&&(s.z=cl(s.x,s.y,e,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i=1;do{let r,s=t;t=null;let n=null;for(e=0;s;){e++;let o=s,a=0;for(let t=0;t<i&&(a++,o=o.nextZ,o);t++);let l=i;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||s.z<=o.z)?(r=s,s=s.nextZ,a--):(r=o,o=o.nextZ,l--),n?n.nextZ=r:t=r,r.prevZ=n,n=r;s=o}n.nextZ=null,i*=2}while(e>1)}(s)}(t,r,s,n);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(n?rl(t,r,s,n):il(t))e.push(l.i,t.i,c.i),bl(t),t=c.next,a=c.next;else if((t=c)===a){o?1===o?el(t=sl(tl(t),e),e,i,r,s,n,2):2===o&&nl(t,e,i,r,s,n):el(tl(t),e,i,r,s,n,1);break}}}function il(t){const e=t.prev,i=t,r=t.next;if(dl(e,i,r)>=0)return!1;const s=e.x,n=i.x,o=r.x,a=e.y,l=i.y,c=r.y,h=s<n?s<o?s:o:n<o?n:o,u=a<l?a<c?a:c:l<c?l:c,p=s>n?s>o?s:o:n>o?n:o,d=a>l?a>c?a:c:l>c?l:c;let m=r.next;for(;m!==e;){if(m.x>=h&&m.x<=p&&m.y>=u&&m.y<=d&&ul(s,a,n,l,o,c,m.x,m.y)&&dl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rl(t,e,i,r){const s=t.prev,n=t,o=t.next;if(dl(s,n,o)>=0)return!1;const a=s.x,l=n.x,c=o.x,h=s.y,u=n.y,p=o.y,d=a<l?a<c?a:c:l<c?l:c,m=h<u?h<p?h:p:u<p?u:p,f=a>l?a>c?a:c:l>c?l:c,_=h>u?h>p?h:p:u>p?u:p,g=cl(d,m,e,i,r),y=cl(f,_,e,i,r);let x=t.prevZ,v=t.nextZ;for(;x&&x.z>=g&&v&&v.z<=y;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=_&&x!==s&&x!==o&&ul(a,h,l,u,c,p,x.x,x.y)&&dl(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,v.x>=d&&v.x<=f&&v.y>=m&&v.y<=_&&v!==s&&v!==o&&ul(a,h,l,u,c,p,v.x,v.y)&&dl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=_&&x!==s&&x!==o&&ul(a,h,l,u,c,p,x.x,x.y)&&dl(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=y;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=_&&v!==s&&v!==o&&ul(a,h,l,u,c,p,v.x,v.y)&&dl(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function sl(t,e){let i=t;do{const r=i.prev,s=i.next.next;!ml(r,s)&&fl(r,i,i.next,s)&&yl(r,s)&&yl(s,r)&&(e.push(r.i,i.i,s.i),bl(i),bl(i.next),i=t=s),i=i.next}while(i!==t);return tl(i)}function nl(t,e,i,r,s,n){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&pl(o,t)){let a=xl(o,t);return o=tl(o,o.next),a=tl(a,a.next),el(o,e,i,r,s,n,0),void el(a,e,i,r,s,n,0)}t=t.next}o=o.next}while(o!==t)}function ol(t,e){return t.x-e.x}function al(t,e){const i=function(t,e){let i=e;const r=t.x,s=t.y;let n,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){const t=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=r&&t>o&&(o=t,n=i.x<i.next.x?i:i.next,t===r))return n}i=i.next}while(i!==e);if(!n)return null;const a=n,l=n.x,c=n.y;let h=1/0;i=n;do{if(r>=i.x&&i.x>=l&&r!==i.x&&ul(s<c?r:o,s,l,c,s<c?o:r,s,i.x,i.y)){const e=Math.abs(s-i.y)/(r-i.x);yl(i,t)&&(e<h||e===h&&(i.x>n.x||i.x===n.x&&ll(n,i)))&&(n=i,h=e)}i=i.next}while(i!==a);return n}(t,e);if(!i)return e;const r=xl(i,t);return tl(r,r.next),tl(i,i.next)}function ll(t,e){return dl(t.prev,t,e.prev)<0&&dl(e.next,t,t.next)<0}function cl(t,e,i,r,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function hl(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function ul(t,e,i,r,s,n,o,a){return(s-o)*(e-a)>=(t-o)*(n-a)&&(t-o)*(r-a)>=(i-o)*(e-a)&&(i-o)*(n-a)>=(s-o)*(r-a)}function pl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&fl(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(yl(t,e)&&yl(e,t)&&function(t,e){let i=t,r=!1;const s=(t.x+e.x)/2,n=(t.y+e.y)/2;do{i.y>n!=i.next.y>n&&i.next.y!==i.y&&s<(i.next.x-i.x)*(n-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(dl(t.prev,t,e.prev)||dl(t,e.prev,e))||ml(t,e)&&dl(t.prev,t,t.next)>0&&dl(e.prev,e,e.next)>0)}function dl(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ml(t,e){return t.x===e.x&&t.y===e.y}function fl(t,e,i,r){const s=gl(dl(t,e,i)),n=gl(dl(t,e,r)),o=gl(dl(i,r,t)),a=gl(dl(i,r,e));return s!==n&&o!==a||!(0!==s||!_l(t,i,e))||!(0!==n||!_l(t,r,e))||!(0!==o||!_l(i,t,r))||!(0!==a||!_l(i,e,r))}function _l(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function gl(t){return t>0?1:t<0?-1:0}function yl(t,e){return dl(t.prev,t,t.next)<0?dl(t,e,t.next)>=0&&dl(t,t.prev,e)>=0:dl(t,e,t.prev)<0||dl(t,t.next,e)<0}function xl(t,e){const i=wl(t.i,t.x,t.y),r=wl(e.i,e.x,e.y),s=t.next,n=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,r.next=i,i.prev=r,n.next=r,r.prev=n,r}function vl(t,e,i,r){const s=wl(t,e,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function bl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wl(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Tl(t,e,i){const r=i.patternDependencies;let s=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(s=!0);const n=e.constantOr(null);n&&(s=!0,r[n.to]=!0,r[n.from]=!0)}return s}function Sl(t,e,i,r,s){const n=s.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:r-1},i,{},s.availableImages),a=e.evaluate({zoom:r},i,{},s.availableImages),l=e.evaluate({zoom:r+1},i,{},s.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,n[t]=!0,n[a]=!0,n[l]=!0,i.patterns[o.id]={min:t,mid:a,max:l}}}return i}class Il{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new go,this.indexArray=new Po,this.indexArray2=new Co,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new zo,this.segments2=new zo,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Tl("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),s=!r.isConstant(),n=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,h=aa(o,t);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),h,i))continue;const u=s?r.evaluate(h,{},i,e.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:c,index:l,geometry:t?h.geometry:oa(o),patterns:{},sortKey:u};n.push(p)}s&&n.sort((t,e)=>t.sortKey-e.sortKey);for(const r of n){const{geometry:s,index:n,sourceLayerIndex:o}=r;if(this.hasPattern){const t=Sl("fill",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,s,n,i,{});e.featureIndex.insert(t[n].feature,s,n,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ka),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,e,i,r,s){for(const t of gi(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),r=i.vertexLength,s=[],n=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&n.push(s.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),r=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(r+e.length-1,r),s.push(e[0].x),s.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(r+t-1,r+t),s.push(e[t].x),s.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const o=Ya(s,n);for(let t=0;t<o.length;t+=3)this.indexArray.emplaceBack(r+o[t],r+o[t+1],r+o[t+2]);i.vertexLength+=e,i.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,s,r)}}let Al,Pl;xs("FillBucket",Il,{omit:["layers","patternFeatures"]});var Cl={get paint(){return Pl=Pl||new In({"fill-antialias":new vn(G.paint_fill["fill-antialias"]),"fill-opacity":new bn(G.paint_fill["fill-opacity"]),"fill-color":new bn(G.paint_fill["fill-color"]),"fill-outline-color":new bn(G.paint_fill["fill-outline-color"]),"fill-translate":new vn(G.paint_fill["fill-translate"]),"fill-translate-anchor":new vn(G.paint_fill["fill-translate-anchor"]),"fill-pattern":new wn(G.paint_fill["fill-pattern"])})},get layout(){return Al=Al||new In({"fill-sort-key":new bn(G.layout_fill["fill-sort-key"])})}};class Ml extends Pn{constructor(t){super(t,Cl)}recalculate(t,e){super.recalculate(t,e);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Il(t)}queryRadius(){return wa(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,r,s,n,o){return pa(Ta(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),n.angle,o),r)}isTileClipped(){return!0}}const kl=zn([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),zl=zn([{name:"a_centroid",components:2,type:"Int16"}],4),{members:El}=kl;var Dl={},Ll=r,Rl=Bl;function Bl(t,e,i,r,s){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=s,t.readFields(Fl,this,e)}function Fl(t,e,i){1==t?e.id=i.readVarint():2==t?function(t,e){for(var i=t.readVarint()+t.pos;t.pos<i;){var r=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[r]=s}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function Ol(t){for(var e,i,r=0,s=0,n=t.length,o=n-1;s<n;o=s++)r+=((i=t[o]).x-(e=t[s]).x)*(e.y+i.y);return r}Bl.types=["Unknown","Point","LineString","Polygon"],Bl.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,r=1,s=0,n=0,o=0,a=[];t.pos<i;){if(s<=0){var l=t.readVarint();r=7&l,s=l>>3}if(s--,1===r||2===r)n+=t.readSVarint(),o+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new Ll(n,o));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Bl.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,r=0,s=0,n=0,o=1/0,a=-1/0,l=1/0,c=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();i=7&h,r=h>>3}if(r--,1===i||2===i)(s+=t.readSVarint())<o&&(o=s),s>a&&(a=s),(n+=t.readSVarint())<l&&(l=n),n>c&&(c=n);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,a,c]},Bl.prototype.toGeoJSON=function(t,e,i){var r,s,n=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=Bl.types[this.type];function h(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+o)/n-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/n)*Math.PI/180))-90]}}switch(this.type){case 1:var u=[];for(r=0;r<l.length;r++)u[r]=l[r][0];h(l=u);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,r,s=[],n=0;n<e;n++){var o=Ol(t[n]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&s.push(i),i=[t[n]]):i.push(t[n]))}return i&&s.push(i),s}(l),r=0;r<l.length;r++)for(s=0;s<l[r].length;s++)h(l[r][s])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var Vl=Rl,Ul=Nl;function Nl(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(jl,this,e),this.length=this._features.length}function jl(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){for(var e=null,i=t.readVarint()+t.pos;t.pos<i;){var r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return e}(i))}Nl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Vl(this._pbf,e,this.extent,this._keys,this._values)};var $l=Ul;function ql(t,e,i){if(3===t){var r=new $l(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}Dl.VectorTile=function(t,e){this.layers=t.readFields(ql,{},e)},Dl.VectorTileFeature=Rl,Dl.VectorTileLayer=Ul;const Zl=Dl.VectorTileFeature.types,Gl=Math.pow(2,13);function Wl(t,e,i,r,s,n,o,a){t.emplaceBack(e,i,2*Math.floor(r*Gl)+o,s*Gl*2,n*Gl*2,Math.round(a))}class Hl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new yo,this.centroidVertexArray=new fo,this.indexArray=new Po,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new zo,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.features=[],this.hasPattern=Tl("fill-extrusion",this.layers,e);for(const{feature:r,id:s,index:n,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=aa(r,t);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),a,i))continue;const l={id:s,sourceLayerIndex:o,index:n,geometry:t?a.geometry:oa(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Sl("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,n,i,{}),e.featureIndex.insert(r,l.geometry,n,o,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:r}=t;this.addFeature(t,r,t.index,e,i)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,El),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,zl.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,s){for(const i of gi(e,500)){const e={x:0,y:0,vertexCount:0};let r=0;for(const t of i)r+=t.length;let s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(Jl(t))continue;let i=0;for(let r=0;r<t.length;r++){const n=t[r];if(r>=1){const o=t[r-1];if(!Xl(n,o)){s.vertexLength+4>zo.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=n.sub(o)._perp()._unit(),r=o.dist(n);i+r>32768&&(i=0),Wl(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,0,i),Wl(this.layoutVertexArray,n.x,n.y,t.x,t.y,0,1,i),e.x+=2*n.x,e.y+=2*n.y,e.vertexCount+=2,i+=r,Wl(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,0,i),Wl(this.layoutVertexArray,o.x,o.y,t.x,t.y,0,1,i),e.x+=2*o.x,e.y+=2*o.y,e.vertexCount+=2;const a=s.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}}}}if(s.vertexLength+r>zo.MAX_VERTEX_ARRAY_LENGTH&&(s=this.segments.prepareSegment(r,this.layoutVertexArray,this.indexArray)),"Polygon"!==Zl[t.type])continue;const n=[],o=[],a=s.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&o.push(n.length/2);for(let i=0;i<t.length;i++){const r=t[i];Wl(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),e.x+=r.x,e.y+=r.y,e.vertexCount+=1,n.push(r.x),n.push(r.y)}}const l=Ya(n,o);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(a+l[t],a+l[t+2],a+l[t+1]);s.primitiveLength+=l.length/3,s.vertexLength+=r;for(let t=0;t<e.vertexCount;t++){const t=Math.floor(e.x/e.vertexCount),i=Math.floor(e.y/e.vertexCount);this.centroidVertexArray.emplaceBack(t,i)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,s,r)}}function Xl(t,e){return t.x===e.x&&(t.x<0||t.x>ra)||t.y===e.y&&(t.y<0||t.y>ra)}function Jl(t){return t.every(t=>t.x<0)||t.every(t=>t.x>ra)||t.every(t=>t.y<0)||t.every(t=>t.y>ra)}let Kl;xs("FillExtrusionBucket",Hl,{omit:["layers","features"]});var Yl={get paint(){return Kl=Kl||new In({"fill-extrusion-opacity":new vn(G["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new bn(G["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new vn(G["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new vn(G["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new wn(G["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new bn(G["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new bn(G["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new vn(G["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Ql extends Pn{constructor(t){super(t,Yl)}createBucket(t){return new Hl(t)}queryRadius(){return wa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,r,s,o,a,l){const c=Ta(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,a),h=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),p=function(t,e){const i=[];for(const r of t){const t=[r.x,r.y,0,1];Da(t,t,e),i.push(new n(t[0]/t[3],t[1]/t[3]))}return i}(c,l),d=function(t,e,i,r){const s=[],o=[],a=r[8]*e,l=r[9]*e,c=r[10]*e,h=r[11]*e,u=r[8]*i,p=r[9]*i,d=r[10]*i,m=r[11]*i;for(const e of t){const t=[],i=[];for(const s of e){const e=s.x,o=s.y,f=r[0]*e+r[4]*o+r[12],_=r[1]*e+r[5]*o+r[13],g=r[2]*e+r[6]*o+r[14],y=r[3]*e+r[7]*o+r[15],x=g+c,v=y+h,b=f+u,w=_+p,T=g+d,S=y+m,I=new n((f+a)/v,(_+l)/v);I.z=x/v,t.push(I);const A=new n(b/S,w/S);A.z=T/S,i.push(A)}s.push(t),o.push(i)}return[s,o]}(r,u,h,l);return function(t,e,i){let r=1/0;pa(i,e)&&(r=ec(i,e[0]));for(let s=0;s<e.length;s++){const n=e[s],o=t[s];for(let t=0;t<n.length-1;t++){const e=n[t],s=[e,n[t+1],o[t+1],o[t],e];ha(i,s)&&(r=Math.min(r,ec(i,s)))}}return r!==1/0&&r}(d[0],d[1],p)}}function tc(t,e){return t.x*e.x+t.y*e.y}function ec(t,e){if(1===t.length){let i=0;const r=e[i++];let s;for(;!s||r.equals(s);)if(s=e[i++],!s)return 1/0;for(;i<e.length;i++){const n=e[i],o=t[0],a=s.sub(r),l=n.sub(r),c=o.sub(r),h=tc(a,a),u=tc(a,l),p=tc(l,l),d=tc(c,a),m=tc(c,l),f=h*p-u*u,_=(p*d-u*m)/f,g=(h*m-u*d)/f,y=r.z*(1-_-g)+s.z*_+n.z*g;if(isFinite(y))return y}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const ic=zn([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:rc}=ic,sc=zn([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:nc}=sc,oc=Dl.VectorTileFeature.types,ac=Math.cos(Math.PI/180*37.5),lc=Math.pow(2,14)/.5;class cc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(t=>t.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new xo,this.layoutVertexArray2=new vo,this.indexArray=new Po,this.programConfigurations=new ta(t.layers,t.zoom),this.segments=new zo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(t,e,i){this.hasPattern=Tl("line",this.layers,e);const r=this.layers[0].layout.get("line-sort-key"),s=!r.isConstant(),n=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=aa(e,t);if(!this.layers[0]._featureFilter.filter(new un(this.zoom),c,i))continue;const h=s?r.evaluate(c,{},i):void 0,u={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:oa(e),patterns:{},sortKey:h};n.push(u)}s&&n.sort((t,e)=>t.sortKey-e.sortKey);for(const r of n){const{geometry:s,index:n,sourceLayerIndex:o}=r;if(this.hasPattern){const t=Sl("line",this.layers,r,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(r,s,n,i,{});e.featureIndex.insert(t[n].feature,s,n,o,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,i)}addFeatures(t,e,i){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,nc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rc),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,i,r,s){const n=this.layers[0].layout,o=n.get("line-join").evaluate(t,{}),a=n.get("line-cap"),l=n.get("line-miter-limit"),c=n.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,o,a,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,s,r)}addLine(t,e,i,r,s,n){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const o="Polygon"===oc[e.type];let a=t.length;for(;a>=2&&t[a-1].equals(t[a-2]);)a--;let l=0;for(;l<a-1&&t[l].equals(t[l+1]);)l++;if(a<(o?3:2))return;"bevel"===i&&(s=1.05);const c=this.overscaling<=16?15*ra/(512*this.overscaling):0,h=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let u,p,d,m,f;this.e1=this.e2=-1,o&&(u=t[a-2],f=t[l].sub(u)._unit()._perp());for(let e=l;e<a;e++){if(d=e===a-1?o?t[l+1]:void 0:t[e+1],d&&t[e].equals(d))continue;f&&(m=f),u&&(p=u),u=t[e],f=d?d.sub(u)._unit()._perp():m,m=m||f;let _=m.add(f);0===_.x&&0===_.y||_._unit();const g=m.x*f.x+m.y*f.y,y=_.x*f.x+_.y*f.y,x=0!==y?1/y:1/0,v=2*Math.sqrt(2-2*y),b=y<ac&&p&&d,w=m.x*f.y-m.y*f.x>0;if(b&&e>l){const t=u.dist(p);if(t>2*c){const e=u.sub(u.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,m,0,0,h),p=e}}const T=p&&d;let S=T?i:o?"butt":r;if(T&&"round"===S&&(x<n?S="miter":x<=2&&(S="fakeround")),"miter"===S&&x>s&&(S="bevel"),"bevel"===S&&(x>2&&(S="flipbevel"),x<s&&(S="miter")),p&&this.updateDistance(p,u),"miter"===S)_._mult(x),this.addCurrentVertex(u,_,0,0,h);else if("flipbevel"===S){if(x>100)_=f.mult(-1);else{const t=x*m.add(f).mag()/m.sub(f).mag();_._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(u,_,0,0,h),this.addCurrentVertex(u,_.mult(-1),0,0,h)}else if("bevel"===S||"fakeround"===S){const t=-Math.sqrt(x*x-1),e=w?t:0,i=w?0:t;if(p&&this.addCurrentVertex(u,m,e,i,h),"fakeround"===S){const t=Math.round(180*v/Math.PI/20);for(let e=1;e<t;e++){let i=e/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const r=f.sub(m)._mult(i)._add(m)._unit()._mult(w?-1:1);this.addHalfVertex(u,r.x,r.y,!1,w,0,h)}}d&&this.addCurrentVertex(u,f,-e,-i,h)}else if("butt"===S)this.addCurrentVertex(u,_,0,0,h);else if("square"===S){const t=p?1:-1;this.addCurrentVertex(u,_,t,t,h)}else"round"===S&&(p&&(this.addCurrentVertex(u,m,0,0,h),this.addCurrentVertex(u,m,1,1,h,!0)),d&&(this.addCurrentVertex(u,f,-1,-1,h,!0),this.addCurrentVertex(u,f,0,0,h)));if(b&&e<a-1){const t=u.dist(d);if(t>2*c){const e=u.add(d.sub(u)._mult(c/t)._round());this.updateDistance(u,e),this.addCurrentVertex(e,f,0,0,h),u=e}}}}addCurrentVertex(t,e,i,r,s,n=!1){const o=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,n,!1,i,s),this.addHalfVertex(t,o,a,n,!0,-r,s),this.distance>lc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,s,n))}addHalfVertex({x:t,y:e},i,r,s,n,o,a){const l=.5*(this.lineClips?this.scaledDistance*(lc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(s?1:0),(e<<1)+(n?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),n?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}}let hc,uc;xs("LineBucket",cc,{omit:["layers","patternFeatures"]});var pc={get paint(){return uc=uc||new In({"line-opacity":new bn(G.paint_line["line-opacity"]),"line-color":new bn(G.paint_line["line-color"]),"line-translate":new vn(G.paint_line["line-translate"]),"line-translate-anchor":new vn(G.paint_line["line-translate-anchor"]),"line-width":new bn(G.paint_line["line-width"]),"line-gap-width":new bn(G.paint_line["line-gap-width"]),"line-offset":new bn(G.paint_line["line-offset"]),"line-blur":new bn(G.paint_line["line-blur"]),"line-dasharray":new Tn(G.paint_line["line-dasharray"]),"line-pattern":new wn(G.paint_line["line-pattern"]),"line-gradient":new Sn(G.paint_line["line-gradient"])})},get layout(){return hc=hc||new In({"line-cap":new vn(G.layout_line["line-cap"]),"line-join":new bn(G.layout_line["line-join"]),"line-miter-limit":new vn(G.layout_line["line-miter-limit"]),"line-round-limit":new vn(G.layout_line["line-round-limit"]),"line-sort-key":new bn(G.layout_line["line-sort-key"])})}};class dc extends bn{possiblyEvaluate(t,e){return e=new un(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=g({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let mc;class fc extends Pn{constructor(t){super(t,pc),this.gradientVersion=0,mc||(mc=new dc(pc.paint.properties["line-width"].specification),mc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof Te,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=mc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new cc(t)}queryRadius(t){const e=t,i=_c(ba("line-width",this,e),ba("line-gap-width",this,e)),r=ba("line-offset",this,e);return i/2+Math.abs(r)+wa(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,r,s,o,a){const l=Ta(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),c=a/2*_c(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),h=this.paint.get("line-offset").evaluate(e,i);return h&&(r=function(t,e){const i=[];for(let r=0;r<t.length;r++){const s=t[r],o=[];for(let t=0;t<s.length;t++){const i=s[t-1],r=s[t],a=s[t+1],l=0===t?new n(0,0):r.sub(i)._unit()._perp(),c=t===s.length-1?new n(0,0):a.sub(r)._unit()._perp(),h=l._add(c)._unit(),u=h.x*c.x+h.y*c.y;0!==u&&h._mult(1/u),o.push(h._mult(e)._add(r))}i.push(o)}return i}(r,h*a)),function(t,e,i){for(let r=0;r<e.length;r++){const s=e[r];if(t.length>=3)for(let e=0;e<s.length;e++)if(xa(t,s[e]))return!0;if(da(t,s,i))return!0}return!1}(l,r,c)}isTileClipped(){return!0}}function _c(t,e){return e>0?e+2*t:t}const gc=zn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),yc=zn([{name:"a_projected_pos",components:3,type:"Float32"}],4);zn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const xc=zn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);zn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const vc=zn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bc=zn([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wc(t,e,i){return t.sections.forEach(t=>{t.text=function(t,e,i){const r=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),hn.applyArabicShaping&&(t=hn.applyArabicShaping(t)),t}(t.text,e,i)}),t}zn([{name:"triangle",components:3,type:"Uint16"}]),zn([{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"}]),zn([{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"}]),zn([{type:"Float32",name:"offsetX"}]),zn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),zn([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Tc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Sc=24,Ic=Cc,Ac=function(t,e,i,r,s){var n,o,a=8*s-r-1,l=(1<<a)-1,c=l>>1,h=-7,u=i?s-1:0,p=i?-1:1,d=t[e+u];for(u+=p,n=d&(1<<-h)-1,d>>=-h,h+=a;h>0;n=256*n+t[e+u],u+=p,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=r;h>0;o=256*o+t[e+u],u+=p,h-=8);if(0===n)n=1-c;else{if(n===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),n-=c}return(d?-1:1)*o*Math.pow(2,n-r)},Pc=function(t,e,i,r,s,n){var o,a,l,c=8*n-s-1,h=(1<<c)-1,u=h>>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:n-1,m=r?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?p/l:p*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*l-1)*Math.pow(2,s),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;t[i+d]=255&a,d+=m,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;t[i+d]=255&o,d+=m,o/=256,c-=8);t[i+d-m]|=128*f};function Cc(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Cc.Varint=0,Cc.Fixed64=1,Cc.Bytes=2,Cc.Fixed32=5;var Mc=4294967296,kc=1/Mc,zc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function Ec(t){return t.type===Cc.Bytes?t.readVarint()+t.pos:t.pos+1}function Dc(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Lc(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var s=i.pos-1;s>=t;s--)i.buf[s+r]=i.buf[s]}function Rc(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function Bc(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function Fc(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Oc(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function Vc(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function Uc(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Nc(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function jc(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function $c(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function qc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Zc(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Gc(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Cc.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),s=r>>3,n=this.pos;this.type=7&r,t(s,e,this),this.pos===n&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=qc(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Gc(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=qc(this.buf,this.pos)+qc(this.buf,this.pos+4)*Mc;return this.pos+=8,t},readSFixed64:function(){var t=qc(this.buf,this.pos)+Gc(this.buf,this.pos+4)*Mc;return this.pos+=8,t},readFloat:function(){var t=Ac(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ac(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,s,n=i.buf;if(r=(112&(s=n[i.pos++]))>>4,s<128)return Dc(t,r,e);if(r|=(127&(s=n[i.pos++]))<<3,s<128)return Dc(t,r,e);if(r|=(127&(s=n[i.pos++]))<<10,s<128)return Dc(t,r,e);if(r|=(127&(s=n[i.pos++]))<<17,s<128)return Dc(t,r,e);if(r|=(127&(s=n[i.pos++]))<<24,s<128)return Dc(t,r,e);if(r|=(1&(s=n[i.pos++]))<<31,s<128)return Dc(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&zc?function(t,e,i){return zc.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var r="",s=e;s<i;){var n,o,a,l=t[s],c=null,h=l>239?4:l>223?3:l>191?2:1;if(s+h>i)break;
vendor: 4,207 bytes, line 2
21===h?l<128&&(c=l):2===h?128==(192&(n=t[s+1]))&&(c=(31&l)<<6|63&n)<=127&&(c=null):3===h?(o=t[s+2],128==(192&(n=t[s+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&n)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===h&&(o=t[s+2],a=t[s+3],128==(192&(n=t[s+1]))&&128==(192&o)&&128==(192&a)&&((c=(15&l)<<18|(63&n)<<12|(63&o)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,h=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),s+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Cc.Bytes)return t.push(this.readVarint(e));var i=Ec(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Cc.Bytes)return t.push(this.readSVarint());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Cc.Bytes)return t.push(this.readBoolean());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Cc.Bytes)return t.push(this.readFloat());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Cc.Bytes)return t.push(this.readDouble());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Cc.Bytes)return t.push(this.readFixed32());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Cc.Bytes)return t.push(this.readSFixed32());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Cc.Bytes)return t.push(this.readFixed64());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Cc.Bytes)return t.push(this.readSFixed64());var e=Ec(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Cc.Varint)for(;this.buf[this.pos++]>127;);else if(e===Cc.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Cc.Fixed32)this.pos+=4;else{if(e!==Cc.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Zc(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Zc(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Zc(this.buf,-1&t,this.pos),Zc(this.buf,Math.floor(t*kc),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Zc(this.buf,-1&t,this.pos),Zc(this.buf,Math.floor(t*kc),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,r;if(t>=0?(i=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){var i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;
vendor: 16,609 bytes, line 2
2this.pos=function(t,e,i){for(var r,s,n=0;n<e.length;n++){if((r=e.charCodeAt(n))>55295&&r<57344){if(!s){r>56319||n+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=r;continue}if(r<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=r;continue}r=s-55296<<10|r-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=null);r<128?t[i++]=r:(r<2048?t[i++]=r>>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&Lc(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Pc(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Pc(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var r=this.pos-i;r>=128&&Lc(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,i){this.writeTag(t,Cc.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Rc,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Bc,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Vc,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Fc,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Oc,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Uc,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Nc,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,jc,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,$c,e)},writeBytesField:function(t,e){this.writeTag(t,Cc.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Cc.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Cc.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Cc.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Cc.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Cc.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Cc.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Cc.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Cc.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Cc.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Wc=i(Ic);function Hc(t,e,i){1===t&&i.readMessage(Xc,e)}function Xc(t,e,i){if(3===t){const{id:t,bitmap:r,width:s,height:n,left:o,top:a,advance:l}=i.readMessage(Jc,{});e.push({id:t,bitmap:new ja({width:s+6,height:n+6},r),metrics:{width:s,height:n,left:o,top:a,advance:l}})}}function Jc(t,e,i){1===t?e.id=i.readVarint():2===t?e.bitmap=i.readBytes():3===t?e.width=i.readVarint():4===t?e.height=i.readVarint():5===t?e.left=i.readSVarint():6===t?e.top=i.readSVarint():7===t&&(e.advance=i.readVarint())}function Kc(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort((t,e)=>e.h-t.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,n=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,n=Math.max(n,e.y+e.h),s=Math.max(s,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:s,h:n,fill:e/(s*n)||0}}class Yc{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:s,content:n,textFitWidth:o,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=s,this.content=n,this.version=i,this.textFitWidth=o,this.textFitHeight=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Qc{constructor(t,e){const i={},r={};this.haveRenderCallbacks=[];const s=[];this.addImages(t,i,s),this.addImages(e,r,s);const{w:n,h:o}=Kc(s),a=new $a({width:n||1,height:o||1});for(const e in t){const r=t[e],s=i[e].paddedRect;$a.copy(r.data,a,{x:0,y:0},{x:s.x+1,y:s.y+1},r.data)}for(const t in e){const i=e[t],s=r[t].paddedRect,n=s.x+1,o=s.y+1,l=i.data.width,c=i.data.height;$a.copy(i.data,a,{x:0,y:0},{x:n,y:o},i.data),$a.copy(i.data,a,{x:0,y:c-1},{x:n,y:o-1},{width:l,height:1}),$a.copy(i.data,a,{x:0,y:0},{x:n,y:o+c},{width:l,height:1}),$a.copy(i.data,a,{x:l-1,y:0},{x:n-1,y:o},{width:1,height:c}),$a.copy(i.data,a,{x:0,y:0},{x:n+l,y:o},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(const r in t){const s=t[r],n={x:0,y:0,w:s.data.width+2,h:s.data.height+2};i.push(n),e[r]=new Yc(n,s),s.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,s]=t.tl;i.update(e.data,void 0,{x:r,y:s})}}var th;xs("ImagePosition",Yc),xs("ImageAtlas",Qc),t.ah=void 0,(th=t.ah||(t.ah={}))[th.none=0]="none",th[th.horizontal=1]="horizontal",th[th.vertical=2]="vertical",th[th.horizontalOnly=3]="horizontalOnly";const eh=-17;class ih{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new ih;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new ih;return e.imageName=t,e}}class rh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new rh;for(let r=0;r<t.sections.length;r++){const s=t.sections[r];s.image?i.addImageSection(s):i.addTextSection(s,e)}return i}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i+1)||null,s=t.charCodeAt(i-1)||null;e+=r&&nn(r)&&!Tc[t[i+1]]||s&&nn(s)&&!Tc[t[i-1]]||!Tc[t[i]]?t[i]:Tc[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&nh[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&nh[this.text.charCodeAt(i)];i--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const i=new rh;return i.text=this.text.substring(t,e),i.sectionIndex=this.sectionIndex.slice(t,e),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,e)=>Math.max(t,this.sections[e].scale),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(ih.forText(t.scale,t.fontStack||e));const i=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(i)}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void T("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(ih.forImage(e)),this.sectionIndex.push(this.sections.length-1)):T("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sh(e,i,r,s,n,o,a,l,c,h,u,p,d,m,f){const _=rh.fromFeature(e,n);let g;p===t.ah.vertical&&_.verticalizePunctuation();const{processBidirectionalText:y,processStyledBidirectionalText:x}=hn;if(y&&1===_.sections.length){g=[];const t=y(_.toString(),dh(_,h,o,i,s,m));for(const e of t){const t=new rh;t.text=e,t.sections=_.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);g.push(t)}}else if(x){g=[];const t=x(_.text,_.sectionIndex,dh(_,h,o,i,s,m));for(const e of t){const t=new rh;t.text=e[0],t.sectionIndex=e[1],t.sections=_.sections,g.push(t)}}else g=function(t,e){const i=[],r=t.text;let s=0;for(const r of e)i.push(t.substring(s,r)),s=r;return s<r.length&&i.push(t.substring(s,r.length)),i}(_,dh(_,h,o,i,s,m));const v=[],b={positionedLines:v,text:_.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,i,r,s,n,o,a,l,c,h,u,p){let d=0,m=eh,f=0,_=0;const g="right"===l?1:"left"===l?0:.5;let y=0;for(const a of n){a.trim();const n=a.getMaxScale(),l=(n-1)*Sc,v={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){m+=o,++y;continue}for(let o=0;o<a.length();o++){const f=a.getSection(o),_=a.getSectionIndex(o),g=a.getCharCode(o);let y=0,v=null,T=null,S=null,I=Sc;const A=!(c===t.ah.horizontal||!u&&!sn(g)||u&&(nh[g]||(x=g,/\p{sc=Arab}/u.test(String.fromCodePoint(x)))));if(f.imageName){const t=s[f.imageName];if(!t)continue;S=f.imageName,e.iconsInText=e.iconsInText||!0,T=t.paddedRect;const i=t.displaySize;f.scale=f.scale*Sc/p,v={width:i[0],height:i[1],left:1,top:-3,advance:A?i[1]:i[0]},y=l+(Sc-i[1]*f.scale),I=v.advance;const r=A?i[0]*f.scale-Sc*n:i[1]*f.scale-Sc*n;r>0&&r>w&&(w=r)}else{const t=r[f.fontStack],e=t&&t[g];if(e&&e.rect)T=e.rect,v=e.metrics;else{const t=i[f.fontStack],e=t&&t[g];if(!e)continue;v=e.metrics}y=(n-f.scale)*Sc}A?(e.verticalizable=!0,b.push({glyph:g,imageName:S,x:d,y:m+y,vertical:A,scale:f.scale,fontStack:f.fontStack,sectionIndex:_,metrics:v,rect:T}),d+=I*f.scale+h):(b.push({glyph:g,imageName:S,x:d,y:m+y,vertical:A,scale:f.scale,fontStack:f.fontStack,sectionIndex:_,metrics:v,rect:T}),d+=v.advance*f.scale+h)}0!==b.length&&(f=Math.max(d-h,f),fh(b,0,b.length-1,g,w)),d=0;const T=o*n+w;v.lineOffset=Math.max(w,l),m+=T,_=Math.max(T,_),++y}var x;const v=m-eh,{horizontalAlign:b,verticalAlign:w}=mh(a);(function(t,e,i,r,s,n,o,a,l){const c=(e-i)*s;let h=0;h=n!==o?-a*r-eh:(-r*l+.5)*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=h})(e.positionedLines,g,b,w,f,_,o,v,n.length),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*f,e.right=e.left+f}(b,i,r,s,g,a,l,c,p,h,d,f),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(v)&&b}const nh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},oh={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},ah={40:!0};function lh(t,e,i,r,s,n){if(e.imageName){const t=r[e.imageName];return t?t.displaySize[0]*e.scale*Sc/n+s:0}{const r=i[e.fontStack],n=r&&r[t];return n?n.metrics.advance*e.scale+s:0}}function ch(t,e,i,r){const s=Math.pow(t-e,2);return r?t<e?s/2:2*s:s+Math.abs(i)*i}function hh(t,e,i){let r=0;return 10===t&&(r-=1e4),i&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function uh(t,e,i,r,s,n){let o=null,a=ch(e,i,s,n);for(const t of r){const r=ch(e-t.x,i,s,n)+t.badness;r<=a&&(o=t,a=r)}return{index:t,x:e,priorBreak:o,badness:a}}function ph(t){return t?ph(t.priorBreak).concat(t.index):[]}function dh(t,e,i,r,s,n){if(!t)return[];const o=[],a=function(t,e,i,r,s,n){let o=0;for(let i=0;i<t.length();i++){const a=t.getSection(i);o+=lh(t.getCharCode(i),a,r,s,e,n)}return o/Math.max(1,Math.ceil(o/i))}(t,e,i,r,s,n),l=t.text.indexOf("​")>=0;let c=0;for(let i=0;i<t.length();i++){const u=t.getSection(i),p=t.getCharCode(i);if(nh[p]||(c+=lh(p,u,r,s,e,n)),i<t.length()-1){const e=!((h=p)<11904)&&(!!Hs(h)||!!qs(h)||!!js(h)||!!Vs(h)||!!$s(h)||!!Js(h)||!!Os(h)||!!Ws(h)||rn.test(String.fromCodePoint(h)));(oh[p]||e||u.imageName||i!==t.length()-2&&ah[t.getCharCode(i+1)])&&o.push(uh(i+1,c,a,o,hh(p,t.getCharCode(i+1),e&&l),!1))}}var h;return ph(uh(t.length(),c,a,o,0,!0))}function mh(t){let e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function fh(t,e,i,r,s){if(!r&&!s)return;const n=t[i],o=(t[i].x+n.metrics.advance*n.scale)*r;for(let r=e;r<=i;r++)t[r].x-=o,t[r].y+=s}function _h(t,e,i){const{horizontalAlign:r,verticalAlign:s}=mh(i),n=e[0]-t.displaySize[0]*r,o=e[1]-t.displaySize[1]*s;return{image:t,top:o,bottom:o+t.displaySize[1],left:n,right:n+t.displaySize[0]}}function gh(t){var e,i;let r=t.left,s=t.top,n=t.right-r,o=t.bottom-s;const a=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(i=t.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===a&&n/o<c||"proportional"===a){const t=Math.ceil(o*c);r*=t/n,n=t}}else if("proportional"===a&&"stretchOnly"===l&&0!==c&&n/o>c){const t=Math.ceil(n/c);s*=t/o,o=t}return{x1:r,y1:s,x2:r+n,y2:s+o}}function yh(t,e,i,r,s,n){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e]}const l=e.left*n,c=e.right*n;let h,u,p,d;"width"===i||"both"===i?(d=s[0]+l-r[3],u=s[0]+c+r[1]):(d=s[0]+(l+c-o.displaySize[0])/2,u=d+o.displaySize[0]);const m=e.top*n,f=e.bottom*n;return"height"===i||"both"===i?(h=s[1]+m-r[0],p=s[1]+f+r[2]):(h=s[1]+(m+f-o.displaySize[1])/2,p=h+o.displaySize[1]),{image:o,top:h,right:u,bottom:p,left:d,collisionPadding:a}}const xh=128,vh=32640;function bh(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new un(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:r}=i;let s=0;for(;s<e.length&&e[s]<=t;)s++;s=Math.max(0,s-1);let n=s;for(;n<e.length&&e[n]<t+1;)n++;n=Math.min(e.length-1,n);const o=e[s],a=e[n];return"composite"===i.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:a,minSize:i.evaluate(new un(o)),maxSize:i.evaluate(new un(a)),interpolationType:r}}}function wh(t,e,i){let r="never";const s=t.get(e);return s?r=s:t.get(i)&&(r="always"),r}const Th=Dl.VectorTileFeature.types,Sh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ih(t,e,i,r,s,n,o,a,l,c,h,u,p){const d=a?Math.min(vh,Math.round(a[0])):0,m=a?Math.min(vh,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*s),n,o,(d<<1)+(l?1:0),m,16*c,16*h,256*u,256*p)}function Ah(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Ph(t){for(const e of t.sections)if(cn(e.text))return!0;return!1}class Ch{constructor(t){this.layoutVertexArray=new wo,this.indexArray=new Po,this.programConfigurations=t,this.segments=new zo,this.dynamicLayoutVertexArray=new To,this.opacityVertexArray=new So,this.hasVisibleVertices=!1,this.placedSymbolArray=new no}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,yc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Sh,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}xs("SymbolBuffers",Ch);class Mh{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new zo,this.collisionVertexArray=new Ao}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,xc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}xs("CollisionBuffers",Mh);class kh{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>
2t.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ma([]),this.placementViewportMatrix=Ma([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bh(this.zoom,i["text-size"]),this.iconSizeData=bh(this.zoom,i["icon-size"]);const r=this.layers[0].layout,s=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap="never"!==wh(r,"text-overlap","text-allow-overlap")||"never"!==wh(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&!s.isConstant(),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(e=>t.ah[e])),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ch(new ta(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Ch(new ta(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new lo,this.lineVertexArray=new co,this.symbolInstances=new ao,this.textAnchorOffsets=new uo}calculateGlyphDependencies(t,e,i,r,s){for(let n=0;n<t.length;n++)if(e[t.charCodeAt(n)]=!0,(i||r)&&s){const i=Tc[t.charAt(n)];
vendor: 52,851 bytes, line 2
2i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,r){const s=this.layers[0],n=s.layout,o=n.get("text-font"),a=n.get("text-field"),l=n.get("icon-image"),c=("constant"!==a.value.kind||a.value.value instanceof Jt&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),h="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,u=n.get("symbol-sort-key");if(this.features=[],!c&&!h)return;const p=i.iconDependencies,d=i.glyphDependencies,m=i.availableImages,f=new un(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:_}of e){const e=s._featureFilter.needGeometry,g=aa(i,e);if(!s._featureFilter.filter(f,g,r))continue;let y,x;if(e||(g.geometry=oa(i)),c){const t=s.getValueAndResolveTokens("text-field",g,r,m),e=Jt.factory(t),i=this.hasRTLText=this.hasRTLText||Ph(e);(!i||"unavailable"===hn.getRTLTextPluginStatus()||i&&hn.isParsed())&&(y=wc(e,s,g))}if(h){const t=s.getValueAndResolveTokens("icon-image",g,r,m);x=t instanceof te?t:te.fromString(t)}if(!y&&!x)continue;const v=this.sortFeaturesByKey?u.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:y,icon:x,index:l,sourceLayerIndex:_,geometry:g.geometry,properties:i.properties,type:Th[i.type],sortKey:v}),x&&(p[x.name]=!0),y){const e=o.evaluate(g,{},r).join(","),i="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ah.vertical)>=0;for(const t of y.sections)if(t.image)p[t.image.name]=!0;else{const r=Ks(y.toString()),s=t.fontStack||e,n=d[s]=d[s]||{};this.calculateGlyphDependencies(t.text,n,i,this.allowVerticalPlacement,r)}}}"line"===n.get("symbol-placement")&&(this.features=function(t){const e={},i={},r=[];let s=0;function n(e){r.push(t[e]),s++}function o(t,e,s){const n=i[t];return delete i[t],i[e]=n,r[n].geometry[0].pop(),r[n].geometry[0]=r[n].geometry[0].concat(s[0]),n}function a(t,i,s){const n=e[i];return delete e[i],e[t]=n,r[n].geometry[0].shift(),r[n].geometry[0]=s[0].concat(r[n].geometry[0]),n}function l(t,e,i){const r=i?e[0][e[0].length-1]:e[0][0];return`${t}:${r.x}:${r.y}`}for(let c=0;c<t.length;c++){const h=t[c],u=h.geometry,p=h.text?h.text.toString():null;if(!p){n(c);continue}const d=l(p,u),m=l(p,u,!0);if(d in i&&m in e&&i[d]!==e[m]){const t=a(d,m,u),s=o(d,m,r[t].geometry);delete e[d],delete i[m],i[l(p,r[s].geometry,!0)]=s,r[t].geometry=null}else d in i?o(d,m,u):m in e?a(d,m,u):(n(c),e[d]=s-1,i[m]=s-1)}return r.filter(t=>t.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((t,e)=>t.sortKey-e.sortKey)}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,i),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,i))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,e){const i=this.lineVertexArray.length;if(void 0!==t.segment){let i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const s={};for(let r=t.segment+1;r<e.length;r++)s[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:i},r<e.length-1&&(i+=e[r+1].dist(e[r]));for(let i=t.segment||0;i>=0;i--)s[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=s[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,r,s,n,o,a,l,c,h,u,p){const d=e.indexArray,m=e.layoutVertexArray,f=e.segments.prepareSegment(4*i.length,m,d,this.canOverlap?o.sortKey:void 0),_=this.glyphOffsetArray.length,g=f.vertexLength,y=this.allowVerticalPlacement&&a===t.ah.vertical?Math.PI/2:0,x=o.text&&o.text.sections;for(let t=0;t<i.length;t++){const{tl:s,tr:n,bl:a,br:c,tex:h,pixelOffsetTL:u,pixelOffsetBR:_,minFontScaleX:g,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:T}=i[t],S=f.vertexLength,I=b[1];Ih(m,l.x,l.y,s.x,I+s.y,h.x,h.y,r,w,u.x,u.y,g,v),Ih(m,l.x,l.y,n.x,I+n.y,h.x+h.w,h.y,r,w,_.x,u.y,g,v),Ih(m,l.x,l.y,a.x,I+a.y,h.x,h.y+h.h,r,w,u.x,_.y,g,v),Ih(m,l.x,l.y,c.x,I+c.y,h.x+h.w,h.y+h.h,r,w,_.x,_.y,g,v),Ah(e.dynamicLayoutVertexArray,l,y),d.emplaceBack(S,S+1,S+2),d.emplaceBack(S+1,S+2,S+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&T===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(m.length,o,o.index,{},p,x&&x[T])}e.placedSymbolArray.emplaceBack(l.x,l.y,_,this.glyphOffsetArray.length-_,g,c,h,l.segment,r?r[0]:0,r?r[1]:0,s[0],s[1],a,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,s,n){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,s,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(t,e,i,r,s,o,a){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),c=l.vertexLength,h=s.layoutVertexArray,u=s.collisionVertexArray,p=a.anchorX,d=a.anchorY;this._addCollisionDebugVertex(h,u,o,p,d,new n(t,e)),this._addCollisionDebugVertex(h,u,o,p,d,new n(i,e)),this._addCollisionDebugVertex(h,u,o,p,d,new n(i,r)),this._addCollisionDebugVertex(h,u,o,p,d,new n(t,r)),l.vertexLength+=4;const m=s.indexArray;m.emplaceBack(c,c+1),m.emplaceBack(c+1,c+2),m.emplaceBack(c+2,c+3),m.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let s=t;s<e;s++){const t=this.collisionBoxArray.get(s);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Mh(Io,vc.members,Co),this.iconCollisionBox=new Mh(Io,vc.members,Co);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,s,n,o,a,l){const c={};for(let r=e;r<i;r++){const e=t.get(r);c.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},c.textFeatureIndex=e.featureIndex;break}for(let e=r;e<s;e++){const i=t.get(e);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let e=n;e<o;e++){const i=t.get(e);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let e=a;e<l;e++){const i=t.get(e);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),i=Math.cos(t),r=[],s=[],n=[];for(let t=0;t<this.symbolInstances.length;++t){n.push(t);const o=this.symbolInstances.get(t);r.push(0|Math.round(e*o.anchorX+i*o.anchorY)),s.push(o.featureIndex)}return n.sort((t,e)=>r[t]-r[e]||s[e]-s[t]),n}addToSortKeyRanges(t,e){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach((t,e,i)=>{t>=0&&i.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let zh,Eh;xs("SymbolBucket",kh,{omit:["layers","collisionBoxArray","features","compareText"]}),kh.MAX_GLYPHS=65535,kh.addDynamicAttributes=Ah;var Dh={get paint(){return Eh=Eh||new In({"icon-opacity":new bn(G.paint_symbol["icon-opacity"]),"icon-color":new bn(G.paint_symbol["icon-color"]),"icon-halo-color":new bn(G.paint_symbol["icon-halo-color"]),"icon-halo-width":new bn(G.paint_symbol["icon-halo-width"]),"icon-halo-blur":new bn(G.paint_symbol["icon-halo-blur"]),"icon-translate":new vn(G.paint_symbol["icon-translate"]),"icon-translate-anchor":new vn(G.paint_symbol["icon-translate-anchor"]),"text-opacity":new bn(G.paint_symbol["text-opacity"]),"text-color":new bn(G.paint_symbol["text-color"],{runtimeType:pt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new bn(G.paint_symbol["text-halo-color"]),"text-halo-width":new bn(G.paint_symbol["text-halo-width"]),"text-halo-blur":new bn(G.paint_symbol["text-halo-blur"]),"text-translate":new vn(G.paint_symbol["text-translate"]),"text-translate-anchor":new vn(G.paint_symbol["text-translate-anchor"])})},get layout(){return zh=zh||new In({"symbol-placement":new vn(G.layout_symbol["symbol-placement"]),"symbol-spacing":new vn(G.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new vn(G.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new bn(G.layout_symbol["symbol-sort-key"]),"symbol-z-order":new vn(G.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new vn(G.layout_symbol["icon-allow-overlap"]),"icon-overlap":new vn(G.layout_symbol["icon-overlap"]),"icon-ignore-placement":new vn(G.layout_symbol["icon-ignore-placement"]),"icon-optional":new vn(G.layout_symbol["icon-optional"]),"icon-rotation-alignment":new vn(G.layout_symbol["icon-rotation-alignment"]),"icon-size":new bn(G.layout_symbol["icon-size"]),"icon-text-fit":new vn(G.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new vn(G.layout_symbol["icon-text-fit-padding"]),"icon-image":new bn(G.layout_symbol["icon-image"]),"icon-rotate":new bn(G.layout_symbol["icon-rotate"]),"icon-padding":new bn(G.layout_symbol["icon-padding"]),"icon-keep-upright":new vn(G.layout_symbol["icon-keep-upright"]),"icon-offset":new bn(G.layout_symbol["icon-offset"]),"icon-anchor":new bn(G.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new vn(G.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new vn(G.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new vn(G.layout_symbol["text-rotation-alignment"]),"text-field":new bn(G.layout_symbol["text-field"]),"text-font":new bn(G.layout_symbol["text-font"]),"text-size":new bn(G.layout_symbol["text-size"]),"text-max-width":new bn(G.layout_symbol["text-max-width"]),"text-line-height":new vn(G.layout_symbol["text-line-height"]),"text-letter-spacing":new bn(G.layout_symbol["text-letter-spacing"]),"text-justify":new bn(G.layout_symbol["text-justify"]),"text-radial-offset":new bn(G.layout_symbol["text-radial-offset"]),"text-variable-anchor":new vn(G.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new bn(G.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new bn(G.layout_symbol["text-anchor"]),"text-max-angle":new vn(G.layout_symbol["text-max-angle"]),"text-writing-mode":new vn(G.layout_symbol["text-writing-mode"]),"text-rotate":new bn(G.layout_symbol["text-rotate"]),"text-padding":new vn(G.layout_symbol["text-padding"]),"text-keep-upright":new vn(G.layout_symbol["text-keep-upright"]),"text-transform":new bn(G.layout_symbol["text-transform"]),"text-offset":new bn(G.layout_symbol["text-offset"]),"text-allow-overlap":new vn(G.layout_symbol["text-allow-overlap"]),"text-overlap":new vn(G.layout_symbol["text-overlap"]),"text-ignore-placement":new vn(G.layout_symbol["text-ignore-placement"]),"text-optional":new vn(G.layout_symbol["text-optional"])})}};class Lh{constructor(t){if(void 0===t.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:lt,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}xs("FormatSectionOverride",Lh,{omit:["defaultValue"]});class Rh extends Pn{constructor(t){super(t,Dh)}recalculate(t,e){if(super.recalculate(t,e),"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")){const t=this.layout.get("text-writing-mode");if(t){const e=[];for(const i of t)e.indexOf(i)<0&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){const s=this.layout.get(t).evaluate(e,{},i,r),n=this._unevaluatedLayout._values[t];return n.isDataDriven()||gr(n.value)||!s?s:function(t,e){return e.replace(/{([^{}]+)}/g,(e,i)=>t&&i in t?String(t[i]):"")}(e.properties,s)}createBucket(t){return new kh(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Dh.paint.overridableProperties){if(!Rh.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Lh(e),r=new _r(i,e.property.specification);let s=null;s="constant"===e.value.kind||"source"===e.value.kind?new xr("source",r):new vr("composite",r,e.value.zoomStops),this.paint._values[t]=new yn(e.property,s,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Rh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),r=Dh.paint.properties[e];let s=!1;const n=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(s=!0)};if("constant"===i.value.kind&&i.value.value instanceof Jt)n(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{s||(e instanceof ne&&re(e.value)===_t?n(e.value.sections):e instanceof qe?n(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return s}}let Bh;var Fh={get paint(){return Bh=Bh||new In({"background-color":new vn(G.paint_background["background-color"]),"background-pattern":new Tn(G.paint_background["background-pattern"]),"background-opacity":new vn(G.paint_background["background-opacity"])})}};class Oh extends Pn{constructor(t){super(t,Fh)}}let Vh;var Uh={get paint(){return Vh=Vh||new In({"raster-opacity":new vn(G.paint_raster["raster-opacity"]),"raster-hue-rotate":new vn(G.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new vn(G.paint_raster["raster-brightness-min"]),"raster-brightness-max":new vn(G.paint_raster["raster-brightness-max"]),"raster-saturation":new vn(G.paint_raster["raster-saturation"]),"raster-contrast":new vn(G.paint_raster["raster-contrast"]),"raster-resampling":new vn(G.paint_raster["raster-resampling"]),"raster-fade-duration":new vn(G.paint_raster["raster-fade-duration"])})}};class Nh extends Pn{constructor(t){super(t,Uh)}}class jh extends Pn{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)},this.implementation=t}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class $h{constructor(t){this._methodToThrottle=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const qh=6371008.8;class Zh{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zh(_(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,i=this.lat*e,r=t.lat*e,s=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return qh*Math.acos(Math.min(s,1))}static convert(t){if(t instanceof Zh)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Zh(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Zh(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Gh=2*Math.PI*qh;function Wh(t){return Gh*Math.cos(t*Math.PI/180)}function Hh(t){return(180+t)/360}function Xh(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Jh(t,e){return t/Wh(e)}function Kh(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class Yh{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Zh.convert(t);return new Yh(Hh(i.lng),Xh(i.lat),Jh(e,i.lat))}toLngLat(){return new Zh(360*this.x-180,Kh(this.y))}toAltitude(){return this.z*Wh(Kh(this.y))}meterInMercatorCoordinateUnits(){return 1/Gh*(t=Kh(this.y),1/Math.cos(t*Math.PI/180));var t}}function Qh(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class tu{constructor(t,e,i){if(!function(t,e,i){return!(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,i))throw new Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=ru(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){const r=(n=this.y,o=this.z,a=Qh(256*(s=this.x),256*(n=Math.pow(2,o)-n-1),o),l=Qh(256*(s+1),256*(n+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var s,n,o,a,l;const c=function(t,e,i){let r,s="";for(let n=t;n>0;n--)r=1<<n-1,s+=(e&r?1:0)+(i&r?2:0);return s}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*ra,(t.y*e-this.y)*ra)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eu{constructor(t,e){this.wrap=t,this.canonical=e,this.key=ru(t,e.z,e.z,e.x,e.y)}}class iu{constructor(t,e,i,r,s){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new tu(i,+r,+s),this.key=ru(e,t,i,r,s)}clone(){return new iu(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new iu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new iu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-t;return t>this.canonical.z?ru(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):ru(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new iu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new iu(e,this.wrap,e,i,r),new iu(e,this.wrap,e,i+1,r),new iu(e,this.wrap,e,i,r+1),new iu(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new iu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new iu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new eu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Yh(t.x-this.wrap,t.y))}}function ru(t,e,i,r,s){(t*=2)<0&&(t=-1*t-1);const n=1<<i;return(n*n*t+n*s+r).toString(36)+i.toString(36)+e.toString(36)}xs("CanonicalTileID",tu),xs("OverscaledTileID",iu,{omit:["posMatrix"]});class su{constructor(t,e,i,r=1,s=1,n=1,o=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void T(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=s,this.blueFactor=n,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let t=0;t<a;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(a,t)]=this.data[this._idx(a-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,a)]=this.data[this._idx(t,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<a;t++)for(let e=0;e<a;e++){const i=this.get(t,e);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(t,e){const i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new $a({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,s=e*this.dim+this.dim,n=i*this.dim,o=i*this.dim+this.dim;switch(e){case-1:r=s-1;break;case 1:s=r+1}switch(i){case-1:n=o-1;break;case 1:o=n+1}const a=-e*this.dim,l=-i*this.dim;for(let e=n;e<o;e++)for(let i=r;i<s;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+a,e+l)]}}xs("DEMData",su);class nu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class ou{constructor(t,e,i,r,s){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=r,this.properties=t.properties,this.id=s}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t}}class au{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new gs(ra,16,0),this.grid3D=new gs(ra,16,0),this.featureIndexArray=new mo,this.promoteId=e}insert(t,e,i,r,s,n){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,s);const a=n?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y)}r[0]<ra&&r[1]<ra&&r[2]>=0&&r[3]>=0&&a.insert(o,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Dl.VectorTile(new Wc(this.rawTileData)).layers,this.sourceLayerCoder=new nu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();const s=t.params||{},o=ra/t.tileSize/t.scale,a=Ar(s.filter),l=t.queryGeometry,c=t.queryPadding*o,h=cu(l),u=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),p=cu(t.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,(e,i,r,s)=>function(t,e,i,r,s){for(const n of t)if(e<=n.x&&i<=n.y&&r>=n.x&&s>=n.y)return!0;const o=[new n(e,i),new n(e,s),new n(r,s),new n(r,i)];if(t.length>2)for(const e of o)if(xa(t,e))return!0;for(let e=0;e<t.length-1;e++)if(va(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-c,i-c,r+c,s+c));for(const t of d)u.push(t);u.sort(hu);const m={};let f;for(let n=0;n<u.length;n++){const c=u[n];if(c===f)continue;f=c;const h=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,a,s.layers,s.availableImages,e,i,r,(e,i,r)=>(p||(p=oa(e)),i.queryIntersectsFeature(l,e,r,p,this.z,t.transform,o,t.pixelPosMatrix)))}return m}loadMatchingFeature(t,e,i,r,s,n,o,a,l,c,h){const u=this.bucketLayerIDs[e];if(n&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(n,u))return;const p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(s.needGeometry){const t=aa(d,!0);if(!s.filter(new un(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!s.filter(new un(this.tileID.overscaledZ),d))return;const m=this.getId(d,p);for(let e=0;e<u.length;e++){const i=u[e];if(n&&n.indexOf(i)<0)continue;const s=a[i];if(!s)continue;let p={};m&&c&&(p=c.getState(s.sourceLayer||"_geojsonTileLayer",m));const f=g({},l[i]);f.paint=lu(f.paint,s.paint,d,p,o),f.layout=lu(f.layout,s.layout,d,p,o);const _=!h||h(d,s,p);if(!_)continue;const y=new ou(d,this.z,this.x,this.y,m);y.layer=f;let x=t[i];void 0===x&&(x=t[i]=[]),x.push({featureIndex:r,feature:y,intersectionZ:_})}}lookupSymbolFeatures(t,e,i,r,s,n,o,a){const l={};this.loadVTLayers();const c=Ar(s);for(const s of t)this.loadMatchingFeature(l,i,r,s,c,n,o,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const i of e)if(t===i)return!0;return!1}getId(t,e){let i=t.id;return this.promoteId&&(i=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof i&&(i=Number(i))),i}}function lu(t,e,i,r,s){return x(t,(t,n)=>{const o=e instanceof xn?e.get(n):null;return o&&o.evaluate?o.evaluate(i,r,s):o})}function cu(t){let e=1/0,i=1/0,r=-1/0,s=-1/0;for(const n of t)e=Math.min(e,n.x),i=Math.min(i,n.y),r=Math.max(r,n.x),s=Math.max(s,n.y);return{minX:e,minY:i,maxX:r,maxY:s}}function hu(t,e){return e-t}function uu(t,e,i,r,s){const o=[];for(let a=0;a<t.length;a++){const l=t[a];let c;for(let t=0;t<l.length-1;t++){let a=l[t],h=l[t+1];a.x<e&&h.x<e||(a.x<e?a=new n(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x<e&&(h=new n(e,a.y+(e-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y<i&&h.y<i||(a.y<i?a=new n(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round():h.y<i&&(h=new n(a.x+(i-a.y)/(h.y-a.y)*(h.x-a.x),i)._round()),a.x>=r&&h.x>=r||(a.x>=r?a=new n(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round():h.x>=r&&(h=new n(r,a.y+(r-a.x)/(h.x-a.x)*(h.y-a.y))._round()),a.y>=s&&h.y>=s||(a.y>=s?a=new n(a.x+(s-a.y)/(h.y-a.y)*(h.x-a.x),s)._round():h.y>=s&&(h=new n(a.x+(s-a.y)/(h.y-a.y)*(h.x-a.x),s)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(h)))))}}return o}xs("FeatureIndex",au,{omit:["rawTileData","sourceLayerCoder"]});class pu extends n{constructor(t,e,i,r){super(t,e),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new pu(this.x,this.y,this.angle,this.segment)}}function du(t,e,i,r,s){if(void 0===e.segment||0===i)return!0;let n=e,o=e.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(n),n=t[o]}a+=t[o].dist(t[o+1]),o++;const l=[];let c=0;for(;a<i/2;){const e=t[o],i=t[o+1];if(!i)return!1;let n=t[o-1].angleTo(e)-e.angleTo(i);for(n=Math.abs((n+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:n}),c+=n;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>s)return!1;o++,a+=e.dist(i)}return!0}function mu(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function fu(t,e,i){return t?.6*e*i:0}function _u(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function gu(t,e,i,r,s,n){const o=fu(i,s,n),a=_u(i,r)*n;let l=0;const c=mu(t)/2;for(let i=0;i<t.length-1;i++){const r=t[i],s=t[i+1],n=r.dist(s);if(l+n>c){const h=(c-l)/n,u=Me.number(r.x,s.x,h),p=Me.number(r.y,s.y,h),d=new pu(u,p,s.angleTo(r),i);return d._round(),!o||du(t,d,a,o,e)?d:void 0}l+=n}}function yu(t,e,i,r,s,n,o,a,l){const c=fu(r,n,o),h=_u(r,s),u=h*o,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-u<e/4&&(e=u+e/4),xu(t,p?e/2*a%e:(h/2+2*n)*o*a%e,e,c,i,u,p,!1,l)}function xu(t,e,i,r,s,n,o,a,l){const c=n/2,h=mu(t);let u=0,p=e-i,d=[];for(let e=0;e<t.length-1;e++){const o=t[e],a=t[e+1],m=o.dist(a),f=a.angleTo(o);for(;p+i<u+m;){p+=i;const _=(p-u)/m,g=Me.number(o.x,a.x,_),y=Me.number(o.y,a.y,_);if(g>=0&&g<l&&y>=0&&y<l&&p-c>=0&&p+c<=h){const i=new pu(g,y,f,e);i._round(),r&&!du(t,i,n,r,s)||d.push(i)}}u+=m}return a||d.length||o||(d=xu(t,u/2,i,r,s,n,o,!0,l)),d}xs("Anchor",pu);function vu(t,e,i,r){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2,c=o.paddedRect.h-2;let h={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const u=o.stretchX||[[0,l]],p=o.stretchY||[[0,c]],d=(t,e)=>t+e[1]-e[0],m=u.reduce(d,0),f=p.reduce(d,0),_=l-m,g=c-f;let y=0,x=m,v=0,b=f,w=0,T=_,S=0,I=g;if(o.content&&r){const e=o.content,i=e[2]-e[0],r=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(h=gh(t)),y=bu(u,0,e[0]),v=bu(p,0,e[1]),x=bu(u,e[0],e[2]),b=bu(p,e[1],e[3]),w=e[0]-y,S=e[1]-v,T=i-x,I=r-b}const A=h.x1,P=h.y1,C=h.x2-A,M=h.y2-P,k=(t,r,s,l)=>{const c=Tu(t.stretch-y,x,C,A),h=Su(t.fixed-w,T,t.stretch,m),u=Tu(r.stretch-v,b,M,P),p=Su(r.fixed-S,I,r.stretch,f),d=Tu(s.stretch-y,x,C,A),_=Su(s.fixed-w,T,s.stretch,m),g=Tu(l.stretch-v,b,M,P),k=Su(l.fixed-S,I,l.stretch,f),z=new n(c,u),E=new n(d,u),D=new n(d,g),L=new n(c,g),R=new n(h/a,p/a),B=new n(_/a,k/a),F=e*Math.PI/180;if(F){const t=Math.sin(F),e=Math.cos(F),i=[e,-t,t,e];z._matMult(i),E._matMult(i),L._matMult(i),D._matMult(i)}const O=t.stretch+t.fixed,V=r.stretch+r.fixed;return{tl:z,tr:E,bl:L,br:D,tex:{x:o.paddedRect.x+1+O,y:o.paddedRect.y+1+V,w:s.stretch+s.fixed-O,h:l.stretch+l.fixed-V},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:B,minFontScaleX:T/a/C,minFontScaleY:I/a/M,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const t=wu(u,_,m),e=wu(p,g,f);for(let i=0;i<t.length-1;i++){const r=t[i],n=t[i+1];for(let t=0;t<e.length-1;t++)s.push(k(r,e[t],n,e[t+1]))}}else s.push(k({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return s}function bu(t,e,i){let r=0;for(const s of t)r+=Math.max(e,Math.min(i,s[1]))-Math.max(e,Math.min(i,s[0]));return r}function wu(t,e,i){const r=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return r.push({fixed:e+1,stretch:i}),r}function Tu(t,e,i,r){return t/e*i+r}function Su(t,e,i,r){return t-e*i/r}class Iu{constructor(t,e,i,r,s,o,a,l,c,h){var u;if(this.boxStartIndex=t.length,c){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(u=o.image)||void 0===u?void 0:u.content)&&(o.image.textFitWidth||o.image.textFitHeight)?gh(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*a-l[0],c.y2=c.y2*a+l[2],c.x1=c.x1*a-l[3],c.x2=c.x2*a+l[1];const p=o.collisionPadding;if(p&&(c.x1-=p[0]*a,c.y1-=p[1]*a,c.x2+=p[2]*a,c.y2+=p[3]*a),h){const t=new n(c.x1,c.y1),e=new n(c.x2,c.y1),i=new n(c.x1,c.y2),r=new n(c.x2,c.y2),s=h*Math.PI/180;t._rotate(s),e._rotate(s),i._rotate(s),r._rotate(s),c.x1=Math.min(t.x,e.x,i.x,r.x),c.x2=Math.max(t.x,e.x,i.x,r.x),c.y1=Math.min(t.y,e.y,i.y,r.y),c.y2=Math.max(t.y,e.y,i.y,r.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,i,r,s)}this.boxEndIndex=t.length}}class Au{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,r=e[t];for(;t>0;){const s=t-1>>1,n=e[s];if(i(r,n)>=0)break;e[t]=n,t=s}e[t]=r}_down(t){const{data:e,compare:i}=this,r=this.length>>1,s=e[t];for(;t<r;){let r=1+(t<<1);const n=r+1;if(n<this.length&&i(e[n],e[r])<0&&(r=n),i(e[r],s)>=0)break;e[t]=e[r],t=r}e[t]=s}}function Pu(t,e=1,i=!1){let r=1/0,s=1/0,o=-1/0,a=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<r)&&(r=e.x),(!t||e.y<s)&&(s=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>a)&&(a=e.y)}const c=Math.min(o-r,a-s);let h=c/2;const u=new Au([],Cu);if(0===c)return new n(r,s);for(let e=r;e<o;e+=c)for(let i=s;i<a;i+=c)u.push(new Mu(e+h,i+h,h,t));let p=function(t){let e=0,i=0,r=0;const s=t[0];for(let t=0,n=s.length,o=n-1;t<n;o=t++){const n=s[t],a=s[o],l=n.x*a.y-a.x*n.y;i+=(n.x+a.x)*l,r+=(n.y+a.y)*l,e+=3*l}return new Mu(i/e,r/e,0,t)}(t),d=u.length;for(;u.length;){const r=u.pop();(r.d>p.d||!p.d)&&(p=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,d)),r.max-p.d<=e||(h=r.h/2,u.push(new Mu(r.p.x-h,r.p.y-h,h,t)),u.push(new Mu(r.p.x+h,r.p.y-h,h,t)),u.push(new Mu(r.p.x-h,r.p.y+h,h,t)),u.push(new Mu(r.p.x+h,r.p.y+h,h,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${p.d}`)),p.p}function Cu(t,e){return e.max-t.max}function Mu(t,e,i,r){this.p=new n(t,e),this.h=i,this.d=function(t,e){let i=!1,r=1/0;for(let s=0;s<e.length;s++){const n=e[s];for(let e=0,s=n.length,o=s-1;e<s;o=e++){const s=n[e],a=n[o];s.y>t.y!=a.y>t.y&&t.x<(a.x-s.x)*(t.y-s.y)/(a.y-s.y)+s.x&&(i=!i),r=Math.min(r,ga(t,s,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var ku;t.aq=void 0,(ku=t.aq||(t.aq={}))[ku.center=1]="center",ku[ku.left=2]="left",ku[ku.right=3]="right",ku[ku.top=4]="top",ku[ku.bottom=5]="bottom",ku[ku["top-left"]=6]="top-left",ku[ku["top-right"]=7]="top-right",ku[ku["bottom-left"]=8]="bottom-left",ku[ku["bottom-right"]=9]="bottom-right";const zu=Number.POSITIVE_INFINITY;function Eu(t,e){return e[1]!==zu?function(t,e,i){let r=0,s=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":s=i-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-i}switch(t){case"top-right":case"bottom-right":case"right":r=-e;break;case"top-left":case"bottom-left":case"left":r=e}return[r,s]}(t,e[0],e[1]):function(t,e){let i=0,r=0;e<0&&(e=0);const s=e/Math.SQRT2;switch(t){case"top-right":case"top-left":r=s-7;break;case"bottom-right":case"bottom-left":r=7-s;break;case"bottom":r=7-e;break;case"top":r=e-7}switch(t){case"top-right":case"bottom-right":i=-s;break;case"top-left":case"bottom-left":i=s;break;case"left":i=e;break;case"right":i=-e}return[i,r]}(t,e[0])}function Du(t,e,i){var r;const s=t.layout,n=null===(r=s.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},i);if(n){const t=n.values,e=[];for(let i=0;i<t.length;i+=2){const r=e[i]=t[i],s=t[i+1].map(t=>t*Sc);r.startsWith("top")?s[1]-=7:r.startsWith("bottom")&&(s[1]+=7),e[i+1]=s}return new Qt(e)}const o=s.get("text-variable-anchor");if(o){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[s.get("text-radial-offset").evaluate(e,{},i)*Sc,zu]:s.get("text-offset").evaluate(e,{},i).map(t=>t*Sc);const n=[];for(const t of o)n.push(t,Eu(t,r));return new Qt(n)}return null}function Lu(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ru(e,i,r,s,n,o,a,l,c,h,u){let p=o.textMaxSize.evaluate(i,{});void 0===p&&(p=a);const d=e.layers[0].layout,m=d.get("icon-offset").evaluate(i,{},u),f=Fu(r.horizontal),_=a/24,g=e.tilePixelRatio*_,y=e.tilePixelRatio*p/24,x=e.tilePixelRatio*l,v=e.tilePixelRatio*d.get("symbol-spacing"),b=d.get("text-padding")*e.tilePixelRatio,w=function(t,e,i,r=1){const s=t.get("icon-padding").evaluate(e,{},i),n=s&&s.values;return[n[0]*r,n[1]*r,n[2]*r,n[3]*r]}(d,i,u,e.tilePixelRatio),S=d.get("text-max-angle")/180*Math.PI,I="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),A="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),P=d.get("symbol-placement"),C=v/2,M=d.get("icon-text-fit");let k;s&&"none"!==M&&(e.allowVerticalPlacement&&r.vertical&&(k=yh(s,r.vertical,M,d.get("icon-text-fit-padding"),m,_)),f&&(s=yh(s,f,M,d.get("icon-text-fit-padding"),m,_)));const z=(l,p)=>{p.x<0||p.x>=ra||p.y<0||p.y>=ra||function(e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g,y,x,v,b,w,S,I,A){const P=e.addToLineVertexArray(i,r);let C,M,k,z,E=0,D=0,L=0,R=0,B=-1,F=-1;const O={};let V=Fo("");if(e.allowVerticalPlacement&&s.vertical){const t=l.layout.get("text-rotate").evaluate(b,{},I)+90;k=new Iu(c,i,h,u,p,s.vertical,d,m,f,t),a&&(z=new Iu(c,i,h,u,p,a,g,y,f,t))}if(n){const r=l.layout.get("icon-rotate").evaluate(b,{}),s="none"!==l.layout.get("icon-text-fit"),o=vu(n,r,S,s),d=a?vu(a,r,S,s):void 0;M=new Iu(c,i,h,u,p,n,g,y,!1,r),E=4*o.length;const m=e.iconSizeData;let f=null;"source"===m.kind?(f=[xh*l.layout.get("icon-size").evaluate(b,{})],f[0]>vh&&T(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[xh*w.compositeIconSizes[0].evaluate(b,{},I),xh*w.compositeIconSizes[1].evaluate(b,{},I)],(f[0]>vh||f[1]>vh)&&T(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,f,v,x,b,t.ah.none,i,P.lineStartIndex,P.lineLength,-1,I),B=e.icon.placedSymbolArray.length-1,d&&(D=4*d.length,e.addSymbols(e.icon,d,f,v,x,b,t.ah.vertical,i,P.lineStartIndex,P.lineLength,-1,I),F=e.icon.placedSymbolArray.length-1)}const U=Object.keys(s.horizontal);for(const r of U){const n=s.horizontal[r];if(!C){V=Fo(n.text);const t=l.layout.get("text-rotate").evaluate(b,{},I);C=new Iu(c,i,h,u,p,n,d,m,f,t)}const a=1===n.positionedLines.length;if(L+=Bu(e,i,n,o,l,f,b,_,P,s.vertical?t.ah.horizontal:t.ah.horizontalOnly,a?U:[r],O,B,w,I),a)break}s.vertical&&(R+=Bu(e,i,s.vertical,o,l,f,b,_,P,t.ah.vertical,["vertical"],O,F,w,I));const N=C?C.boxStartIndex:e.collisionBoxArray.length,j=C?C.boxEndIndex:e.collisionBoxArray.length,$=k?k.boxStartIndex:e.collisionBoxArray.length,q=k?k.boxEndIndex:e.collisionBoxArray.length,Z=M?M.boxStartIndex:e.collisionBoxArray.length,G=M?M.boxEndIndex:e.collisionBoxArray.length,W=z?z.boxStartIndex:e.collisionBoxArray.length,H=z?z.boxEndIndex:e.collisionBoxArray.length;let X=-1;const J=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;X=J(C,X),X=J(k,X),X=J(M,X),X=J(z,X);const K=X>-1?1:0;K&&(X*=A/Sc),e.glyphOffsetArray.length>=kh.MAX_GLYPHS&&T("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);const Y=Du(l,b,I),[Q,tt]=function(e,i){const r=e.length,s=null==i?void 0:i.values;if((null==s?void 0:s.length)>0)for(let i=0;i<s.length;i+=2){const r=s[i+1];e.emplaceBack(t.aq[s[i]],r[0],r[1])}return[r,e.length]}(e.textAnchorOffsets,Y);e.symbolInstances.emplaceBack(i.x,i.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,B,F,V,N,j,$,q,Z,G,W,H,h,L,R,E,D,K,0,d,X,Q,tt)}(e,p,l,r,s,n,k,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,g,[b,b,b,b],I,c,x,w,A,m,i,o,h,u,a)};if("line"===P)for(const t of uu(i.geometry,0,0,ra,ra)){const i=yu(t,v,S,r.vertical||f,s,24,y,e.overscaling,ra);for(const r of i)f&&Ou(e,f.text,C,r)||z(t,r)}else if("line-center"===P){for(const t of i.geometry)if(t.length>1){const e=gu(t,S,r.vertical||f,s,24,y);e&&z(t,e)}}else if("Polygon"===i.type)for(const t of gi(i.geometry,0)){const e=Pu(t,16);z(t[0],new pu(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)z(t,new pu(t[0].x,t[0].y,0));else if("Point"===i.type)for(const t of i.geometry)for(const e of t)z([e],new pu(e.x,e.y,0))}function Bu(t,e,i,r,s,o,a,l,c,h,u,p,d,m,f){const _=function(t,e,i,r,s,o,a,l){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,h=[];for(const t of e.positionedLines)for(const r of t.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let u=4,p=!0,d=1,m=0;const f=(s||l)&&r.vertical,_=r.metrics.advance*r.scale/2;if(l&&e.verticalizable&&(m=t.lineOffset/2-(r.imageName?-(Sc-r.metrics.width*r.scale)/2:(r.scale-1)*Sc)),r.imageName){const t=a[r.imageName];p=t.sdf,d=t.pixelRatio,u=1/d}const g=s?[r.x+_,r.y]:[0,0];let y=s?[0,0]:[r.x+_+i[0],r.y+i[1]-m],x=[0,0];f&&(x=y,y=[0,0]);const v=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-u)*r.scale-_+y[0],w=(-r.metrics.top-u)*r.scale+y[1],T=b+o.w/v*r.scale/d,S=w+o.h/v*r.scale/d,I=new n(b,w),A=new n(T,w),P=new n(b,S),C=new n(T,S);if(f){const t=new n(-_,_-eh),e=-Math.PI/2,i=12-_,s=new n(22-i,-(r.imageName?i:0)),o=new n(...x);I._rotateAround(e,t)._add(s)._add(o),A._rotateAround(e,t)._add(s)._add(o),P._rotateAround(e,t)._add(s)._add(o),C._rotateAround(e,t)._add(s)._add(o)}if(c){const t=Math.sin(c),e=Math.cos(c),i=[e,-t,t,e];I._matMult(i),A._matMult(i),P._matMult(i),C._matMult(i)}const M=new n(0,0),k=new n(0,0);h.push({tl:I,tr:A,bl:P,br:C,tex:o,writingMode:e.writingMode,glyphOffset:g,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}return h}(0,i,l,s,o,a,r,t.allowVerticalPlacement),g=t.textSizeData;let y=null;"source"===g.kind?(y=[xh*s.layout.get("text-size").evaluate(a,{})],y[0]>vh&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(y=[xh*m.compositeTextSizes[0].evaluate(a,{},f),xh*m.compositeTextSizes[1].evaluate(a,{},f)],(y[0]>vh||y[1]>vh)&&T(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,_,y,l,o,a,h,e,c.lineStartIndex,c.lineLength,d,f);for(const e of u)p[e]=t.text.placedSymbolArray.length-1;return 4*_.length}function Fu(t){for(const e in t)return t[e];return null}function Ou(t,e,i,r){const s=t.compareText;if(e in s){const t=s[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<i)return!0}else s[e]=[];return s[e].push(r),!1}const Vu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Uu{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,i]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const s=Vu[15&i];if(!s)throw new Error("Unrecognized array type.");const[n]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Uu(o,n,s,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const s=Vu.indexOf(this.ArrayType),n=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(s<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+n+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+s]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Nu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:n,nodeSize:o}=this,a=[0,s.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,h=a.pop()||0,u=a.pop()||0;if(h-u<=o){for(let o=u;o<=h;o++){const a=n[2*o],c=n[2*o+1];a>=t&&a<=i&&c>=e&&c<=r&&l.push(s[o])}continue}const p=u+h>>1,d=n[2*p],m=n[2*p+1];d>=t&&d<=i&&m>=e&&m<=r&&l.push(s[p]),(0===c?t<=d:e<=m)&&(a.push(u),a.push(p-1),a.push(1-c)),(0===c?i>=d:r>=m)&&(a.push(p+1),a.push(h),a.push(1-c))}return l}within(t,e,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:s,nodeSize:n}=this,o=[0,r.length-1,0],a=[],l=i*i;for(;o.length;){const c=o.pop()||0,h=o.pop()||0,u=o.pop()||0;if(h-u<=n){for(let i=u;i<=h;i++)Zu(s[2*i],s[2*i+1],t,e)<=l&&a.push(r[i]);continue}const p=u+h>>1,d=s[2*p],m=s[2*p+1];Zu(d,m,t,e)<=l&&a.push(r[p]),(0===c?t-i<=d:e-i<=m)&&(o.push(u),o.push(p-1),o.push(1-c)),(0===c?t+i>=d:e+i>=m)&&(o.push(p+1),o.push(h),o.push(1-c))}return a}}function Nu(t,e,i,r,s,n){if(s-r<=i)return;const o=r+s>>1;ju(t,e,o,r,s,n),Nu(t,e,i,r,o-1,1-n),Nu(t,e,i,o+1,s,1-n)}function ju(t,e,i,r,s,n){for(;s>r;){if(s-r>600){const o=s-r+1,a=i-r+1,l=Math.log(o),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(o-c)/o)*(a-o/2<0?-1:1);ju(t,e,i,Math.max(r,Math.floor(i-a*c/o+h)),Math.min(s,Math.floor(i+(o-a)*c/o+h)),n)}const o=e[2*i+n];let a=r,l=s;for($u(t,e,r,i),e[2*s+n]>o&&$u(t,e,r,s);a<l;){for($u(t,e,a,l),a++,l--;e[2*a+n]<o;)a++;for(;e[2*l+n]>o;)l--}e[2*r+n]===o?$u(t,e,r,l):(l++,$u(t,e,l,s)),l<=i&&(r=l+1),i<=l&&(s=l-1)}}function $u(t,e,i,r){qu(t,i,r),qu(e,2*i,2*r),qu(e,2*i+1,2*r+1)}function qu(t,e,i){const r=t[e];t[e]=t[i],t[i]=r}function Zu(t,e,i,r){const s=t-i,n=e-r;return s*s+n*n}var Gu;t.bg=void 0,(Gu=t.bg||(t.bg={})).create="create",Gu.load="load",Gu.fullLoad="fullLoad";let Wu=null,Hu=[];const Xu=1e3/60,Ju="loadTime",Ku="fullLoadTime",Yu={mark(t){performance.mark(t)},frame(t){const e=t;null!=Wu&&Hu.push(e-Wu),Wu=e},clearMetrics(){Wu=null,Hu=[],performance.clearMeasures(Ju),performance.clearMeasures(Ku);for(const e in t.bg)performance.clearMarks(t.bg[e])},getPerformanceMetrics(){performance.measure(Ju,t.bg.create,t.bg.load),performance.measure(Ku,t.bg.create,t.bg.fullLoad);const e=performance.getEntriesByName(Ju)[0].duration,i=performance.getEntriesByName(Ku)[0].duration,r=Hu.length,s=1/(Hu.reduce((t,e)=>t+e,0)/r/1e3),n=Hu.filter(t=>t>Xu).reduce((t,e)=>t+(e-Xu)/Xu,0);return{loadTime:e,fullLoadTime:i,fps:s,percentDroppedFrames:n/(r+n)*100,totalFrames:r}}};t.$=class extends Rn{},t.A=Ca,t.B=ds,t.C=function(t){if(null==A){const e=t.navigator?t.navigator.userAgent:null;A=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return A},t.D=vn,t.E=Z,t.F=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new $h(()=>this.process()),this.subscription=function(t,e,i){return t.addEventListener(e,i,!1),{unsubscribe:()=>{t.removeEventListener(e,i,!1)}}}(this.target,"message",t=>this.receive(t)),this.globalScope=I(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}sendAsync(t,e){return new Promise((i,r)=>{const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[s]={resolve:i,reject:r},e&&e.signal.addEventListener("abort",()=>{delete this.resolveRejects[s];const e={id:s,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e)},{once:!0});const n=[],o=Object.assign(Object.assign({},t),{id:s,sourceMapId:this.mapId,origin:location.origin,data:Ts(t.data,n)});this.target.postMessage(o,{transfer:n})})}receive(t){const e=t.data,i=e.id;if(!("file://"!==e.origin&&"file://"!==location.origin&&"resource://android"!==e.origin&&"resource://android"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[i];const t=this.abortControllers[i];return delete this.abortControllers[i],void(t&&t.abort())}if(I(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,i){return e(this,void 0,void 0,function*(){if("<response>
2"===i.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(i.error?e.reject(Ss(i.error)):e.resolve(Ss(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=Ss(i.data),r=new AbortController;this.abortControllers[t]=r;try{const s=yield this.messageHandlers[i.type](i.sourceMapId,e,r);this.completeTask(t,null,s)}catch(e){this.completeTask(t,e)}})}completeTask(t,e,i){const r=[];delete this.abortControllers[t];const s={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Ts(e):null,data:Ts(i,r)};this.target.postMessage(s,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},t.G=B,t.H=function(){var t=new Ca(16);return Ca!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.I=Yc,t.J=function(t,e,i){var r,s,n,o,a,l,c,h,u,p,d,m,f=i[0],_=i[1],g=i[2];return e===t?(t[12]=e[0]*f+e[4]*_+e[8]*g+e[12],t[13]=e[1]*f+e[5]*_+e[9]*g+e[13],t[14]=e[2]*f+e[6]*_+e[10]*g+e[14],t[15]=e[3]*f+e[7]*_+e[11]*g+e[15]):(s=e[1],n=e[2],o=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],m=e[11],t[0]=r=e[0],t[1]=s,t[2]=n,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=h,t[8]=u,t[9]=p,t[10]=d,t[11]=m,t[12]=r*f+a*_+u*g+e[12],t[13]=s*f+l*_+p*g+e[13],t[14]=n*f+c*_+d*g+e[14],t[15]=o*f+h*_+m*g+e[15]),t},t.K=function(t,e,i){var r=i[0],s=i[1],n=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.L=ka,t.M=function(t,e){const i={};for(let r=0;r<e.length;r++){const s=e[r];s in t&&(i[s]=t[s])}return i},t.N=Zh,t.O=Hh,t.P=n,t.Q=Xh,t.R=$a,t.S=iu,t.T=mn,t.U=u,t.V=p,t.W=M,t.X=ra,t.Y=zn,t.Z=Yh,t._=e,t.a=L,t.a$=function(t,e){var i=t[0],r=t[1],s=t[2],n=t[3],o=t[4],a=t[5],l=t[6],c=t[7],h=t[8],u=t[9],p=t[10],d=t[11],m=t[12],f=t[13],_=t[14],g=t[15],y=e[0],x=e[1],v=e[2],b=e[3],w=e[4],T=e[5],S=e[6],I=e[7],A=e[8],P=e[9],C=e[10],M=e[11],k=e[12],z=e[13],E=e[14],D=e[15];return Math.abs(i-y)<=Pa*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=Pa*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(s-v)<=Pa*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(n-b)<=Pa*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=Pa*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=Pa*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-S)<=Pa*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-I)<=Pa*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(h-A)<=Pa*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(u-P)<=Pa*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(p-C)<=Pa*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(d-M)<=Pa*Math.max(1,Math.abs(d),Math.abs(M))&&Math.abs(m-k)<=Pa*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(f-z)<=Pa*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(_-E)<=Pa*Math.max(1,Math.abs(_),Math.abs(E))&&Math.abs(g-D)<=Pa*Math.max(1,Math.abs(g),Math.abs(D))},t.a0=zo,t.a1=tu,t.a2=st,t.a3=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise(i=>{e.onloadstart=()=>{i(e)};for(const i of t){const t=window.document.createElement("source");U(i)||(e.crossOrigin="Anonymous"),t.src=i,e.appendChild(t)}})},t.a4=function(){return y++},t.a5=ro,t.a6=kh,t.a7=Ar,t.a8=aa,t.a9=ou,t.aA=function(t){if("custom"===t.type)return new jh(t);switch(t.type){case"background":return new Oh(t);case"circle":return new La(t);case"fill":return new Ml(t);case"fill-extrusion":return new Ql(t);case"heatmap":return new Ga(t);case"hillshade":return new Xa(t);case"line":return new fc(t);case"raster":return new Nh(t);case"symbol":return new Rh(t)}},t.aB=b,t.aC=function(t,e){if(!t)return[{command:"setStyle",args:[e]}];let i=[];try{if(!X(t.version,e.version))return[{command:"setStyle",args:[e]}];X(t.center,e.center)||i.push({command:"setCenter",args:[e.center]}),X(t.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),X(t.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),X(t.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),X(t.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),X(t.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),X(t.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),X(t.light,e.light)||i.push({command:"setLight",args:[e.light]}),X(t.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),X(t.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),X(t.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const r={},s=[];
vendor: 23,865 bytes, line 2
2!function(t,e,i,r){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(Object.prototype.hasOwnProperty.call(e,s)||Y(s,i,r));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&(Object.prototype.hasOwnProperty.call(t,s)?X(t[s],e[s])||("geojson"===t[s].type&&"geojson"===e[s].type&&tt(t,e,s)?J(i,{command:"setGeoJSONSourceData",args:[s,e[s].data]}):Q(s,e,i,r)):K(s,e,i))}(t.sources,e.sources,s,r);const n=[];t.layers&&t.layers.forEach(t=>{"source"in t&&r[t.source]?i.push({command:"removeLayer",args:[t.id]}):n.push(t)}),i=i.concat(s),function(t,e,i){e=e||[];const r=(t=t||[]).map(it),s=e.map(it),n=t.reduce(rt,{}),o=e.reduce(rt,{}),a=r.slice(),l=Object.create(null);let c,h,u,p,d;for(let t=0,e=0;t<r.length;t++)c=r[t],Object.prototype.hasOwnProperty.call(o,c)?e++:(J(i,{command:"removeLayer",args:[c]}),a.splice(a.indexOf(c,e),1));for(let t=0,e=0;t<s.length;t++)c=s[s.length-1-t],a[a.length-1-t]!==c&&(Object.prototype.hasOwnProperty.call(n,c)?(J(i,{command:"removeLayer",args:[c]}),a.splice(a.lastIndexOf(c,a.length-e),1)):e++,p=a[a.length-t],J(i,{command:"addLayer",args:[o[c],p]}),a.splice(a.length-t,0,c),l[c]=!0);for(let t=0;t<s.length;t++)if(c=s[t],h=n[c],u=o[c],!l[c]&&!X(h,u))if(X(h.source,u.source)&&X(h["source-layer"],u["source-layer"])&&X(h.type,u.type)){for(d in et(h.layout,u.layout,i,c,null,"setLayoutProperty"),et(h.paint,u.paint,i,c,null,"setPaintProperty"),X(h.filter,u.filter)||J(i,{command:"setFilter",args:[c,u.filter]}),X(h.minzoom,u.minzoom)&&X(h.maxzoom,u.maxzoom)||J(i,{command:"setLayerZoomRange",args:[c,u.minzoom,u.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?et(h[d],u[d],i,c,d.slice(6),"setPaintProperty"):X(h[d],u[d])||J(i,{command:"setLayerProperty",args:[c,d,u[d]]}));for(d in u)Object.prototype.hasOwnProperty.call(u,d)&&!Object.prototype.hasOwnProperty.call(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?et(h[d],u[d],i,c,d.slice(6),"setPaintProperty"):X(h[d],u[d])||J(i,{command:"setLayerProperty",args:[c,d,u[d]]}))}else J(i,{command:"removeLayer",args:[c]}),p=a[a.lastIndexOf(c)+1],J(i,{command:"addLayer",args:[u,p]})}(n,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:"setStyle",args:[e]}]}return i},t.aD=function(t){const e=[],i=t.id;return void 0===i&&e.push({message:`layers.${i}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},t.aE=function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(const r in e)if(!t(e[r],i[r]))return!1;return!0}return e===i},t.aF=x,t.aG=v,t.aH=class extends jo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.aI=$o,t.aJ=class extends jo{constructor(t,e){super(t,e),this.current=Go}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.aK=qo,t.aL=Zo,t.aM=Wt,t.aN=class extends jo{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}},t.aO=class extends jo{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}},t.aP=function(t,e,i,r,s,n,o){var a=1/(e-i),l=1/(r-s),c=1/(n-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+i)*a,t[13]=(s+r)*l,t[14]=(o+n)*c,t[15]=1,t},t.aQ=Ea,t.aR=class extends Zn{},t.aS=bc,t.aT=class extends Wn{},t.aU=Za,t.aV=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.aW=qa,t.aX=fo,t.aY=Po,t.aZ=class extends to{},t.a_=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},t.aa=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,i,r,s)=>{const n=r||s;return e[i]=!n||n.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e},t.ab=function(t,e){const i=[];for(const r in t)r in e||i.push(r);return i},t.ac=f,t.ad=function(t,e,i){var r=Math.sin(i),s=Math.cos(i),n=e[0],o=e[1],a=e[2],l=e[3],c=e[4],h=e[5],u=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=n*s+c*r,t[1]=o*s+h*r,t[2]=a*s+u*r,t[3]=l*s+p*r,t[4]=c*s-n*r,t[5]=h*s-o*r,t[6]=u*s-a*r,t[7]=p*s-l*r,t},t.ae=function(t){var e=new Ca(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.af=Da,t.ag=function(t,e){let i=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:s,minZoom:n,maxZoom:o}=t,a=s?f(ke.interpolationFactor(s,e,n,o),0,1):0;"camera"===t.kind?r=Me.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:r}},t.ai=function(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:s}){return"source"===t.kind?r/xh:"composite"===t.kind?Me.number(r/xh,s/xh,i):e},t.aj=Ah,t.ak=function(t,e,i,r){const s=e.y-t.y,o=e.x-t.x,a=r.y-i.y,l=r.x-i.x,c=a*o-l*s;if(0===c)return null;const h=(l*(t.y-i.y)-a*(t.x-i.x))/c;return new n(t.x+h*o,t.y+h*s)},t.al=uu,t.am=ha,t.an=Ma,t.ao=function(t){let e=1/0,i=1/0,r=-1/0,s=-1/0;for(const n of t)e=Math.min(e,n.x),i=Math.min(i,n.y),r=Math.max(r,n.x),s=Math.max(s,n.y);return[e,i,r,s]},t.ap=Sc,t.ar=wh,t.as=function(t,e){var i=e[0],r=e[1],s=e[2],n=e[3],o=e[4],a=e[5],l=e[6],c=e[7],h=e[8],u=e[9],p=e[10],d=e[11],m=e[12],f=e[13],_=e[14],g=e[15],y=i*a-r*o,x=i*l-s*o,v=i*c-n*o,b=r*l-s*a,w=r*c-n*a,T=s*c-n*l,S=h*f-u*m,I=h*_-p*m,A=h*g-d*m,P=u*_-p*f,C=u*g-d*f,M=p*g-d*_,k=y*M-x*C+v*P+b*A-w*I+T*S;return k?(t[0]=(a*M-l*C+c*P)*(k=1/k),t[1]=(s*C-r*M-n*P)*k,t[2]=(f*T-_*w+g*b)*k,t[3]=(p*w-u*T-d*b)*k,t[4]=(l*A-o*M-c*I)*k,t[5]=(i*M-s*A+n*I)*k,t[6]=(_*v-m*T-g*x)*k,t[7]=(h*T-p*v+d*x)*k,t[8]=(o*C-a*A+c*S)*k,t[9]=(r*A-i*C-n*S)*k,t[10]=(m*w-f*v+g*y)*k,t[11]=(u*v-h*w-d*y)*k,t[12]=(a*I-o*P-l*S)*k,t[13]=(i*P-r*I+s*S)*k,t[14]=(f*x-m*b-_*y)*k,t[15]=(h*b-u*x+p*y)*k,t):null},t.at=Lu,t.au=mh,t.av=Uu,t.aw=function(){const t={},e=G.$version;for(const i in G.$root){const r=G.$root[i];if(r.required){let s=null;s="version"===i?e:"array"===r.type?[]:{},null!=s&&(t[i]=s)}}return t},t.ax=Is,t.ay=O,t.az=function(t){t=t.slice();const e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=H(t[i],e[t[i].ref]));return t},t.b=P,t.b0=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.b1=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},t.b2=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.b3=_,t.b4=eu,t.b5=Jh,t.b6=function(t,e,i,r,s){var n,o=1/Math.tan(e/2);return t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=s&&s!==1/0?(t[10]=(s+r)*(n=1/(r-s)),t[14]=2*s*r*n):(t[10]=-1,t[14]=-2*r),t},t.b7=function(t,e,i){var r=Math.sin(i),s=Math.cos(i),n=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],u=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=n*s+c*r,t[5]=o*s+h*r,t[6]=a*s+u*r,t[7]=l*s+p*r,t[8]=c*s-n*r,t[9]=h*s-o*r,t[10]=u*s-a*r,t[11]=p*s-l*r,t},t.b8=d,t.b9=m,t.bA=Ic,t.bB=function(t){return t.message===E},t.bC=yr,t.bD=hn,t.ba=function(t){return t*Math.PI/180},t.bb=function(t,e){const{x:i,y:r}=Yh.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)},t.bc=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.bd=class extends Ln{},t.be=qh,t.bf=Yu,t.bh=F,t.bi=function(t,e){L.REGISTERED_PROTOCOLS[t]=e},t.bj=function(t){delete L.REGISTERED_PROTOCOLS[t]},t.bk=function(t,e){const i={};for(let r=0;r<t.length;r++){const s=e&&e[t[r].id]||Rr(t[r]);e&&(e[t[r].id]=s);let n=i[s];n||(n=i[s]=[]),n.push(t[r])}const r=[];for(const t in i)r.push(i[t]);return r},t.bl=xs,t.bm=nu,t.bn=au,t.bo=Qc,t.bp=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=ra/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0],r=i.layout,s=i._unevaluatedLayout._values,n={layoutIconSize:s["icon-size"].possiblyEvaluate(new un(e.bucket.zoom+1),e.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new un(e.bucket.zoom+1),e.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new un(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;n.compositeTextSizes=[s["text-size"].possiblyEvaluate(new un(t),e.canonical),s["text-size"].possiblyEvaluate(new un(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;n.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new un(t),e.canonical),s["icon-size"].possiblyEvaluate(new un(i),e.canonical)]}const o=r.get("text-line-height")*Sc,a="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),c=r.get("text-size");for(const s of e.bucket.features){const h=r.get("text-font").evaluate(s,{},e.canonical).join(","),u=c.evaluate(s,{},e.canonical),p=n.layoutTextSize.evaluate(s,{},e.canonical),d=n.layoutIconSize.evaluate(s,{},e.canonical),m={horizontal:{},vertical:void 0},f=s.text;let _,g=[0,0];if(f){const n=f.toString(),c=r.get("text-letter-spacing").evaluate(s,{},e.canonical)*Sc,d=Ys(n)?c:0,_=r.get("text-anchor").evaluate(s,{},e.canonical),y=Du(i,s,e.canonical);if(!y){const t=r.get("text-radial-offset").evaluate(s,{},e.canonical);g=t?Eu(_,[t*Sc,zu]):r.get("text-offset").evaluate(s,{},e.canonical).map(t=>t*Sc)}let x=a?"center":r.get("text-justify").evaluate(s,{},e.canonical);const v="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(s,{},e.canonical)*Sc:1/0,b=()=>{e.bucket.allowVerticalPlacement&&Ks(n)&&(m.vertical=sh(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,o,_,"left",d,g,t.ah.vertical,!0,p,u))};if(!a&&y){const i=new Set;if("auto"===x)for(let t=0;t<y.values.length;t+=2)i.add(Lu(y.values[t]));else i.add(x);let r=!1;for(const s of i)if(!m.horizontal[s])if(r)m.horizontal[s]=m.horizontal[0];else{const i=sh(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,o,"center",s,d,g,t.ah.horizontal,!1,p,u);i&&(m.horizontal[s]=i,r=1===i.positionedLines.length)}b()}else{"auto"===x&&(x=Lu(_));const i=sh(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,o,_,x,d,g,t.ah.horizontal,!1,p,u);i&&(m.horizontal[x]=i),b(),Ks(n)&&a&&l&&(m.vertical=sh(f,e.glyphMap,e.glyphPositions,e.imagePositions,h,v,o,_,x,d,g,t.ah.vertical,!1,p,u))}}let y=!1;if(s.icon&&s.icon.name){const t=e.imageMap[s.icon.name];t&&(_=_h(e.imagePositions[s.icon.name],r.get("icon-offset").evaluate(s,{},e.canonical),r.get("icon-anchor").evaluate(s,{},e.canonical)),y=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&T("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0))}const x=Fu(m.horizontal)||m.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||_)&&Ru(e.bucket,s,m,_,e.imageMap,n,p,d,g,y,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.bq=cc,t.br=Il,t.bs=Hl,t.bt=Dl,t.bu=Wc,t.bv=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.bw=function(t,i,r,s,n){return e(this,void 0,void 0,function*(){if(p())try{return yield M(t,i,r,s,n)}catch(t){}return function(t,e,i,r,s){const n=t.width,o=t.height;k&&z||(k=new OffscreenCanvas(n,o),z=k.getContext("2d",{willReadFrequently:!0})),k.width=n,k.height=o,z.drawImage(t,0,0,n,o);const a=z.getImageData(e,i,r,s);return z.clearRect(0,0,n,o),a.data}(t,i,r,s,n)})},t.bx=su,t.by=i,t.bz=r,t.c=D,t.d=t=>e(void 0,void 0,void 0,function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),t.e=g,t.f=t=>new Promise((e,i)=>{const r=new Image;r.onload=()=>{e(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=C})},r.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const s=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(s):C}),t.g=R,t.h=(t,e)=>V(g(t,{type:"json"}),e),t.i=I,t.j=q,t.k=$,t.l=(t,e)=>V(g(t,{type:"arrayBuffer"}),e),t.m=V,t.n=function(t){return new Wc(t).readFields(Hc,[])},t.o=ja,t.p=Kc,t.q=In,t.r=ps,t.s=U,t.t=_s,t.u=us,t.v=G,t.w=T,t.x=function([t,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(i),y:t*Math.sin(e)*Math.sin(i),z:t*Math.cos(i)}},t.y=Me,t.z=un}),i("worker",0,function(t){class e{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,i){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.aA(i);e._featureFilter=t.a7(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of i)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=t.bk(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const e=t.map(t=>this._layers[t.id]),i=e[0];if("none"===i.visibility)continue;const r=i.source||"";let s=this.familiesBySource[r];s||(s=this.familiesBySource[r]={});const n=i.sourceLayer||"_geojsonTileLayer";let o=s[n];o||(o=s[n]=[]),o.push(e)}}}class i{constructor(e){const i={},r=[];for(const t in e){const s=e[t],n=i[t]={};for(const t in s){const e=s[+t];if(!e||0===e.bitmap.width||0===e.bitmap.height)continue;const i={x:0,y:0,w:e.bitmap.width+2,h:e.bitmap.height+2};r.push(i),n[t]={rect:i,metrics:e.metrics}}}const{w:s,h:n}=t.p(r),o=new t.o({width:s||1,height:n||1});for(const r in e){const s=e[r];for(const e in s){const n=s[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const a=i[r][e].rect;t.o.copy(n.bitmap,o,{x:0,y:0},{x:a.x+1,y:a.y+1},n.bitmap)}}this.image=o,this.positions=i}}t.bl("GlyphAtlas",i);class r{constructor(e){this.tileID=new t.S(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}parse(e,r,n,o){return t._(this,void 0,void 0,function*(){this.status="parsing",this.data=e,this.collisionBoxArray=new t.a5;const a=new t.bm(Object.keys(e.layers).sort()),l=new t.bn(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},h={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},u=r.familiesBySource[this.source];for(const i in u){const r=e.layers[i];if(!r)continue;1===r.version&&t.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=a.encode(i),p=[];for(let t=0;t<r.length;t++){const e=r.feature(t),s=l.getId(e,i);p.push({feature:e,id:s,index:t,sourceLayerIndex:o})}for(const e of u[i]){const i=e[0];i.source!==this.source&&t.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(s(e,this.zoom,n),(c[i.id]=i.createBucket({index:l.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(p,h,this.tileID.canonical),l.bucketLayerIDs.push(e.map(t=>t.id)))}}const p=t.aF(h.glyphDependencies,t=>Object.keys(t).map(Number));this.inFlightDependencies.forEach(t=>null==t?void 0:t.abort()),this.inFlightDependencies=[];let d=Promise.resolve({});if(Object.keys(p).length){const t=new AbortController;this.inFlightDependencies.push(t),d=o.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},t)}const m=Object.keys(h.iconDependencies);let f=Promise.resolve({});if(m.length){const t=new AbortController;this.inFlightDependencies.push(t),f=o.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},t)}const _=Object.keys(h.patternDependencies);let g=Promise.resolve({});if(_.length){const t=new AbortController;this.inFlightDependencies.push(t),g=o.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},t)}const[y,x,v]=yield Promise.all([d,f,g]),b=new i(y),w=new t.bo(x,v);for(const e in c){const i=c[e];i instanceof t.a6?(s(i.layers,this.zoom,n),t.bp({bucket:i,glyphMap:y,glyphPositions:b.positions,imageMap:x,imagePositions:w.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):i.hasPattern&&(i instanceof t.bq||i instanceof t.br||i instanceof t.bs)&&(s(i.layers,this.zoom,n),i.addFeatures(h,this.tileID.canonical,w.patternPositions))}return this.status="done",{buckets:Object.values(c).filter(t=>!t.isEmpty()),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:w,glyphMap:this.returnDependencies?y:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?b.positions:null}})}}function s(e,i,r){const s=new t.z(i);for(const t of e)t.recalculate(s,r)}class n{constructor(t,e,i){this.actor=t,this.layerIndex=e,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(e,i){return t._(this,void 0,void 0,function*(){const r=yield t.l(e.request,i);try{return{vectorTile:new t.bt.VectorTile(new t.bu(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(t){const i=new Uint8Array(r.data);let s=`Unable to parse the tile at ${e.request.url}, `;throw s+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${t.message}`,new Error(s)}})}loadTile(e){return t._(this,void 0,void 0,function*(){const i=e.uid,s=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bv(e.request),n=new r(e);this.loading[i]=n;const o=new AbortController;n.abort=o;try{const r=yield this.loadVectorTile(e,o);if(delete this.loading[i],!r)return null;const a=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(s){const t=s.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}n.vectorTile=r.vectorTile;const h=n.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[i]=n,this.fetching[i]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const e=yield h;return t.e({rawTileData:a.slice(0)},e,l,c)}finally{delete this.fetching[i]}}catch(t){throw delete this.loading[i],n.status="done",this.loaded[i]=n,t}})}reloadTile(e){return t._(this,void 0,void 0,function*(){const i=e.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=e.showCollisionBoxes,"parsing"===r.status){const e=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor);let s;if(this.fetching[i]){const{rawTileData:r,cacheControl:n,resourceTiming:o}=this.fetching[i];delete this.fetching[i],s=t.e({rawTileData:r.slice(0)},e,n,o)}else s=e;return s}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(e){return t._(this,void 0,void 0,function*(){const t=this.loading,i=e.uid;t&&t[i]&&t[i].abort&&(t[i].abort.abort(),delete t[i])})}removeTile(e){return t._(this,void 0,void 0,function*(){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]})}}class o{constructor(){this.loaded={}}loadTile(e){return t._(this,void 0,void 0,function*(){const{uid:i,encoding:r,rawImageData:s,redFactor:n,greenFactor:o,blueFactor:a,baseShift:l}=e,c=s.width+2,h=s.height+2,u=t.b(s)?new t.R({width:c,height:h},yield t.bw(s,-1,-1,c,h)):s,p=new t.bx(i,u,r,n,o,a,l);return this.loaded=this.loaded||{},this.loaded[i]=p,p})}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}function a(t,e){if(0!==t.length){l(t[0],e);for(var i=1;i<t.length;i++)l(t[i],!e)}}function l(t,e){for(var i=0,r=0,s=0,n=t.length,o=n-1;s<n;o=s++){var a=(t[s][0]-t[o][0])*(t[o][1]+t[s][1]),l=i+a;r+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+r>=0!=!!e&&t.reverse()}var c=t.by(function t(e,i){var r,s=e&&e.type;if("FeatureCollection"===s)for(r=0;r<e.features.length;r++)t(e.features[r],i);else if("GeometryCollection"===s)for(r=0;r<e.geometries.length;r++)t(e.geometries[r],i);else if("Feature"===s)t(e.geometry,i);else if("Polygon"===s)a(e.coordinates,i);else if("MultiPolygon"===s)for(r=0;r<e.coordinates.length;r++)a(e.coordinates[r],i);return e});const h=t.bt.VectorTileFeature.prototype.toGeoJSON;var u={exports:{}},p=t.bz,d=t.bt.VectorTileFeature,m=f;function f(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}f.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],r=[],s=0;s<i.length;s++)r.push(new p(i[s][0],i[s][1]));this.geometry.push(r)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,r=1/0,s=-1/0,n=0;n<t.length;n++)for(var o=t[n],a=0;a<o.length;a++){var l=o[a];e=Math.min(e,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),s=Math.max(s,l.y)}return[e,r,i,s]},_.prototype.toGeoJSON=d.prototype.toGeoJSON;var g=t.bA,y=m;function x(t){var e=new g;
vendor: 8,456 bytes, line 2
2return function(t,e){for(var i in t.layers)e.writeMessage(3,v,t.layers[i])}(t,e),e.finish()}function v(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)r.feature=t.feature(i),e.writeMessage(2,b,r);var s=r.keys;for(i=0;i<s.length;i++)e.writeStringField(3,s[i]);var n=r.values;for(i=0;i<n.length;i++)e.writeMessage(4,A,n[i])}function b(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,w,t),e.writeVarintField(3,i.type),e.writeMessage(4,I,i)}function w(t,e){var i=t.feature,r=t.keys,s=t.values,n=t.keycache,o=t.valuecache;for(var a in i.properties){var l=i.properties[a],c=n[a];if(null!==l){void 0===c&&(r.push(a),n[a]=c=r.length-1),e.writeVarint(c);var h=typeof l;"string"!==h&&"boolean"!==h&&"number"!==h&&(l=JSON.stringify(l));var u=h+":"+l,p=o[u];void 0===p&&(s.push(l),o[u]=p=s.length-1),e.writeVarint(p)}}}function T(t,e){return(e<<3)+(7&t)}function S(t){return t<<1^t>>31}function I(t,e){for(var i=t.loadGeometry(),r=t.type,s=0,n=0,o=i.length,a=0;a<o;a++){var l=i[a],c=1;1===r&&(c=l.length),e.writeVarint(T(1,c));for(var h=3===r?l.length-1:l.length,u=0;u<h;u++){1===u&&1!==r&&e.writeVarint(T(2,h-1));var p=l[u].x-s,d=l[u].y-n;e.writeVarint(S(p)),e.writeVarint(S(d)),s+=p,n+=d}3===r&&e.writeVarint(T(7,1))}}function A(t,e){var i=typeof t;"string"===i?e.writeStringField(1,t):"boolean"===i?e.writeBooleanField(7,t):"number"===i&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}u.exports=x,u.exports.fromVectorTileJs=x,u.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var r in t)i[r]=new y(t[r].features,e),i[r].name=r,i[r].version=e.version,i[r].extent=e.extent;return x({layers:i})},u.exports.GeoJSONWrapper=y;var P=t.by(u.exports);const C={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},M=Math.fround||(k=new Float32Array(1),t=>(k[0]=+t,k[0]));var k;class z{constructor(t){this.options=Object.assign(Object.create(C),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){const{log:e,minZoom:i,maxZoom:r}=this.options;e&&console.time("total time");const s=`prepare ${t.length} points`;e&&console.time(s),this.points=t;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(!i.geometry)continue;const[r,s]=i.geometry.coordinates,o=M(L(r)),a=M(R(s));n.push(o,a,1/0,e,-1,1),this.options.reduce&&n.push(0)}let o=this.trees[r+1]=this._createTree(n);e&&console.timeEnd(s);for(let t=r;t>=i;t--){const i=+Date.now();o=this.trees[t]=this._createTree(this._cluster(o,t)),e&&console.log("z%d: %d clusters in %dms",t,o.numItems,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let s=180===t[2]?180:((t[2]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,s=180;else if(i>s){const t=this.getClusters([i,r,180,n],e),o=this.getClusters([-180,r,s,n],e);return t.concat(o)}const o=this.trees[this._limitZoom(e)],a=o.range(L(i),R(n),L(s),R(r)),l=o.data,c=[];for(const t of a){const e=this.stride*t;c.push(l[e+5]>1?E(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),r="No cluster with the specified id.",s=this.trees[i];if(!s)throw new Error(r);const n=s.data;if(e*this.stride>=n.length)throw new Error(r);const o=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=s.within(n[e*this.stride],n[e*this.stride+1],o),l=[];for(const e of a){const i=e*this.stride;n[i+4]===t&&l.push(n[i+5]>1?E(n,i,this.clusterProps):this.points[n[i+3]])}if(0===l.length)throw new Error(r);return l}getLeaves(t,e,i){const r=[];return this._appendLeaves(r,t,e=e||10,i=i||0,0),r}getTile(t,e,i){const r=this.trees[this._limitZoom(t)],s=Math.pow(2,t),{extent:n,radius:o}=this.options,a=o/n,l=(i-a)/s,c=(i+1+a)/s,h={features:[]};return this._addTileFeatures(r.range((e-a)/s,l,(e+1+a)/s,c),r.data,e,i,s,h),0===e&&this._addTileFeatures(r.range(1-a/s,l,1,c),r.data,s,i,s,h),e===s-1&&this._addTileFeatures(r.range(0,l,a/s,c),r.data,-1,i,s,h),h.features.length?h:null}getClusterExpansionZoom(t){let e=this._getOriginZoom(t)-1;for(;e<=this.options.maxZoom;){const i=this.getChildren(t);if(e++,1!==i.length)break;t=i[0].properties.cluster_id}return e}_appendLeaves(t,e,i,r,s){const n=this.getChildren(e);for(const e of n){const n=e.properties;if(n&&n.cluster?s+n.point_count<=r?s+=n.point_count:s=this._appendLeaves(t,n.cluster_id,i,r,s):s<r?s++:t.push(e),t.length===i)break}return s}_createTree(e){const i=new t.av(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let t=0;t<e.length;t+=this.stride)i.add(e[t],e[t+1]);return i.finish(),i.data=e,i}_addTileFeatures(t,e,i,r,s,n){for(const o of t){const t=o*this.stride,a=e[t+5]>1;let l,c,h;if(a)l=D(e,t,this.clusterProps),c=e[t],h=e[t+1];else{const i=this.points[e[t+3]];l=i.properties;const[r,s]=i.geometry.coordinates;c=L(r),h=R(s)}const u={type:1,geometry:[[Math.round(this.options.extent*(c*s-i)),Math.round(this.options.extent*(h*s-r))]],tags:l};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(u.id=p),n.features.push(u)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const{radius:i,extent:r,reduce:s,minPoints:n}=this.options,o=i/(r*Math.pow(2,e)),a=t.data,l=[],c=this.stride;for(let i=0;i<a.length;i+=c){if(a[i+2]<=e)continue;a[i+2]=e;const r=a[i],h=a[i+1],u=t.within(a[i],a[i+1],o),p=a[i+5];let d=p;for(const t of u){const i=t*c;a[i+2]>e&&(d+=a[i+5])}if(d>p&&d>=n){let t,n=r*p,o=h*p,m=-1;const f=(i/c<<5)+(e+1)+this.points.length;for(const r of u){const l=r*c;if(a[l+2]<=e)continue;a[l+2]=e;const h=a[l+5];n+=a[l]*h,o+=a[l+1]*h,a[l+4]=f,s&&(t||(t=this._map(a,i,!0),m=this.clusterProps.length,this.clusterProps.push(t)),s(t,this._map(a,l)))}a[i+4]=f,l.push(n/d,o/d,1/0,f,-1,d),s&&l.push(m)}else{for(let t=0;t<c;t++)l.push(a[i+t]);if(d>1)for(const t of u){const i=t*c;if(!(a[i+2]<=e)){a[i+2]=e;for(let t=0;t<c;t++)l.push(a[i+t])}}}}return l}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e,i){if(t[e+5]>1){const r=this.clusterProps[t[e+6]];return i?Object.assign({},r):r}const r=this.points[t[e+3]].properties,s=this.options.map(r);return i&&s===r?Object.assign({},s):s}}function E(t,e,i){return{type:"Feature",id:t[e+3],properties:D(t,e,i),geometry:{type:"Point",coordinates:[(r=t[e],360*(r-.5)),B(t[e+1])]}};var r}function D(t,e,i){const r=t[e+5],s=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,n=t[e+6],o=-1===n?{}:Object.assign({},i[n]);return Object.assign(o,{cluster:!0,cluster_id:t[e+3],point_count:r,point_count_abbreviated:s})}function L(t){return t/360+.5}function R(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function B(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function F(t,e,i,r){let s=r;const n=e+(i-e>>1);let o,a=i-e;const l=t[e],c=t[e+1],h=t[i],u=t[i+1];for(let r=e+3;r<i;r+=3){const e=O(t[r],t[r+1],l,c,h,u);if(e>s)o=r,s=e;else if(e===s){const t=Math.abs(r-n);t<a&&(o=r,a=t)}}s>r&&(o-e>3&&F(t,e,o,r),t[o+2]=s,i-o>3&&F(t,o,i,r))}function O(t,e,i,r,s,n){let o=s-i,a=n-r;if(0!==o||0!==a){const l=((t-i)*o+(e-r)*a)/(o*o+a*a);l>1?(i=s,r=n):l>0&&(i+=o*l,r+=a*l)}return o=t-i,a=e-r,o*o+a*a}function V(t,e,i,r){const s={id:null==t?null:t,type:e,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===e||"MultiPoint"===e||"LineString"===e)U(s,i);else if("Polygon"===e)U(s,i[0]);else if("MultiLineString"===e)for(const t of i)U(s,t);else if("MultiPolygon"===e)for(const t of i)U(s,t[0]);return s}function U(t,e){for(let i=0;i<e.length;i+=3)t.minX=Math.min(t.minX,e[i]),t.minY=Math.min(t.minY,e[i+1]),t.maxX=Math.max(t.maxX,e[i]),t.maxY=Math.max(t.maxY,e[i+1])}function N(t,e,i,r){if(!e.geometry)return;const s=e.geometry.coordinates;if(s&&0===s.length)return;const n=e.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===n)j(s,a);else if("MultiPoint"===n)for(const t of s)j(t,a);else if("LineString"===n)$(s,a,o,!1);else if("MultiLineString"===n){if(i.lineMetrics){for(const i of s)
vendor: 12,570 bytes, line 2
2a=[],$(i,a,o,!1),t.push(V(l,"LineString",a,e.properties));return}q(s,a,o,!1)}else if("Polygon"===n)q(s,a,o,!0);else{if("MultiPolygon"!==n){if("GeometryCollection"===n){for(const s of e.geometry.geometries)N(t,{id:l,geometry:s,properties:e.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of s){const e=[];q(t,e,o,!0),a.push(e)}}t.push(V(l,n,a,e.properties))}function j(t,e){e.push(Z(t[0]),G(t[1]),0)}function $(t,e,i,r){let s,n,o=0;for(let i=0;i<t.length;i++){const a=Z(t[i][0]),l=G(t[i][1]);e.push(a,l,0),i>0&&(o+=r?(s*l-a*n)/2:Math.sqrt(Math.pow(a-s,2)+Math.pow(l-n,2))),s=a,n=l}const a=e.length-3;e[2]=1,F(e,0,a,i),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function q(t,e,i,r){for(let s=0;s<t.length;s++){const n=[];$(t[s],n,i,r),e.push(n)}}function Z(t){return t/360+.5}function G(t){const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function W(t,e,i,r,s,n,o,a){if(r/=e,n>=(i/=e)&&o<r)return t;if(o<i||n>=r)return null;const l=[];for(const e of t){const t=e.geometry;let n=e.type;const o=0===s?e.minX:e.minY,c=0===s?e.maxX:e.maxY;if(o>=i&&c<r){l.push(e);continue}if(c<i||o>=r)continue;let h=[];if("Point"===n||"MultiPoint"===n)H(t,h,i,r,s);else if("LineString"===n)X(t,h,i,r,s,!1,a.lineMetrics);else if("MultiLineString"===n)K(t,h,i,r,s,!1);else if("Polygon"===n)K(t,h,i,r,s,!0);else if("MultiPolygon"===n)for(const e of t){const t=[];K(e,t,i,r,s,!0),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===n){for(const t of h)l.push(V(e.id,n,t,e.tags));continue}"LineString"!==n&&"MultiLineString"!==n||(1===h.length?(n="LineString",h=h[0]):n="MultiLineString"),"Point"!==n&&"MultiPoint"!==n||(n=3===h.length?"Point":"MultiPoint"),l.push(V(e.id,n,h,e.tags))}}return l.length?l:null}function H(t,e,i,r,s){for(let n=0;n<t.length;n+=3){const o=t[n+s];o>=i&&o<=r&&Y(e,t[n],t[n+1],t[n+2])}}function X(t,e,i,r,s,n,o){let a=J(t);const l=0===s?Q:tt;let c,h,u=t.start;for(let p=0;p<t.length-3;p+=3){const d=t[p],m=t[p+1],f=t[p+2],_=t[p+3],g=t[p+4],y=0===s?d:m,x=0===s?_:g;let v=!1;o&&(c=Math.sqrt(Math.pow(d-_,2)+Math.pow(m-g,2))),y<i?x>i&&(h=l(a,d,m,_,g,i),o&&(a.start=u+c*h)):y>r?x<r&&(h=l(a,d,m,_,g,r),o&&(a.start=u+c*h)):Y(a,d,m,f),x<i&&y>=i&&(h=l(a,d,m,_,g,i),v=!0),x>r&&y<=r&&(h=l(a,d,m,_,g,r),v=!0),!n&&v&&(o&&(a.end=u+c*h),e.push(a),a=J(t)),o&&(u+=c)}let p=t.length-3;const d=t[p],m=t[p+1],f=0===s?d:m;f>=i&&f<=r&&Y(a,d,m,t[p+2]),p=a.length-3,n&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&Y(a,a[0],a[1],a[2]),a.length&&e.push(a)}function J(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function K(t,e,i,r,s,n){for(const o of t)X(o,e,i,r,s,n,!1)}function Y(t,e,i,r){t.push(e,i,r)}function Q(t,e,i,r,s,n){const o=(n-e)/(r-e);return Y(t,n,i+(s-i)*o,1),o}function tt(t,e,i,r,s,n){const o=(n-i)/(s-i);return Y(t,e+(r-e)*o,n,1),o}function et(t,e){const i=[];for(let r=0;r<t.length;r++){const s=t[r],n=s.type;let o;if("Point"===n||"MultiPoint"===n||"LineString"===n)o=it(s.geometry,e);else if("MultiLineString"===n||"Polygon"===n){o=[];for(const t of s.geometry)o.push(it(t,e))}else if("MultiPolygon"===n){o=[];for(const t of s.geometry){const i=[];for(const r of t)i.push(it(r,e));o.push(i)}}i.push(V(s.id,n,o,s.tags))}return i}function it(t,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(let r=0;r<t.length;r+=3)i.push(t[r]+e,t[r+1],t[r+2]);return i}function rt(t,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,s=t.y;for(const n of t.features){const t=n.geometry,o=n.type;if(n.geometry=[],1===o)for(let o=0;o<t.length;o+=2)n.geometry.push(st(t[o],t[o+1],e,i,r,s));else for(let o=0;o<t.length;o++){const a=[];for(let n=0;n<t[o].length;n+=2)a.push(st(t[o][n],t[o][n+1],e,i,r,s));n.geometry.push(a)}}return t.transformed=!0,t}function st(t,e,i,r,s,n){return[Math.round(i*(t*r-s)),Math.round(i*(e*r-n))]}function nt(t,e,i,r,s){const n=e===s.maxZoom?0:s.tolerance/((1<<e)*s.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:i,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)ot(o,e,n,s);return o}function ot(t,e,i,r){const s=e.geometry,n=e.type,o=[];if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===n||"MultiPoint"===n)for(let e=0;e<s.length;e+=3)o.push(s[e],s[e+1]),t.numPoints++,t.numSimplified++;else if("LineString"===n)at(o,s,t,i,!1,!1);else if("MultiLineString"===n||"Polygon"===n)for(let e=0;e<s.length;e++)at(o,s[e],t,i,"Polygon"===n,0===e);else if("MultiPolygon"===n)for(let e=0;e<s.length;e++){const r=s[e];for(let e=0;e<r.length;e++)at(o,r[e],t,i,!0,0===e)}if(o.length){let i=e.tags||null;if("LineString"===n&&r.lineMetrics){i={};for(const t in e.tags)i[t]=e.tags[t];i.mapbox_clip_start=s.start/s.size,i.mapbox_clip_end=s.end/s.size}const a={geometry:o,type:"Polygon"===n||"MultiPolygon"===n?3:"LineString"===n||"MultiLineString"===n?2:1,tags:i};null!==e.id&&(a.id=e.id),t.features.push(a)}}function at(t,e,i,r,s,n){const o=r*r;if(r>0&&e.size<(s?o:r))return void(i.numPoints+=e.length/3);const a=[];for(let t=0;t<e.length;t+=3)(0===r||e[t+2]>o)&&(i.numSimplified++,a.push(e[t],e[t+1])),i.numPoints++;s&&function(t,e){let i=0;for(let e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===e)for(let e=0,i=t.length;e<i/2;e+=2){const r=t[e],s=t[e+1];t[e]=t[i-2-e],t[e+1]=t[i-1-e],t[i-2-e]=r,t[i-1-e]=s}}(a,n),t.push(a)}const lt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ct{constructor(t,e){const i=(e=this.options=function(t,e){for(const i in e)t[i]=e[i];return t}(Object.create(lt),e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const i=[];if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)N(i,t.features[r],e,r);else N(i,"Feature"===t.type?t:{geometry:t},e);return i}(t,e);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const i=e.buffer/e.extent;let r=t;const s=W(t,1,-1-i,i,0,-1,2,e),n=W(t,1,1-i,2+i,0,-1,2,e);return(s||n)&&(r=W(t,1,-i,1+i,0,-1,2,e)||[],s&&(r=et(s,1).concat(r)),n&&(r=r.concat(et(n,-1)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),i&&(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)))}splitTile(t,e,i,r,s,n,o){const a=[t,e,i,r],l=this.options,c=l.debug;for(;a.length;){r=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,u=ht(e,i,r);let p=this.tiles[u];if(!p&&(c>1&&console.time("creation"),p=this.tiles[u]=nt(t,e,i,r,l),this.tileCoords.push({z:e,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(p.source=t,null==s){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===s)continue;if(null!=s){const t=s-e;if(i!==n>>t||r!==o>>t)continue}}if(p.source=null,0===t.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,m=.5-d,f=.5+d,_=1+d;let g=null,y=null,x=null,v=null,b=W(t,h,i-d,i+f,0,p.minX,p.maxX,l),w=W(t,h,i+m,i+_,0,p.minX,p.maxX,l);t=null,b&&(g=W(b,h,r-d,r+f,1,p.minY,p.maxY,l),y=W(b,h,r+m,r+_,1,p.minY,p.maxY,l),b=null),w&&(x=W(w,h,r-d,r+f,1,p.minY,p.maxY,l),v=W(w,h,r+m,r+_,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],e+1,2*i,2*r),a.push(y||[],e+1,2*i,2*r+1),a.push(x||[],e+1,2*i+1,2*r),a.push(v||[],e+1,2*i+1,2*r+1)}}getTile(t,e,i){t=+t,e=+e,i=+i;const r=this.options,{extent:s,debug:n}=r;if(t<0||t>24)return null;const o=1<<t,a=ht(t,e=e+o&o-1,i);if(this.tiles[a])return rt(this.tiles[a],s);n>1&&console.log("drilling down to z%d-%d-%d",t,e,i);let l,c=t,h=e,u=i;for(;!l&&c>0;)c--,h>>=1,u>>=1,l=this.tiles[ht(c,h,u)];return l&&l.source?(n>1&&(console.log("found parent tile z%d-%d-%d",c,h,u),console.time("drilling down")),this.splitTile(l.source,c,h,u,t,e,i),n>1&&console.timeEnd("drilling down"),this.tiles[a]?rt(this.tiles[a],s):null):null}}function ht(t,e,i){return 32*((1<<t)*i+e)+t}function ut(t,e){return e?t.properties[e]:t.id}function pt(t,e){if(null==t)return!0;if("Feature"===t.type)return null!=ut(t,e);if("FeatureCollection"===t.type){const i=new Set;for(const r of t.features){const t=ut(r,e);if(null==t)return!1;if(i.has(t))return!1;i.add(t)}return!0}return!1}function dt(t,e){const i=new Map;if(null==t);else if("Feature"===t.type)i.set(ut(t,e),t);else for(const r of t.features)i.set(ut(r,e),r);return i}class mt extends n{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(e,i){return t._(this,void 0,void 0,function*(){const i=e.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return null;const s=new class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.X,this.length=e.length,this._features=e}feature(e){return new class{constructor(e){this._feature=e,this.extent=t.X,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const i of this._feature.geometry)e.push([new t.P(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const r=[];for(const e of i)r.push(new t.P(e[0],e[1]));e.push(r)}return e}}toGeoJSON(t,e,i){return h.call(this,t,e,i)}}(this._features[e])}}(r.features);let n=P(s);return 0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:s,rawData:n.buffer}})}loadData(e){return t._(this,void 0,void 0,function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.bv(e.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(e,this._pendingRequest),this._geoJSONIndex=e.cluster?new z(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const r={},s={},n={accumulated:null,zoom:0},o={properties:null},a=Object.keys(i);for(const e of a){const[n,o]=i[e],a=t.bC(o),l=t.bC("string"==typeof n?[n,["accumulated"],["get",e]]:n);r[e]=a.value,s[e]=l.value}return e.map=t=>{o.properties=t;const e={};for(const t of a)e[t]=r[t].evaluate(n,o);return e},e.reduce=(t,e)=>{o.properties=e;for(const e of a)n.accumulated=t[e],t[e]=s[e].evaluate(n,o)},e}(e)).load((yield this._pendingData).features):(s=yield this._pendingData,new ct(s,e.geojsonVtOptions)),this.loaded={};const i={};if(r){const t=r.finish();t&&(i.resourceTiming={},i.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}return i}catch(e){if(delete this._pendingRequest,t.bB(e))return{abandoned:!0};throw e}var s})}getData(){return t._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(t){const e=this.loaded;return e&&e[t.uid]?super.reloadTile(t):this.loadTile(t)}loadAndProcessGeoJSON(e,i){return t._(this,void 0,void 0,function*(){let r=yield this.loadGeoJSON(e,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(c(r,!0),e.filter){const i=t.bC(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map(t=>`${t.key}: ${t.message}`).join(", "));const s=r.features.filter(t=>i.value.evaluate({zoom:0},t));r={type:"FeatureCollection",features:s}}return r})}loadGeoJSON(e,i){return t._(this,void 0,void 0,function*(){const{promoteId:r}=e;if(e.request){const s=yield t.h(e.request,i);return this._dataUpdateable=pt(s.data,r)?dt(s.data,r):void 0,s.data}if("string"==typeof e.data)try{const t=JSON.parse(e.data);return this._dataUpdateable=pt(t,r)?dt(t,r):void 0,t}catch(t){throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`)}if(!e.dataDiff)throw new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${e.source}`);
2return function(t,e,i){var r,s,n,o;if(e.removeAll&&t.clear(),e.remove)for(const i of e.remove)t.delete(i);if(e.add)for(const r of e.add){const e=ut(r,i);null!=e&&t.set(e,r)}if(e.update)for(const i of e.update){let e=t.get(i.id);if(null==e)continue;const a=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0);if((i.newGeometry||i.removeAllProperties||a)&&(e=Object.assign({},e),t.set(i.id,e),a&&(e.properties=Object.assign({},e.properties))),i.newGeometry&&(e.geometry=i.newGeometry),i.removeAllProperties)e.properties={};else if((null===(n=i.removeProperties)||void 0===n?void 0:n.length)>0)for(const t of i.removeProperties)Object.prototype.hasOwnProperty.call(e.properties,t)&&delete e.properties[t];if((null===(o=i.addOrUpdateProperties)||void 0===o?void 0:o.length)>0)for(const{key:t,value:r}of i.addOrUpdateProperties)e.properties[t]=r}}(this._dataUpdateable,e.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(e){return t._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset)}}class ft{constructor(e){this.self=e,this.actor=new t.F(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(t,e)=>{if(this.externalWorkerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.externalWorkerSourceTypes[t]=e},this.self.addProtocol=t.bi,this.self.removeProtocol=t.bj,this.self.registerRTLTextPlugin=e=>{if(t.bD.isParsed())throw new Error("RTL text plugin already registered.");t.bD.setMethods(e)},this.actor.registerMessageHandler("LDT",(t,e)=>this._getDEMWorkerSource(t,e.source).loadTile(e)),this.actor.registerMessageHandler("RDT",(e,i)=>t._(this,void 0,void 0,function*(){this._getDEMWorkerSource(e,i.source).removeTile(i)})),this.actor.registerMessageHandler("GCEZ",(e,i)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,i.type,i.source).getClusterExpansionZoom(i)})),this.actor.registerMessageHandler("GCC",(e,i)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,i.type,i.source).getClusterChildren(i)})),this.actor.registerMessageHandler("GCL",(e,i)=>t._(this,void 0,void 0,function*(){return this._getWorkerSource(e,i.type,i.source).getClusterLeaves(i)})),this.actor.registerMessageHandler("LD",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadData(e)),this.actor.registerMessageHandler("GD",(t,e)=>this._getWorkerSource(t,e.type,e.source).getData()),this.actor.registerMessageHandler("LT",(t,e)=>this._getWorkerSource(t,e.type,e.source).loadTile(e)),this.actor.registerMessageHandler("RT",(t,e)=>this._getWorkerSource(t,e.type,e.source).reloadTile(e)),this.actor.registerMessageHandler("AT",(t,e)=>this._getWorkerSource(t,e.type,e.source).abortTile(e)),this.actor.registerMessageHandler("RMT",(t,e)=>this._getWorkerSource(t,e.type,e.source).removeTile(e)),this.actor.registerMessageHandler("RS",(e,i)=>t._(this,void 0,void 0,function*(){if(!this.workerSources[e]||!this.workerSources[e][i.type]||!this.workerSources[e][i.type][i.source])return;const t=this.workerSources[e][i.type][i.source];delete this.workerSources[e][i.type][i.source],void 0!==t.removeSource&&t.removeSource(i)})),this.actor.registerMessageHandler("RM",e=>t._(this,void 0,void 0,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e]})),this.actor.registerMessageHandler("SR",(e,i)=>t._(this,void 0,void 0,function*(){this.referrer=i})),this.actor.registerMessageHandler("SRPS",(t,e)=>this._syncRTLPluginState(t,e)),this.actor.registerMessageHandler("IS",(e,i)=>t._(this,void 0,void 0,function*(){this.self.importScripts(i)})),this.actor.registerMessageHandler("SI",(t,e)=>this._setImages(t,e)),this.actor.registerMessageHandler("UL",(e,i)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).update(i.layers,i.removedIds)})),this.actor.registerMessageHandler("SL",(e,i)=>t._(this,void 0,void 0,function*(){this._getLayerIndex(e).replace(i)}))}_setImages(e,i){return t._(this,void 0,void 0,function*(){this.availableImages[e]=i;for(const t in this.workerSources[e]){const r=this.workerSources[e][t];for(const t in r)r[t].availableImages=i}})}_syncRTLPluginState(e,i){return t._(this,void 0,void 0,function*(){if(t.bD.isParsed())return t.bD.getState();if("loading"!==i.pluginStatus)return t.bD.setState(i),i;const e=i.pluginURL;if(this.self.importScripts(e),t.bD.isParsed()){const i={pluginStatus:"loaded",pluginURL:e};return t.bD.setState(i),i}throw t.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let i=this.layerIndexes[t];
vendor: 27,395 bytes, line 2
2return i||(i=this.layerIndexes[t]=new e),i}_getWorkerSource(t,e,i){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][i]){const r={sendAsync:(e,i)=>(e.targetMapId=t,this.actor.sendAsync(e,i))};switch(e){case"vector":this.workerSources[t][e][i]=new n(r,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][i]=new mt(r,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][i]=new this.externalWorkerSourceTypes[e](r,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][i]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new o),this.demWorkerSources[t][e]}}return t.i(self)&&(self.worker=new ft(self)),ft}),i("index",0,function(t,e){var i="4.7.1";let r,s;const n={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:t=>new Promise((i,r)=>{const s=requestAnimationFrame(i);t.signal.addEventListener("abort",()=>{cancelAnimationFrame(s),r(e.c())})}),getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(r||(r=document.createElement("a")),r.href=t,r.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==s&&(s=matchMedia("(prefers-reduced-motion: reduce)")),s.matches)}};class o{static testProp(t){if(!o.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in o.docStyle)return t[e];return t[0]}static create(t,e,i){const r=window.document.createElement(t);return void 0!==e&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){o.docStyle&&o.selectProp&&(o.userSelect=o.docStyle[o.selectProp],o.docStyle[o.selectProp]="none")}static enableDrag(){o.docStyle&&o.selectProp&&(o.docStyle[o.selectProp]=o.userSelect)}static setTransform(t,e){t.style[o.transformProp]=e}static addEventListener(t,e,i,r={}){t.addEventListener(e,i,"passive"in r?r:r.capture)}static removeEventListener(t,e,i,r={}){t.removeEventListener(e,i,"passive"in r?r:r.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",o.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",o.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",o.suppressClickInternal,!0)},0)}static getScale(t){const e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,r){const s=i.boundingClientRect;return new e.P((r.clientX-s.left)/i.x-t.clientLeft,(r.clientY-s.top)/i.y-t.clientTop)}static mousePos(t,e){const i=o.getScale(t);return o.getPoint(t,i,e)}static touchPos(t,e){const i=[],r=o.getScale(t);for(let s=0;s<e.length;s++)i.push(o.getPoint(t,r,e[s]));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}o.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,o.selectProp=o.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),o.transformProp=o.testProp(["transform","WebkitTransform"]);const a={supported:!1,testSupport:function(t){!h&&c&&(u?p(t):l=t)}};let l,c,h=!1,u=!1;function p(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,c),t.isContextLost())return;a.supported=!0}catch(t){}t.deleteTexture(e),h=!0}var d;"undefined"!=typeof document&&(c=document.createElement("img"),c.onload=()=>{l&&p(l),l=null,u=!0},c.onerror=()=>{h=!0,l=null},c.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let i,r,s,n;t.resetRequestQueue=()=>{i=[],r=0,s=0,n={}},t.addThrottleControl=t=>{const e=s++;return n[e]=t,e},t.removeThrottleControl=t=>{delete n[t],l()},t.getImage=(t,r,s=!0)=>new Promise((n,o)=>{a.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),i.push({abortController:r,requestParameters:t,supportImageRefresh:s,state:"queued",onError:t=>{o(t)},onSuccess:t=>{n(t)}}),l()});const o=t=>e._(this,void 0,void 0,function*(){t.state="running";const{requestParameters:i,supportImageRefresh:s,onError:n,onSuccess:o,abortController:a}=t,h=!1===s&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce((t,e)=>t&&"accept"===e,!0));r++;const u=h?c(i,a):e.m(i,a);try{const i=yield u;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?o(i):i.data&&o({data:yield(p=i.data,"function"==typeof createImageBitmap?e.d(p):e.f(p)),cacheControl:i.cacheControl,expires:i.expires})}catch(e){delete t.abortController,n(e)}finally{r--,l()}var p}),l=()=>{const t=(()=>{for(const t of Object.keys(n))if(n[t]())return!0;return!1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=r;e<t&&i.length>0;e++){const t=i.shift();t.abortController.signal.aborted?e--:o(t)}},c=(t,i)=>new Promise((r,s)=>{const n=new Image,o=t.url,a=t.credentials;a&&"include"===a?n.crossOrigin="use-credentials":(a&&"same-origin"===a||!e.s(o))&&(n.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{n.src="",s(e.c())}),n.fetchPriority="high",n.onload=()=>{n.onerror=n.onload=null,r({data:n})},n.onerror=()=>{n.onerror=n.onload=null,i.signal.aborted||s(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},n.src=o})}(d||(d={})),d.resetRequestQueue();class m{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function f(t){var i=new e.A(3);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i}var _,g=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};_=new e.A(3),e.A!=Float32Array&&(_[0]=0,_[1]=0,_[2]=0);var y=function(t){var e=t[0],i=t[1];return e*e+i*i};function x(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:r,url:s}of t){const t=`${r}${s}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:r,url:s}))}}return e}function v(t,e,i){const r=t.split("?");return r[0]+=`${e}${i}`,r.join("?")}!function(){var t=new e.A(2);e.A!=Float32Array&&(t[0]=0,t[1]=0)}();class b{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,r)}update(t,i,r){const{width:s,height:n}=t,o=!(this.size&&this.size[0]===s&&this.size[1]===n||r),{context:a}=this,{gl:l}=a;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),o)this.size=[s,n],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,s,n,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:i,y:o}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,o,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,o,s,n,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:r}=this,{gl:s}=r;s.bindTexture(s.TEXTURE_2D,this.texture),i!==s.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=s.LINEAR),t!==this.filter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function w(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class T extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[]}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,i){let r=!0;const s=i.data||i.spriteData;return this._validateStretch(i.stretchX,s&&s.width)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,s&&s.height)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.j(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(t,e){if(!t)return!0;let i=0;for(const r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(4!==t.length)return!1;const i=e.spriteData,r=i&&i.width||e.data.width,s=i&&i.height||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||s<t[1]||t[2]<0||r<t[2]||t[3]<0||s<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((e,i)=>{let r=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(r=!1);this.isLoaded()||r?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})})}_getImagesForIds(t){const i={};for(const r of t){let t=this.getImage(r);t||(this.fire(new e.k("styleimagemissing",{id:r})),t=this.getImage(r)),t?i[r]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${r}" 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 i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){const i=this.patterns[t],r=this.getImage(t);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},s=new e.I(i,r);this.patterns[t]={bin:i,position:s}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new b(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:r}=e.p(t),s=this.atlasImage;s.resize({width:i||1,height:r||1});for(const t in this.patterns){const{bin:i}=this.patterns[t],r=i.x+1,n=i.y+1,o=this.getImage(t).data,a=o.width,l=o.height;e.R.copy(o,s,{x:0,y:0},{x:r,y:n},{width:a,height:l}),e.R.copy(o,s,{x:0,y:l-1},{x:r,y:n-1},{width:a,height:1}),e.R.copy(o,s,{x:0,y:0},{x:r,y:n+l},{width:a,height:1}),e.R.copy(o,s,{x:a-1,y:0},{x:r-1,y:n},{width:1,height:l}),e.R.copy(o,s,{x:0,y:0},{x:r+a,y:n},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: "${i}" was not found`),w(t)&&this.updateImage(i,t)}}}const S=1e20;function I(t,e,i,r,s,n,o,a,l){for(let c=e;c<e+r;c++)A(t,i*n+c,n,s,o,a,l);for(let c=i;c<i+s;c++)A(t,c*n+e,1,r,o,a,l)}function A(t,e,i,r,s,n,o){n[0]=0,o[0]=-S,o[1]=S,s[0]=t[e];for(let a=1,l=0,c=0;a<r;a++){s[a]=t[e+a*i];const r=a*a;do{const t=n[l];c=(s[a]-s[t]+r-t*t)/(a-t)/2}while(c<=o[l]&&--l>-1);l++,n[l]=a,o[l]=c,o[l+1]=S}for(let a=0,l=0;a<r;a++){for(;o[l+1]<a;)l++;const r=n[l],c=a-r;t[e+a*i]=s[r]+c*c}}class P{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t){return e._(this,void 0,void 0,function*(){const e=[];for(const i in t)for(const r of t[i])e.push(this._getAndCacheGlyphsPromise(i,r));const i=yield Promise.all(e),r={};for(const{stack:t,id:e,glyph:s}of i)r[t]||(r[t]={}),r[t][e]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return r})}_getAndCacheGlyphsPromise(t,i){return e._(this,void 0,void 0,function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=e.glyphs[i];if(void 0!==r)return{stack:t,id:i,glyph:r};if(r=this._tinySDF(e,t,i),r)return e.glyphs[i]=r,{stack:t,id:i,glyph:r};const s=Math.floor(i/256);if(256*s>65535)throw new Error("glyphs > 65535 not supported");if(e.ranges[s])return{stack:t,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!e.requests[s]){const i=P.loadGlyphRange(t,s,this.url,this.requestManager);e.requests[s]=i}const n=yield e.requests[s];for(const t in n)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=n[+t]);return e.ranges[s]=!0,{stack:t,id:i,glyph:n[i]||null}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(t))}_tinySDF(t,i,r){const s=this.localIdeographFontFamily;if(!s)return;if(!this._doesCharSupportLocalGlyph(r))return;let n=t.tinySDF;if(!n){let e="400";/bold/i.test(i)?e="900":/medium/i.test(i)?e="500":/light/i.test(i)&&(e="200"),n=t.tinySDF=new P.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:s,fontWeight:e})}const o=n.draw(String.fromCharCode(r));return{id:r,bitmap:new e.o({width:o.width||60,height:o.height||60},o.data),metrics:{width:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:o.glyphAdvance/2||24,isDoubleResolution:!0}}}}P.loadGlyphRange=function(t,i,r,s){return e._(this,void 0,void 0,function*(){const n=256*i,o=n+255,a=s.transformRequest(r.replace("{fontstack}",t).replace("{range}",`${n}-${o}`),"Glyphs"),l=yield e.l(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${n}-${o}`);const c={};for(const t of e.n(l.data))c[t.id]=t;return c})},P.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=.25,fontFamily:s="sans-serif",fontWeight:n="normal",fontStyle:o="normal"}={}){this.buffer=e,this.cutoff=r,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${n} ${t}px ${s}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:s,actualBoundingBoxRight:n}=this.ctx.measureText(t),o=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n-s))),l=Math.min(this.size-this.buffer,o+Math.ceil(r)),c=a+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),p=new Uint8ClampedArray(u),d={data:p,width:c,height:h,glyphWidth:a,glyphHeight:l,glyphTop:o,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return d;const{ctx:m,buffer:f,gridInner:_,gridOuter:g}=this;m.clearRect(f,f,a,l),m.fillText(t,f,f+o);const y=m.getImageData(f,f,a,l);g.fill(S,0,u),_.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const i=y.data[4*(t*a+e)+3]/255;if(0===i)continue;const r=(t+f)*c+e+f;if(1===i)g[r]=0,_[r]=S;else{const t=.5-i;g[r]=t>0?t*t:0,_[r]=t<0?t*t:0}}I(g,0,0,c,h,c,this.f,this.v,this.z),I(_,f,f,a,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(g[t])-Math.sqrt(_[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};class C{constructor(){this.specification=e.v.light.position}possiblyEvaluate(t,i){return e.x(t.expression.evaluate(i))}interpolate(t,i,r){return{x:e.y.number(t.x,i.x,r),y:e.y.number(t.y,i.y,r),z:e.y.number(t.z,i.z,r)}}}let M;class k extends e.E{constructor(t){super(),M=M||new e.q({anchor:new e.D(e.v.light.anchor),position:new C,color:new e.D(e.v.light.color),intensity:new e.D(e.v.light.intensity)}),this._transitionable=new e.T(M),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,i={}){if(!this._validate(e.r,t,i))for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r){return(!r||!1!==r.validate)&&e.t(this,t.call(e.u,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v}))}}const z=new e.q({"sky-color":new e.D(e.v.sky["sky-color"]),"horizon-color":new e.D(e.v.sky["horizon-color"]),"fog-color":new e.D(e.v.sky["fog-color"]),"fog-ground-blend":new e.D(e.v.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.v.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.v.sky["atmosphere-blend"])});class E extends e.E{constructor(t){super(),this._transitionable=new e.T(z),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.z(0))}setSky(t,i={}){if(!this._validate(e.B,t,i)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const e in t){const i=t[e];e.endsWith("-transition")?this._transitionable.setTransition(e.slice(0,-11),i):this._transitionable.setValue(e,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,r={}){return!1!==(null==r?void 0:r.validate)&&e.t(this,t.call(e.u,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.v})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class D{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){const i=t.join(",")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const r=[];let s=t.length%2==1?-t[t.length-1]*i:0,n=t[0]*i,o=!0;r.push({left:s,right:n,isDash:o,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){o=!o;const l=t[e];s=a*i,a+=l,n=a*i,r.push({left:s,right:n,isDash:o,zeroLength:0===l})}return r}addRoundDash(t,e,i){const r=e/2;for(let e=-i;e<=i;e++){const s=this.width*(this.nextRow+i+e);let n=0,o=t[n];for(let a=0;a<this.width;a++){a/o.right>1&&(o=t[++n]);const l=Math.abs(a-o.left),c=Math.abs(a-o.right),h=Math.min(l,c);let u;const p=e/i*(r+1);if(o.isDash){const t=r-Math.abs(p);u=Math.sqrt(h*h+t*t)}else u=r-Math.sqrt(h*h+p*p);this.data[s+a]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],r=t[e+1];i.zeroLength?t.splice(e,1):r&&r.isDash===i.isDash&&(r.left=i.left,t.splice(e,1))}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const r=this.width*this.nextRow;let s=0,n=t[s];for(let e=0;e<this.width;e++){e/n.right>1&&(n=t[++s]);const i=Math.abs(e-n.left),o=Math.abs(e-n.right),a=Math.min(i,o);this.data[r+e]=Math.max(0,Math.min(255,(n.isDash?a:-a)+128))}}addDash(t,i){const r=i?7:0,s=2*r+1;if(this.nextRow+s>this.height)return e.w("LineAtlas out of space"),null;let n=0;for(let e=0;e<t.length;e++)n+=t[e];if(0!==n){const e=this.width/n,s=this.getDashRanges(t,this.width,e);i?this.addRoundDash(s,e,r):this.addRegularDash(s)}const o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:n};return this.nextRow+=s,this.dirty=!0,o}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}const L="maplibre_preloaded_worker_pool";class R{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<R.workerCount;)this.workers.push(new Worker(e.a.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[L]}numActive(){return Object.keys(this.active).length}}const B=Math.floor(n.hardwareConcurrency/2);let F,O;function V(){return F||(F=new R),F}R.workerCount=e.C(globalThis)?Math.max(Math.min(B,3),1):1;class U{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let t=0;t<r.length;t++){const s=new e.F(r[t],i);s.name=`Worker ${t}`,this.actors.push(s)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const i=[];for(const r of this.actors)i.push(r.sendAsync({type:t,data:e}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(const i of this.actors)i.registerMessageHandler(t,e)}}function N(){return O||(O=new U(V(),e.G),O.registerMessageHandler("GR",(t,i,r)=>e.m(i,r))),O}function j(t,i){const r=e.H();return e.J(r,r,[1,1,0]),e.K(r,r,[.5*t.width,.5*t.height,1]),e.L(r,r,t.calculatePosMatrix(i.toUnwrapped()))}function $(t,e,i,r,s,n){const o=function(t,e,i){if(t)for(const r of t){const t=e[r];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const r=e[t];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(s&&s.layers,e,t.id),a=n.maxPitchScaleFactor(),l=t.tilesIn(r,a,o);l.sort(q);const c=[];for(const r of l)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(e,i,t._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,s,n,a,j(t.transform,r.tileID))});const h=function(t){const e={},i={};for(const r of t){const t=r.queryResults,s=r.wrappedTileID,n=i[s]=i[s]||{};for(const i in t){const r=t[i],s=n[i]=n[i]||{},o=e[i]=e[i]||[];for(const t of r)s[t.featureIndex]||(s[t.featureIndex]=!0,o.push(t))}}return e}(c);for(const e in h)h[e].forEach(e=>{const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r});return h}function q(t,e){const i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Z(t,i,r){return e._(this,void 0,void 0,function*(){let s=t;if(t.url?s=(yield e.h(i.transformRequest(t.url,"Source"),r)).data:yield n.frameAsync(r),!s)return null;const o=e.M(e.e(s,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(t=>t.id)),o})}class G{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}extend(t){const i=this._sw,r=this._ne;let s,n;if(t instanceof e.N)s=t,n=t;else{if(!(t instanceof G))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(G.convert(t)):this.extend(e.N.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.N.convert(t)):this;if(s=t._sw,n=t._ne,!s||!n)return this}return i||r?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)):(this._sw=new e.N(s.lng,s.lat),this._ne=new e.N(n.lng,n.lat)),this}getCenter(){return new e.N((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 e.N(this.getWest(),this.getNorth())}getSouthEast(){return new e.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:i,lat:r}=e.N.convert(t);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&s}static convert(t){return t instanceof G?t:t?new G(t):t}static fromLngLat(t,i=0){const r=360*i/40075017,s=r/Math.cos(Math.PI/180*t.lat);return new G(new e.N(t.lng-s,t.lat-r),new e.N(t.lng+s,t.lat+r))}adjustAntiMeridian(){const t=new e.N(this._sw.lng,this._sw.lat),i=new e.N(this._ne.lng,this._ne.lat);return new G(t,t.lng>i.lng?new e.N(i.lng+360,i.lat):i)}}class W{constructor(t,e,i){this.bounds=G.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}
vendor: 2,341 bytes, line 2
2validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),r=Math.floor(e.O(this.bounds.getWest())*i),s=Math.floor(e.Q(this.bounds.getNorth())*i),n=Math.ceil(e.O(this.bounds.getEast())*i),o=Math.ceil(e.Q(this.bounds.getSouth())*i);return t.x>=r&&t.x<n&&t.y>=s&&t.y<o}}class H extends e.E{constructor(t,i,r,s){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.M(i,["url","scheme","tileSize","promoteId"])),this._options=e.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s)}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Z(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t&&(e.e(this,t),t.bounds&&(this.tileBounds=new W(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise((e,i)=>{t.reloadPromise={resolve:e,reject:i}})}else t.actor=this.dispatcher.getActor(),r="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e)}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null)}})}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject)}}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
2ype,source:this.id}}))})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class X extends e.E{constructor(t,i,r,s){super(),this.id=t,this.dispatcher=r,this.setEventedParent(s),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},i),e.e(this,e.M(i,["url","scheme","tileSize"]))}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Z(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(e.e(this,t),t.bounds&&(this.tileBounds=new W(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return e.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield d.getImage(this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const e=this.map.painter.context,r=e.gl,s=i.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new b(e,s,r.RGBA,{useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}class J extends X{constructor(t,i,r,s){super(t,i,r,s),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(t){return e._(this,void 0,void 0,function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield d.getImage(r,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const s=e.b(r)&&e.U()?r:yield this.readImageNow(r),n={type:this.type,uid:t.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||"expired"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:"LDT",data:n});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}
vendor: 4,157 bytes, line 2
2catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}})}readImageNow(t){return e._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&e.V()){const i=t.width+2,r=t.height+2;try{return new e.R({width:i,height:r},yield e.W(t,-1,-1,i,r))}catch(t){}}return n.getImageData(t,1)})}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),s=(i.x-1+r)%r,n=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.S(t.overscaledZ,n,i.z,s,i.y).key]={backfilled:!1},l[new e.S(t.overscaledZ,a,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.S(t.overscaledZ,n,i.z,s,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,a,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.S(t.overscaledZ,n,i.z,s,i.y+1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.S(t.overscaledZ,a,i.z,o,i.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}class K extends e.E{constructor(t,i,r,s){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(s),this._data=i.data,this._options=e.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const n=e.X/this.tileSize;void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=e.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*n,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*n,extent:e.X,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.X,radius:(i.clusterRadius||50)*n,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}load(){return e._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}getData(){return e._(this,void 0,void 0,function*(){const t=e.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})})}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(t){return e._(this,void 0,void 0,function*(){const i=e.e({type:this.type},this.workerOptions);t?i.dataDiff=t:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(n.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new e.k("dataloading",{dataType:"source"}));try{const t=yield this.actor.sendAsync({type:"LD",data:i});
2if(this._pendingLoads--,this._removed||t.abandoned)return void this.fire(new e.k("dataabort",{dataType:"source"}));let r=null;t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0));const s={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&e.e(s,{resourceTiming:r}),this.fire(new e.k("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new e.k("data",Object.assign(Object.assign({},s),{sourceDataType:"content"})))}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.k("dataabort",{dataType:"source"}));this.fire(new e.j(t))}})}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const r=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,"RT"===e)})}abortTile(t){return e._(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return e._(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
2ype,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Y=e.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Q extends e.E{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t){return e._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new e.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield d.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new e.j(t))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const i=t.map(e.Z.fromLngLat);this.tileID=function(t){let i=1/0,r=1/0,s=-1/0,n=-1/0;for(const e of t)i=Math.min(i,e.x),r=Math.min(r,e.y),s=Math.max(s,e.x),n=Math.max(n,e.y);const o=Math.max(s-i,n-r),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,a);return new e.a1(a,Math.floor((i+s)/2*l),Math.floor((r+n)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const r=i.map(t=>this.tileID.getTilePoint(t)._round());return this._boundsArray=new e.$,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,e.X,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,e.X),this._boundsArray.emplaceBack(r[2].x,r[2].y,e.X,e.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new b(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return e._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class tt extends Q{constructor(t,e,i,r){super(t,e,i,r),this.roundZoom=!0,this.type="video",this.options=e}load(){return e._(this,void 0,void 0,function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,"Source").url);try{const t=yield e.a3(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new e.j(t))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.j(new e.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}
vendor: 4,449 bytes, line 2
2onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new b(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class et extends Q{constructor(t,i,r,s){super(t,i,r,s),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(t=>!Array.isArray(t)||2!==t.length||t.some(t=>"number"!=typeof t))||this.fire(new e.j(new e.a2(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.j(new e.a2(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.j(new e.a2(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.j(new e.a2(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.j(new e.a2(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return e._(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 e.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new b(i,this.canvas,r.RGBA,{premultiply:!0});let s=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,s=!0)}s&&this.fire(new e.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const it={},rt=t=>{switch(t){case"geojson":return K;case"image":return Q;case"raster":return X;case"raster-dem":return J;case"vector":return H;case"video":return tt;case"canvas":return et}return it[t]},st="RTLPluginLoaded";class nt extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=N()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(t=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return e._(this,arguments,void 0,function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=n.resolveURL(t),!this.url)throw new Error(`requested url ${t}
2 is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return e._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.k(st))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let ot=null;function at(){return ot||(ot=new nt),ot}class lt{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,i,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const r of t){const t=r.layerIds.map(t=>e.getLayer(t)).filter(Boolean);if(0!==t.length){r.layers=t,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(e=>t.filter(t=>t.id===e)[0]));for(const e of t)i[e.id]=r}}return i}(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6&&i.hasRTLText){this.hasRTLText=!0,at().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new e.a5}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t)}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new b(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new b(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,s,n,o,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:s,scale:n,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:o,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(t,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const s=r.loadVTLayers(),n=i&&i.sourceLayer?i.sourceLayer:"",o=s._geojsonTileLayer||s[n];if(!o)return;const a=e.a7(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<o.length;i++){const s=o.feature(i);if(a.needGeometry){const t=e.a8(s,!0);if(!a.filter(new e.z(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new e.z(this.tileID.overscaledZ),s))continue;const p=r.getId(s,n),d=new e.a9(s,l,c,h,p);d.tile=u,t.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.aa(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const r=this.expirationTime-i;r?this.expirationTime=t+Math.max(r,3e4):e=!0}else e=!0;e?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!e.style.hasLayer(r))continue;const s=this.buckets[r],n=s.layers[0].sourceLayer||"_geojsonTileLayer",o=i[n],a=t[n];if(!o||!a||0===Object.keys(a).length)continue;s.update(a,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<n.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=n.now()+t}
vendor: 56,820 bytes, line 2
2setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return!0}return!1}}class ct{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const s={value:e,timeout:void 0};if(void 0!==i&&(s.timeout=setTimeout(()=>{this.remove(t,s)},i)),this.data[r].push(s),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,r=void 0===e?0:this.data[i].indexOf(e),s=this.data[i][r];return this.data[i].splice(r,1),s.timeout&&clearTimeout(s.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(s.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(t){const e=[];for(const i in this.data)for(const r of this.data[i])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t)}}class ht{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,r){const s=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][s]=this.stateChanges[t][s]||{},e.e(this.stateChanges[t][s],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==s&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][s]){this.deletedStates[t][s]={};for(const e in this.state[t][s])r[e]||(this.deletedStates[t][s][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][s]&&null===this.deletedStates[t][s][e]&&delete this.deletedStates[t][s][e]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const r=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][r]&&(this.deletedStates[t][r]=this.deletedStates[t][r]||{},this.deletedStates[t][r][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][r])for(i in this.deletedStates[t][r]={},this.stateChanges[t][r])this.deletedStates[t][r][i]=null;else this.deletedStates[t][r]=null;else this.deletedStates[t]=null}getState(t,i){const r=String(i),s=e.e({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return{};for(const t in e)delete s[t]}return s}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,i){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.e(this.state[t][r],this.stateChanges[t][r]),i[r]=this.state[t][r];r[t]=i}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e]}r[t]=r[t]||{},e.e(r[t],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].setFeatureState(r,i)}}class ut extends e.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",t=>this._dataHandler(t)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((t,e,i,r)=>{const s=new(rt(e.type))(t,e,i,r);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return s})(t,e,i,this),this._tiles={},this._cache=new ct(0,t=>this._unloadTile(t)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ht,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!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(const t in this._tiles){const e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,i,r){return e._(this,void 0,void 0,function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,r)}catch(i){t.state="errored",404!==i.status?this._source.fire(new e.j(i,{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.k("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(pt).map(t=>t.key)}getRenderableIds(t){const i=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&i.push(this._tiles[e]);return t?i.sort((t,i)=>{const r=t.tileID,s=i.tileID,n=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new e.P(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-s.overscaledZ||o.y-n.y||o.x-n.x}).map(t=>t.tileID.key):i.map(t=>t.tileID).sort(pt).map(t=>t.key)}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")}}_reloadTile(t,i){return e._(this,void 0,void 0,function*(){const e=this._tiles[t];e&&("loading"!==e.state&&(e.state=i),yield this._loadTile(e,t,i))})}_tileLoaded(t,i,r){t.timeAdded=n.now(),"expired"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),"raster-dem"===this.getSource().type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.k("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let r=0;r<e.length;r++){const s=e[r];if(t.neighboringTiles&&t.neighboringTiles[s]){const e=this.getTileByID(s);i(t,e),i(e,t)}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const r=e.tileID.canonical.y-t.tileID.canonical.y,s=Math.pow(2,t.tileID.canonical.z),n=e.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+s)?i+=s:1===Math.abs(i-s)&&(i-=s)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,r),t.neighboringTiles&&t.neighboringTiles[n]&&(t.neighboringTiles[n].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,r){for(const s in this._tiles){let n=this._tiles[s];if(r[s]||!n.hasData()||n.tileID.overscaledZ<=e||n.tileID.overscaledZ>i)continue;let o=n.tileID;for(;n&&n.tileID.overscaledZ>e+1;){const t=n.tileID.scaledTo(n.tileID.overscaledZ-1);n=this._tiles[t.key],n&&n.hasData()&&(o=t)}let a=o;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){r[o.key]=o;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),r=this._getLoadedTile(e);if(r)return r}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,s=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(n)}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t])}}_updateCoveredAndRetainedTiles(t,e,i,r,s,o){const a={},l={},c=Object.keys(t),h=n.now();for(const i of c){const r=t[i],s=this._tiles[i];if(!s||0!==s.fadeEndTime&&s.fadeEndTime<=h)continue;const n=this.findLoadedParent(r,e),o=this.findLoadedSibling(r),c=n||o||null;c&&(this._addTile(c.tileID),a[c.tileID.key]=c.tileID),l[i]=r}this._retainLoadedChildren(l,r,i,t);for(const e in a)t[e]||(this._coveredTiles[e]=!0,t[e]=a[e]);if(o){const e={},i={};for(const t of s)this._tiles[t.key].hasData()?e[t.key]=t:i[t.key]=t;for(const r in i){const s=i[r].children(this._source.maxzoom);this._tiles[s[0].key]&&this._tiles[s[1].key]&&this._tiles[s[2].key]&&this._tiles[s[3].key]&&(e[s[0].key]=t[s[0].key]=s[0],e[s[1].key]=t[s[1].key]=s[1],e[s[2].key]=t[s[2].key]=s[2],e[s[3].key]=t[s[3].key]=s[3],delete i[r])}for(const r in i){const s=i[r],n=this.findLoadedParent(s,this._source.minzoom),o=this.findLoadedSibling(s),a=n||o||null;if(a){e[a.tileID.key]=t[a.tileID.key]=a.tileID;for(const t in e)e[t].isChildOf(a.tileID)&&delete e[t]}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}update(t,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.S(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(r=r.filter(t=>this._source.hasTile(t)))):r=[];const s=t.coveringZoomLevel(this._source),n=Math.max(s-ut.maxOverzooming,this._source.minzoom),o=Math.max(s+ut.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of r)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const r=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[r.key]=r}r=r.concat(Object.values(t))}const a=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new e.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,s);dt(this._source.type)&&this._updateCoveredAndRetainedTiles(l,n,o,s,r,i);for(const t in l)this._tiles[t].clearFadeHold();const c=e.ab(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;const r={},s={},n=Math.max(e-ut.maxOverzooming,this._source.minzoom),o=Math.max(e+ut.maxUnderzooming,this._source.minzoom),a={};for(const i of t){const t=this._addTile(i);r[i.key]=i,t.hasData()||e<this._source.maxzoom&&(a[i.key]=i)}this._retainLoadedChildren(a,e,o,r);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){r[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(r[t[0].key]&&r[t[1].key]&&r[t[2].key]&&r[t[3].key])continue}let a=t.wasRequested();for(let e=o.overscaledZ-1;e>=n;--e){const n=o.scaledTo(e);if(s[n.key])break;if(s[n.key]=!0,t=this.getTile(n),!t&&a&&(t=this._addTile(n)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||a)&&(r[n.key]=n),a=t.wasRequested(),e)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,r=this._tiles[t].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}e.push(r.key);const t=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;r=t}for(const t of e)this._loadedParentTiles[t]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,i=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=i}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const r=i;return i||(i=new lt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,r||this._source.fire(new e.k("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},i))}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){const e=t.sourceDataType;"source"===t.dataType&&"metadata"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===e&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,i,r){const s=[],n=this.transform;if(!n)return s;const o=r?n.getCameraQueryGeometry(t):t,a=t.map(t=>n.pointCoordinate(t,this.terrain)),l=o.map(t=>n.pointCoordinate(t,this.terrain)),c=this.getIds();let h=1/0,u=1/0,p=-1/0,d=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),p=Math.max(p,t.x),d=Math.max(d,t.y);for(let t=0;t<c.length;t++){const r=this._tiles[c[t]];if(r.holdingForFade())continue;const o=r.tileID,m=Math.pow(2,n.zoom-r.tileID.overscaledZ),f=i*r.queryPadding*e.X/r.tileSize/m,_=[o.getTilePoint(new e.Z(h,u)),o.getTilePoint(new e.Z(p,d))];if(_[0].x-f<e.X&&_[0].y-f<e.X&&_[1].x+f>=0&&_[1].y+f>=0){const t=a.map(t=>o.getTilePoint(t)),e=l.map(t=>o.getTilePoint(t));s.push({tile:r,tileID:o,queryGeometry:t,cameraQueryGeometry:e,scale:m})}}return s}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map(t=>this._tiles[t].tileID);for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return!0;if(dt(this._source.type)){const t=n.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return!0}return!1}setFeatureState(t,e,i){this._state.updateState(t=t||"_geojsonTileLayer",e,i)}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,i)}getFeatureState(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)}setDependencies(t,e,i){const r=this._tiles[t];r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(t,e))}}function pt(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function dt(t){return"raster"===t||"image"===t||"video"===t}ut.maxOverzooming=10,ut.maxUnderzooming=3;class mt{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.ac(t,0,1);let i=1,r=this._distances[i];const s=t*this.paddedLength+this.padding;for(;r<s&&i<this._distances.length;)r=this._distances[++i];const n=i-1,o=this._distances[n],a=r-o,l=a>0?(s-o)/a:0;return this.points[n].mult(1-l).add(this.points[i].mult(l))}}function ft(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class _t{constructor(t,e,i){const r=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)r.push([]),s.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,s){this._forEachCell(e,i,r,s,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(s)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,s,n){this.boxCells[s].push(n)}_insertCircleCell(t,e,i,r,s,n){this.circleCells[s].push(n)}_query(t,e,i,r,s,n,o){if(i<0||t>this.width||r<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(s)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let t=0;t<this.boxKeys.length;t++)a.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],r=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}else this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:s,overlapMode:n,seenUids:{box:{},circle:{}}},o);return a}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,s,n){return this._query(t,e,i,r,!0,s,n).length>0}hitTestCircle(t,e,i,r,s){const n=t-i,o=t+i,a=e-i,l=e+i;if(o<0||n>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(n,a,o,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},s),c.length>0}_queryCell(t,e,i,r,s,n,o,a){const{seenUids:l,hitTest:c,overlapMode:h}=o,u=this.boxCells[s];if(null!==u){const s=this.bboxes;for(const o of u)if(!l.box[o]){l.box[o]=!0;const u=4*o,p=this.boxKeys[o];if(t<=s[u+2]&&e<=s[u+3]&&i>=s[u+0]&&r>=s[u+1]&&(!a||a(p))&&(!c||!ft(h,p.overlapMode))&&(n.push({key:p,x1:s[u],y1:s[u+1],x2:s[u+2],y2:s[u+3]}),c))return!0}}const p=this.circleCells[s];if(null!==p){const s=this.circles;for(const o of p)if(!l.circle[o]){l.circle[o]=!0;const u=3*o,p=this.circleKeys[o];if(this._circleAndRectCollide(s[u],s[u+1],s[u+2],t,e,i,r)&&(!a||a(p))&&(!c||!ft(h,p.overlapMode))){const t=s[u],e=s[u+1],i=s[u+2];if(n.push({key:p,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,r,s,n,o,a){const{circle:l,seenUids:c,overlapMode:h}=o,u=this.boxCells[s];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,r=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!a||a(r))&&!ft(h,r.overlapMode))return n.push(!0),!0}}const p=this.circleCells[s];if(null!==p){const t=this.circles;for(const e of p)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,r=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(r))&&!ft(h,r.overlapMode))return n.push(!0),!0}}}_forEachCell(t,e,i,r,s,n,o,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r);for(let p=l;p<=h;p++)for(let l=c;l<=u;l++)if(s.call(this,t,e,i,r,this.xCellCount*l+p,n,o,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,s,n){const o=r-t,a=s-e,l=i+n;return l*l>o*o+a*a}_circleAndRectCollide(t,e,i,r,s,n,o){const a=(n-r)/2,l=Math.abs(t-(r+a));if(l>a+i)return!1;const c=(o-s)/2,h=Math.abs(e-(s+c));if(h>c+i)return!1;if(l<=a||h<=c)return!0;const u=l-a,p=h-c;return u*u+p*p<=i*i}}function gt(t,i,r,s,n){const o=e.H();return i?(e.K(o,o,[1/n,1/n,1]),r||e.ad(o,o,s.angle)):e.L(o,s.labelPlaneMatrix,t),o}function yt(t,i,r,s,n){if(i){const i=e.ae(t);return e.K(i,i,[n,n,1]),r||e.ad(i,i,-s.angle),i}return s.glCoordMatrix}function xt(t,i,r,s){let n;s?(n=[t,i,s(t,i),1],e.af(n,n,r)):(n=[t,i,0,1],Lt(n,n,r));const o=n[3];return{point:new e.P(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function vt(t,e){return.5+t/e*.5}function bt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function wt(t,i,r,s,n,o,a,l,c,h,u,p,d,m,f){const _=s?t.textSizeData:t.iconSizeData,g=e.ag(_,r.transform.zoom),y=[256/r.width*2+1,256/r.height*2+1],x=s?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;x.clear();const v=t.lineVertexArray,b=s?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=r.transform.width/r.transform.height;let T=!1;for(let s=0;s<b.length;s++){const S=b.get(s);if(S.hidden||S.writingMode===e.ah.vertical&&!T){Dt(S.numGlyphs,x);continue}T=!1;const I=xt(S.anchorX,S.anchorY,i,f);if(!bt(I.point,y)){Dt(S.numGlyphs,x);continue}const A=vt(r.transform.cameraToCenterDistance,I.signedDistanceFromCamera),P=e.ai(_,g,S),C=a?P/A:P*A,M={getElevation:f,labelPlaneMatrix:n,lineVertexArray:v,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:h,tileAnchorPoint:new e.P(S.anchorX,S.anchorY),unwrappedTileID:u,width:p,height:d,translation:m},k=It(M,S,C,!1,l,i,o,t.glyphOffsetArray,x,w,c);T=k.useVertical,(k.notEnoughRoom||T||k.needsFlipping&&It(M,S,C,!0,l,i,o,t.glyphOffsetArray,x,w,c).notEnoughRoom)&&Dt(S.numGlyphs,x)}s?t.text.dynamicLayoutVertexBuffer.updateData(x):t.icon.dynamicLayoutVertexBuffer.updateData(x)}function Tt(t,e,i,r,s,n,o,a){const l=n.glyphStartIndex+n.numGlyphs,c=n.lineStartIndex,h=n.lineStartIndex+n.lineLength,u=e.getoffsetX(n.glyphStartIndex),p=e.getoffsetX(l-1),d=zt(t*u,i,r,s,n.segment,c,h,a,o);if(!d)return null;const m=zt(t*p,i,r,s,n.segment,c,h,a,o);return m?a.projectionCache.anyProjectionOccluded?null:{first:d,last:m}:null}function St(t,i,r,s){return t===e.ah.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*s?{useVertical:!0}:(t===e.ah.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function It(t,i,r,s,n,o,a,l,c,h,u){const p=r/24,d=i.lineOffsetX*p,m=i.lineOffsetY*p;let f;if(i.numGlyphs>1){const e=i.glyphStartIndex+i.numGlyphs,r=i.lineStartIndex,o=i.lineStartIndex+i.lineLength,c=Tt(p,l,d,m,s,i,u,t);if(!c)return{notEnoughRoom:!0};const _=xt(c.first.point.x,c.first.point.y,a,t.getElevation).point,g=xt(c.last.point.x,c.last.point.y,a,t.getElevation).point;if(n&&!s){const t=St(i.writingMode,_,g,h);if(t)return t}f=[c.first];for(let n=i.glyphStartIndex+1;n<e-1;n++)f.push(zt(p*l.getoffsetX(n),d,m,s,i.segment,r,o,t,u));f.push(c.last)}else{if(n&&!s){const r=xt(t.tileAnchorPoint.x,t.tileAnchorPoint.y,o,t.getElevation).point,s=i.lineStartIndex+i.segment+1,n=new e.P(t.lineVertexArray.getx(s),t.lineVertexArray.gety(s)),a=xt(n.x,n.y,o,t.getElevation),l=a.signedDistanceFromCamera>0?a.point:function(t,e,i,r,s,n){return At(t,e,i,1,s,n)}(t.tileAnchorPoint,n,r,0,o,t),c=St(i.writingMode,r,l,h);if(c)return c}const r=zt(p*l.getoffsetX(i.glyphStartIndex),d,m,s,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,t,u);if(!r||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[r]}for(const t of f)e.aj(c,t.point,t.angle);return{}}function At(t,e,i,r,s,n){const o=t.add(t.sub(e)._unit()),a=void 0!==s?xt(o.x,o.y,s,n.getElevation).point:Ct(o.x,o.y,n).point,l=i.sub(a);return i.add(l._mult(r/l.mag()))}function Pt(t,i,r){const s=i.projectionCache;if(s.projections[t])return s.projections[t];const n=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),o=Ct(n.x,n.y,i);if(o.signedDistanceFromCamera>0)return s.projections[t]=o.point,s.anyProjectionOccluded=s.anyProjectionOccluded||o.isOccluded,o.point;const a=t-r.direction;return function(t,e,i,r,s){return At(t,e,i,r,void 0,s)}(0===r.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),n,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Ct(t,e,i){const r=t+i.translation[0],s=e+i.translation[1];let n;return!i.pitchWithMap&&i.projection.useSpecialProjectionForSymbols?(n=i.projection.projectTileCoordinates(r,s,i.unwrappedTileID,i.getElevation),n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height):(n=xt(r,s,i.labelPlaneMatrix,i.getElevation),n.isOccluded=!1),n}function Mt(t,e,i){return t._unit()._perp()._mult(e*i)}function kt(t,i,r,s,n,o,a,l,c){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const h=r.add(i);if(t+c.direction<s||t+c.direction>=n)return l.projectionCache.offsets[t]=h,h;const u=Pt(t+c.direction,l,c),p=Mt(u.sub(r),a,c.direction),d=r.add(p),m=u.add(p);return l.projectionCache.offsets[t]=e.ak(o,h,d,m)||h,l.projectionCache.offsets[t]}function zt(t,e,i,r,s,n,o,a,l){const c=r?t-e:t+e;let h=c>0?1:-1,u=0;r&&(h*=-1,u=Math.PI),h<0&&(u+=Math.PI);let p,d=h>0?n+s:n+s+1;a.projectionCache.cachedAnchorPoint?p=a.projectionCache.cachedAnchorPoint:(p=Ct(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=p);let m,f,_=p,g=p,y=0,x=0;const v=Math.abs(c),b=[];let w;for(;y+x<=v;){if(d+=h,d<n||d>=o)return null;y+=x,g=_,f=m;const t={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:g};if(_=Pt(d,a,t),0===i)b.push(g),w=_.sub(g);else{let e;const r=_.sub(g);e=0===r.mag()?Mt(Pt(d+h,a,t).sub(_),i,h):Mt(r,i,h),f||(f=g.add(e)),m=kt(d,e,_,n,o,f,i,a,t),b.push(f),w=m.sub(f)}x=w.mag()}const T=w._mult((v-y)/x)._add(f||g),S=u+Math.atan2(_.y-g.y,_.x-g.x);return b.push(T),{point:T,angle:l?S:0,path:b}}const Et=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Dt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(Et,3*t)}}function Lt(t,e,i){const r=e[0],s=e[1];return t[0]=i[0]*r+i[4]*s+i[12],t[1]=i[1]*r+i[5]*s+i[13],t[3]=i[3]*r+i[7]*s+i[15],t}const Rt=100;class Bt{constructor(t,e,i=new _t(t.width+200,t.height+200,25),r=new _t(t.width+200,t.height+200,25)){this.transform=t,this.mapProjection=e,this.grid=i,this.ignoredGrid=r,this.pitchFactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Rt,this.screenBottomBoundary=t.height+Rt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,r,s,n,o,a,l,c,h){const u=t.anchorPointX+a[0],p=t.anchorPointY+a[1],d=this.projectAndGetPerspectiveRatio(r,u,p,s,c),m=i*d.perspectiveRatio;let f;if(n||o)f=this._projectCollisionBox(t,m,r,s,n,o,a,d,c,h);else{const e=d.point.x+(h?h.x*m:0),i=d.point.y+(h?h.y*m:0);f={allPointsOccluded:!1,box:[e+t.x1*m,i+t.y1*m,e+t.x2*m,i+t.y2*m]}}const[_,g,y,x]=f.box;return this.mapProjection.useSpecialProjectionForSymbols&&(n?f.allPointsOccluded:this.mapProjection.isOccluded(u,p,s))||d.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(_,g,y,x)||"always"!==e&&this.grid.hitTest(_,g,y,x,e,l)?{box:[_,g,y,x],placeable:!1,offscreen:!1}:{box:[_,g,y,x],placeable:!0,offscreen:this.isOffscreen(_,g,y,x)}}placeCollisionCircles(t,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_){const g=[],y=new e.P(i.anchorX,i.anchorY),x=this.getPerspectiveRatio(o,y.x,y.y,a,_),v=(u?n/x:n*x)/e.ap,b={getElevation:_,labelPlaneMatrix:l,lineVertexArray:r,pitchWithMap:u,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:y,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:f},w=Tt(v,s,i.lineOffsetX*v,i.lineOffsetY*v,!1,i,!1,b);let T=!1,S=!1,I=!0;if(w){const i=.5*d*x+m,r=new e.P(-100,-100),s=new e.P(this.screenRightBoundary,this.screenBottomBoundary),n=new mt,o=w.first,a=w.last;let l=[];for(let t=o.path.length-1;t>=1;t--)l.push(o.path[t]);for(let t=1;t<a.path.length;t++)l.push(a.path[t]);const u=2.5*i;if(c){const t=this.projectPathToScreenSpace(l,b,c);l=t.some(t=>t.signedDistanceFromCamera<=0)?[]:t.map(t=>t.point)}let f=[];if(l.length>0){const t=l[0].clone(),i=l[0].clone();for(let e=1;e<l.length;e++)t.x=Math.min(t.x,l[e].x),t.y=Math.min(t.y,l[e].y),i.x=Math.max(i.x,l[e].x),i.y=Math.max(i.y,l[e].y);f=t.x>=r.x&&i.x<=s.x&&t.y>=r.y&&i.y<=s.y?[l]:i.x<r.x||t.x>s.x||i.y<r.y||t.y>s.y?[]:e.al([l],r.x,r.y,s.x,s.y)}for(const e of f){n.reset(e,.25*i);let r=0;r=n.length<=.5*i?1:Math.ceil(n.paddedLength/u)+1;for(let e=0;e<r;e++){const s=e/Math.max(r-1,1),o=n.lerp(s),a=o.x+Rt,l=o.y+Rt;g.push(a,l,i,0);const c=a-i,u=l-i,d=a+i,m=l+i;if(I=I&&this.isOffscreen(c,u,d,m),S=S||this.isInsideGrid(c,u,d,m),"always"!==t&&this.grid.hitTestCircle(a,l,i,t,p)&&(T=!0,!h))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!h&&T||!S||x<this.perspectiveRatioCutoff?[]:g,offscreen:I,collisionDetected:T}}projectPathToScreenSpace(t,e,i){return t.map(t=>xt(t.x,t.y,i,e.getElevation))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,s=1/0,n=-1/0,o=-1/0;for(const a of t){const t=new e.P(a.x+Rt,a.y+Rt);r=Math.min(r,t.x),s=Math.min(s,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y),i.push(t)}const a=this.grid.query(r,s,n,o).concat(this.ignoredGrid.query(r,s,n,o)),l={},c={};for(const t of a){const r=t.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const s=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.am(i,s)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(t,e,i,r,s,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:s,collisionGroupID:n,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,s,n){const o=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:s,collisionGroupID:n,overlapMode:e};for(let e=0;e<t.length;e+=4)o.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(t,i,r,s,n){let o;n?(o=[i,r,n(i,r),1],e.af(o,o,t)):(o=[i,r,0,1],Lt(o,o,t));const a=o[3];return{point:new e.P((o[0]/a+1)/2*this.transform.width+Rt,(-o[1]/a+1)/2*this.transform.height+Rt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}getPerspectiveRatio(t,e,i,r,s){const n=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(e,i,r,s):xt(e,i,t,s);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(t,e,i,r){return i<Rt||t>=this.screenRightBoundary||r<Rt||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.an([]);return e.J(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,r,s,n,o,a,l,c,h){let u=new e.P(1,0),p=new e.P(0,1);const d=new e.P(t.anchorPointX+a[0],t.anchorPointY+a[1]);if(o&&!n){const t=this.projectAndGetPerspectiveRatio(r,d.x+1,d.y,s,c).point.sub(l.point).unit(),i=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0),n=Math.sin(i),o=Math.cos(i);u=new e.P(o,n),p=new e.P(-n,o)}else if(!o&&n){const t=-this.transform.angle,i=Math.sin(t),r=Math.cos(t);u=new e.P(r,i),p=new e.P(-i,r)}let m=l.point,f=i;if(n){m=d;const t=this.transform.zoom-Math.floor(this.transform.zoom);f=Math.pow(2,-t),f*=this.mapProjection.getPitchedTextCorrection(this.transform,d,s),h||(f*=e.ac(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}h&&(m=m.add(u.mult(h.x*f)).add(p.mult(h.y*f)));const _=t.x1*f,g=t.x2*f,y=(_+g)/2,x=t.y1*f,v=t.y2*f,b=(x+v)/2,w=[{offsetX:_,offsetY:x},{offsetX:y,offsetY:x},{offsetX:g,offsetY:x},{offsetX:g,offsetY:b},{offsetX:g,offsetY:v},{offsetX:y,offsetY:v},{offsetX:_,offsetY:v},{offsetX:_,offsetY:b}];let T=[];for(const{offsetX:t,offsetY:i}of w)T.push(new e.P(m.x+u.x*t+p.x*i,m.y+u.y*t+p.y*i));let S=!1;if(n){const t=T.map(t=>this.projectAndGetPerspectiveRatio(r,t.x,t.y,s,c));S=t.some(t=>!t.isOccluded),T=t.map(t=>t.point)}else S=!0;return{box:e.ao(T),allPointsOccluded:!S}}}function Ft(t,i,r){return i*(e.X/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}class Ot{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Vt{constructor(t,e,i,r,s){this.text=new Ot(t?t.text:null,e,i,s),this.icon=new Ot(t?t.icon:null,e,r,s)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class Nt{constructor(){this.invProjMatrix=e.H(),this.viewportMatrix=e.H(),this.circles=[]}}class jt{constructor(t,e,i,r,s){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=s}}class $t{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e}}return this.collisionGroups[t]}}function qt(t,i,r,s,n){const{horizontalAlign:o,verticalAlign:a}=e.au(t);return new e.P(-(o-.5)*i+s[0]*n,-(a-.5)*r+s[1]*n)}class Zt{constructor(t,e,i,r,s,n){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new Bt(this.transform,e),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new $t(s),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,r)=>e.getElevation(t,i,r):null}getBucketParts(t,i,r,s){const n=r.getBucket(i),o=r.latestFeatureIndex;if(!n||!o||i.id!==n.layerIds[0])return;const a=r.collisionBoxArray,l=n.layers[0].layout,c=n.layers[0].paint,h=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.X,p=r.tileID.toUnwrapped(),d=this.transform.calculatePosMatrix(p),m="map"===l.get("text-pitch-alignment"),f="map"===l.get("text-rotation-alignment"),_=Ft(r,1,this.transform.zoom),g=this.collisionIndex.mapProjection.translatePosition(this.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),y=this.collisionIndex.mapProjection.translatePosition(this.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),x=gt(d,m,f,this.transform,_);let v=null;if(m){const t=yt(d,m,f,this.transform,_);v=e.L([],this.transform.labelPlaneMatrix,t)}this.retainedQueryData[n.bucketInstanceId]=new jt(n.bucketInstanceId,o,n.sourceLayerIndex,n.index,r.tileID);const b={bucket:n,layout:l,translationText:g,translationIcon:y,posMatrix:d,unwrappedTileID:p,textLabelPlaneMatrix:x,labelToScreenMatrix:v,scale:h,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:e.ag(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(s)for(const e of n.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:s}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:s,parameters:b})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:b})}attemptAnchorPlacement(t,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g,y,x){const v=e.aq[t.textAnchor],b=[t.textOffset0,t.textOffset1],w=qt(v,r,s,b,n),T=this.collisionIndex.placeCollisionBox(i,p,l,c,h,a,o,_,u.predicate,x,w);if((!y||this.collisionIndex.placeCollisionBox(y,p,l,c,h,a,o,g,u.predicate,x,w).placeable)&&T.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(t=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:b,width:r,height:s,anchor:v,textBoxScale:n,prevAnchor:t},this.markUsedJustification(m,v,d,f),m.allowVerticalPlacement&&(this.markUsedOrientation(m,f,d),this.placedOrientations[d.crossTileID]=f),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(t,i,r){const{bucket:s,layout:n,translationText:o,translationIcon:a,posMatrix:l,unwrappedTileID:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,textPixelRatio:p,holdingForFade:d,collisionBoxArray:m,partiallyEvaluatedTextSize:f,collisionGroup:_}=t.parameters,g=n.get("text-optional"),y=n.get("icon-optional"),x=e.ar(n,"text-overlap","text-allow-overlap"),v="always"===x,b=e.ar(n,"icon-overlap","icon-allow-overlap"),w="always"===b,T="map"===n.get("text-rotation-alignment"),S="map"===n.get("text-pitch-alignment"),I="none"!==n.get("icon-text-fit"),A="viewport-y"===n.get("symbol-z-order"),P=v&&(w||!s.hasIconData()||y),C=w&&(v||!s.hasTextData()||g);!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m);const M=this._getTerrainElevationFunc(this.retainedQueryData[s.bucketInstanceId].tileID),k=(t,m,w)=>{var A,k;if(i[t.crossTileID])return;if(d)return void(this.placements[t.crossTileID]=new Ut(!1,!1,!1));let z=!1,E=!1,D=!0,L=null,R={box:null,placeable:!1,offscreen:null},B={box:null,placeable:!1,offscreen:null},F=null,O=null,V=null,U=0,N=0,j=0;m.textFeatureIndex?U=m.textFeatureIndex:t.useRuntimeCollisionCircles&&(U=t.featureIndex),m.verticalTextFeatureIndex&&(N=m.verticalTextFeatureIndex);const $=m.textBox;if($){const i=i=>{let r=e.ah.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,r=e,this.markUsedOrientation(s,r,t))}return r},n=(i,r)=>{if(s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&m.verticalTextBox){for(const t of s.writingModes)if(t===e.ah.vertical?(R=r(),B=R):R=i(),R&&R.placeable)break}else R=i()},h=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===h){const r=(e,i)=>{const r=this.collisionIndex.placeCollisionBox(e,x,p,l,c,S,T,o,_.predicate,M);return r&&r.placeable&&(this.markUsedOrientation(s,i,t),this.placedOrientations[t.crossTileID]=i),r};n(()=>r($,e.ah.horizontal),()=>{const i=m.verticalTextBox;return s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?r(i,e.ah.vertical):{box:null,offscreen:null}}),i(R&&R.placeable)}else{let d=e.aq[null===(k=null===(A=this.prevPlacement)||void 0===A?void 0:A.variableOffsets[t.crossTileID])||void 0===k?void 0:k.anchor];const f=(i,n,m)=>{const f=i.x2-i.x1,g=i.y2-i.y1,y=t.textBoxScale,v=I&&"never"===b?n:null;let w=null,A="never"===x?1:2,P="never";d&&A++;for(let e=0;e<A;e++){for(let e=h;e<u;e++){const r=s.textAnchorOffsets.get(e);if(d&&r.textAnchor!==d)continue;const n=this.attemptAnchorPlacement(r,i,f,g,y,T,S,p,l,c,_,P,t,s,m,o,a,v,M);if(n&&(w=n.placedGlyphBoxes,w&&w.placeable))return z=!0,L=n.shift,w}d?d=null:P=x}return r&&!w&&(w={box:this.collisionIndex.placeCollisionBox($,"always",p,l,c,S,T,o,_.predicate,M,new e.P(0,0)).box,offscreen:!1,placeable:!1}),w};n(()=>f($,m.iconBox,e.ah.horizontal),()=>{const i=m.verticalTextBox;return s.allowVerticalPlacement&&(!R||!R.placeable)&&t.numVerticalGlyphVertices>0&&i?f(i,m.verticalIconBox,e.ah.vertical):{box:null,occluded:!0,offscreen:null}}),R&&(z=R.placeable,D=R.offscreen);const g=i(R&&R.placeable);if(!z&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(s,e.anchor,t,g))}}}if(F=R,z=F&&F.placeable,D=F&&F.offscreen,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),a=e.ai(s.textSizeData,f,i),p=n.get("text-padding");O=this.collisionIndex.placeCollisionCircles(x,i,s.lineVertexArray,s.glyphOffsetArray,a,l,c,h,u,r,S,_.predicate,t.collisionCircleDiameter,p,o,M),O.circles.length&&O.collisionDetected&&!r&&e.w("Collisions detected, but collision boxes are not shown"),z=v||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,b,p,l,c,S,T,a,_.predicate,M,I&&L?L:void 0);B&&B.placeable&&m.verticalIconBox?(V=t(m.verticalIconBox),E=V.placeable):(V=t(m.iconBox),E=V.placeable),D=D&&V.offscreen}const q=g||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,Z=y||0===t.numIconVertices;q||Z?Z?q||(E=E&&z):z=E&&z:E=z=E&&z;const G=E&&V.placeable;if(z&&F.placeable&&this.collisionIndex.insertCollisionBox(F.box,x,n.get("text-ignore-placement"),s.bucketInstanceId,B&&B.placeable&&N?N:U,_.ID),G&&this.collisionIndex.insertCollisionBox(V.box,b,n.get("icon-ignore-placement"),s.bucketInstanceId,j,_.ID),O&&z&&this.collisionIndex.insertCollisionCircles(O.circles,x,n.get("text-ignore-placement"),s.bucketInstanceId,U,_.ID),r&&this.storeCollisionData(s.bucketInstanceId,w,m,F,V,O),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===s.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new Ut(z||P,E||C,D||s.justReloaded),i[t.crossTileID]=!0};if(A){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=s.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const i=e[t];k(s.symbolInstances.get(i),s.collisionArrays[i],i)}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)k(s.symbolInstances.get(e),s.collisionArrays[e],e);if(r&&s.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[s.bucketInstanceId];e.as(t.invProjMatrix,l),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}storeCollisionData(t,e,i,r,s,n){if(i.textBox||i.iconBox){let n,o;this.collisionBoxArrays.has(t)?n=this.collisionBoxArrays.get(t):(n=new Map,this.collisionBoxArrays.set(t,n)),n.has(e)?o=n.get(e):(o={text:null,icon:null},n.set(e,o)),i.textBox&&(o.text=r.box),i.iconBox&&(o.icon=s.box)}if(n){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Nt);for(let t=0;t<n.circles.length;t+=4)e.circles.push(n.circles[t+0]),e.circles.push(n.circles[t+1]),e.circles.push(n.circles[t+2]),e.circles.push(n.collisionDetected?1:0)}}markUsedJustification(t,i,r,s){let n;n=s===e.ah.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.at(i)];const o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=n>=0&&e!==n?0:r.crossTileID)}markUsedOrientation(t,i,r){const s=i===e.ah.horizontal||i===e.ah.horizontalOnly?i:0,n=i===e.ah.vertical?i:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=s;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const r=e?e.symbolFadeChange(t):1,s=e?e.opacities:{},n=e?e.variableOffsets:{},o=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],n=s[t];n?(this.opacities[t]=new Vt(n,r,e.text,e.icon),i=i||e.text!==n.text.placed||e.icon!==n.icon.placed):(this.opacities[t]=new Vt(null,r,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in s){const e=s[t];if(!this.opacities[t]){const s=new Vt(e,r,!1,!1);s.isHidden()||(this.opacities[t]=s,i=i||e.text.placed||e.icon.placed)}}for(const t in n)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=n[t]);for(const t in o)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=o[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){const i={};for(const r of e){const e=r.getBucket(t);e&&r.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,i,r,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const n=t.layers[0],o=n.layout,a=new Vt(null,0,!1,!1,!0),l=o.get("text-allow-overlap"),c=o.get("icon-allow-overlap"),h=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===o.get("text-rotation-alignment"),p="map"===o.get("text-pitch-alignment"),d="none"!==o.get("icon-text-fit"),m=new Vt(null,0,l&&(c||!t.hasIconData()||o.get("icon-optional")),c&&(l||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const f=(t,e,i)=>{for(let r=0;r<e/4;r++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==ee},_=this.collisionBoxArrays.get(t.bucketInstanceId);for(let i=0;i<t.symbolInstances.length;i++){const s=t.symbolInstances.get(i),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,crossTileID:l}=s;let c=this.opacities[l];r[l]?c=a:c||(c=m,this.opacities[l]=c),r[l]=!0;const g=s.numIconVertices>0,y=this.placedOrientations[s.crossTileID],x=y===e.ah.vertical,v=y===e.ah.horizontal||y===e.ah.horizontalOnly;if(n>0||o>0){const e=te(c.text);f(t.text,n,x?ee:e),f(t.text,o,v?ee:e);const i=c.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||x?1:0)}),s.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const r=this.variableOffsets[s.crossTileID];r&&this.markUsedJustification(t,r.anchor,s,y);const a=this.placedOrientations[s.crossTileID];a&&(this.markUsedJustification(t,"left",s,a),this.markUsedOrientation(t,a,s))}if(g){const e=te(c.icon),i=!(d&&s.verticalPlacedIconSymbolIndex&&x);s.placedIconSymbolIndex>=0&&(f(t.icon,s.numIconVertices,i?e:ee),t.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=c.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(f(t.icon,s.numVerticalIconVertices,i?ee:e),t.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const b=_&&_.has(i)?_.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const r=t.collisionArrays[i];if(r){let i=new e.P(0,0);if(r.textBox||r.verticalTextBox){let e=!0;if(h){const t=this.variableOffsets[l];t?(i=qt(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(p?this.transform.angle:-this.transform.angle)):e=!1}if(r.textBox||r.verticalTextBox){let s;r.textBox&&(s=x),r.verticalTextBox&&(s=v),Gt(t.textCollisionBox.collisionVertexArray,c.text.placed,!e||s,b.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const e=Boolean(!v&&r.verticalIconBox);let s;r.iconBox&&(s=e),r.verticalIconBox&&(s=!e),Gt(t.iconCollisionBox.collisionVertexArray,c.icon.placed,s,b.icon,d?i.x:0,d?i.y:0)}}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function Gt(t,e,i,r,s,n){r&&0!==r.length||(r=[0,0,0,0]);const o=r[0]-Rt,a=r[1]-Rt,l=r[2]-Rt,c=r[3]-Rt;t.emplaceBack(e?1:0,i?1:0,s||0,n||0,o,a),t.emplaceBack(e?1:0,i?1:0,s||0,n||0,l,a),t.emplaceBack(e?1:0,i?1:0,s||0,n||0,l,c),t.emplaceBack(e?1:0,i?1:0,s||0,n||0,o,c)}const Wt=Math.pow(2,25),Ht=Math.pow(2,24),Xt=Math.pow(2,17),Jt=Math.pow(2,16),Kt=Math.pow(2,9),Yt=Math.pow(2,8),Qt=Math.pow(2,1);function te(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Wt+e*Ht+i*Xt+e*Jt+i*Kt+e*Yt+i*Qt+e}const ee=0;function ie(){return{isOccluded:(t,e,i)=>!1,getPitchedTextCorrection:(t,e,i)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(t,e,i,r){throw new Error("Not implemented.")},translatePosition:(t,e,i,r)=>function(t,e,i,r,s=!1){if(!i[0]&&!i[1])return[0,0];const n=s?"map"===r?t.angle:0:"viewport"===r?-t.angle:0;if(n){const t=Math.sin(n),e=Math.cos(n);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e]}return[s?i[0]:Ft(e,i[0],t.zoom),s?i[1]:Ft(e,i[1],t.zoom)]}(t,e,i,r),getCircleRadiusCorrection:t=>1}}class re{constructor(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,s){const n=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(n,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,s())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort((t,e)=>t.sortKey-e.sortKey));this._currentPartIndex<n.length;)if(e.placeLayerBucketPart(n[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,s())return!0;return!1}}class se{constructor(t,e,i,r,s,n,o,a){this.placement=new Zt(t,ie(),e,n,o,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=s,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){const r=n.now(),s=()=>!this._forceFullPlacement&&n.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=e[t[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=n)&&(!r.maxzoom||r.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new re(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const ne=512/e.X/2;class oe{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this._symbolsByKey={};const s=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),r=e.key,n=s.get(r);n?n.push(e):s.set(r,[e])}for(const[t,i]of s){const r={positions:i.map(t=>({x:Math.floor(t.anchorX*ne),y:Math.floor(t.anchorY*ne)})),crossTileIDs:i.map(t=>t.crossTileID)};if(r.positions.length>128){const t=new e.av(r.positions.length,16,Uint16Array);for(const{x:e,y:i}of r.positions)t.add(e,i);t.finish(),delete r.positions,r.index=t}this._symbolsByKey[t]=r}}getScaledCoordinates(t,i){const{x:r,y:s,z:n}=this.tileID.canonical,{x:o,y:a,z:l}=i.canonical,c=ne/Math.pow(2,l-n),h=(a*e.X+t.anchorY)*c,u=s*e.X*ne;return{x:Math.floor((o*e.X+t.anchorX)*c-r*e.X*ne),y:Math.floor(h-u)}}findMatches(t,e,i){const r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let s=0;s<t.length;s++){const n=t.get(s);if(n.crossTileID)continue;const o=this._symbolsByKey[n.key];if(!o)continue;const a=this.getScaledCoordinates(n,e);if(o.index){const t=o.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(const e of t){const t=o.crossTileIDs[e];if(!i[t]){i[t]=!0,n.crossTileID=t;break}}}else if(o.positions)for(let t=0;t<o.positions.length;t++){const e=o.positions[t],s=o.crossTileIDs[t];if(Math.abs(e.x-a.x)<=r&&Math.abs(e.y-a.y)<=r&&!i[s]){i[s]=!0,n.crossTileID=s;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class ae{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class le{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],r={};for(const t in i){const s=i[t];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),r[s.tileID.key]=s}this.indexes[t]=r}this.lng=t}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const r=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const s=this.indexes[i];if(Number(i)>
2t.overscaledZ)for(const i in s){const n=s[i];n.tileID.isChildOf(t)&&n.findMatches(e.symbolInstances,t,r)}else{const n=s[t.scaledTo(Number(i)).key];n&&n.findMatches(e.symbolInstances,t,r)}}for(let t=0;t<e.symbolInstances.length;t++){const s=e.symbolInstances.get(t);s.crossTileID||(s.crossTileID=i.generate(),r[s.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new oe(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const r=this.indexes[i];for(const s in r)t[r[s].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[s]),delete r[s],e=!0)}return e}}class ce{constructor(){this.layerIndexes={},this.crossTileIDs=new ae,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];void 0===r&&(r=this.layerIndexes[t.id]=new le);let s=!1;const n={};r.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,e,this.crossTileIDs)&&(s=!0),n[e.bucketInstanceId]=!0)}return r.removeStaleBuckets(n)&&(s=!0),s}pruneUnusedLayers(t){const e={};t.forEach(t=>{e[t]=!0});for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}const he=(t,i)=>e.t(t,i&&i.filter(t=>"source.canvas"!==t.identifier)),ue=e.aw();class pe extends e.E{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;"vector"!==e&&"geojson"!==e||this.sourceCaches[t].reload()}},this.map=t,this.dispatcher=new U(V(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,e)=>this.getGlyphs(t,e)),this.dispatcher.registerMessageHandler("GI",(t,e)=>this.getImages(t,e)),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new P(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new D(256,512),this.crossTileSymbolIndex=new ce,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",e.ay()),at().on(st,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e)}})}loadURL(t,i={},r){this.fire(new e.k("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const s=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const n=this._loadStyleRequest;e.h(s,this._loadStyleRequest).then(t=>{this._loadStyleRequest=null,this._load(t.data,i,r)}).catch(t=>{this._loadStyleRequest=null,t&&!n.signal.aborted&&this.fire(new e.j(t))})}loadJSON(t,i={},r){this.fire(new e.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,n.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,r)}).catch(()=>{})}loadEmpty(){this.fire(new e.k("dataloading",{dataType:"style"})),this._load(ue,{validate:!1})}_load(t,i,r){var s;const n=i.transformStyle?i.transformStyle(r,t):t;if(!i.validate||!he(this,e.u(n))){this._loaded=!0,this.stylesheet=n;for(const t in n.sources)this.addSource(t,n.sources[t],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this._createLayers(),this.light=new k(this.stylesheet.light),this.sky=new E(this.stylesheet.sky),this.map.setTerrain(null!==(s=this.stylesheet.terrain)&&void 0!==s?s:null),this.fire(new e.k("data",{dataType:"style"})),this.fire(new e.k("style.load"))}}_createLayers(){const t=e.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(t=>t.id),this._layers={},this._serializedLayers=null;for(const i of t){const t=e.aA(i);t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t}}_loadSprite(t,i=!1,r=void 0){let s;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,i,r,s){return e._(this,void 0,void 0,function*(){const o=x(t),a=r>1?"@2x":"",l={},c={};for(const{id:t,url:r}of o){const n=i.transformRequest(v(r,a,".json"),"SpriteJSON");l[t]=e.h(n,s);const o=i.transformRequest(v(r,a,".png"),"SpriteImage");c[t]=d.getImage(o,s)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(t,i){return e._(this,void 0,void 0,function*(){const e={};for(const r in t){e[r]={};const s=n.getImageCanvasContext((yield i[r]).data),o=(yield t[r]).data;for(const t in o){const{width:i,height:n,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:p,content:d,textFitWidth:m,textFitHeight:f}=o[t];e[r][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:p,content:d,textFitWidth:m,textFitHeight:f,spriteData:{width:i,height:n,x:a,y:l,context:s}}}}return e})}(l,c)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const r=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter(e=>!(e in t)):[];for(const t of r)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const r in t[e]){const s="default"===e?r:`${e}:${r}`;this._spritesImagesIds[e].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,t[e][r],!1):this.imageManager.addImage(s,t[e][r]),i&&(this._changedImages[s]=!0)}}}).catch(t=>{this._spriteRequest=null,s=t,this.fire(new e.j(s))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"})),r&&r(s)})}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}_validateLayer(t){const i=this.sourceCaches[t.source];if(!i)return;const r=t.sourceLayer;if(!r)return;const s=i.getSource();("geojson"===s.type||s.vectorLayerIds&&-1===s.vectorLayerIds.indexOf(r))&&this.fire(new e.j(new Error(`Source layer "${r}" does not exist on source "${s.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const r=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?e.aB(r):r);const s=[];for(const n of t)if(r[n]){const t=i?e.aB(r[n]):r[n];s.push(t)}return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;
vendor: 4,824 bytes, line 2
2if(this.sky&&this.sky.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else{if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const r={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];r[t]=e.used,e.used=!1}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const t in r){const i=this.sourceCaches[t];!!r[t]!=!!i.used&&i.fire(new e.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,i&&this.fire(new e.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var r;this._checkLoaded();const s=this.serialize();if(t=i.transformStyle?i.transformStyle(s,t):t,(null===(r=i.validate)||void 0===r||r)&&he(this,e.u(t)))return!1;(t=e.aB(t)).layers=e.az(t.layers);const n=e.aC(s,t),o=this._getOperationsToPerform(n);if(o.unimplemented.length>0)throw new Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(const t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],i=[];for(const r of t)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":e.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":e.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":e.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":e.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":e.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":e.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":e.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":e.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":e.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":e.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":e.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":e.push(()=>this.setSprite.apply(this,r.args));break;case"setSky":e.push(()=>this.setSky.apply(this,r.args));break;case"setTerrain":e.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setTransition":e.push(()=>{});break;default:i.push(r.command)}return{operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.j(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Ob
2ject.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.u.source,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const s=this.sourceCaches[t]=new ut(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.j(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new e.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,r={}){this._checkLoaded();const s=t.id;if(this.getLayer(s))return void this.fire(new e.j(new Error(`Layer "${s}" already exists on this map.`)));let n;if("custom"===t.type){if(he(this,e.aD(t)))return;n=e.aA(t)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(s,t.source),t=e.aB(t),t=e.e(t,{source:s})),this._validate(e.u.layer,`layers.${s}`,t,{arrayIndex:-1},r))return;n=e.aA(t),this._validateLayer(n),n.setEventedParent(this,{layer:{id:s}})}const o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new e.j(new Error(`Cannot add layer "${s}" before non-existing layer "${i}".`)));else{if(this._order.splice(o,0,s),this._layerOrderChanged=!0,this._layers[s]=n,this._removedLayers[s]&&n.source&&"custom"!==n.type){const t=this._removedLayers[s];delete this._removedLayers[s],t.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.sourceCaches[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const r=this._order.indexOf(t);this._order.splice(r,1);const s=i?this._order.indexOf(i):this._order.length;i&&-1===s?this.fire(new e.j(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(s,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.j(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,r){this._checkLoaded();const s=this.getLayer(t);s?s.minzoom===i&&s.maxzoom===r||(null!=i&&(s.minzoom=i),null!=r&&(s.maxzoom=r),this._updateLayer(s)):this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,r={}){this._checkLoaded();const s=this.getLayer(t);if(s){if(!e.aE(s.filter,i))return null==i?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(e.u.filter,`layers.${s.id}.filter`,i,null,r)||(s.filter=e.aB(i),this._updateLayer(s)))}else this.fire(new e.j(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return e.aB(this.getLayer(t).filter)}setLayoutProperty(t,i,r,s={}){this._checkLoaded();const n=this.getLayer(t);n?e.aE(n.getLayoutProperty(i),r)||(n.setLayoutProperty(i,r,s),this._updateLayer(n)):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){const r=this.getLayer(t);if(r)return r.getLayoutProperty(i);this.fire(new e.j(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,r,s={}){this._checkLoaded();const n=this.getLayer(t);n?e.aE(n.getPaintProperty(i),r)||(n.setPaintProperty(i,r,s)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.j(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const r=t.source,s=t.sourceLayer,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new e.j(new Error(`The source '${r}' does not exist in the map's style.`)));
vendor: 12,797 bytes, line 2
2const o=n.getSource().type;"geojson"===o&&s?this.fire(new e.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||s?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),n.setFeatureState(s,t.id,i)):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,i){this._checkLoaded();const r=t.source,s=this.sourceCaches[r];if(void 0===s)return void this.fire(new e.j(new Error(`The source '${r}' does not exist in the map's style.`)));const n=s.getSource().type,o="vector"===n?t.sourceLayer:void 0;"vector"!==n||o?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.j(new Error("A feature id is required to remove its specific state property."))):s.removeFeatureState(o,t.id,i):this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const i=t.source,r=t.sourceLayer,s=this.sourceCaches[i];if(void 0!==s)return"vector"!==s.getSource().type||r?(void 0===t.id&&this.fire(new e.j(new Error("The feature id parameter must be provided."))),s.getFeatureState(r,t.id)):void this.fire(new e.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.j(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.aF(this.sourceCaches,t=>t.serialize()),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,s=this.stylesheet;return e.aG({version:s.version,name:s.name,metadata:s.metadata,light:s.light,sky:s.sky,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,sources:t,layers:i,terrain:r},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},r=[];for(let s=this._order.length-1;s>=0;s--){const n=this._order[s];if(e(n)){i[n]=s;for(const e of t){const t=e[n];if(t)for(const e of t)r.push(e)}}}r.sort((t,e)=>e.intersectionZ-t.intersectionZ);const s=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(e(o))for(let t=r.length-1;t>=0;t--){const e=r[t].feature;if(i[e.layer.id]<n)break;s.push(e),r.pop()}else for(const e of t){const t=e[o];if(t)for(const e of t)s.push(e.feature)}}return s}queryRenderedFeatures(t,i,r){i&&i.filter&&this._validate(e.u.filter,"queryRenderedFeatures.filter",i.filter,null,i);const s={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.j(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];s[i.source]=!0}}const n=[];i.availableImages=this._availableImages;const o=this._serializedAllLayers();for(const e in this.sourceCaches)i.layers&&!s[e]||n.push($(this.sourceCaches[e],this._layers,o,t,i,r));return this.placement&&n.push(function(t,e,i,r,s,n,o){const a={},l=n.queryRenderedSymbols(r),c=[];for(const t of Object.keys(l).map(Number))c.push(o[t]);c.sort(q);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,s.filter,s.layers,s.availableImages,t);for(const t in r){const e=a[t]=a[t]||[],s=r[t];s.sort((t,e)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(t.featureIndex);return r.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex});for(const t of s)e.push(t)}}for(const e in a)a[e].forEach(r=>{const s=r.feature,n=i[t[e].source].getFeatureState(s.layer["source-layer"],s.id);s.source=s.layer.source,s.layer["source-layer"]&&(s.sourceLayer=s.layer["source-layer"]),s.state=n});return a}(this._layers,o,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.u.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[t];return r?function(t,e){const i=t.getRenderableIds().map(e=>t.getTileByID(e)),r=[],s={};for(let t=0;t<i.length;t++){const n=i[t],o=n.tileID.canonical.key;s[o]||(s[o]=!0,n.querySourceFeatures(r,e))}return r}(r,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();const r=this.light.getLight();let s=!1;for(const i in t)if(!e.aE(t[i],r[i])){s=!0;break}if(!s)return;const o={now:n.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(o)}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,i={}){const r=this.getSky();let s=!1;if(!t&&!r)return;if(t&&!r)s=!0;else if(!t&&r)s=!0;else for(const i in t)if(!e.aE(t[i],r[i])){s=!0;break}if(!s)return;const o={now:n.now(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(o)}_validate(t,i,r,s,n={}){return(!n||!1!==n.validate)&&he(this,t.call(e.u,e.e({key:i,style:this.serialize(),value:r,styleSpec:e.v},s)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),at().off(st,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,e,i,r,s=!1){let o=!1,a=!1;const l={};for(const e of this._order){const i=this._layers[e];if("symbol"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map(e=>t.getTileByID(e)).sort((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1))}const r=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.now(),t.zoom))&&(this.pauseablePlacement=new se(t,this.map.terrain,this._order,s,e,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,l[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,i){return e._(this,void 0,void 0,function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t})}getGlyphs(t,i){return e._(this,void 0,void 0,function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.u.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,r={},s){this._checkLoaded();const n=[{id:t,url:i}],o=[...x(this.stylesheet.sprite),...n];this._validate(e.u.sprite,"sprite",o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(n,!0,s))}removeSprite(t){this._checkLoaded();const i=x(this.stylesheet.sprite);if(i.find(e=>e.id===t)){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex(e=>e.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.k("data",{dataType:"style"}))}else this.fire(new e.j(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return x(this.stylesheet.sprite)}setSprite(t,i={},r){this._checkLoaded(),t&&this._validate(e.u.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,r):(this._unloadSprite(),r&&r(null)))}}var de=e.Y([{name:"a_pos",type:"Int16",components:2}]);const me={prelude:fe("#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\n","#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;}\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(texture2D(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=(texture2D(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\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}"),background:fe("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:fe("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;
2uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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:fe("varying vec3 v_data;varying 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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying 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 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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:fe("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:fe("uniform highp float u_intensity;varying 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);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying 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 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}"),heatmapTexture:fe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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:fe("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}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:fe("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:fe("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:fe("#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_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\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=u_matrix*vec4(a_pos,0,1);}"),fillOutline:fe("varying vec2 v_pos;\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);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\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=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),fillOutlinePattern:fe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\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=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\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=u_matrix*vec4(a_pos,0,1);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;}"),fillPattern:fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);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:fe("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying 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);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*
20.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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=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:fe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying 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=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying 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 z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*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:fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:fe("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
2\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:fe("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\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=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:fe("#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;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\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(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.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:fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
2uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:fe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:fe("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:fe("#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;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(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);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:fe("#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;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
2gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:fe("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;varying vec2 v_texture_pos;varying 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=texture2D(u_texture,v_texture_pos);if (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);
2float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:fe("varying 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() {gl_FragColor=pack(v_depth);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:fe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying 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=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:fe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function fe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/attribute ([\w]+) ([\w]+)/g),s=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=n?n.concat(s):s,a={};return{fragmentSource:t=t.replace(i,(t,e,i,r,s)=>(a[s]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nvarying ${i} ${r} ${s};\n#else\nuniform ${i} ${r} u_${s};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${s}\n    ${i} ${r} ${s} = u_${s};\n#endif\n`)),vertexSource:e=e.replace(i,(t,e,i,r,s)=>{const n="float"===r?"vec2":"vec4",o=s.match(/color/)?"color":n;return a[s]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nattribute ${i} ${n} a_${s};\nvarying ${i} ${r} ${s};\n#else\nuniform ${i} ${r} u_${s};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${s}\n    ${s} = a_${s};\n#else\n    ${i} ${r} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n    ${s} = unpack_mix_${o}(a_${s}, u_${s}_t);\n#else\n    ${i} ${r} ${s} = u_${s};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nattribute ${i} ${n} a_${s};\n#else\nuniform ${i} ${r} u_${s};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${s}\n    ${i} ${r} ${s} = a_${s};\n#else\n    ${i} ${r} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n    ${i} ${r} ${s} = unpack_mix_${o}(a_${s}, u_${s}_t);\n#else\n    ${i} ${r} ${s} = u_${s};\n#endif\n`}),staticAttributes:r,staticUniforms:o}}class _e{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,s,n,o,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==r.length;for(let t=0;!c&&t<r.length;t++)this.boundPaintVertexBuffers[t]!==r[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==s||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,r,s,n,o,a,l):(t.bindVertexArray.set(this.vao),o&&o.bind(),s&&s.dynamicDraw&&s.bind(),a&&a.bind(),l&&l.bind())}freshBind(t,e,i,r,s,n,o,a){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=s,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=a,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);n&&n.enableAttributes(h,t),o&&o.enableAttributes(h,t),a&&a.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,s);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,s);n&&(n.bind(),n.setVertexAttribPointers(h,t,s)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(h,t,s)),a&&(a.bind(),a.setVertexAttribPointers(h,t,s)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const ge=(t,i,r,s,n)=>({u_matrix:t,u_texture:0,u_ele_delta:i,u_fog_matrix:r,u_fog_color:s?s.properties.get("fog-color"):e.aM.white,u_fog_ground_blend:s?s.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(n):0,u_horizon_color:s?s.properties.get("horizon-color"):e.aM.white,u_horizon_fog_blend:s?s.properties.get("horizon-fog-blend"):1});function ye(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const r=t[i].split(" ");e.push(r.pop())}return e}class xe{constructor(t,i,r,s,n,o){const a=t.gl;this.program=a.createProgram();const l=ye(i.staticAttributes),c=r?r.getBinderAttributes():[],h=l.concat(c),u=me.prelude.staticUniforms?ye(me.prelude.staticUniforms):[],p=i.staticUniforms?ye(i.staticUniforms):[],d=r?r.getBinderUniforms():[],m=u.concat(p).concat(d),f=[];for(const t of m)f.indexOf(t)<0&&f.push(t);const _=r?r.defines():[];n&&_.push("#define OVERDRAW_INSPECTOR;"),o&&_.push("#define TERRAIN3D;");const g=_.concat(me.prelude.fragmentSource,i.fragmentSource).join("\n"),y=_.concat(me.prelude.vertexSource,i.vertexSource).join("\n"),x=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(x,g),a.compileShader(x),!a.getShaderParameter(x,a.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${a.getShaderInfoLog(x)}`);a.attachShader(this.program,x);const v=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);if(a.shaderSource(v,y),a.compileShader(v),!a.getShaderParameter(v,a.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${a.getShaderInfoLog(v)}`);a.attachShader(this.program,v),this.attributes={};const b={};this.numAttributes=h.length;for(let t=0;t<this.numAttributes;t++)h[t]&&(a.bindAttribLocation(this.program,t,h[t]),this.attributes[h[t]]=t);if(a.linkProgram(this.program),!a.getProgramParameter(this.program,a.LINK_STATUS))throw new Error(`Program failed to link: ${a.getProgramInfoLog(this.program)}`);a.deleteShader(v),a.deleteShader(x);for(let t=0;t<f.length;t++){const e=f[t];if(e&&!b[e]){const t=a.getUniformLocation(this.program,e);t&&(b[e]=t)}}this.fixedUniforms=s(t,b),this.terrainUniforms=((t,i)=>({u_depth:new e.aH(t,i.u_depth),u_terrain:new e.aH(t,i.u_terrain),u_terrain_dim:new e.aI(t,i.u_terrain_dim),u_terrain_matrix:new e.aJ(t,i.u_terrain_matrix),u_terrain_unpack:new e.aK(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.aI(t,i.u_terrain_exaggeration)}))(t,b),this.binderUniforms=r?r.getUniforms(t,b):[]}draw(t,e,i,r,s,n,o,a,l,c,h,u,p,d,m,f,_,g){const y=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(s),t.setCullFace(n),a){t.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,a.depthTexture),t.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t])}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(o[t]);m&&m.setUniforms(t,this.binderUniforms,p,{zoom:d});let x=0;switch(e){case y.LINES:x=2;break;case y.TRIANGLES:x=3;break;case y.LINE_STRIP:x=1}for(const i of u.get()){const r=i.vaos||(i.vaos={});(r[l]||(r[l]=new _e)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,f,_,g),y.drawElements(e,i.primitiveLength*x,y.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function ve(t,e,i){const r=1/Ft(i,1,e.transform.tileZoom),s=Math.pow(2,i.tileID.overscaledZ
vendor: 58,997 bytes, line 2
2),n=i.tileSize*Math.pow(2,e.transform.tileZoom)/s,o=n*(i.tileID.canonical.x+i.tileID.wrap*s),a=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[o>>16,a>>16],u_pixel_coord_lower:[65535&o,65535&a]}}const be=(t,i,r,s)=>{const n=i.style.light,o=n.properties.get("position"),a=[o.x,o.y,o.z],l=function(){var t=new e.A(9);return e.A!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}();"viewport"===n.properties.get("anchor")&&function(t,e){var i=Math.sin(e),r=Math.cos(e);t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1}(l,-i.transform.angle),function(t,e,i){var r=e[0],s=e[1],n=e[2];t[0]=r*i[0]+s*i[3]+n*i[6],t[1]=r*i[1]+s*i[4]+n*i[7],t[2]=r*i[2]+s*i[5]+n*i[8]}(a,a,l);const c=n.properties.get("color");return{u_matrix:t,u_lightpos:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+r,u_opacity:s}},we=(t,i,r,s,n,o,a)=>e.e(be(t,i,r,s),ve(o,i,a),{u_height_factor:-Math.pow(2,n.overscaledZ)/a.tileSize/8}),Te=t=>({u_matrix:t}),Se=(t,i,r,s)=>e.e(Te(t),ve(r,i,s)),Ie=(t,e)=>({u_matrix:t,u_world:e}),Ae=(t,i,r,s,n)=>e.e(Se(t,i,r,s),{u_world:n}),Pe=(t,e,i,r)=>{const s=t.transform;let n,o;if("map"===r.paint.get("circle-pitch-alignment")){const t=Ft(i,1,s.zoom);n=!0,o=[t,t]}else n=!1,o=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+n,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:o}},Ce=(t,e,i)=>({u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_viewport_size:[i.width,i.height]}),Me=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),ke=t=>({u_matrix:t}),ze=(t,e,i,r)=>({u_matrix:t,u_extrude_scale:Ft(e,1,i),u_intensity:r}),Ee=(t,i,r,s)=>{const n=e.H();e.aP(n,0,t.width,t.height,0,0,1);const o=t.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:r,u_color_ramp:s,u_opacity:i.paint.get("heatmap-opacity")}};function De(t,i){const r=Math.pow(2,i.canonical.z),s=i.canonical.y;return[new e.Z(0,s/r).toLngLat().lat,new e.Z(0,(s+1)/r).toLngLat().lat]}const Le=(t,e,i,r)=>{const s=t.transform;return{u_matrix:Ve(t,e,i,r),u_ratio:1/Ft(e,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Re=(t,i,r,s,n)=>e.e(Le(t,i,r,n),{u_image:0,u_image_height:s}),Be=(t,e,i,r,s)=>{const n=t.transform,o=Oe(e,n);return{u_matrix:Ve(t,e,i,s),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ft(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[o,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},Fe=(t,i,r,s,n,o)=>{const a=t.lineAtlas,l=Oe(i,t.transform),c="round"===r.layout.get("line-cap"),h=a.getDash(s.from,c),u=a.getDash(s.to,c),p=h.width*n.fromScale,d=u.width*n.toScale;return e.e(Le(t,i,r,o),{u_patternscale_a:[l/p,-h.height/2],u_patternscale_b:[l/d,-u.height/2],u_sdfgamma:a.width/(256*Math.min(p,d)*t.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:n.t})};function Oe(t,e){return 1/Ft(t,1,e.tileZoom)}function Ve(t,e,i,r){return t.translatePosMatrix(r?r.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Ue=(t,e,i,r,s)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(o=s.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(n=s.paint.get("raster-contrast"),n>0?1/(1-n):1+n),u_spin_weights:Ne(s.paint.get("raster-hue-rotate"))};var n,o};function Ne(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const je=(t,e,i,r,s,n,o,a,l,c,h,u,p,d)=>{const m=o.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:m.cameraToCenterDistance,u_pitch:m.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:m.width/m.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:s,u_is_variable_anchor:n,u_texsize:p,u_texture:0,u_translation:h,u_pitched_scale:d}},$e=(t,i,r,s,n,o,a,l,c,h,u,p,d,m,f)=>{const _=a.transform;return e.e(je(t,i,r,s,n,o,a,l,c,h,u,p,d,f),{u_gamma_scale:s?Math.cos(_._pitch)*_.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+m})},qe=(t,i,r,s,n,o,a,l,c,h,u,p,d,m)=>e.e($e(t,i,r,s,n,o,a,l,c,h,u,!0,p,!0,m),{u_texsize_icon:d,u_texture_icon:1}),Ze=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Ge=(t,i,r,s,n,o)=>e.e(function(t,e,i,r){const s=i.imageManager.getPattern(t.from.toString()),n=i.imageManager.getPattern(t.to.toString()),{width:o,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(r.tileID.canonical.x+r.tileID.wrap*l),u=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[o,a],u_mix:e.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Ft(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(s,o,r,n),{u_matrix:t,u_opacity:i}),We={fillExtrusion:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_lightpos:new e.aN(t,i.u_lightpos),u_lightintensity:new e.aI(t,i.u_lightintensity),u_lightcolor:new e.aN(t,i.u_lightcolor),u_vertical_gradient:new e.aI(t,i.u_vertical_gradient),u_opacity:new e.aI(t,i.u_opacity)}),fillExtrusionPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_lightpos:new e.aN(t,i.u_lightpos),u_lightintensity:new e.aI(t,i.u_lightintensity),u_lightcolor:new e.aN(t,i.u_lightcolor),u_vertical_gradient:new e.aI(t,i.u_vertical_gradient),u_height_factor:new e.aI(t,i.u_height_factor),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade),u_opacity:new e.aI(t,i.u_opacity)}),fill:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix)}),fillPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),fillOutline:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world)}),fillOutlinePattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),circle:(t,i)=>({u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_scale_with_map:new e.aH(t,i.u_scale_with_map),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_extrude_scale:new e.aO(t,i.u_extrude_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_matrix:new e.aJ(t,i.u_matrix)}),collisionBox:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_pixel_extrude_scale:new e.aO(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_inv_matrix:new e.aJ(t,i.u_inv_matrix),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_viewport_size:new e.aO(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new e.aL(t,i.u_color),u_matrix:new e.aJ(t,i.u_matrix),u_overlay:new e.aH(t,i.u_overlay),u_overlay_scale:new e.aI(t,i.u_overlay_scale)}),clippingMask:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix)}),heatmap:(t,i)=>({u_extrude_scale:new e.aI(t,i.u_extrude_scale),u_intensity:new e.aI(t,i.u_intensity),u_matrix:new e.aJ(t,i.u_matrix)}),heatmapTexture:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world),u_image:new e.aH(t,i.u_image),u_color_ramp:new e.aH(t,i.u_color_ramp),u_opacity:new e.aI(t,i.u_opacity)}),hillshade:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_latrange:new e.aO(t,i.u_latrange),u_light:new e.aO(t,i.u_light),u_shadow:new e.aL(t,i.u_shadow),u_highlight:new e.aL(t,i.u_highlight),u_accent:new e.aL(t,i.u_accent)}),hillshadePrepare:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_dimension:new e.aO(t,i.u_dimension),u_zoom:new e.aI(t,i.u_zoom),u_unpack:new e.aK(t,i.u_unpack)}),line:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_image:new e.aH(t,i.u_image),u_image_height:new e.aI(t,i.u_image_height)}),linePattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texsize:new e.aO(t,i.u_texsize),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_image:new e.aH(t,i.u_image),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),lineSDF:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_patternscale_a:new e.aO(t,i.u_patternscale_a),u_patternscale_b:new e.aO(t,i.u_patternscale_b),u_sdfgamma:new e.aI(t,i.u_sdfgamma),u_image:new e.aH(t,i.u_image),u_tex_y_a:new e.aI(t,i.u_tex_y_a),u_tex_y_b:new e.aI(t,i.u_tex_y_b),u_mix:new e.aI(t,i.u_mix)}),raster:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_tl_parent:new e.aO(t,i.u_tl_parent),u_scale_parent:new e.aI(t,i.u_scale_parent),u_buffer_scale:new e.aI(t,i.u_buffer_scale),u_fade_t:new e.aI(t,i.u_fade_t),u_opacity:new e.aI(t,i.u_opacity),u_image0:new e.aH(t,i.u_image0),u_image1:new e.aH(t,i.u_image1),u_brightness_low:new e.aI(t,i.u_brightness_low),u_brightness_high:new e.aI(t,i.u_brightness_high),u_saturation_factor:new e.aI(t,i.u_saturation_factor),u_contrast_factor:new e.aI(t,i.u_contrast_factor),u_spin_weights:new e.aN(t,i.u_spin_weights)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texture:new e.aH(t,i.u_texture),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texture:new e.aH(t,i.u_texture),u_gamma_scale:new e.aI(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_is_halo:new e.aH(t,i.u_is_halo),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texsize_icon:new e.aO(t,i.u_texsize_icon),u_texture:new e.aH(t,i.u_texture),u_texture_icon:new e.aH(t,i.u_texture_icon),u_gamma_scale:new e.aI(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_is_halo:new e.aH(t,i.u_is_halo),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),background:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_opacity:new e.aI(t,i.u_opacity),u_color:new e.aL(t,i.u_color)}),backgroundPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_opacity:new e.aI(t,i.u_opacity),u_image:new e.aH(t,i.u_image),u_pattern_tl_a:new e.aO(t,i.u_pattern_tl_a),u_pattern_br_a:new e.aO(t,i.u_pattern_br_a),u_pattern_tl_b:new e.aO(t,i.u_pattern_tl_b),u_pattern_br_b:new e.aO(t,i.u_pattern_br_b),u_texsize:new e.aO(t,i.u_texsize),u_mix:new e.aI(t,i.u_mix),u_pattern_size_a:new e.aO(t,i.u_pattern_size_a),u_pattern_size_b:new e.aO(t,i.u_pattern_size_b),u_scale_a:new e.aI(t,i.u_scale_a),u_scale_b:new e.aI(t,i.u_scale_b),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.aI(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texture:new e.aH(t,i.u_texture),u_ele_delta:new e.aI(t,i.u_ele_delta),u_fog_matrix:new e.aJ(t,i.u_fog_matrix),u_fog_color:new e.aL(t,i.u_fog_color),u_fog_ground_blend:new e.aI(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.aI(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.aL(t,i.u_horizon_color),u_horizon_fog_blend:new e.aI(t,i.u_horizon_fog_blend)}),terrainDepth:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ele_delta:new e.aI(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texture:new e.aH(t,i.u_texture),u_terrain_coords_id:new e.aI(t,i.u_terrain_coords_id),u_ele_delta:new e.aI(t,i.u_ele_delta)}),sky:(t,i)=>({u_sky_color:new e.aL(t,i.u_sky_color),u_horizon_color:new e.aL(t,i.u_horizon_color),u_horizon:new e.aI(t,i.u_horizon),u_sky_horizon_blend:new e.aI(t,i.u_sky_horizon_blend)})};class He{constructor(t,e,i){this.context=t;const r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Xe={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Je{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;const s=t.gl;this.buffer=s.createBuffer(),t.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const r=e.attributes[this.attributes[i].name];void 0!==r&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r=0;r<this.attributes.length;r++){const s=this.attributes[r],n=e.attributes[s.name];void 0!==n&&t.vertexAttribPointer(n,s.components,t[Xe[s.type]],!1,this.itemSize,s.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ke=new WeakMap;function Ye(t){var e;if(Ke.has(t))return Ke.get(t);{const i=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return Ke.set(t,i),i}}class Qe{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ti extends Qe{getDefault(){return e.aM.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ei extends Qe{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class ii extends Qe{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class ri extends Qe{getDefault(){return[!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class si extends Qe{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class ni extends Qe{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class oi extends Qe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class ai extends Qe{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class li extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class ci extends Qe{getDefault(){return[0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class hi extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class ui extends Qe{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class pi extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class di extends Qe{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class mi extends Qe{getDefault(){return e.aM.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class fi extends Qe{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class _i extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class gi extends Qe{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class yi extends Qe{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class xi extends Qe{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class vi extends Qe{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class bi extends Qe{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wi extends Qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ti extends Qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Si extends Qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Ii extends Qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ai extends Qe{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Pi extends Qe{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;Ye(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ci extends Qe{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Mi extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ki extends Qe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class zi extends Qe{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class Ei extends zi{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Di extends zi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Li extends zi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ri{constructor(t,e,i,r,s){this.context=t,this.width=e,this.height=i;const n=t.gl,o=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new Ei(t,o),r)this.depthAttachment=s?new Li(t,o):new Di(t,o);else if(s)throw new Error("Stencil cannot be set without depth");if(n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e)}t.deleteFramebuffer(this.framebuffer)}}class Bi{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}Bi.Replace=[1,0],Bi.disabled=new Bi(Bi.Replace,e.aM.transparent,[!1,!1,!1,!1]),Bi.unblended=new Bi(Bi.Replace,e.aM.transparent,[!0,!0,!0,!0]),Bi.alphaBlended=new Bi([1,771],e.aM.transparent,[!0,!0,!0,!0]);class Fi{constructor(t){var e,i;if(this.gl=t,this.clearColor=new ti(this),this.clearDepth=new ei(this),this.clearStencil=new ii(this),this.colorMask=new ri(this),this.depthMask=new si(this),this.stencilMask=new ni(this),this.stencilFunc=new oi(this),this.stencilOp=new ai(this),this.stencilTest=new li(this),this.depthRange=new ci(this),this.depthTest=new hi(this),this.depthFunc=new ui(this),this.blend=new pi(this),this.blendFunc=new di(this),this.blendColor=new mi(this),this.blendEquation=new fi(this),this.cullFace=new _i(this),this.cullFaceSide=new gi(this),this.frontFace=new yi(this),this.program=new xi(this),this.activeTexture=new vi(this),this.viewport=new bi(this),this.bindFramebuffer=new wi(this),this.bindRenderbuffer=new Ti(this),this.bindTexture=new Si(this),this.bindVertexBuffer=new Ii(this),this.bindElementBuffer=new Ai(this),this.bindVertexArray=new Pi(this),this.pixelStoreUnpack=new Ci(this),this.pixelStoreUnpackPremultiplyAlpha=new Mi(this),this.pixelStoreUnpackFlipY=new ki(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ye(t)){this.HALF_FLOAT=t.HALF_FLOAT;const r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new He(this,t,e)}createVertexBuffer(t,e,i){return new Je(this,t,e,i)}createRenderbuffer(t,e,i){const r=this.gl,s=r.createRenderbuffer();return this.bindRenderbuffer.set(s),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),s}createFramebuffer(t,e,i,r){return new Ri(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){const r=this.gl;let s=0;t&&(s|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(s|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(s|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(s)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.aE(t.blendFunction,Bi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Ye(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ye(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}class Oi{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Oi.ReadOnly=!1,Oi.ReadWrite=!0,Oi.disabled=new Oi(519,Oi.ReadOnly,[0,1]);const Vi=7680;class Ui{constructor(t,e,i,r,s,n){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=s,this.pass=n}}Ui.disabled=new Ui({func:519,mask:0},0,0,Vi,Vi,Vi);class Ni{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let ji;function $i(t,i,r,s,n){const o=t.context,a=o.gl,l=t.useProgram("collisionBox"),c=[];let h=0,u=0;for(let d=0;d<s.length;d++){const m=s[d],f=i.getTile(m).getBucket(r);if(!f)continue;const _=n?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;if(g.length>0){const i=e.H();e.aQ(i,f.placementInvProjMatrix,t.transform.glCoordMatrix),e.aQ(i,i,f.placementViewportMatrix),c.push({circleArray:g,circleOffset:u,transform:m.posMatrix,invTransform:i,coord:m}),h+=g.length/4,u=h}_&&l.draw(o,a.LINES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),Ni.disabled,{u_matrix:m.posMatrix,u_pixel_extrude_scale:[1/(p=t.transform).width,1/p.height]},t.style.map.terrain&&t.style.map.terrain.getTerrainData(m),r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,t.transform.zoom,null,null,_.collisionVertexBuffer)}var p;if(!n||!c.length)return;const d=t.useProgram("collisionCircle"),m=new e.aR;m.resize(4*h),m._trim();let f=0;for(const t of c)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,r=t.circleArray[i+0],s=t.circleArray[i+1],n=t.circleArray[i+2],o=t.circleArray[i+3];m.emplace(f++,r,s,n,o,0),m.emplace(f++,r,s,n,o,1),m.emplace(f++,r,s,n,o,2),m.emplace(f++,r,s,n,o,3)}(!ji||ji.length<2*h)&&(ji=function(t){const i=2*t,r=new e.aT;r.resize(i),r._trim();for(let t=0;t<i;t++){const e=6*t;r.uint16[e+0]=4*t+0,r.uint16[e+1]=4*t+1,r.uint16[e+2]=4*t+2,r.uint16[e+3]=4*t+2,r.uint16[e+4]=4*t+3,r.uint16[e+5]=4*t+0}return r}(h));const _=o.createIndexBuffer(ji,!0),g=o.createVertexBuffer(m,e.aS.members,!0);for(const i of c){const s=Ce(i.transform,i.invTransform,t.transform);d.draw(o,a.TRIANGLES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),Ni.disabled,s,t.style.map.terrain&&t.style.map.terrain.getTerrainData(i.coord),r.id,g,_,e.a0.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,t.transform.zoom,null,null,null)}g.destroy(),_.destroy()}Ni.disabled=new Ni(!1,1029,2305),Ni.backCCW=new Ni(!0,1029,2305);const qi=e.an(new Float32Array(16));function Zi(t,i,r,s,n,o){const{horizontalAlign:a,verticalAlign:l}=e.au(t);return new e.P((-(a-.5)*i/n+s[0])*o,(-(l-.5)*r/n+s[1])*o)}function Gi(t,i,r,s,n,o){const a=i.tileAnchorPoint.add(new e.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=s.mult(o);r||(t=t.rotate(-n));const e=a.add(t);return xt(e.x,e.y,i.labelPlaneMatrix,i.getElevation).point}if(r){const e=Ct(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),r=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(s.rotate(r))}return t.add(s)}function Wi(t,i,r,s,n,o,a,l,c,h,u,p,d,m){const f=t.text.placedSymbolArray,_=t.text.dynamicLayoutVertexArray,g=t.icon.dynamicLayoutVertexArray,y={};_.clear();for(let g=0;g<f.length;g++){const x=f.get(g),v=x.hidden||!x.crossTileID||t.allowVerticalPlacement&&!x.placedOrientation?null:s[x.crossTileID];if(v){const s=new e.P(x.anchorX,x.anchorY),f={getElevation:m,width:n.width,height:n.height,labelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:r,projection:u,projectionCache:null,tileAnchorPoint:s,translation:p,unwrappedTileID:d},g=r?xt(s.x,s.y,a,m):Ct(s.x,s.y,f),b=vt(n.cameraToCenterDistance,g.signedDistanceFromCamera);let w=e.ai(t.textSizeData,c,x)*b/e.ap;r&&(w*=t.tilePixelRatio/l);const{width:T,height:S,anchor:I,textOffset:A,textBoxScale:P}=v,C=Zi(I,T,S,A,P,w),M=u.getPitchedTextCorrection(n,s.add(new e.P(p[0],p[1])),d),k=Gi(g.point,f,i,C,n.angle,M),z=t.allowVerticalPlacement&&x.placedOrientation===e.ah.vertical?Math.PI/2:0;for(let t=0;t<x.numGlyphs;t++)e.aj(_,k,z);h&&x.associatedIconIndex>=0&&(y[x.associatedIconIndex]={shiftedAnchor:k,angle:z})}else Dt(x.numGlyphs,_)}if(h){g.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const r=i.get(t);if(r.hidden)Dt(r.numGlyphs,g);else{const i=y[t];if(i)for(let t=0;t<r.numGlyphs;t++)e.aj(g,i.shiftedAnchor,i.angle);else Dt(r.numGlyphs,g)}}t.icon.dynamicLayoutVertexBuffer.updateData(g)}t.text.dynamicLayoutVertexBuffer.updateData(_)}function Hi(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Xi(t,i,r,s,n,o,a,l,c,h,u,p){const d=t.context,m=d.gl,f=t.transform,_=ie(),g="map"===l,y="map"===c,x="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),v=g&&!y&&!x,b=!y&&x,w=!r.layout.get("symbol-sort-key").isConstant();let T=!1;const S=t.depthModeForSublayer(0,Oi.ReadOnly),I=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=[],P=_.getCircleRadiusCorrection(f);for(const l of s){const s=i.getTile(l),c=s.getBucket(r);if(!c)continue;const u=n?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const p=u.programConfigurations.get(r.id),d=n||c.sdfIcons,S=n?c.textSizeData:c.iconSizeData,C=y||0!==f.pitch,M=t.useProgram(Hi(d,n,c),p),k=e.ag(S,f.zoom),z=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l);let E,D,L,R,B=[0,0],F=null;if(n)D=s.glyphAtlasTexture,L=m.LINEAR,E=s.glyphAtlasTexture.size,c.iconsInText&&(B=s.imageAtlasTexture.size,F=s.imageAtlasTexture,R=C||t.options.rotating||t.options.zooming||"composite"===S.kind||"camera"===S.kind?m.LINEAR:m.NEAREST);else{const e=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;D=s.imageAtlasTexture,L=d||t.options.rotating||t.options.zooming||e||C?m.LINEAR:m.NEAREST,E=s.imageAtlasTexture.size}const O=Ft(s,1,t.transform.zoom),V=b?l.posMatrix:qi,U=gt(V,y,g,t.transform,O),N=yt(V,y,g,t.transform,O),j=yt(l.posMatrix,y,g,t.transform,O),$=_.translatePosition(t.transform,s,o,a),q=I&&c.hasTextData(),Z="none"!==r.layout.get("icon-text-fit")&&q&&c.hasIconData();if(x){const e=t.style.map.terrain?(e,i)=>t.style.map.terrain.getElevation(l,e,i):null,i="map"===r.layout.get("text-rotation-alignment");wt(c,l.posMatrix,t,n,U,j,y,h,i,_,l.toUnwrapped(),f.width,f.height,$,e)}const G=l.posMatrix,W=n&&I||Z,H=x||W?qi:U,X=N,J=d&&0!==r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1);let K;K=d?c.iconsInText?qe(S.kind,k,v,y,x,W,t,G,H,X,$,E,B,P):$e(S.kind,k,v,y,x,W,t,G,H,X,$,n,E,!0,P):je(S.kind,k,v,y,x,W,t,G,H,X,$,n,E,P);const Y={program:M,buffers:u,uniformValues:K,atlasTexture:D,atlasTextureIcon:F,atlasInterpolation:L,atlasInterpolationIcon:R,isSDF:d,hasHalo:J};if(w&&c.canOverlap){T=!0;const t=u.segments.get();for(const i of t)A.push({segments:new e.a0([i]),sortKey:i.sortKey,state:Y,terrainData:z})}else A.push({segments:u.segments,sortKey:0,state:Y,terrainData:z})}T&&A.sort((t,e)=>t.sortKey-e.sortKey);for(const e of A){const i=e.state;if(d.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(d.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const s=i.uniformValues;i.hasHalo&&(s.u_is_halo=1,Ji(i.buffers,e.segments,r,t,i.program,S,u,p,s,e.terrainData)),s.u_is_halo=0}Ji(i.buffers,e.segments,r,t,i.program,S,u,p,i.uniformValues,e.terrainData)}}function Ji(t,e,i,r,s,n,o,a,l,c){const h=r.context;s.draw(h,h.gl.TRIANGLES,n,o,a,Ni.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Ki(t,i,r,s){const n=t.context,o=n.gl,a=Ui.disabled,l=new Bi([o.ONE,o.ONE],e.aM.transparent,[!0,!0,!0,!0]),c=i.getBucket(r);if(!c)return;const h=s.key;let u=r.heatmapFbos.get(h);u||(u=Qi(n,i.tileSize,i.tileSize),r.heatmapFbos.set(h,u)),n.bindFramebuffer.set(u.framebuffer),n.viewport.set([0,0,i.tileSize,i.tileSize]),n.clear({color:e.aM.transparent});const p=c.programConfigurations.get(r.id),d=t.useProgram("heatmap",p),m=t.style.map.terrain.getTerrainData(s);d.draw(n,o.TRIANGLES,Oi.disabled,a,l,Ni.disabled,ze(s.posMatrix,i,t.transform.zoom,r.paint.get("heatmap-intensity")),m,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,t.transform.zoom,p)}function Yi(t,e,i){const r=t.context,s=r.gl;r.setColorMode(t.colorModeForRenderPass());const n=tr(r,e),o=i.key,a=e.heatmapFbos.get(o);a&&(r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(s.TEXTURE1),n.bind(s.LINEAR,s.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,s.TRIANGLES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),Ni.disabled,Ee(t,e,0,1),null,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,t.transform.zoom),a.destroy(),e.heatmapFbos.delete(o))}function Qi(t,e,i){var r,s;const n=t.gl,o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);const a=null!==(r=t.HALF_FLOAT)&&void 0!==r?r:n.UNSIGNED_BYTE,l=null!==(s=t.RGBA16F)&&void 0!==s?s:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,l,e,i,0,n.RGBA,a,null);const c=t.createFramebuffer(e,i,!1,!1);return c.colorAttachment.set(o),c}function tr(t,e){return e.colorRampTexture||(e.colorRampTexture=new b(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}function er(t,e,i,r,s){if(!i||!r||!r.imageAtlas)return;const n=r.imageAtlas.patternPositions;let o=n[i.to.toString()],a=n[i.from.toString()];if(!o&&a&&(o=a),!a&&o&&(a=o),!o||!a){const t=s.getPaintProperty(e);o=n[t],a=n[t]}o&&a&&t.setConstantPatternPositions(o,a)}function ir(t,e,i,r,s,n,o){const a=t.context.gl,l="fill-pattern",c=i.paint.get(l),h=c&&c.constantOr(1),u=i.getCrossfadeParameters();let p,d,m,f,_;o?(d=h&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=a.LINES):(d=h?"fillPattern":"fill",p=a.TRIANGLES);const g=c.constantOr(null);for(const c of r){const r=e.getTile(c);if(h&&!r.patternsLoaded())continue;const y=r.getBucket(i);if(!y)continue;const x=y.programConfigurations.get(i.id),v=t.useProgram(d,x),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);h&&(t.context.activeTexture.set(a.TEXTURE0),r.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),x.updatePaintBuffers(u)),er(x,l,g,r,i);const w=b?c:null,T=t.translatePosMatrix(w?w.posMatrix:c.posMatrix,r,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(o){f=y.indexBuffer2,_=y.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];m="fillOutlinePattern"===d&&h?Ae(T,t,u,r,e):Ie(T,e)}else f=y.indexBuffer,_=y.segments,m=h?Se(T,t,u,r):Te(T);v.draw(t.context,p,s,t.stencilModeForClipping(c),n,Ni.disabled,m,b,i.id,y.layoutVertexBuffer,f,_,i.paint,t.transform.zoom,x)}}function rr(t,e,i,r,s,n,o){const a=t.context,l=a.gl,c="fill-extrusion-pattern",h=i.paint.get(c),u=h.constantOr(1),p=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity"),m=h.constantOr(null);for(const h of r){const r=e.getTile(h),f=r.getBucket(i);if(!f)continue;const _=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),g=f.programConfigurations.get(i.id),y=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",g);u&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(p)),er(g,c,m,r,i);const x=t.translatePosMatrix(h.posMatrix,r,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),v=i.paint.get("fill-extrusion-vertical-gradient"),b=u?we(x,t,v,d,h,p,r):be(x,t,v,d);y.draw(a,a.gl.TRIANGLES,s,n,o,Ni.backCCW,b,_,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,g,t.style.map.terrain&&f.centroidVertexBuffer)}}function sr(t,e,i,r,s,n,o){const a=t.context,l=a.gl,c=i.fbo;if(!c)return;const h=t.useProgram("hillshade"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(a,l.TRIANGLES,s,n,o,Ni.disabled,((t,e,i,r)=>{const s=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);const l=!t.options.moving;return{u_matrix:r?r.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:De(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:s,u_highlight:n,u_accent:o}})(t,i,r,u?e:null),u,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function nr(t,i,r,s,n,o){const a=t.context,l=a.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,p=c.getPixels();if(a.activeTexture.set(l.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new b(a,p,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);a.activeTexture.set(l.TEXTURE0);let d=i.fbo;if(!d){const t=new b(a,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),d=i.fbo=a.createFramebuffer(h,h,!0,!1),d.colorAttachment.set(t.texture)}a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,h,h]),t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,s,n,o,Ni.disabled,((t,i)=>{const r=i.stride,s=e.H();return e.aP(s,0,e.X,-e.X,0,0,1),e.J(s,s,[0,-e.X,0]),{u_matrix:s,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function or(t,i,r,s,o,a){const l=s.paint.get("raster-fade-duration");if(!a&&l>0){const s=n.now(),a=(s-t.timeAdded)/l,c=i?(s-i.timeAdded)/l:-1,h=r.getSource(),u=o.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=p&&t.refreshedUponExpiration?1:e.ac(p?a:1-c,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const ar=new e.aM(1,0,0,1),lr=new e.aM(0,1,0,1),cr=new e.aM(0,0,1,1),hr=new e.aM(1,0,1,1),ur=new e.aM(0,1,1,1);function pr(t,e,i,r){mr(t,0,e+i/2,t.transform.width,i,r)}function dr(t,e,i,r){mr(t,e-i/2,0,i,t.transform.height,r)}function mr(t,e,i,r,s,n){const o=t.context,a=o.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,s*t.pixelRatio),o.clear({color:n}),a.disable(a.SCISSOR_TEST)}function fr(t,i,r){const s=t.context,n=s.gl,o=r.posMatrix,a=t.useProgram("debug"),l=Oi.disabled,c=Ui.disabled,h=t.colorModeForRenderPass(),u="$debug",p=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r);s.activeTexture.set(n.TEXTURE0);const d=i.getTileByID(r.key).latestRawTileData,m=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(r).tileSize,_=512/Math.min(f,512)*(r.overscaledZ/t.transform.zoom)*.5;let g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,r=t.context.gl,s=t.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,i.width,i.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(e,5,5),s.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${g} ${m}kB`),a.draw(s,n.TRIANGLES,l,c,Bi.alphaBlended,Ni.disabled,Me(o,e.aM.transparent,_),null,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),a.draw(s,n.LINE_STRIP,l,c,h,Ni.disabled,Me(o,e.aM.red),p,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function _r(t,e,i){const r=t.context,s=r.gl,n=t.colorModeForRenderPass(),o=new Oi(s.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),h=e.getTerrainData(c.tileID);r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,i.texture);const u=t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),p=e.getMeshFrameDelta(t.transform.zoom),d=t.transform.calculateFogMatrix(c.tileID.toUnwrapped()),m=ge(u,p,d,t.style.sky,t.transform.pitch);a.draw(r,s.TRIANGLES,o,Ui.disabled,n,Ni.backCCW,m,h,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}class gr{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class yr{constructor(t,i){this.context=new Fi(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ut.maxUnderzooming+ut.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ce}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize()}setup(){const t=this.context,i=new e.aX;i.emplaceBack(0,0),i.emplaceBack(e.X,0),i.emplaceBack(0,e.X),i.emplaceBack(e.X,e.X),this.tileExtentBuffer=t.createVertexBuffer(i,de.members),this.tileExtentSegments=e.a0.simpleSegment(0,0,4,2);const r=new e.aX;r.emplaceBack(0,0),r.emplaceBack(e.X,0),r.emplaceBack(0,e.X),r.emplaceBack(e.X,e.X),this.debugBuffer=t.createVertexBuffer(r,de.members),this.debugSegments=e.a0.simpleSegment(0,0,4,5);const s=new e.$;s.emplaceBack(0,0,0,0),s.emplaceBack(e.X,0,e.X,0),s.emplaceBack(0,e.X,0,e.X),s.emplaceBack(e.X,e.X,e.X,e.X),this.rasterBoundsBuffer=t.createVertexBuffer(s,Y.members),this.rasterBoundsSegments=e.a0.simpleSegment(0,0,4,2);const n=new e.aX;n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,de.members),this.viewportSegments=e.a0.simpleSegment(0,0,4,2);const o=new e.aZ;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);const a=new e.aY;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);const l=this.context.gl;this.stencilClearMode=new Ui({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=e.H();e.aP(r,0,this.width,this.height,0,0,1),e.K(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,i.TRIANGLES,Oi.disabled,this.stencilClearMode,Bi.disabled,Ni.disabled,ke(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,r=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Bi.disabled),i.setDepthMode(Oi.disabled);const s=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,n=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);s.draw(i,r.TRIANGLES,Oi.disabled,new Ui({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),Bi.disabled,Ni.disabled,ke(t.posMatrix),n,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ui({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ui({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort((t,e)=>e.overscaledZ-t.overscaledZ),r=i[i.length-1].overscaledZ,s=i[0].overscaledZ-r+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();const t={};for(let i=0;i<s;i++)t[i+r]=new Ui({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=s,[t,i]}return[{[r]:Ui.disabled},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Bi([t.CONSTANT_COLOR,t.ONE],new e.aM(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Bi.unblended:Bi.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Oi.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Oi(i||this.context.gl.LEQUAL,e,[r,r])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(n.now()),this.imageManager.beginFrame();const r=this.style._order,s=this.style.sourceCaches,o={},a={},l={};for(const t in s){const e=s[t];e.used&&e.prepare(this.context),o[t]=e.getVisibleCoordinates(),a[t]=o[t].slice().reverse(),l[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of r){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=a[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,s[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?e.aM.black:e.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,i){const r=t.context,s=r.gl,n=((t,e,i)=>({u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:(e.height/2+e.getHorizon())*i,u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i}))(i,t.style.map.transform,t.pixelRatio),o=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),a=Ui.disabled,l=t.colorModeForRenderPass(),c=t.useProgram("sky");if(!i.mesh){const t=new e.aX;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1);const s=new e.aY;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),i.mesh=new gr(r.createVertexBuffer(t,de.members),r.createIndexBuffer(s),e.a0.simpleSegment(0,0,t.length,s.length))}c.draw(r,s.TRIANGLES,o,a,l,Ni.disabled,n,void 0,"sky",i.mesh.vertexBuffer,i.mesh.indexBuffer,i.mesh.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],e=s[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],e=s[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=("symbol"===t.type?l:a)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const r=Object.values(t._layers).flatMap(i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[]),s=r.filter(t=>"vector"===t.getSource().type),n=r.filter(t=>"vector"!==t.getSource().type),o=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t)};return s.forEach(t=>o(t)),i||n.forEach(t=>o(t)),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let r=0;r<i.length;r++)fr(t,e,i[r])}(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;pr(t,t.transform.height-(e.top||0),3,ar),pr(t,e.bottom||0,3,lr),dr(t,e.left||0,3,cr),dr(t,t.transform.width-(e.right||0),3,hr);const i=t.transform.centerPoint;!function(t,e,i,r){mr(t,e-1,i-10,2,20,r),mr(t,e-10,i-1,20,2,r)}(t,i.x,t.transform.height-i.y,ur)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix;let s=this.terrainFacilitator.dirty;s||(s=t?!e.a_(i,r):!e.a$(i,r)),s||(s=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),s&&(e.b0(i,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const r=t.context,s=r.gl,n=Bi.unblended,o=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.aM.transparent,depth:1});for(const e of l){const l=i.getTerrainData(e.tileID),h={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};c.draw(r,s.TRIANGLES,o,Ui.disabled,n,Ni.backCCW,h,l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain),function(t,i){const r=t.context,s=r.gl,n=Bi.unblended,o=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=t.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.aM.transparent,depth:1}),i.coordsIndex=[];for(const e of c){const c=i.getTerrainData(e.tileID);r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.texture);const u={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};h.draw(r,s.TRIANGLES,o,Ui.disabled,n,Ni.backCCW,u,c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),i.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.map.terrain))}renderLayer(t,i,r,s){if(!r.isHidden(this.transform.zoom)&&("background"===r.type||"custom"===r.type||(s||[]).length))switch(this.id=r.id,r.type){case"symbol":!function(t,i,r,s,n){if("translucent"!==t.renderPass)return;const o=Ui.disabled,a=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,r,s,n,o,a,l,c){const h=i.transform,u=ie(),p="map"===n,d="map"===o;for(const n of t){const t=s.getTile(n),o=t.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const m=e.ag(o.textSizeData,h.zoom),f=Ft(t,1,i.transform.zoom),_=gt(n.posMatrix,d,p,i.transform,f),g="none"!==r.layout.get("icon-text-fit")&&o.hasIconData();if(m){const e=Math.pow(2,h.zoom-t.tileID.overscaledZ),r=i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(n,t,e):null,s=u.translatePosition(h,t,a,l);Wi(o,p,d,c,h,_,n.posMatrix,e,m,g,u,s,n.toUnwrapped(),r)}}}(s,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),n),0!==r.paint.get("icon-opacity").constantOr(1)&&Xi(t,i,r,s,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,a),0!==r.paint.get("text-opacity").constantOr(1)&&Xi(t,i,r,s,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,a),i.map.showCollisionBoxes&&($i(t,i,r,s,!0),$i(t,i,r,s,!1))}(t,i,r,s,this.style.placement.variableOffsets);break;case"circle":!function(t,i,r,s){if("translucent"!==t.renderPass)return;const n=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=!r.layout.get("
2circle-sort-key").isConstant();if(0===n.constantOr(1)&&(0===o.constantOr(1)||0===a.constantOr(1)))return;const c=t.context,h=c.gl,u=t.depthModeForSublayer(0,Oi.ReadOnly),p=Ui.disabled,d=t.colorModeForRenderPass(),m=[];for(let n=0;n<s.length;n++){const o=s[n],a=i.getTile(o),c=a.getBucket(r);if(!c)continue;const h=c.programConfigurations.get(r.id),u=t.useProgram("circle",h),p=c.layoutVertexBuffer,d=c.indexBuffer,f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(o),_={programConfiguration:h,program:u,layoutVertexBuffer:p,indexBuffer:d,uniformValues:Pe(t,o,a,r),terrainData:f};if(l){const t=c.segments.get();for(const i of t)m.push({segments:new e.a0([i]),sortKey:i.sortKey,state:_})}else m.push({segments:c.segments,sortKey:0,state:_})}l&&m.sort((t,e)=>t.sortKey-e.sortKey);for(const e of m){const{programConfiguration:i,program:s,layoutVertexBuffer:n,indexBuffer:o,uniformValues:a,terrainData:l}=e.state;s.draw(c,h.TRIANGLES,u,p,d,Ni.disabled,a,l,r.id,n,o,e.segments,r.paint,t.transform.zoom,i)}}(t,i,r,s);break;case"heatmap":!function(t,i,r,s){if(0===r.paint.get("heatmap-opacity"))return;const n=t.context;if(t.style.map.terrain){for(const e of s){const s=i.getTile(e);i.hasRenderableParent(e)||("offscreen"===t.renderPass?Ki(t,s,r,e):"translucent"===t.renderPass&&Yi(t,r,e))}n.viewport.set([0,0,t.width,t.height])}else"offscreen"===t.renderPass?function(t,i,r,s){const n=t.context,o=n.gl,a=Ui.disabled,l=new Bi([o.ONE,o.ONE],e.aM.transparent,[!0,!0,!0,!0]);(function(t,i,r){const s=t.gl;t.activeTexture.set(s.TEXTURE1),t.viewport.set([0,0,i.width/4,i.height/4]);let n=r.heatmapFbos.get(e.aU);n?(s.bindTexture(s.TEXTURE_2D,n.colorAttachment.get()),t.bindFramebuffer.set(n.framebuffer)):(n=Qi(t,i.width/4,i.height/4),r.heatmapFbos.set(e.aU,n))})(n,t,r),n.clear({color:e.aM.transparent});for(let e=0;e<s.length;e++){const c=s[e];if(i.hasRenderableParent(c))continue;const h=i.getTile(c),u=h.getBucket(r);if(!u)continue;const p=u.programConfigurations.get(r.id),d=t.useProgram("heatmap",p),{zoom:m}=t.transform;d.draw(n,o.TRIANGLES,Oi.disabled,a,l,Ni.disabled,ze(c.posMatrix,h,m,r.paint.get("heatmap-intensity")),null,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,t.transform.zoom,p)}n.viewport.set([0,0,t.width,t.height])}(t,i,r,s):"translucent"===t.renderPass&&function(t,i){const r=t.context,s=r.gl;r.setColorMode(t.colorModeForRenderPass());const n=i.heatmapFbos.get(e.aU);n&&(r.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,n.colorAttachment.get()),r.activeTexture.set(s.TEXTURE1),tr(r,i).bind(s.LINEAR,s.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,s.TRIANGLES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),Ni.disabled,Ee(t,i,0,1),null,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom))}(t,r)}(t,i,r,s);break;case"line":!function(t,i,r,s){if("translucent"!==t.renderPass)return;const n=r.paint.get("line-opacity"),o=r.paint.get("line-width");if(0===n.constantOr(1)||0===o.constantOr(1))return;const a=t.depthModeForSublayer(0,Oi.ReadOnly),l=t.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),h=r.paint.get("line-pattern"),u=h.constantOr(1),p=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),m=u?"linePattern":c?"lineSDF":p?"lineGradient":"line",f=t.context,_=f.gl;let g=!0;for(const n of s){const s=i.getTile(n);if(u&&!s.patternsLoaded())continue;const o=s.getBucket(r);if(!o)continue;const y=o.programConfigurations.get(r.id),x=t.context.program.get(),v=t.useProgram(m,y),w=g||v.program!==x,T=t.style.map.terrain&&t.style.map.terrain.getTerrainData(n),S=h.constantOr(null);if(S&&s.imageAtlas){const t=s.imageAtlas,e=t.patternPositions[S.to.toString()],i=t.patternPositions[S.from.toString()];e&&i&&y.setConstantPatternPositions(e,i)}const I=T?n:null,A=u?Be(t,s,r,d,I):c?Fe(t,s,r,c,d,I):p?Re(t,s,r,o.lineClipsArray.length,I):Le(t,s,r,I);if(u)f.activeTexture.set(_.TEXTURE0),s.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),y.updatePaintBuffers(d);else if(c&&(w||t.lineAtlas.dirty))f.activeTexture.set(_.TEXTURE0),t.lineAtlas.bind(f);else if(p){const s=o.gradients[r.id];let a=s.texture;if(r.gradientVersion!==s.version){let l=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,s=n.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-n.canonical.z):1;l=e.ac(e.aV(o.maxLineLength/e.X*1024*s),256,f.maxTextureSize)}s.gradient=e.aW({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:s.gradient||void 0,clips:o.lineClipsArray}),s.texture?s.texture.update(s.gradient):s.texture=new b(f,s.gradient,_.RGBA),s.version=r.gradientVersion,a=s.texture}f.activeTexture.set(_.TEXTURE0),a.bind(r.stepInterpolant?_.NEAREST:_.LINEAR,_.CLAMP_TO_EDGE)}v.draw(f,_.TRIANGLES,a,t.stencilModeForClipping(n),l,Ni.disabled,A,T,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,t.transform.zoom,y,o.layoutVertexBuffer2),g=!1}}(t,i,r,s);break;case"fill":!function(t,i,r,s){const n=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;const a=t.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===n.constantOr(e.aM.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const e=t.depthModeForSublayer(1,"opaque"===t.renderPass?Oi.ReadWrite:Oi.ReadOnly);ir(t,i,r,s,e,a,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const e=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Oi.ReadOnly);ir(t,i,r,s,e,a,!0)}}(t,i,r,s);break;
vendor: 117,687 bytes, line 2
2case"fill-extrusion":!function(t,e,i,r){const s=i.paint.get("fill-extrusion-opacity");if(0!==s&&"translucent"===t.renderPass){const n=new Oi(t.context.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D);if(1!==s||i.paint.get("fill-extrusion-pattern").constantOr(1))rr(t,e,i,r,n,Ui.disabled,Bi.disabled),rr(t,e,i,r,n,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const s=t.colorModeForRenderPass();rr(t,e,i,r,n,Ui.disabled,s)}}}(t,i,r,s);break;case"hillshade":!function(t,e,i,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const s=t.context,n=t.depthModeForSublayer(0,Oi.ReadOnly),o=t.colorModeForRenderPass(),[a,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(r):[{},r];for(const r of l){const s=e.getTile(r);void 0!==s.needsHillshadePrepare&&s.needsHillshadePrepare&&"offscreen"===t.renderPass?nr(t,s,i,n,Ui.disabled,o):"translucent"===t.renderPass&&sr(t,r,s,i,n,a[r.overscaledZ],o)}s.viewport.set([0,0,t.width,t.height])}(t,i,r,s);break;case"raster":!function(t,e,i,r){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const s=t.context,n=s.gl,o=e.getSource(),a=t.useProgram("raster"),l=t.colorModeForRenderPass(),[c,h]=o instanceof Q?[{},r]:t.stencilConfigForOverlap(r),u=h[h.length-1].overscaledZ,p=!t.options.moving;for(const r of h){const h=t.depthModeForSublayer(r.overscaledZ-u,1===i.paint.get("raster-opacity")?Oi.ReadWrite:Oi.ReadOnly,n.LESS),d=e.getTile(r);d.registerFadeDuration(i.paint.get("raster-fade-duration"));const m=e.findLoadedParent(r,0),f=e.findLoadedSibling(r),_=or(d,m||f||null,e,i,t.transform,t.style.map.terrain);let g,y;const x="nearest"===i.paint.get("raster-resampling")?n.NEAREST:n.LINEAR;s.activeTexture.set(n.TEXTURE0),d.texture.bind(x,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),s.activeTexture.set(n.TEXTURE1),m?(m.texture.bind(x,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,m.tileID.overscaledZ-d.tileID.overscaledZ),y=[d.tileID.canonical.x*g%1,d.tileID.canonical.y*g%1]):d.texture.bind(x,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),d.texture.useMipmap&&s.extTextureFilterAnisotropic&&t.transform.pitch>20&&n.texParameterf(n.TEXTURE_2D,s.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,s.extTextureFilterAnisotropicMax);const v=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r),b=v?r:null,w=b?b.posMatrix:t.transform.calculatePosMatrix(r.toUnwrapped(),p),T=Ue(w,y||[0,0],g||1,_,i);o instanceof Q?a.draw(s,n.TRIANGLES,h,Ui.disabled,l,Ni.disabled,T,v,i.id,o.boundsBuffer,t.quadTriangleIndexBuffer,o.boundsSegments):a.draw(s,n.TRIANGLES,h,c[r.overscaledZ],l,Ni.disabled,T,v,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}(t,i,r,s);break;case"background":!function(t,e,i,r){const s=i.paint.get("background-color"),n=i.paint.get("background-opacity");if(0===n)return;const o=t.context,a=o.gl,l=t.transform,c=l.tileSize,h=i.paint.get("background-pattern");if(t.isPatternMissing(h))return;const u=!h&&1===s.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==u)return;const p=Ui.disabled,d=t.depthModeForSublayer(0,"opaque"===u?Oi.ReadWrite:Oi.ReadOnly),m=t.colorModeForRenderPass(),f=t.useProgram(h?"backgroundPattern":"background"),_=r||l.coveringTiles({tileSize:c,terrain:t.style.map.terrain});h&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const g=i.getCrossfadeParameters();for(const e of _){const l=r?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=h?Ge(l,n,t,h,{tileID:e,tileSize:c},g):Ze(l,n,s),_=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);f.draw(o,a.TRIANGLES,d,p,m,Ni.disabled,u,_,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}(t,0,r,s);break;case"custom":!function(t,e,i){const r=t.context,s=i.implementation;if("offscreen"===t.renderPass){const e=s.prerender;e&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),e.call(s,r.gl,t.transform.customLayerMatrix()),r.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(Ui.disabled);const e="3d"===s.renderingMode?new Oi(t.context.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Oi.ReadOnly);r.setDepthMode(e),s.render(r.gl,t.transform.customLayerMatrix(),{farZ:t.transform.farZ,nearZ:t.transform.nearZ,fov:t.transform._fov,modelViewProjectionMatrix:t.transform.modelViewProjectionMatrix,projectionMatrix:t.transform.projectionMatrix}),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null)}}(t,0,r)}}translatePosMatrix(t,i,r,s,n){if(!r[0]&&!r[1])return t;const o=n?"map"===s?this.transform.angle:0:"viewport"===s?-this.transform.angle:0;if(o){const t=Math.sin(o),e=Math.cos(o);r=[r[0]*e-r[1]*t,r[0]*t+r[1]*e]}const a=[n?r[0]:Ft(i,r[0],this.transform.zoom),n?r[1]:Ft(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return e.J(l,t,a),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new xe(this.context,me[t],e,We[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new b(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class xr{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(t,i,r){const s=Math.pow(2,r),n=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(r=>{const n=1/(r=e.af([],r,t))[3]/i*s;return e.b1(r,r,[n,n,1/r[3],n])}),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(t=>{const e=function(t,e){var i=e[0],r=e[1],s=e[2],n=i*i+r*r+s*s;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}([],function(t,e,i){var r=e[0],s=e[1],n=e[2],o=i[0],a=i[1],l=i[2];return t[0]=s*l-n*a,t[1]=n*o-r*l,t[2]=r*a-s*o,t}([],g([],n[t[0]],n[t[1]]),g([],n[t[2]],n[t[1]]))),i=-((r=e)[0]*(s=n[t[1]])[0]+r[1]*s[1]+r[2]*s[2]);var r,s;return e.concat(i)});return new xr(n,o)}}class vr{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max))}quadrant(t){const e=[t%2==0,t<2],i=f(this.min),r=f(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],r[t]=e[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new vr(i,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let r=!0;for(let s=0;s<t.planes.length;s++){const n=t.planes[s];let o=0;for(let t=0;t<i.length;t++)e.b2(n,i[t])>=0&&o++;if(0===o)return 0;o!==i.length&&(r=!1)}if(r)return 2;for(let e=0;e<3;e++){let i=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let s=0;s<t.points.length;s++){const n=t.points[s][e]-this.min[e];i=Math.min(i,n),r=Math.max(r,n)}if(r<0||i>this.max[e]-this.min[e])return 0}return 1}}class br{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.y.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.y.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.y.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.y.number(t.right,i.right,r)),this}getCenter(t,i){const r=e.ac((this.left+t-this.right)/2,0,t),s=e.ac((this.top+i-this.bottom)/2,0,i);return new e.P(r,s)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new br(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const wr=85.051129;class Tr{constructor(t,i,r,s,n){this.tileSize=512,this._renderWorldCopies=void 0===n||!!n,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==r?0:r,this._maxPitch=null==s?60:s,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new br,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const t=new Tr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.lngRange=t.lngRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const i=-e.b3(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}(),function(t,e,i){var r=e[0],s=e[1],n=e[2],o=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=r*l+n*a,t[1]=s*l+o*a,t[2]=r*-a+n*l,t[3]=s*-a+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.ac(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){const i=[new e.b4(0,t)];if(this._renderWorldCopies){const r=this.pointCoordinate(new e.P(0,0)),s=this.pointCoordinate(new e.P(this.width,0)),n=this.pointCoordinate(new e.P(this.width,this.height)),o=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(r.x,s.x,n.x,o.x)),l=Math.floor(Math.max(r.x,s.x,n.x,o.x)),c=1;for(let r=a-c;r<=l+c;r++)0!==r&&i.push(new e.b4(r,t))}return i}coveringTiles(t){var i,r;let s=this.coveringZoomLevel(t);const n=s;if(void 0!==t.minzoom&&s<t.minzoom)return[];void 0!==t.maxzoom&&s>t.maxzoom&&(s=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),a=e.Z.fromLngLat(this.center),l=Math.pow(2,s),c=[l*o.x,l*o.y,0],h=[l*a.x,l*a.y,0],u=xr.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,s);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=s);const d=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,m=t=>({aabb:new vr([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),f=[],_=[],g=s,x=t.reparseOverscaled?n:s;if(this._renderWorldCopies)for(let t=1;t<=3;t++)f.push(m(-t)),f.push(m(t));for(f.push(m(0));f.length>0;){const s=f.pop(),n=s.x,o=s.y;let a=s.fullyVisible;if(!a){const t=s.aabb.intersects(u);if(0===t)continue;a=2===t}const l=t.terrain?c:h,m=s.aabb.distanceX(l),v=s.aabb.distanceY(l),b=Math.max(Math.abs(m),Math.abs(v));if(s.zoom===g||b>d+(1<<g-s.zoom)-2&&s.zoom>=p){const t=g-s.zoom,i=c[0]-.5-(n<<t),r=c[1]-.5-(o<<t);_.push({tileID:new e.S(s.zoom===g?x:s.zoom,s.wrap,s.zoom,n,o),distanceSq:y([h[0]-.5-n,h[1]-.5-o]),tileDistanceToCamera:Math.sqrt(i*i+r*r)})}else for(let l=0;l<4;l++){const c=(n<<1)+l%2,h=(o<<1)+(l>>1),u=s.zoom+1;let p=s.aabb.quadrant(l);if(t.terrain){const n=new e.S(u,s.wrap,u,c,h),o=t.terrain.getMinMaxElevation(n),a=null!==(i=o.minElevation)&&void 0!==i?i:this.elevation,l=null!==(r=o.maxElevation)&&void 0!==r?r:this.elevation;p=new vr([p.min[0],p.min[1],a],[p.max[0],p.max[1],l])}f.push({aabb:p,zoom:u,x:c,y:h,wrap:s.wrap,fullyVisible:a})}}return _.sort((t,e)=>t.distanceSq-e.distanceSq).map(t=>t.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const i=e.ac(t.lat,-85.051129,wr);return new e.P(e.O(t.lng)*this.worldSize,e.Q(i)*this.worldSize)}unproject(t){return new e.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const i=this.elevation,r=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,s=this.pointLocation(this.centerPoint,t),n=t.getElevationForLngLatZoom(s,this.tileZoom);if(!(this.elevation-n))return;const o=r+i-n,a=Math.cos(this._pitch)*this.cameraToCenterDistance/o/e.b5(1,s.lat),l=this.scaleZoom(a/this.tileSize);this._elevation=n,this._center=s,this.zoom=l}setLocationAtPoint(t,i){const r=this.pointCoordinate(i),s=this.pointCoordinate(this.centerPoint),n=this.locationCoordinate(t),o=new e.Z(n.x-(r.x-s.x),n.y-(r.y-s.y));this.center=this.coordinateLocation(o),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return e.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(null!=e)return e}const r=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.af(r,r,this.pixelMatrixInverse),e.af(s,s,this.pixelMatrixInverse);const n=r[3],o=s[3],a=r[1]/n,l=s[1]/o,c=r[2]/n,h=s[2]/o,u=c===h?0:(0-c)/(h-c);return new e.Z(e.y.number(r[0]/n,s[0]/o,u)/this.worldSize,e.y.number(a,l,u)/this.worldSize)}coordinatePoint(t,i=0,r=this.pixelMatrix){const s=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.af(s,s,r),new e.P(s[0]/s[3],s[1]/s[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return(new G).extend(this.pointLocation(new e.P(0,t))).extend(this.pointLocation(new e.P(this.width,t))).extend(this.pointLocation(new e.P(this.width,this.height))).extend(this.pointLocation(new e.P(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new G([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,wr])}calculateTileMatrix(t){const i=t.canonical,r=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*t.wrap,n=e.an(new Float64Array(16));return e.J(n,n,[s*r,i.y*r,0]),e.K(n,n,[r/e.X,r/e.X,1]),n}calculatePosMatrix(t,i=!1){const r=t.key,s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s[r])return s[r];const n=this.calculateTileMatrix(t);return e.L(n,i?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,n),s[r]=new Float32Array(n),s[r]}calculateFogMatrix(t){const i=t.key,r=this._fogMatrixCache;if(r[i])return r[i];const s=this.calculateTileMatrix(t);return e.L(s,this.fogMatrix,s),r[i]=new Float32Array(s),r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,i){i=e.ac(+i,this.minZoom,this.maxZoom);const r={center:new e.N(t.lng,t.lat),zoom:i};let s=this.lngRange;if(!this._renderWorldCopies&&null===s){const t=180-1e-10;s=[-t,t]}const n=this.tileSize*this.zoomScale(r.zoom);let o=0,a=n,l=0,c=n,h=0,u=0;const{x:p,y:d}=this.size;if(this.latRange){const t=this.latRange;o=e.Q(t[1])*n,a=e.Q(t[0])*n,a-o<d&&(h=d/(a-o))}s&&(l=e.b3(e.O(s[0])*n,0,n),c=e.b3(e.O(s[1])*n,0,n),c<l&&(c+=n),c-l<p&&(u=p/(c-l)));const{x:m,y:f}=this.project.call({worldSize:n},t);let _,g;const y=Math.max(u||0,h||0);if(y){const t=new e.P(u?(c+l)/2:m,h?(a+o)/2:f);return r.center=this.unproject.call({worldSize:n},t).wrap(),r.zoom+=this.scaleZoom(y),r}if(this.latRange){const t=d/2;f-t<o&&(g=o+t),f+t>a&&(g=a-t)}if(s){const t=(l+c)/2;let i=m;this._renderWorldCopies&&(i=e.b3(m,t-n/2,t+n/2));const r=p/2;i-r<l&&(_=l+r),i+r>c&&(_=c-r)}if(void 0!==_||void 0!==g){const t=new e.P(null!=_?_:m,null!=g?g:f);r.center=this.unproject.call({worldSize:n},t).wrap()}return r}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.getConstrained(this.center,this.zoom);this.center=e,this.zoom=i,this._unmodified=t,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.b5(1,this.center.lat)*this.worldSize;let s=e.an(new Float64Array(16));e.K(s,s,[this.width/2,-this.height/2,1]),e.J(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.an(new Float64Array(16)),e.K(s,s,[1,-1,1]),e.J(s,s,[-1,-1,0]),e.K(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s;const n=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),o=Math.min(this.elevation,this.minElevationForCurrentTile),a=n-o*this._pixelPerMeter/Math.cos(this._pitch),l=o<0?a:n,c=Math.PI/2+this._pitch,h=this._fov*(.5+t.y/this.height),u=Math.sin(h)*l/Math.sin(e.ac(Math.PI-c-h,.01,Math.PI-.01)),p=this.getHorizon(),d=2*Math.atan(p/this.cameraToCenterDistance)*(.5+t.y/(2*p)),m=Math.sin(d)*l/Math.sin(e.ac(Math.PI-c-d,.01,Math.PI-.01)),f=Math.min(u,m);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*f+l),this.nearZ=this.height/50,s=new Float64Array(16),e.b6(s,this._fov,this.width/this.height,this.nearZ,this.farZ),s[8]=2*-t.x/this.width,s[9]=2*t.y/this.height,this.projectionMatrix=e.ae(s),e.K(s,s,[1,-1,1]),e.J(s,s,[0,0,-this.cameraToCenterDistance]),e.b7(s,s,this._pitch),e.ad(s,s,this.angle),e.J(s,s,[-i,-r,0]),this.mercatorMatrix=e.K([],s,[this.worldSize,this.worldSize,this.worldSize]),e.K(s,s,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.L(new Float64Array(16),this.labelPlaneMatrix,s),e.J(s,s,[0,0,-this.elevation]),this.modelViewProjectionMatrix=s,this.invModelViewProjectionMatrix=e.as([],s),this.fogMatrix=new Float64Array(16),e.b6(this.fogMatrix,this._fov,this.width/this.height,n,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,e.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b7(this.fogMatrix,this.fogMatrix,this._pitch),e.ad(this.fogMatrix,this.fogMatrix,this.angle),e.J(this.fogMatrix,this.fogMatrix,[-i,-r,0]),e.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=e.L(new Float64Array(16),this.labelPlaneMatrix,s);const _=this.width%2/2,g=this.height%2/2,y=Math.cos(this.angle),x=Math.sin(this.angle),v=i-Math.round(i)+y*_+x*g,b=r-Math.round(r)+y*g+x*_,w=new Float64Array(s);if(e.J(w,w,[v>.5?v-1:v,b>.5?b-1:b,0]),this.alignedModelViewProjectionMatrix=w,s=e.as(new Float64Array(16),this.pixelMatrix),!s)throw new Error("failed to invert matrix");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.af(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}getCameraQueryGeometry(t){const i=this.getCameraPoint();if(1===t.length)return[t[0],i];{let r=i.x,s=i.y,n=i.x,o=i.y;for(const e of t)r=Math.min(r,e.x),s=Math.min(s,e.y),n=Math.max(n,e.x),o=Math.max(o,e.y);return[new e.P(r,s),new e.P(n,s),new e.P(n,o),new e.P(r,o),new e.P(r,s)]}}lngLatToCameraDepth(t,i){const r=this.locationCoordinate(t),s=[r.x*this.worldSize,r.y*this.worldSize,i,1];return e.af(s,s,this.modelViewProjectionMatrix),s[2]/s[3]}}function Sr(t,e){let i,r=!1,s=null,n=null;const o=()=>{s=null,r&&(t.apply(n,i),s=setTimeout(o,e),r=!1)};return(...t)=>(r=!0,n=this,i=t,s||o(),s)}class Ir{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(t=>t.split("=")).forEach(t=>{t[0]===this._hashName&&(e=t)}),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some(t=>isNaN(t))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let i=e;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${e}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let s=window.location.href.replace(/(#.+)?$/,r);s=s.replace("&&","&"),window.history.replaceState(window.history.state,null,s)},this._updateHash=Sr(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,r),n=Math.round(e.lng*s)/s,o=Math.round(e.lat*s)/s,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${n}/${o}/${i}`:`${i}/${o}/${n}`,(a||l)&&(c+="/"+Math.round(10*a)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map(i=>{const r=i.split("=")[0];return r===t?(e=!0,`${r}=${c}`):i}).filter(t=>t);return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}}const Ar={linearity:.3,easing:e.b8(0,0,.3,1)},Pr=e.e({deceleration:2500,maxSpeed:1400},Ar),Cr=e.e({deceleration:20,maxSpeed:1400},Ar),Mr=e.e({deceleration:1e3,maxSpeed:360},Ar),kr=e.e({deceleration:1e3,maxSpeed:90},Ar);class zr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=n.now();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){const n=Dr(i.pan.mag(),r,e.e({},Pr,t||{}));s.offset=i.pan.mult(n.amount/i.pan.mag()),s.center=this._map.transform.center,Er(s,n)}if(i.zoom){const t=Dr(i.zoom,r,Cr);s.zoom=this._map.transform.zoom+t.amount,Er(s,t)}if(i.bearing){const t=Dr(i.bearing,r,Mr);s.bearing=this._map.transform.bearing+e.ac(t.amount,-179,179),Er(s,t)}if(i.pitch){const t=Dr(i.pitch,r,kr);s.pitch=this._map.transform.pitch+t.amount,Er(s,t)}if(s.zoom||s.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;s.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),e.e(s,{noMoveStart:!0})}}function Er(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function Dr(t,i,r){const{maxSpeed:s,linearity:n,deceleration:o}=r,a=e.ac(t*n/(i/1e3),-s,s),l=Math.abs(a)/(o*n);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class Lr extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,s={}){const n=o.mousePos(i.getCanvas(),r),a=i.unproject(n);super(t,e.e({point:n,lngLat:a,originalEvent:r},s)),this._defaultPrevented=!1,this.target=i}}class Rr extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const s="touchend"===t?r.changedTouches:r.touches,n=o.touchPos(i.getCanvasContainer(),s),a=n.map(t=>i.unproject(t)),l=n.reduce((t,e,i,r)=>t.add(e.div(r.length)),new e.P(0,0));super(t,{points:n,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Br extends e.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class Fr{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Br(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Lr(t.type,this._map,t))}mouseup(t){this._map.fire(new Lr(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Lr(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Lr(t.type,this._map,t))}mouseover(t){this._map.fire(new Lr(t.type,this._map,t))}mouseout(t){this._map.fire(new Lr(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Rr(t.type,this._map,t))}touchmove(t){this._map.fire(new Rr(t.type,this._map,t))}touchend(t){this._map.fire(new Rr(t.type,this._map,t))}touchcancel(t){this._map.fire(new Rr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Or{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Lr(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Lr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Lr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(e.P.convert(t),this._map.terrain)}}class Ur{constructor(t,e){this._map=t,this._tr=new Vr(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(o.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=o.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const s=Math.min(r.x,i.x),n=Math.max(r.x,i.x),a=Math.min(r.y,i.y),l=Math.max(r.y,i.y);o.setTransform(this._box,`translate(${s}px,${a}px)`),this._box.style.width=n-s+"px",this._box.style.height=l-a+"px"}mouseupWindow(t,i){if(!this._active)return;if(0!==t.button)return;const r=this._startPos,s=i;if(this.reset(),o.suppressClick(),r.x!==s.x||r.y!==s.y)return this._map.fire(new e.k("boxzoomend",{originalEvent:t})),{cameraAnimation:t=>t.fitScreenCoordinates(r,s,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.k(t,{originalEvent:i}))}}function Nr(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class jr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=Nr(r,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const r=Nr(i,e);for(const t in this.touches){const e=r[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class $r{constructor(t){this.singleTap=new jr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){const r=this.singleTap.touchend(t,e,i);if(r){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class qr{constructor(t){this._tr=new Vr(t),this._zoomIn=new $r({numTouches:1,numTaps:2}),this._zoomOut=new $r({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){const r=this._zoomIn.touchend(t,e,i),s=this._zoomOut.touchend(t,e,i),n=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:n.zoom+1,around:n.unproject(r)},{originalEvent:t})}):s?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:n.zoom-1,around:n.unproject(s)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const r=e.length?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&o.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Gr={0:1,2:2};class Wr{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const e=o.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(t,e){const i=Gr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return o.mouseButton(t)===this._eventButton}}class Hr{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Xr=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}},Jr=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new Wr({checkCorrectEvent:t=>0===o.mouseButton(t)&&t.ctrlKey||2===o.mouseButton(t)});return new Zr({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:Xr})},Kr=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new Wr({checkCorrectEvent:t=>0===o.mouseButton(t)&&t.ctrlKey||2===o.mouseButton(t)});return new Zr({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:Xr})};class Yr{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);const s=Nr(r,i),n=new e.P(0,0),o=new e.P(0,0);let a=0;for(const t in s){const e=s[t],i=this._touches[t];i&&(n._add(e),o._add(e.sub(i)),a++,s[t]=e)}if(this._touches=s,this._shouldBePrevented(a)||!o.mag())return;const l=o.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Qr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[r,s]=this._firstTwoTouches,n=ts(i,e,r),o=ts(i,e,s);if(!n||!o)return;const a=this._aroundCenter?null:n.add(o).div(2);return this._move([n,o],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[r,s]=this._firstTwoTouches,n=ts(i,e,r),a=ts(i,e,s);n&&a||(this._active&&o.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function ts(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function es(t,e){return Math.log(t/e)/Math.LN2}class is extends Qr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(es(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:es(this._distance,i),pinchAround:e}}}function rs(t,e){return 180*t.angleWith(e)/Math.PI}class ss extends Qr{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,i){const r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rs(this._vector,r),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=rs(t,this._startVector);return Math.abs(i)<e}}function ns(t){return Math.abs(t.y)>Math.abs(t.x)}class os extends Qr{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,ns(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=t[0].sub(this._lastPoints[0]),s=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,s,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+s.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const r=t.mag()>=2,s=e.mag()>=2;if(!r&&!s)return;if(!r||!s)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const n=t.y>0==e.y>0;return ns(t)&&ns(e)&&n}}const as={panStep:100,bearingStep:15,pitchStep:10};class ls{constructor(t){this._tr=new Vr(t);const e=as;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,s=0,n=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),s=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),s=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),n=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:o=>{const a=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:cs,zoom:e?Math.round(a.zoom)+e*(t.shiftKey?2:1):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-s*this._panStep,-n*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function cs(t){return t*(2-t)}const hs=4.000244140625;class us{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=new Vr(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=n.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%hs==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=o.mousePos(this._map.getCanvas(),t),r=this._tr;this._around=i.y>r.transform.height/2-r.transform.getHorizon()?e.N.convert(this._aroundCenter?r.center:r.unproject(i)):e.N.convert(r.center),this._aroundPoint=r.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>hs?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);const r="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(r*i))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:t.zoom,r=this._startZoom,s=this._easing;let o,a=!1;const l=n.now()-this._lastWheelEventTime;if("wheel"===this._type&&r&&s&&l){const t=Math.min(l/200,1),n=s(t);o=e.y.number(r,i,n),t<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.b9;if(this._prevEase){const t=this._prevEase,r=(n.now()-t.start)/t.duration,s=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(s*s+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=e.b8(o,a,.25,1)}return this._prevEase={start:n.now(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ps{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class ds{constructor(t){this._tr=new Vr(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ms{constructor(){this._tap=new $r({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const r=e[0],s=t.timeStamp-this._tapTime<500,n=this._tapPoint.dist(r)<30;s&&n?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=e[0],s=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class fs{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class _s{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class gs{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ys{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=o.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=e,this._container.appendChild(r);const s=document.createElement("div");s.className="maplibregl-mobile-message",s.textContent=i,this._container.appendChild(s),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(o.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new e.k("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const xs=t=>t.zoom||t.drag||t.pitch||t.rotate;class vs extends e.k{}function bs(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class ws{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,e)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,r={needsRenderFrame:!1},s={},n={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?o.touchPos(this._map.getCanvas(),l):o.mousePos(this._map.getCanvas(),t);for(const{handlerName:o,handler:a,allowed:h}of this._handlers){if(!a.isEnabled())continue;let u;this._blockedByActive(n,h,o)?a.reset():a[e||t.type]&&(u=a[e||t.type](t,c,l),this.mergeHandlerResult(r,s,u,o,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||a.isActive())&&(n[o]=a)}const h={};for(const t in this._previousActiveHandlers)n[t]||(h[t]=i);this._previousActiveHandlers=n,(Object.keys(h).length||bs(r))&&(this._changes.push([r,s,h]),this._triggerRenderFrame()),(Object.keys(n).length||bs(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=r;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zr(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,e,i]of this._listeners)o.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[t,e,i]of this._listeners)o.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new Fr(e,t));const r=e.boxZoom=new Ur(e,t);this._add("boxZoom",r),t.interactive&&t.boxZoom&&r.enable();const s=e.cooperativeGestures=new ys(e,t.cooperativeGestures);this._add("cooperativeGestures",s),t.cooperativeGestures&&s.enable();const n=new qr(e),a=new ds(e);e.doubleClickZoom=new ps(a,n),this._add("tapZoom",n),this._add("clickZoom",a),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const l=new ms;this._add("tapDragZoom",l);const c=e.touchPitch=new os(e);this._add("touchPitch",c),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const h=Jr(t),u=Kr(t);e.dragRotate=new _s(t,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const p=(({enable:t,clickTolerance:e})=>{const i=new Wr({checkCorrectEvent:t=>0===o.mouseButton(t)&&!t.ctrlKey});return new Zr({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Xr})})(t),d=new Yr(t,e);e.dragPan=new fs(i,p,d),this._add("mousePan",p),this._add("touchPan",d,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const m=new ss,f=new is;e.touchZoomRotate=new gs(i,f,m,l),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const _=e.scrollZoom=new us(e,()=>this._triggerRenderFrame());this._add("scrollZoom",_,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const g=e.keyboard=new ls(e);this._add("keyboard",g),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add("blockableMapEvent",new Or(e))}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(xs(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const r in t)if(r!==i&&(!e||e.indexOf(r)<0))return!0;return!1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,r,s,n){if(!r)return;e.e(t,r);const o={handlerName:s,originalEvent:r.originalEvent||n};void 0!==r.zoomDelta&&(i.zoom=o),void 0!==r.panDelta&&(i.drag=o),void 0!==r.pitchDelta&&(i.pitch=o),void 0!==r.bearingDelta&&(i.rotate=o)}_applyChanges(){const t={},i={},r={};for(const[s,n,o]of this._changes)s.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(s.panDelta)),s.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(t.around=s.around),void 0!==s.pinchAround&&(t.pinchAround=s.pinchAround),s.noInertia&&(t.noInertia=s.noInertia),e.e(i,n),e.e(r,o);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,e,i){const r=this._map,s=r._getTransformForUpdate(),n=r.terrain;if(!(bs(t)||n&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:o,zoomDelta:a,bearingDelta:l,pitchDelta:c,around:h,pinchAround:u}=t;void 0!==u&&(h=u),r._stop(!0),h=h||r.transform.centerPoint;const p=s.pointLocation(o?h.sub(o):h);l&&(s.bearing+=l),c&&(s.pitch+=c),a&&(s.zoom+=a),n?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?s.center=s.pointLocation(s.centerPoint.sub(o)):s.setLocationAtPoint(p,h):(this._terrainMovement=!0,this._map._elevationFreeze=!0,s.setLocationAtPoint(p,h)):s.setLocationAtPoint(p,h),r._applyUpdatedTransform(s),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_fireEvents(t,i,r){const s=xs(this._eventsInProgress),o=xs(t),a={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!s&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:r}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=i[e]||r,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const h=xs(this._eventsInProgress),u=(s||o)&&!h;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();t.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(t)}if(r&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&n.prefersReducedMotion?(this._map.fire(new e.k("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new e.k(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new vs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Ts extends e.E{constructor(t,e){super(),this._renderFrameCallback=()=>{const t=Math.min((n.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=e.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new e.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.e({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,r){return this.easeTo(e.e({zoom:t},i),r)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,r){return this.easeTo(e.e({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=G.convert(t).adjustAntiMeridian();const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,i,r,s){const n={top:0,bottom:0,right:0,left:0};if("number"==typeof(s=e.e({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},s)).padding){const t=s.padding;s.padding={top:t,bottom:t,right:t,left:t}}s.padding=e.e(n,s.padding);const o=this.transform,a=o.padding,l=new G(t,i),c=o.project(l.getNorthWest()),h=o.project(l.getNorthEast()),u=o.project(l.getSouthEast()),p=o.project(l.getSouthWest()),d=e.ba(-r),m=c.rotate(d),f=h.rotate(d),_=u.rotate(d),g=p.rotate(d),y=new e.P(Math.max(m.x,f.x,g.x,_.x),Math.max(m.y,f.y,g.y,_.y)),x=new e.P(Math.min(m.x,f.x,g.x,_.x),Math.min(m.y,f.y,g.y,_.y)),v=y.sub(x),b=(o.width-(a.left+a.right+s.padding.left+s.padding.right))/v.x,w=(o.height-(a.top+a.bottom+s.padding.top+s.padding.bottom))/v.y;if(w<0||b<0)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const T=Math.min(o.scaleZoom(o.scale*Math.min(b,w)),s.maxZoom),S=e.P.convert(s.offset),I=new e.P((s.padding.left-s.padding.right)/2,(s.padding.top-s.padding.bottom)/2).rotate(e.ba(r)),A=S.add(I).mult(o.scale/o.zoomScale(T));return{center:o.unproject(c.add(u).div(2).sub(A)),zoom:T,bearing:r}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,i,r,s,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.P.convert(t)),this.transform.pointLocation(e.P.convert(i)),r,s),s,n)}_fitInternal(t,i,r){return t?(delete(i=e.e(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(t,i){this.stop();const r=this._getTransformForUpdate();let s=!1,n=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(s=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.N.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(n=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),this._applyUpdatedTransform(r),this.fire(new e.k("movestart",i)).fire(new e.k("move",i)),s&&this.fire(new e.k("zoomstart",i)).fire(new e.k("zoom",i)).fire(new e.k("zoomend",i)),n&&this.fire(new e.k("rotatestart",i)).fire(new e.k("rotate",i)).fire(new e.k("rotateend",i)),o&&this.fire(new e.k("pitchstart",i)).fire(new e.k("pitch",i)).fire(new e.k("pitchend",i)),this.fire(new e.k("moveend",i))}calculateCameraOptionsFromTo(t,i,r,s=0){const n=e.Z.fromLngLat(t,i),o=e.Z.fromLngLat(r,s),a=o.x-n.x,l=o.y-n.y,c=o.z-n.z,h=Math.hypot(a,l,c);if(0===h)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(a,l),p=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),d=180*Math.atan2(a,-l)/Math.PI;let m=180*Math.acos(u/h)/Math.PI;return m=c<0?90-m:90+m,{center:o.toLngLat(),zoom:p,pitch:m,bearing:d}}easeTo(t,i){var r;this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.b9},t)).animate||!t.essential&&n.prefersReducedMotion)&&(t.duration=0);const s=this._getTransformForUpdate(),o=s.zoom,a=s.bearing,l=s.pitch,c=s.padding,h="bearing"in t?this._normalizeBearing(t.bearing,a):a,u="pitch"in t?+t.pitch:l,p="padding"in t?t.padding:s.padding,d=e.P.convert(t.offset);let m=s.centerPoint.add(d);const f=s.pointLocation(m),{center:_,zoom:g}=s.getConstrained(e.N.convert(t.center||f),null!==(r=t.zoom)&&void 0!==r?r:o);this._normalizeCenter(_,s);const y=s.project(f),x=s.project(_).sub(y),v=s.zoomScale(g-o);let b,w;t.around&&(b=e.N.convert(t.around),w=s.locationPoint(b));const T={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||g!==o,this._rotating=this._rotating||a!==h,this._pitching=this._pitching||u!==l,this._padding=!s.isPaddingEqual(p),this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,T),this.terrain&&this._prepareElevation(_),this._ease(r=>{if(this._zooming&&(s.zoom=e.y.number(o,g,r)),this._rotating&&(s.bearing=e.y.number(a,h,r)),this._pitching&&(s.pitch=e.y.number(l,u,r)),this._padding&&(s.interpolatePadding(c,p,r),m=s.centerPoint.add(d)),this.terrain&&!t.freezeElevation&&this._updateElevation(r),b)s.setLocationAtPoint(b,w);else{const t=s.zoomScale(s.zoom-o),e=g>o?Math.min(2,v):Math.max(.5,v),i=Math.pow(e,1-r),n=s.unproject(y.add(x.mult(r*i)).mult(t));s.setLocationAtPoint(s.renderWorldCopies?n.wrap():n,m)}this._applyUpdatedTransform(s),this._fireMoveEvents(i)},e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e)},t),this}_prepareEase(t,i,r={}){this._moving=!0,i||r.moving||this.fire(new e.k("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.k("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.k("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.k("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i}this.transform.elevation=e.y.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const e=t.getCameraPosition(),i=this.terrain.getElevationForLngLatZoom(e.lngLat,t.zoom);if(e.altitude<i){const r=this.calculateCameraOptionsFromTo(e.lngLat,i,t.center,t.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}_applyUpdatedTransform(t){const e=[];if(this.terrain&&e.push(t=>this._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&e.push(t=>this.transformCameraUpdate(t)),!e.length)return;const i=t.clone();for(const t of e){const e=i.clone(),{center:r,zoom:s,pitch:n,bearing:o,elevation:a}=t(e);r&&(e.center=r),void 0!==s&&(e.zoom=s),void 0!==n&&(e.pitch=n),void 0!==o&&(e.bearing=o),void 0!==a&&(e.elevation=a),i.apply(e)}this.transform.apply(i)}_fireMoveEvents(t){this.fire(new e.k("move",t)),this._zooming&&this.fire(new e.k("zoom",t)),this._rotating&&this.fire(new e.k("rotate",t)),this._pitching&&this.fire(new e.k("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,s=this._rotating,n=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.k("zoomend",t)),s&&this.fire(new e.k("rotateend",t)),n&&this.fire(new e.k("pitchend",t)),this.fire(new e.k("moveend",t))}flyTo(t,i){var r;if(!t.essential&&n.prefersReducedMotion){const r=e.M(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.b9},t);const s=this._getTransformForUpdate(),o=s.zoom,a=s.bearing,l=s.pitch,c=s.padding,h="bearing"in t?this._normalizeBearing(t.bearing,a):a,u="pitch"in t?+t.pitch:l,p="padding"in t?t.padding:s.padding,d=e.P.convert(t.offset);let m=s.centerPoint.add(d);const f=s.pointLocation(m),{center:_,zoom:g}=s.getConstrained(e.N.convert(t.center||f),null!==(r=t.zoom)&&void 0!==r?r:o);this._normalizeCenter(_,s);const y=s.zoomScale(g-o),x=s.project(f),v=s.project(_).sub(x);let b=t.curve;const w=Math.max(s.width,s.height),T=w/y,S=v.mag();if("minZoom"in t){const i=e.ac(Math.min(t.minZoom,o,g),s.minZoom,s.maxZoom),r=w/s.zoomScale(i-o);b=Math.sqrt(r/S*2)}const I=b*b;function A(t){const e=(T*T-w*w+(t?-1:1)*I*I*S*S)/(2*(t?T:w)*I*S);return Math.log(Math.sqrt(e*e+1)-e)}function P(t){return(Math.exp(t)-Math.exp(-t))/2}function C(t){return(Math.exp(t)+Math.exp(-t))/2}const M=A(!1);let k=function(t){return C(M)/C(M+b*t)},z=function(t){return w*((C(M)*(P(e=M+b*t)/C(e))-P(M))/I)/S;var e},E=(A(!0)-M)/b;if(Math.abs(S)<1e-6||!isFinite(E)){if(Math.abs(w-T)<1e-6)return this.easeTo(t,i);const e=T<w?-1:1;E=Math.abs(Math.log(T/w))/b,z=()=>0,k=t=>Math.exp(e*b*t)}return t.duration="duration"in t?+t.duration:1e3*E/("screenSpeed"in t?+t.screenSpeed/b:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==h,this._pitching=u!==l,this._padding=!s.isPaddingEqual(p),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(_),this._ease(r=>{const n=r*E,f=1/k(n);s.zoom=1===r?g:o+s.scaleZoom(f),this._rotating&&(s.bearing=e.y.number(a,h,r)),this._pitching&&(s.pitch=e.y.number(l,u,r)),this._padding&&(s.interpolatePadding(c,p,r),m=s.centerPoint.add(d)),this.terrain&&!t.freezeElevation&&this._updateElevation(r);const y=1===r?_:s.unproject(x.add(v.mult(z(n))).mult(f));s.setLocationAtPoint(s.renderWorldCopies?y.wrap():y,m),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e)}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=n.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=e.b3(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}_normalizeCenter(t,e){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Ss={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Is{constructor(t=Ss){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o.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(){o.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"!=typeof t?"":t)):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}const e=this._map.style.sourceCaches;for(const i in e){const r=e[i];if(r.used||r.usedForTerrain){const e=r.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution)}}t=t.filter(t=>String(t).trim()),t.sort((t,e)=>t.length-e.length),t=t.filter((e,i)=>{for(let r=i+1;r<t.length;r++)if(t[r].indexOf(e)>=0)return!1;return!0});const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class As{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl");const e=o.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){o.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ps{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Cs=e.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ms extends e.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(t,i){this.sourceCache.update(t,i),this._renderableTilesKeys=[];const r={};for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))r[s.key]=!0,this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),e.aP(s.posMatrix,0,e.X,0,e.X,0,1),this._tiles[s.key]=new lt(s,this.tileSize));for(const t in this._tiles)r[t]||delete this._tiles[t]}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const i={};for(const r of this._renderableTilesKeys){const s=this._tiles[r].tileID;if(s.canonical.equals(t.canonical)){const s=t.clone();s.posMatrix=new Float64Array(16),e.aP(s.posMatrix,0,e.X,0,e.X,0,1),i[r]=s}else if(s.canonical.isChildOf(t.canonical)){const n=t.clone();n.posMatrix=new Float64Array(16);const o=s.canonical.z-t.canonical.z,a=s.canonical.x-(s.canonical.x>>o<<o),l=s.canonical.y-(s.canonical.y>>o<<o),c=e.X>>o;e.aP(n.posMatrix,0,c,0,c,0,1),e.J(n.posMatrix,n.posMatrix,[-a*c,-l*c,0]),i[r]=n}else if(t.canonical.isChildOf(s.canonical)){const n=t.clone();n.posMatrix=new Float64Array(16);const o=t.canonical.z-s.canonical.z,a=t.canonical.x-(t.canonical.x>>o<<o),l=t.canonical.y-(t.canonical.y>>o<<o),c=e.X>>o;e.aP(n.posMatrix,0,e.X,0,e.X,0,1),e.J(n.posMatrix,n.posMatrix,[a*c,l*c,0]),e.K(n.posMatrix,n.posMatrix,[1/2**o,1/2**o,0]),i[r]=n}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let r=t.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(r).key);let s=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!s||!s.dem)&&e)for(;r>=i.minzoom&&(!s||!s.dem);)s=this.sourceCache.getTileByID(t.scaledTo(r--).key);return s}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(e=>e.timeAdded>=t)}}class ks{constructor(t,e,i){this.painter=t,this.sourceCache=new Ms(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,i,r,s=e.X){var n;if(!(i>=0&&i<s&&r>=0&&r<s))return 0;const o=this.getTerrainData(t),a=null===(n=o.tile)||void 0===n?void 0:n.dem;if(!a)return 0;const l=function(t,e,i){var r=e[0],s=e[1];return t[0]=i[0]*r+i[4]*s+i[12],t[1]=i[1]*r+i[5]*s+i[13],t}([],[i/s*e.X,r/s*e.X],o.u_terrain_matrix),c=[l[0]*a.dim,l[1]*a.dim],h=Math.floor(c[0]),u=Math.floor(c[1]),p=c[0]-h,d=c[1]-u;return a.get(h,u)*(1-p)*(1-d)+a.get(h+1,u)*p*(1-d)+a.get(h,u+1)*(1-p)*d+a.get(h+1,u+1)*p*d}getElevationForLngLatZoom(t,i){if(!e.bb(i,t.wrap()))return 0;const{tileID:r,mercatorX:s,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(r,s%e.X,n%e.X,e.X)}getElevation(t,i,r,s=e.X){return this.getDEMElevation(t,i,r,s)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,i=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new b(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new b(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.an([])}const i=this.sourceCache.getSourceTile(t,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new b(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let s=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?s=t.canonical.z-r:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const n=t.canonical.x-(t.canonical.x>>s<<s),o=t.canonical.y-(t.canonical.y>>s<<s),a=e.bc(new Float64Array(16),[1/(e.X<<s),1/(e.X<<s),0]);e.J(a,a,[n*e.X,o*e.X,0]),this._demMatrixCache[t.key]={matrix:a,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new b(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new b(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let r=0;r<this._coordsTextureSize;r++,e+=4)i[e+0]=255&r,i[e+1]=255&t,i[e+2]=r>>8<<4|t>>8,i[e+3]=0;const r=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),s=new b(t,r,t.gl.RGBA,{premultiply:!1});return s.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=s,s}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),r=this.painter.context,s=r.gl,n=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),s.readPixels(n,a-o-1,1,1,s.RGBA,s.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),h=this.coordsIndex[255-i[3]],u=h&&this.sourceCache.getTileByID(h);if(!u)return null;const p=this._coordsTextureSize,d=(1<<u.tileID.canonical.z)*p;return new e.Z((u.tileID.canonical.x*p+l)/d+u.tileID.wrap,(u.tileID.canonical.y*p+c)/d,this.getElevation(u.tileID,l,c,p))}depthAtPoint(t){const e=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,i=new e.bd,r=new e.aY,s=this.meshSize,n=e.X/s,o=s*s;for(let t=0;t<=s;t++)for(let e=0;e<=s;e++)i.emplaceBack(e*n,t*n,0);for(let t=0;t<o;t+=s+1)for(let e=0;e<s;e++)r.emplaceBack(e+t,s+e+t+1,s+e+t+2),r.emplaceBack(e+t,s+e+t+2,e+t+1);const a=i.length,l=a+2*(s+1);for(const t of[0,1])for(let r=0;r<=s;r++)for(const s of[0,1])i.emplaceBack(r*n,t*e.X,s);for(let t=0;t<2*s;t+=2)r.emplaceBack(l+t,l+t+1,l+t+3),r.emplaceBack(l+t,l+t+3,l+t+2),r.emplaceBack(a+t,a+t+3,a+t+1),r.emplaceBack(a+t,a+t+2,a+t+3);const c=i.length,h=c+2*(s+1);for(const t of[0,1])for(let r=0;r<=s;r++)for(const s of[0,1])i.emplaceBack(t*e.X,r*n,s);for(let t=0;t<2*s;t+=2)r.emplaceBack(c+t,c+t+1,c+t+3),r.emplaceBack(c+t,c+t+3,c+t+2),r.emplaceBack(h+t,h+t+3,h+t+1),r.emplaceBack(h+t,h+t+2,h+t+3);return this._mesh=new gr(t.createVertexBuffer(i,Cs.members),t.createIndexBuffer(r),e.a0.simpleSegment(0,0,i.length,r.length)),this._mesh}getMeshFrameDelta(t){return 2*Math.PI*e.be/Math.pow(2,t)/5}getMinTileElevationForLngLatZoom(t,e){var i;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return null!==(i=this.getMinMaxElevation(r).minElevation)&&void 0!==i?i:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,i){const r=e.Z.fromLngLat(t.wrap()),s=(1<<i)*e.X,n=r.x*s,o=r.y*s,a=Math.floor(n/e.X),l=Math.floor(o/e.X);return{tileID:new e.S(i,0,i,a,l),mercatorX:n,mercatorY:o}}}class zs{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new b(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(e=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(t=>!t.inUse)}}const Es={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ds{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new zs(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(i=>!t._layers[i].isHidden(e)),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t])}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],r=i.source;if(Es[i.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const t in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][t]=this._coordsDescendingInv[r][t].map(t=>t.key).sort().join()}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const i=t.type,r=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Es[i]&&(this._prevType&&Es[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(t.id),!s))return!0;if(Es[this._prevType]||Es[i]&&s){this._prevType=i;const t=this._stacks.length-1,s=this._stacks[t]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(_r(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[t]){const e=this.pool.getObjectForId(i.rtt[t].id);if(e.stamp===i.rtt[t].stamp){this.pool.useObject(e);continue}}const n=this.pool.getOrCreateFreeObject();this.pool.useObject(n),this.pool.stampObject(n),i.rtt[t]={id:n.id,stamp:n.stamp},r.context.bindFramebuffer.set(n.fbo.framebuffer),r.context.clear({color:e.aM.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t=0;t<s.length;t++){const e=r.style._layers[s[t]],o=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];r.context.viewport.set([0,0,n.fbo.width,n.fbo.height]),r._renderTileClippingMasks(e,o),r.renderLayer(r,r.style.sourceCaches[e.source],e,o),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key])}}return _r(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Es[i]}return!1}}const Ls={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"},Rs=i,Bs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ss,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!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],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},Fs=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd},Os={showCompass:!0,showZoom:!0,visualizePitch:!1};class Vs{constructor(t,i,r=!1){this.mousedown=t=>{this.startMouse(e.e({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),o.mousePos(this.element,t)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=t=>{this.moveMouse(t,o.mousePos(this.element,t))},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),o.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.addEventListener(window,"touchend",this.touchend))},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},this.touchend=t=>{0===t.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.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const s=t.dragRotate._mouseRotate.getClickTolerance(),n=t.dragRotate._mousePitch.getClickTolerance();this.element=i,this.mouseRotate=Jr({clickTolerance:s,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const r=new Hr;return new Zr({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:r,enable:t,assignEvents:Fs})})({clickTolerance:s,enable:!0}),this.map=t,r&&(this.mousePitch=Kr({clickTolerance:n,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const r=new Hr;return new Zr({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:r,enable:t,assignEvents:Fs})})({clickTolerance:n,enable:!0})),o.addEventListener(i,"mousedown",this.mousedown),o.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(i,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),o.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),o.disableDrag()}moveMouse(t,e){const i=this.map,{bearingDelta:r}=this.mouseRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const{pitchDelta:r}=this.mousePitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}moveTouch(t,e){const i=this.map,{bearingDelta:r}=this.touchRotate.dragMove(t,e)||{};if(r&&i.setBearing(i.getBearing()+r),this.touchPitch){const{pitchDelta:r}=this.touchPitch.dragMove(t,e)||{};r&&i.setPitch(i.getPitch()+r)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend),o.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){o.enableDrag(),o.removeEventListener(window,"mousemove",this.mousemove),o.removeEventListener(window,"mouseup",this.mouseup),o.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),o.removeEventListener(window,"touchend",this.touchend)}}let Us;function Ns(t,i,r){const s=new e.N(t.lng,t.lat);if(t=new e.N(t.lng,t.lat),i){const s=new e.N(t.lng-360,t.lat),n=new e.N(t.lng+360,t.lat),o=r.locationPoint(t).distSqr(i);r.locationPoint(s).distSqr(i)<o?t=s:r.locationPoint(n).distSqr(i)<o&&(t=n)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t.lng!==s.lng&&r.locationPoint(t).y>r.height/2-r.getHorizon()?t:s}const js={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 $s(t,e,i){const r=t.classList;for(const t in js)r.remove(`maplibregl-${i}-anchor-${t}`);r.add(`maplibregl-${i}-anchor-${e}`)}class qs extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()},this._update=t=>{var e;if(!this._map)return;const i=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!i)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Ns(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?s="rotateX(0deg)":"map"===this._pitchAlignment&&(s=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),o.setTransform(this._element,`${js[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${r}`),n.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&"moveend"===t.type)}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e}this._isDragging&&(this._pos=t.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 e.k("dragstart"))),this.fire(new e.k("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 e.k("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div");const i=o.createNS("http://www.w3.org/2000/svg","svg"),r=41,s=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${s}px`),i.setAttributeNS(null,"viewBox",`0 0 ${s} ${r}`);const n=o.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"stroke","none"),n.setAttributeNS(null,"stroke-width","1"),n.setAttributeNS(null,"fill","none"),n.setAttributeNS(null,"fill-rule","evenodd");const a=o.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=o.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of c){const e=o.createNS("http://www.w3.org/2000/svg","ellipse");e.setAttributeNS(null,"opacity","0.04"),e.setAttributeNS(null,"cx","10.5"),e.setAttributeNS(null,"cy","5.80029008"),e.setAttributeNS(null,"rx",t.rx),e.setAttributeNS(null,"ry",t.ry),l.appendChild(e)}const h=o.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const u=o.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(u);const p=o.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=o.createNS("http://www.w3.org/2000/svg","path");d.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"),p.appendChild(d);const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const f=o.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(8.0, 8.0)");const _=o.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");const g=o.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),f.appendChild(_),f.appendChild(g),a.appendChild(l),a.appendChild(h),a.appendChild(p),a.appendChild(m),a.appendChild(f),i.appendChild(a),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",s*this._scale+"px"),this._element.appendChild(i),this._offset=e.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),$s(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("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),o.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,r=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[r,-1*(e-i+r)],"bottom-right":[-r,-1*(e-i+r)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const s=this._map,n=s.terrain.depthAtPoint(this._pos),o=s.terrain.getElevationForLngLatZoom(this._lngLat,s.transform.tileZoom);if(s.transform.lngLatToCameraDepth(this._lngLat,o)-n<.006)return void(this._element.style.opacity=this._opacity);const a=-this._offset.y/s.transform._pixelPerMeter,l=Math.sin(s.getPitch()*Math.PI/180)*a,c=s.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),h=s.transform.lngLatToCameraDepth(this._lngLat,o+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&h&&this._popup.remove(),this._element.style.opacity=h?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return void 0===t&&void 0===e&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Zs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Gs=0,Ws=!1;const Hs={maxWidth:100,unit:"metric"};function Xs(t,e,i){const r=i&&i.maxWidth||100,s=t._container.clientHeight/2,n=t.unproject([0,s]),o=t.unproject([r,s]),a=n.distanceTo(o);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?Js(e,r,i/5280,t._getUIString("ScaleControl.Miles")):Js(e,r,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Js(e,r,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?Js(e,r,a/1e3,t._getUIString("ScaleControl.Kilometers")):Js(e,r,a,t._getUIString("ScaleControl.Meters"))}function Js(t,e,i,r){const s=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(s/i)+"px",t.innerHTML=`${s}&nbsp;${r}`}const Ks={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Ys=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Qs(t){if(t){if("number"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return{center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(i,i),"top-right":new e.P(-i,i),bottom:new e.P(0,-t),"bottom-left":new e.P(i,-i),"bottom-right":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Qs(new e.P(0,0))}const tn=i;t.AJAXError=e.bh,t.Evented=e.E,t.LngLat=e.N,t.MercatorCoordinate=e.Z,t.Point=e.P,t.addProtocol=e.bi,t.config=e.a,t.removeProtocol=e.bj,t.AttributionControl=Is,t.BoxZoomHandler=Ur,t.CanvasSource=et,t.CooperativeGesturesHandler=ys,t.DoubleClickZoomHandler=ps,t.DragPanHandler=fs,t.DragRotateHandler=_s,t.EdgeInsets=br,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.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(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const t=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_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 e.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},t.GeoJSONSource=K,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.k("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.k("geolocate",t)),this._finish()}},this._updateCamera=t=>{const i=new e.N(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,s=this._map.getBearing(),n=e.e({bearing:s},this.options.fitBoundsOptions),o=G.fromLngLat(i,r);this._map.fitBounds(o,n,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const i=new e.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(1===t.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;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&Ws)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.k("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new qs({element:this._dotElement}),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new qs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.k("trackuserlocationend")),this.fire(new e.k("userlocationlostfocus")))})}},this.options=e.e({},Zs,t)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,function*(t=!1){if(void 0!==Us&&!t)return Us;if(void 0===window.navigator.permissions)return Us=!!window.navigator.geolocation,Us;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Us="denied"!==t.state}catch(t){Us=!!window.navigator.geolocation}return Us})}().then(t=>this._finishSetupUI(t)),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(),o.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Gs=0,Ws=!1}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.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":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),r=e.distanceTo(i),s=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}trigger(){if(!this._setup)return e.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 e.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Gs--,Ws=!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 e.k("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 e.k("trackuserlocationstart")),this.fire(new e.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Gs++,Gs>1?(t={maximumAge:6e5,timeout:0},Ws=!0):(t=this.options.positionOptions,Ws=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}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","fal
2se"),this.options.showUserLocation&&this._updateMarker(null)}},t.Hash=Ir,t.ImageSource=Q,t.KeyboardHandler=ls,t.LngLatBounds=G,t.LogoControl=As,t.Map=class extends Ts{constructor(t){e.bf.mark(e.bg.create);const i=Object.assign(Object.assign({},Bs),t);if(null!=i.minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Tr(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ps,this._controls=[],this._mapId=e.a4(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.k("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.k("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=!0===i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=!0===i.preserveDrawingBuffer,this._antialias=!0===i.antialias,this._trackResize=!0===i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=!0===i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=!0===i.crossSourceCollisions,this._collectResourceTiming=!0===i.collectResourceTiming,this._locale=Object.assign(Object.assign({},Ls),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===i.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=d.addThrottleControl(()=>this.isMoving()),this._requestManager=new m(i.transformRequest),"string"==typeof i.container){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else{if(!(i.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)).on("moveend",()=>this._update(!1)).on("zoom",()=>this._update(!0)).on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}).once("idle",()=>{this._idleTriggered=!0}),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let t=!1;const e=Sr(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50);this._resizeObserver=new ResizeObserver(i=>{t?e(i):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ws(this,i),this._hash=i.hash&&new Ir("string"==typeof i.hash&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,e.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new Is("boolean"==typeof i.attributionControl?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new As,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update("style"===t.dataType),this.fire(new e.k(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new e.k(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new e.k("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const s=this._controlPositions[i];
vendor: 14,925 bytes, line 2
2return-1!==i.indexOf("bottom")?s.insertBefore(r,s.firstChild):s.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(t){var i;const r=this._containerDimensions(),s=r[0],n=r[1],o=this._getClampedPixelRatio(s,n);if(this._resizeCanvas(s,n,o),this.painter.resize(s,n,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(s,n);this._resizeCanvas(s,n,e),this.painter.resize(s,n,e)}this.transform.resize(s,n),null===(i=this._requestedCameraState)||void 0===i||i.resize(s,n);const a=!this._moving;return a&&(this.stop(),this.fire(new e.k("movestart",t)).fire(new e.k("move",t))),this.fire(new e.k("resize",t)),a&&this.fire(new e.k("moveend",t)),this}_getClampedPixelRatio(t,e){const{0:i,1:r}=this._maxCanvasSize,s=this.getPixelRatio(),n=t*s,o=e*s;return Math.min(n>i?i/n:1,o>r?r/o:1)*s}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(G.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(e.N.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let r=!1;const s=s=>{const n=e.filter(t=>this.getLayer(t)),o=0!==n.length?this.queryRenderedFeatures(s.point,{layers:n}):[];o.length?r||(r=!0,i.call(this,new Lr(t,this,s.originalEvent,{features:o}))):r=!1};return{layers:e,listener:i,delegates:{mousemove:s,mouseout:()=>{r=!1}}}}if("mouseleave"===t||"mouseout"===t){let r=!1;const s=s=>{const n=e.filter(t=>this.getLayer(t));(0!==n.length?this.queryRenderedFeatures(s.point,{layers:n}):[]).length?r=!0:r&&(r=!1,i.call(this,new Lr(t,this,s.originalEvent)))},n=e=>{r&&(r=!1,i.call(this,new Lr(t,this,e.originalEvent)))};return{layers:e,listener:i,delegates:{mousemove:s,mouseout:n}}}{const r=t=>{const r=e.filter(t=>this.getLayer(t)),s=0!==r.length?this.queryRenderedFeatures(t.point,{layers:r}):[];s.length&&(t.features=s,i.call(this,t),delete t.features)};return{layers:e,listener:i,delegates:{[t]:r}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const s=r[t];if(s.listener===i&&s.layers.length===e.length&&s.layers.every(t=>e.includes(t))){for(const t in s.delegates)this.off(t,s.delegates[t]);return void r.splice(t,1)}}}on(t,e,i){if(void 0===i)return super.on(t,e);const r=this._createDelegatedListener(t,"string"==typeof e?[e]:e,i);this._saveDelegatedListener(t,r);for(const t in r.delegates)this.on(t,r.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const r="string"==typeof e?[e]:e,s=this._createDelegatedListener(t,r,i);for(const e in s.delegates){const n=s.delegates[e];s.delegates[e]=(...e)=>{this._removeDelegatedListener(t,r,i),n(...e)}}this._saveDelegatedListener(t,s);for(const t in s.delegates)this.once(t,s.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,i){if(!this.style)return[];let r;const s=t instanceof e.P||Array.isArray(t),n=s?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(s?{}:t)||{},n instanceof e.P||"number"==typeof n[0])r=[e.P.convert(n)];else{const t=e.P.convert(n[0]),i=e.P.convert(n[1]);r=[t,new e.P(i.x,t.y),i,new e.P(t.x,i.y),t]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,i){return!1!==(i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,e));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new pe(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new pe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if("string"==typeof t){const r=this._requestManager.transformRequest(t,"Style");e.h(r,new AbortController).then(t=>{this._updateDiff(t.data,i)}).catch(t=>{t&&this.fire(new e.j(t))})}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(r){e.w(`Unable to perform style diff: ${r.message||r.error||r}.  Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.sourceCaches[t];if(void 0!==i)return i.loaded();this.fire(new e.j(new Error(`There is no source with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&e.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.")}this.terrain=new ks(this.painter,i,t),this.painter.renderToTexture=new Ds(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=e=>{"style"===e.dataType?this.terrain.sourceCache.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(e.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new e.k("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,r={}){const{pixelRatio:s=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:r,height:n,data:p}=i,d=i;return this.style.addImage(t,{data:new e.R({width:r,height:n},new Uint8Array(p)),pixelRatio:s,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{const{width:r,height:p,data:d}=n.getImageData(i);this.style.addImage(t,{data:new e.R({width:r,height:p},d),pixelRatio:s,stretchX:a,stretchY:l,content:c,textFitWidth:h,textFitHeight:u,sdf:o,version:0})}}updateImage(t,i){const r=this.style.getImage(t);if(!r)return this.fire(new e.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=i instanceof HTMLImageElement||e.b(i)?n.getImageData(i):i,{width:o,height:a,data:l}=s;if(void 0===o||void 0===a)return this.fire(new e.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==r.data.width||a!==r.data.height)return this.fire(new e.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||e.b(i));return r.data.replace(l,c),this.style.updateImage(t,r),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.j(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return d.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,t=>{t||this._update(!0)}),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t){return this._lazyInitEmptyStyle(),this.style.setSky(t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=o.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas",e),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","regi
2on");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const s=this._controlContainer=o.create("div","maplibregl-control-container",t),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(t=>{n[t]=o.create("div",`maplibregl-ctrl-${t} `,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type)},{once:!0});const i=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new yr(i,this.transform),a.testSupport(i)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,s=n.now();this.style.zoomHistory.update(t,s);const o=new e.z(t,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=o.crossFadingFactor();1===a&&a===this._crossFadingFactor||(r=!0,this._crossFadingFactor=a),this.style.update(o)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new e.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.bf.mark(e.bg.load),this.fire(new e.k("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.k("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,e.bf.mark(e.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),d.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),e.bf.clearMetrics(),this._removed=!0,this.fire(new e.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,n.frameAsync(this._frameRequest).then(t=>{e.bf.frame(t),this._frameRequest=null,this._render(t)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Rs}getCameraTargetElevation(){return this.transform.elevation}},t.MapMouseEvent=Lr,t.MapTouchEvent=Rr,t.MapWheelEvent=Br,t.Marker=qs,t.NavigationControl
vendor: 15,500 bytes, line 2
2=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)},this.options=e.e({},Os,t),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),o.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=o.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,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._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Vs(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){o.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){const i=o.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}},t.Popup=class extends e.E{constructor(t){super(),this.remove=()=>(this._content&&o.remove(this._content),this._container&&(o.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new e.k("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{var e;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=o.create("div","maplibregl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);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=this._map.transform.renderWorldCopies&&!this._trackPointer?Ns(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._trackPointer&&!t)return;const i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let r=this.options.anchor;const s=Qs(this.options.offset);if(!r){const t=this._container.offsetWidth,e=this._container.offsetHeight;let n;n=i.y+s.bottom.y<e?["top"]:i.y>this._map.transform.height-e?["bottom"]:[],i.x<t/2?n.push("left"):i.x>this._map.transform.width-t/2&&n.push("right"),r=0===n.length?"bottom":n.join("-")}let n=i.add(s[r]);this.options.subpixelPositioning||(n=n.round()),o.setTransform(this._container,`${js[r]} translate(${n.x}px,${n.y}px)`),$s(this._container,r,"popup")},this._onClose=()=>{this.remove()},this.options=e.e(Object.create(Ks),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=o.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Ys);t&&t.focus()}},t.RasterDEMTileSource=J,t.RasterTileSource=X,t.ScaleControl=class{constructor(t){this._onMove=()=>{Xs(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Xs(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Hs),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){o.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},t.ScrollZoomHandler=us,t.Style=pe,t.TerrainControl=class{constructor(t){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=t}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain",this._container),o.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){o.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},t.TwoFingersTouchPitchHandler=os,t.TwoFingersTouchRotateHandler=ss,t.TwoFingersTouchZoomHandler=is,t.TwoFingersTouchZoomRotateHandler=gs,t.VectorTileSource=H,t.VideoSource=tt,t.addSourceType=(t,i)=>e._(void 0,void 0,void 0,function*(){if(rt(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{it[t]=e})(t,i)}),t.clearPrewarmedResources=function(){const t=F;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(L),F=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()"))},t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return at().getRTLTextPluginStatus()},t.getVersion=function(){return tn},t.getWorkerCount=function(){return R.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return N().broadcast("IS",t)},t.prewarm=function(){V().acquire(L)},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t},t.setRTLTextPlugin=function(t,e){return at().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){R.workerCount=t},t.setWorkerUrl=function(t){e.a.WORKER_URL=t}}),t}()}(m);var f=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(m.exports);const _=r.Layer.extend({options:{updateInterval:32,padding:.1,interactive:!1,pane:"tilePane"},initialize(t){r.setOptions(this,t),this._throttledUpdate=r.Util.throttle(this._update,this.options.updateInterval,this)},onAdd(t){this._container||this._initContainer();const e=this.getPaneName();t.getPane(e).appendChild(this._container),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),t.options.zoomAnimation&&r.DomEvent.on(t._proxy,r.DomUtil.TRANSITION_END,this._transitionEnd,this)},onRemove(t){this._map._proxy&&this._map.options.zoomAnimation&&r.DomEvent.off(this._map._proxy,r.DomUtil.TRANSITION_END,this._transitionEnd,this);const e=this.getPaneName();t.getPane(e).removeChild(this._container),this._container=null,this._glMap.remove(),this._glMap=null},getEvents(){return{move:this._throttledUpdate,zoomanim:this._animateZoom,zoom:this._pinchZoom,zoomstart:this._zoomStart,zoomend:this._zoomEnd,resize:this._resize}},getMaplibreMap(){return this._glMap},getCanvas(){return this._glMap.getCanvas()},getSize(){return this._map.getSize().multiplyBy(1+2*this.options.padding)},getOpacity(){return this.options.opacity},setOpacity(t){this.options.opacity=t,this._container.style.opacity=t},getBounds(){const t=this.getSize().multiplyBy(.5),e=this._map.latLngToContainerPoint(this._map.getCenter());return r.latLngBounds(this._map.containerPointToLatLng(e.subtract(t)),this._map.containerPointToLatLng(e.add(t)))},getContainer(){return this._container},getPaneName(){return this._map.getPane(this.options.pane)?this.options.pane:"tilePane"},_resize(){return this._glMap._resize},_initContainer(){if(this._container)return;this._container=r.DomUtil.create("div","leaflet-gl-layer");const t=this.getSize(),e=this._map.getSize().multiplyBy(this.options.padding);this._container.style.width=`${t.x}px`,this._container.style.height=`${t.y}px`;const i=this._map.containerPointToLayerPoint([0,0]).subtract(e);r.DomUtil.setPosition(this._container,i)},_initGL(){if(this._glMap)return;const t=this._map.getCenter(),e=r.extend({},this.options,{container:this._container,center:[t.lng,t.lat],zoom:this._map.getZoom()-1,attributionControl:!1});this._glMap=new f.Map(e),this._glMap.on("error",t=>{t.error&&401===t.error.status&&console.warn("Invalid or expired API key. Please check that API key is not expired and has the basemaps privilege assigned.")}),this._glMap.once("styledata",()=>{this.fire("styleLoaded")}),this._glMap.transform.latRange=null,this._glMap.transform.maxValidLatitude=1/0,this._transformGL(this._glMap),this._glMap._canvas.canvas?this._glMap._actualCanvas=this._glMap._canvas.canvas:this._glMap._actualCanvas=this._glMap._canvas;const i=this._glMap._actualCanvas;r.DomUtil.addClass(i,"leaflet-image-layer"),r.DomUtil.addClass(i,"leaflet-zoom-animated"),this.options.interactive&&r.DomUtil.addClass(i,"leaflet-interactive"),this.options.className&&r.DomUtil.addClass(i,this.options.className)},_update(){if(!this._map)return;if(this._offset=this._map.containerPointToLayerPoint([0,0]),this._zooming)return;const t=this.getSize(),e=this._container,i=this._glMap,s=this._map.getSize().multiplyBy(this.options.padding),n=this._map.containerPointToLayerPoint([0,0]).subtract(s);r.DomUtil.setPosition(e,n),this._transformGL(i),i.transform.width!==t.x||i.transform.height!==t.y?(e.style.width=`${t.x}px`,e.style.height=`${t.y}px`,null!==i._resize&&void 0!==i._resize?i._resize():i.resize()):i._update()},_transformGL(t){const e=this._map.getCenter(),i=t.transform;i.center=f.LngLat.convert([e.lng,e.lat]),i.zoom=this._map.getZoom()-1},_pinchZoom(){this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:this._map.getCenter()})},_animateZoom(t){const e=this._map.getZoomScale(t.zoom),i=this._map.getSize().multiplyBy(this.options.padding*e),s=this.getSize()._divideBy(2),n=this._map.project(t.center,t.zoom)._subtract(s)._add(this._map._getMapPanePos().add(i))._round(),o=this._map.project(this._map.getBounds().getNorthWest(),t.zoom)._subtract(n);r.DomUtil.setTransform(this._glMap._actualCanvas,o.subtract(this._offset),e)},_zoomStart(){this._zooming=!0},_zoomEnd(){const t=this._map.getZoomScale(this._map.getZoom());r.DomUtil.setTransform(this._glMap._actualCanvas,null,t),this._zooming=!1,this._update()}
2,_transitionEnd(){r.Util.requestAnimFrame(function(){const t=this._map.getZoom(),e=this._map.getCenter(),i=this._map.latLngToContainerPoint(this._map.getBounds().getNorthWest());r.DomUtil.setTransform(this._glMap._actualCanvas,i,1),this._glMap.once("moveend",r.Util.bind(function(){this._zoomEnd()},this)),this._glMap.jumpTo({center:e,zoom:t-1})},this)}});function g(t){return new _(t)}const y=r.Layer.extend({options:{portalUrl:"https://www.arcgis.com",preserveDrawingBuffer:!1},initialize(t,e){if(e&&r.setOptions(this,e),this.options.apiKey&&(this.options.apikey=this.options.apiKey),this.options.apikey?this.options.token=this.options.apikey:this.options.token&&(this.options.apikey=this.options.token),!t)throw new Error("An ITEM ID or SERVICE URL is required for vectorTileLayer.");t&&(this.options.key=t),this._createLayer()},_createLayer(){!function(t,e,i){/^https?:\/\//.test(t)&&/\/VectorTileServer\/?$/.test(t)?o(t,e,i):function(t,e,i){const r=c(`${e.portalUrl}/sharing/rest/content/items/${t}/resources/styles/root.json`);a(r,e,(a,l)=>{n(t,e,a?(t,r)=>{t?i(t):o(r.url,e,i)}:(t,n)=>{t?i(t):s(n.url,e,(t,e)=>{i(t,l,r,e,n.url)})})})}(t,e,i)}(this.options.key,this.options,(t,e,i,r)=>{var s;t?this.fire("load-error",{value:t}):(s=r.tileInfo.spatialReference.wkid,p.indexOf(s)>=0||console.warn('This layer is not guaranteed to display properly because its service does not use the Web Mercator projection. The "tileInfo.spatialReference" property is:',r.tileInfo.spatialReference,"\nMore information is available at https://github.com/maplibre/maplibre-gl-js/issues/168 and https://github.com/Esri/esri-leaflet-vector/issues/94."),e=h(e,i,r,this.options.token),this._createMaplibreLayer(e))})},_setupAttribution(){if(!this.getAttribution()){const t=this._maplibreGL.getMaplibreMap().style.stylesheet.sources,e=Object.keys(t);this.options.attribution=t[e[e.length-1]].attribution,this._map&&this._map.attributionControl&&this._map.attributionControl.addAttribution(this.getAttribution())}},_createMaplibreLayer(t){this._maplibreGL=g({style:t,pane:this.options.pane,opacity:this.options.opacity,preserveDrawingBuffer:this.options.preserveDrawingBuffer}),this._ready=!0,this.fire("ready",{},!0),this._maplibreGL.on("styleLoaded",()=>{this._setupAttribution(),this.options.style&&"function"==typeof this.options.style&&this._maplibreGL._glMap.setStyle(this.options.style(this._maplibreGL._glMap.getStyle()))})},onAdd(t){this._map=t,this._ready?this._asyncAdd():this.once("ready",function(){this._asyncAdd()},this)},onRemove(t){t.removeLayer(this._maplibreGL)},_asyncAdd(){const t=this._map;this._maplibreGL.addTo(t,this)}}),x=y.extend({initialize(t,e){if(e.version||(t.includes("/")?e.version=2:e.version=1),t||(t=1===e.version?"ArcGIS:Streets":"arcgis/streets"),!(e.apikey||e.apiKey||e.token))throw new Error("An API Key or token is required for vectorBasemapLayer.");if(2!==e.version){if(e.language)throw new Error("The language parameter is only supported by the basemap styles service v2. Provide a v2 style enumeration to use this option.");if(e.worldview)throw new Error("The worldview parameter is only supported by the basemap styles service v2. Provide a v2 style enumeration to use this option.");if(e.places)throw new Error("The places parameter is only supported by the basemap styles service v2. Provide a v2 style enumeration to use this option.")}e.pane||(t.includes(":Label")||t.includes("/label")?e.pane="esri-labels":t.includes(":Detail")||t.includes("/detail")?e.pane="esri-detail":e.pane="tilePane"),y.prototype.initialize.call(this,t,e)},_createLayer(){let t;t=this.options.version&&2===this.options.version?function(t,e,i){if(t.startsWith("osm/")&&console.log("L.esri.Vector.vectorBasemapLayer: All 'osm/*' styles are retired are no longer receiving updates and were last updated in 2024. Please use 'open/*' styles instead."),t.includes(":"))throw new Error(`${t} is a v1 style enumeration. Set version:1 to request this style`);let r=i.baseUrl||"https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/";if(t.startsWith("open/")||t.startsWith("osm/")||t.startsWith("arcgis/")||32!==t.length)r+=t;else if(r=`${r}items/${t}`,i.language)throw new Error("The 'language' parameter is not supported for custom basemap styles");if(!e)throw new Error("A token is required to access basemap styles.");return r=`${r}?token=${e}`,i.language&&(r=`${r}&language=${i.language}`),i.worldview&&(r=`${r}&worldview=${i.worldview}
2`),i.places&&(r=`${r}&places=${i.places}`),r}(this.options.key,this.options.apikey,{language:this.options.language,worldview:this.options.worldview,places:this.options.places,baseUrl:this.options.baseUrl}):function(t,e){if(t.includes("/"))throw new Error(`${t} is a v2 style enumeration. Set version:2 to request this style`);let i=`https://basemaps-api.arcgis.com/arcgis/rest/services/styles/${t}?type=style`;return e&&(i=`${i}&token=${e}`),i}(this.options.key,this.options.apikey),this.options.version&&1===this.options.version&&fetch(t).then(t=>t.json()).then(t=>{t.error&&console.warn("Error:",t.error.message)}).catch(t=>{console.warn("Error:",t.message)}),this._createMaplibreLayer(t)},_setupAttribution(){if(32===this.options.key.length){const t=this._maplibreGL.getMaplibreMap().style.stylesheet.sources,e=[];Object.keys(t).forEach(i=>{e.push(t[i].attribution),t[i].copyrightText&&t[i].copyrightText&&""!==t[i].copyrightText&&t[i].attribution!==t[i].copyrightText&&e.push(t[i].copyrightText)}),this._map.attributionControl.addAttribution(`<span class="esri-dynamic-attribution">Powered by <a href="https://www.esri.com">Esri</a> | ${e.join(", ")}</span>`)}else if(e.Util.setEsriAttribution(this._map),this.options.attributionUrls||(this.options.attributionUrls=this._getAttributionUrls(this.options.key)),this._map&&this.options.attributionUrls){if(this._map.attributionControl){for(let t=0;t<this.options.attributionUrls.length;t++)u(this.options.attributionUrls[t],this._map);this._map.attributionControl.addAttribution('<span class="esri-dynamic-attribution"></span>')}e.Util._updateMapAttribution({target:this._map})}},_getAttributionUrls:t=>0===t.indexOf("OSM:")||0===t.indexOf("osm/")?["https://static.arcgis.com/attribution/Vector/OpenStreetMap_v2"]:0===t.indexOf("ArcGIS:Imagery")||0===t.indexOf("arcgis/imagery")?["https://static.arcgis.com/attribution/World_Imagery","https://static.arcgis.com/attribution/Vector/World_Basemap_v2"]:["https://static.arcgis.com/attribution/Vector/World_Basemap_v2"],_initPane(){if(!this._map.getPane(this.options.pane)){const t=this._map.createPane(this.options.pane);t.style.pointerEvents="none";let e=500;"esri-detail"===this.options.pane?e=250:"esri-labels"===this.options.pane&&(e=300),t.style.zIndex=e}},onRemove(t){if(t.off("moveend",e.Util._updateMapAttribution),t.removeLayer(this._maplibreGL),t.attributionControl){e.Util.removeEsriAttribution&&e.Util.removeEsriAttribution(t);const i=document.getElementsByClassName("esri-dynamic-attribution");if(i&&i.length>0){const e=i[0].outerHTML;t.attributionControl.removeAttribution(e),t.attributionControl.removeAttribution('<span class="esri-dynamic-attribution"></span>')}}},_asyncAdd(){const t=this._map;this._initPane(),t.on("moveend",e.Util._updateMapAttribution),this._maplibreGL.addTo(t,this)}});t.MaplibreGLJSLayer=_,t.Util=d,t.VERSION="4.3.2",t.VectorBasemapLayer=x,t.VectorTileLayer=y,t.maplibreGLJSLayer=g,t.setRTLTextPlugin=(t,e,i)=>{f.setRTLTextPlugin(t,e,i)},t.vectorBasemapLayer=function(t,e){return new x(t,e)},t.vectorTileLayer=function(t,e){return new y(t,e)},Object.defineProperty(t,"__esModule",{value:!0})}(e,i(5402),i(3481))},5402:(t,e,i)=>{"use strict";i.r(e),i.d(e,{BasemapLayer:()=>vt,DynamicMapLayer:()=>Ct,FeatureLayer:()=>Lt,FeatureLayerService:()=>_t,FeatureManager:()=>Dt,Find:()=>K,Identify:()=>tt,IdentifyFeatures:()=>it,IdentifyImage:()=>nt,ImageMapLayer:()=>At,ImageService:()=>dt,MapService:()=>ht,Query:()=>H,RasterLayer:()=>It,Service:()=>lt,Support:()=>n,Task:()=>G,TiledMapLayer:()=>wt,Util:()=>Z,VERSION:()=>Bt,basemapLayer:()=>bt,dynamicMapLayer:()=>Mt,featureLayer:()=>Rt,featureLayerService:()=>gt,find:()=>Y,get:()=>f,identify:()=>et,identifyFeatures:()=>rt,identifyImage:()=>ot,imageMapLayer:()=>Pt,imageService:()=>mt,mapService:()=>ut,options:()=>o,post:()=>u,query:()=>X,request:()=>d,service:()=>ct,task:()=>W,tiledMapLayer:()=>Tt});const r=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,s=""===document.documentElement.style.pointerEvents,n={cors:r,pointerEvents:s},o={attributionWidthOffset:55};var a=i(3481);let l=0;function c(t){let e="";t.f=t.f||"json";for(const i in t)if(Object.hasOwn(t,i)){const r=t[i],s=Object.prototype.toString.call(r);let n;e.length&&(e+="&"),n="[object Array]"===s?"[object Object]"===Object.prototype.toString.call(r[0])?JSON.stringify(r):r.join(","):"[object Object]"===s?JSON.stringify(r):"[object Date]"===s?r.valueOf():r,e+=`${encodeURIComponent(i)}=${encodeURIComponent(n)}`}return e.replaceAll("'","%27")}function h(t,e){const i=new window.XMLHttpRequest;return i.onerror=function(){i.onreadystatechange=a.Util.falseFn,t.call(e,{error:{code:500,message:"XMLHttpRequest error"}},null)},i.onreadystatechange=function(){let r,s;if(4===i.readyState){try{r=JSON.parse(i.responseText)}catch(t){r=null,s={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!s&&r.error&&(s=r.error,r=null),i.onerror=a.Util.falseFn,t.call(e,s,r)}}
vendor: 10,970 bytes, line 2
2,i.ontimeout=function(){this.onerror()},i}function u(t,e,i,r){const s=h(i,r);return s.open("POST",t),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),s.send(c(e)),s}function p(t,e,i,r){const s=h(i,r);return s.open("GET",`${t}?${c(e)}`,!0),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout,r.options.withCredentials&&(s.withCredentials=!0)),s.send(null),s}function d(t,e,i,r){const s=c(e),o=h(i,r),a=`${t}?${s}`.length;if(a<=2e3&&n.cors?o.open("GET",`${t}?${s}`):a>2e3&&n.cors&&(o.open("POST",t),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=r&&void 0!==r.options&&(o.timeout=r.options.timeout,r.options.withCredentials&&(o.withCredentials=!0)),a<=2e3&&n.cors)o.send(null);else{if(!(a>2e3&&n.cors))return a<=2e3&&!n.cors?m(t,e,i,r):void _(`a request to ${t} was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy https://developers.arcgis.com/esri-leaflet/api-reference/request/`);o.send(s)}return o}function m(t,e,i,r){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};const s=`c${l}`;e.callback=`window._EsriLeafletCallbacks.${s}`,window._EsriLeafletCallbacks[s]=function(t){if(!0!==window._EsriLeafletCallbacks[s]){let e;const n=Object.prototype.toString.call(t);"[object Object]"!==n&&"[object Array]"!==n&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),i.call(r,e,t),window._EsriLeafletCallbacks[s]=!0}};const n=a.DomUtil.create("script",null,document.body);return n.type="text/javascript",n.src=`${t}?${c(e)}`,n.id=s,n.onerror=function(t){if(t&&!0!==window._EsriLeafletCallbacks[s]){const t={error:{code:500,message:"An unknown error occurred"}};i.call(r,t),window._EsriLeafletCallbacks[s]=!0}},a.DomUtil.addClass(n,"esri-leaflet-jsonp"),l++,{id:s,url:n.src,abort(){window._EsriLeafletCallbacks._callback[s]({code:0,message:"Request aborted."})}}}const f=n.cors?p:m;function _(...t){console&&console.warn&&console.warn.apply(console,t)}f.CORS=p,f.JSONP=m;const g={request:d,get:f,post:u};var y=function(t,e,i,r){var s=(r[0]-i[0])*(t[1]-i[1])-(r[1]-i[1])*(t[0]-i[0]),n=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),o=(r[1]-i[1])*(e[0]-t[0])-(r[0]-i[0])*(e[1]-t[1]);if(0!==o){var a=s/o,l=n/o;if(a>=0&&a<=1&&l>=0&&l<=1)return!0}return!1},x=function(t,e){for(var i=0;i<t.length-1;i++)for(var r=0;r<e.length-1;r++)if(y(t[i],t[i+1],e[r],e[r+1]))return!0;return!1},v=function(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}(t[0],t[t.length-1])||t.push(t[0]),t},b=function(t){for(var e,i=0,r=0,s=t.length,n=t[r];r<s-1;r++)i+=((e=t[r+1])[0]-n[0])*(e[1]+n[1]),n=e;return i>=0},w=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},T=function(t,e){var i=x(t,e),r=function(t,e){for(var i=!1,r=-1,s=t.length,n=s-1;++r<s;n=r)(t[r][1]<=e[1]&&e[1]<t[n][1]||t[n][1]<=e[1]&&e[1]<t[r][1])&&e[0]<(t[n][0]-t[r][0])*(e[1]-t[r][1])/(t[n][1]-t[r][1])+t[r][0]&&(i=!i);return i}(t,e[0]);return!(i||!r)},S=function t(e,i){var r={};if(e.features){r.type="FeatureCollection",r.features=[];for(var s=0;s<e.features.length;s++)r.features.push(t(e.features[s],i))}if("number"==typeof e.x&&"number"==typeof e.y&&(r.type="Point",r.coordinates=[e.x,e.y],"number"==typeof e.z&&r.coordinates.push(e.z)),e.points&&(r.type="MultiPoint",r.coordinates=e.points.slice(0)),e.paths&&(1===e.paths.length?(r.type="LineString",r.coordinates=e.paths[0].slice(0)):(r.type="MultiLineString",r.coordinates=e.paths.slice(0))),e.rings&&(r=function(t){for(var e,i,r,s=[],n=[],o=0;o<t.length;o++){var a=v(t[o].slice(0));if(!(a.length<4))if(b(a)){var l=[a.slice().reverse()];s.push(l)}else n.push(a.slice().reverse())}for(var c=[];n.length;){r=n.pop();var h=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],T(i,r)){s[e].push(r),h=!0;break}h||c.push(r)}for(;c.length;){r=c.pop();var u=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],x(i,r)){s[e].push(r),u=!0;break}u||s.push([r.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}(e.rings.slice(0))),"number"==typeof e.xmin&&"number"==typeof e.ymin&&"number"==typeof e.xmax&&"number"==typeof e.ymax&&(r.type="Polygon",r.coordinates=[[[e.xmax,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax]]]),(e.geometry||e.attributes)&&(r.type="Feature",r.geometry=e.geometry?t(e.geometry):null,r.properties=e.attributes?w(e.attributes):null,e.attributes))try{r.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],r=0;r<i.length;r++){var s=i[r];if(s in t&&("string"==typeof t[s]||"number"==typeof t[s]))return t[s]}throw Error("No valid id attribute found")}(e.attributes,i)}catch(t){}return JSON.stringify(r.geometry)===JSON.stringify({})&&(r.geometry=null),e.spatialReference&&e.spatialReference.wkid&&4326!==e.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(e.spatialReference)),r},I=function(t){var e=[],i=t.slice(0),r=v(i.shift().slice(0));if(r.length>=4){b(r)||r.reverse(),e.push(r);for(var s=0;s<i.length;s++){var n=v(i[s].slice(0));n.length>=4&&(b(n)&&n.reverse(),e.push(n))}}return e},A=function t(e,i){i=i||"OBJECTID";var r,s={wkid:4326},n={};switch(e.type){case"Point":n.x=e.coordinates[0],n.y=e.coordinates[1],null!=e.coordinates[2]&&(n.z=e.coordinates[2]),n.spatialReference=s;break;case"MultiPoint":n.points=e.coordinates.slice(0),null!=e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"LineString":n.paths=[e.coordinates.slice(0)],null!=e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiLineString":n.paths=e.coordinates.slice(0),null!=e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Polygon":n.rings=I(e.coordinates.slice(0)),null!=e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiPolygon":n.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var r=I(t[i]),s=r.length-1;s>=0;s--){var n=r[s].slice(0);e.push(n)}return e}(e.coordinates.slice(0)),null!=e.coordinates[0][0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Feature":e.geometry&&(n.geometry=t(e.geometry,i)),n.attributes=e.properties?w(e.properties):{},e.id&&(n.attributes[i]=e.id);break;case"FeatureCollection":for(n=[],r=0;r<e.features.length;r++)n.push(t(e.features[r],i));break;case"GeometryCollection":for(n=[],r=0;r<e.geometries.length;r++)n.push(t(e.geometries[r],i))}return n};function P(t,e){return A(t,e)}function C(t,e){return S(t,e)}function M(t){if("NaN"!==t.xmin&&"NaN"!==t.ymin&&"NaN"!==t.xmax&&"NaN"!==t.ymax){const e=(0,a.latLng)(t.ymin,t.xmin),i=(0,a.latLng)(t.ymax,t.xmax);return(0,a.latLngBounds)(e,i)}return null}function k(t){return{xmin:(t=(0,a.latLngBounds)(t)).getSouthWest().lng,ymin:t.getSouthWest().lat,xmax:t.getNorthEast().lng,ymax:t.getNorthEast().lat,spatialReference:{wkid:4326}}}const z=/^(OBJECTID|FID|OID|ID)$/i;function E(t){let e;if(t.objectIdFieldName)e=t.objectIdFieldName;else if(t.fields){for(let i=0;i<=t.fields.length-1;i++)if("esriFieldTypeOID"===t.fields[i].type){e=t.fields[i].name;break}if(!e)for(let i=0;i<=t.fields.length-1;i++)if(t.fields[i].name.match(z)){e=t.fields[i].name;break}}return e}function D(t){for(const e in t.attributes)if(e.match(z))return e}function L(t,e){let i;const r=t.features||t.results,s=r&&r.length;i=e||E(t);const n={type:"FeatureCollection",features:[]};if(s)for(let t=r.length-1;t>=0;t--){const e=C(r[t],i||D(r[t]));n.features.push(e)}return n}function R(t){return"/"!==(t=a.Util.trim(t))[t.length-1]&&(t+="/"),t}function B(t){if(-1!==t.url.indexOf("?")){t.requestParams=t.requestParams||{};const e=t.url.substring(t.url.indexOf("?")+1);t.url=t.url.split("?")[0],t.requestParams=JSON.parse(`{"${decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')}"}`)}return t.url=R(t.url.split("?")[0]),t}function F(t){return/^(?!.*utility\.arcgis\.com).*\.arcgis\.com.*FeatureServer/i.test(t)}function O(t){let e;switch(t){case"Point":e="esriGeometryPoint";break;case"MultiPoint":e="esriGeometryMultipoint";break;case"LineString":case"MultiLineString":e="esriGeometryPolyline";break;case"Polygon":case"MultiPolygon":e="esriGeometryPolygon"}return e}function V(t){return t.getSize().x-o.attributionWidthOffset+"px"}function U(t){if(t.attributionControl){if(t.attributionControl._esriAttributionLayerCount||(t.attributionControl._esriAttributionLayerCount=0),0===t.attributionControl._esriAttributionLayerCount){if(!t.attributionControl._esriAttributionAddedOnce){const e=document.createElement("style");e.type="text/css",e.innerHTML=".esri-truncated-attribution:hover {white-space: normal;}",document.getElementsByTagName("head")[0].appendChild(e);const i=document.createElement("style");i.type="text/css",i.innerHTML=`.esri-truncated-attribution {vertical-align: -3px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: inline-block;transition: 0s white-space;transition-delay: 1s;max-width: ${V(t)};}`,document.getElementsByTagName("head")[0].appendChild(i),t.on("resize",e=>{t.attributionControl&&(t.attributionControl._container.style.maxWidth=V(e.target))}),t.attributionControl._esriAttributionAddedOnce=!0}a.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution:hover"),a.DomUtil.addClass(t.attributionControl._container,"esri-truncated-attribution")}t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount+1}}function N(t){t.attributionControl&&(t.attributionControl._esriAttributionLayerCount&&1===t.attributionControl._esriAttributionLayerCount&&(a.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution:hover"),a.DomUtil.removeClass(t.attributionControl._container,"esri-truncated-attribution")),t.attributionControl._esriAttributionLayerCount=t.attributionControl._esriAttributionLayerCount-1)}function j(t){const e={geometry:null,geometryType:null};return t instanceof a.LatLngBounds?(e.geometry=k(t),e.geometryType="esriGeometryEnvelope",e):(t.getLatLng&&(t=t.getLatLng()),t instanceof a.LatLng&&(t={type:"Point",coordinates:[t.lng,t.lat]}),t instanceof a.GeoJSON&&(t=t.getLayers()[0].feature.geometry,e.geometry=P(t),e.geometryType=O(t.type)),t.toGeoJSON&&(t=t.toGeoJSON()),"Feature"===t.type&&(t=t.geometry),"Point"===t.type||"LineString"===t.type||"Polygon"===t.type||"MultiPolygon"===t.type?(e.geometry=P(t),e.geometryType=O(t.type),e):void _("invalid geometry passed to spatial query. Should be L.LatLng, L.LatLngBounds, L.Marker or a GeoJSON Point, Line, Polygon or MultiPolygon object"))}function $(t,e){n.cors&&d(t,{},a.Util.bind((t,i)=>{if(!t){e._esriAttributions=[];for(let t=0;t<i.contributors.length;t++){const r=i.contributors[t];for(let t=0;t<r.coverageAreas.length;t++){const i=r.coverageAreas[t],s=(0,a.latLng)(i.bbox[0],i.bbox[1]),n=(0,a.latLng)(i.bbox[2],i.bbox[3]);e._esriAttributions.push({attribution:r.attribution,score:i.score,boun
2ds:(0,a.latLngBounds)(s,n),minZoom:i.zoomMin,maxZoom:i.zoomMax})}}e._esriAttributions.sort((t,e)=>e.score-t.score),q({target:e})}},this))}function q(t){const e=t.target,i=e._esriAttributions;if(!e||!e.attributionControl)return;const r=e.attributionControl._container.querySelector(".esri-dynamic-attribution");if(r&&i){let t="";const s=e.getBounds(),n=(0,a.latLngBounds)(s.getSouthWest().wrap(),s.getNorthEast().wrap()),o=e.getZoom();for(let e=0;e<i.length;e++){const r=i[e],s=r.attribution;!t.match(s)&&r.bounds.intersects(n)&&o>=r.minZoom&&o<=r.maxZoom&&(t+=`, ${s}`)}t=`Powered by <a href="https://www.esri.com">Esri</a> | ${t.substr(2)}`,r.innerHTML=t,r.style.maxWidth=V(e),e.fire("attributionupdated",{attribution:t})}}const Z={warn:_,cleanUrl:R,getUrlParams:B,isArcgisOnline:F,geojsonTypeToArcGIS:O,responseToFeatureCollection:L,geojsonToArcGIS:P,arcgisToGeoJSON:C,boundsToExtent:k,extentToBounds:M,calcAttributionWidth:V,setEsriAttribution:U,getEsriAttributionHtmlString:function(){return'Powered by <a href="https://www.esri.com">Esri</a>'},removeEsriAttribution:N,_setGeometry:j,_getAttributionData:$,_updateMapAttribution:q,_findIdAttributeFromFeature:D,_findIdAttributeFromResponse:E},G=a.Class.extend({options:{proxy:!1,useCors:r},generateSetter:(t,e)=>a.Util.bind(function(e){return this.params[t]=e,this},e),initialize(t){if(t.request&&t.options?(this._service=t,a.Util.setOptions(this,t.options)):(a.Util.setOptions(this,t),this.options.url=R(t.url)),this.params=a.Util.extend({},this.params||{}),this.setters)for(const t in this.setters){const e=this.setters[t];this[t]=this.generateSetter(e,this)}},token(t){return this._service?this._service.authenticate(t):this.params.token=t,this},apikey(t){return this.token(t)},format(t){return this.params.returnUnformattedValues=!t,this},request(t,e){return this.options.requestParams&&a.Util.extend(this.params,this.options.requestParams),this._service?this._service.request(this.path,this.params,t,e):this._request("request",this.path,this.params,t,e)},_request(t,e,i,r,s){const n=this.options.proxy?`${this.options.proxy}?${this.options.url}${e}`:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?g[t](n,i,r,s):g.get.JSONP(n,i,r,s)}});function W(t){return t=B(t),new G(t)}const H=G.extend({setters:{offset:"resultOffset",limit:"resultRecordCount",fields:"outFields",precision:"geometryPrecision",featureIds:"objectIds",returnGeometry:"returnGeometry",returnM:"returnM",transform:"datumTransformation",token:"token"},path:"query",params:{returnGeometry:!0,where:"1=1",outSR:4326,outFields:"*"},within(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelContains",this},intersects(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIntersects",this},contains(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelWithin",this},crosses(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelCrosses",this},touches(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelTouches",this},overlaps(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelOverlaps",this},bboxIntersects(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelEnvelopeIntersects",this},indexIntersects(t){return this._setGeometryParams(t),this.params.spatialRel="esriSpatialRelIndexIntersects",this},nearby(t,e){return t=(0,a.latLng)(t),this.params.geometry=[t.lng,t.lat],this.params.geometryType="esriGeometryPoint",this.params.spatialRel="esriSpatialRelIntersects",this.params.units="esriSRUnit_Meter",this.params.distance=e,this.params.inSR=4326,this},where(t){return this.params.where=t,this},between(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this},simplify(t,e){const i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},orderBy(t,e){return e=e||"ASC",this.params.orderByFields=this.params.orderByFields?`${this.params.orderByFields},`:"",this.params.orderByFields+=[t,e].join(" "),this},run(t,e){return this._cleanParams(),this.options.isModern||F(this.options.url)&&void 0===this.options.isModern?(this.params.f="geojson",this.request(function(i,r){this._trapSQLerrors(i),t.call(e,i,r,r)},this)):this.request(function(i,r){this._trapSQLerrors(i),t.call(e,i,r&&L(r),r)},this)},count(t,e){return this._cleanParams(),this.params.returnCountOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.count,i)},e)},ids(t,e){return this._cleanParams(),this.params.returnIdsOnly=!0,this.request(function(e,i){t.call(this,e,i&&i.objectIds,i)},e)},bounds(t,e){return this._cleanParams(),this.params.returnExtentOnly=!0,this.request((i,r)=>{r&&r.extent&&M(r.extent)?t.call(e,i,M(r.extent),r):(i={message:"Invalid Bounds"},t.call(e,i,null,r))},e)},distinct(){return this.params.returnGeometry=!1,this.params.returnDistinctValues=!0,this},pixelSize(t){const e=(0,a.point)(t);return this.params.pixelSize=[e.x,e.y],this},layer(t){return this.path=`${t}/query`,this},_trapSQLerrors(t){t&&"400"===t.code&&_("one common syntax error in query requests is encasing str
2ing values in double quotes instead of single quotes")},_cleanParams(){delete this.params.returnIdsOnly,delete this.params.returnExtentOnly,delete this.params.returnCountOnly},_setGeometryParams(t){this.params.inSR=4326;const e=j(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function X(t){return new H(t)}const J=X,K=G.extend({setters:{contains:"contains",text:"searchText",fields:"searchFields",spatialReference:"sr",sr:"sr",layers:"layers",returnGeometry:"returnGeometry",maxAllowableOffset:"maxAllowableOffset",precision:"geometryPrecision",dynamicLayers:"dynamicLayers",returnZ:"returnZ",returnM:"returnM",gdbVersion:"gdbVersion",token:"token"},path:"find",params:{sr:4326,contains:!0,returnGeometry:!0,returnZ:!0,returnM:!1},layerDefs(t,e){return this.params.layerDefs=this.params.layerDefs?`${this.params.layerDefs};`:"",this.params.layerDefs+=[t,e].join(":"),this},simplify(t,e){const i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run(t,e){return this.request((i,r)=>{t.call(e,i,r&&L(r),r)},e)}});function Y(t){return new K(t)}const Q=Y,tt=G.extend({path:"identify",between(t,e){return this.params.time=[t.valueOf(),e.valueOf()],this}});function et(t){return new tt(t)}const it=tt.extend({setters:{layers:"layers",precision:"geometryPrecision",tolerance:"tolerance",returnGeometry:"returnGeometry"},params:{sr:4326,layers:"all",tolerance:3,returnGeometry:!0},on(t){const e=k(t.getBounds()),i=t.getSize();return this.params.imageDisplay=[i.x,i.y,96],this.params.mapExtent=[e.xmin,e.ymin,e.xmax,e.ymax],this},at(t){return 2===t.length&&(t=(0,a.latLng)(t)),this._setGeometryParams(t),this},layerDef(t,e){return this.params.layerDefs=this.params.layerDefs?`${this.params.layerDefs};`:"",this.params.layerDefs+=[t,e].join(":"),this},simplify(t,e){const i=Math.abs(t.getBounds().getWest()-t.getBounds().getEast());return this.params.maxAllowableOffset=i/t.getSize().y*e,this},run(t,e){return this.request((i,r)=>{if(i)t.call(e,i,void 0,r);else{const i=L(r);r.results=r.results.reverse();for(let t=0;t<i.features.length;t++)i.features[t].layerId=r.results[t].layerId;t.call(e,void 0,i,r)}})},_setGeometryParams(t){const e=j(t);this.params.geometry=e.geometry,this.params.geometryType=e.geometryType}});function rt(t){return new it(t)}const st=rt,nt=tt.extend({setters:{setMosaicRule:"mosaicRule",setRenderingRule:"renderingRule",setPixelSize:"pixelSize",returnCatalogItems:"returnCatalogItems",returnGeometry:"returnGeometry"},params:{returnGeometry:!1},at(t){return t=(0,a.latLng)(t),this.params.geometry=JSON.stringify({x:t.lng,y:t.lat,spatialReference:{wkid:4326}}),this.params.geometryType="esriGeometryPoint",this},getMosaicRule(){return this.params.mosaicRule},getRenderingRule(){return this.params.renderingRule},getPixelSize(){return this.params.pixelSize},run(t,e){return this.request(function(i,r){t.call(e,i,r&&this._responseToGeoJSON(r),r)},this)},_responseToGeoJSON(t){const e=t.location,i=t.catalogItems,r=t.catalogItemVisibilities,s={pixel:{type:"Feature",geometry:{type:"Point",coordinates:[e.x,e.y]},crs:{type:"EPSG",properties:{code:e.spatialReference.wkid}},properties:{OBJECTID:t.objectId,name:t.name,value:t.value},id:t.objectId}};if(t.properties&&t.properties.Values&&(s.pixel.properties.values=t.properties.Values),i&&i.features&&(s.catalogItems=L(i),r&&r.length===s.catalogItems.features.length))for(let t=r.length-1;t>=0;t--)s.catalogItems.features[t].properties.catalogItemVisibility=r[t];return s}});function ot(t){return new nt(t)}const at=ot,lt=a.Evented.extend({options:{proxy:!1,useCors:r,timeout:0},initialize(t){t=t||{},this._requestQueue=[],this._authenticating=!1,a.Util.setOptions(this,t),this.options.url=R(this.options.url)},get(t,e,i,r){return this._request("get",t,e,i,r)},post(t,e,i,r){return this._request("post",t,e,i,r)},request(t,e,i,r){return this._request("request",t,e,i,r)},metadata(t,e){return this._request("get","",{},t,e)},authenticate(t){return this._authenticating=!1,this.options.token=t,this._runQueue(),this},getTimeout(){return this.options.timeout},setTimeout(t){this.options.timeout=t},_request(t,e,i,r,s){this.fire("requeststart",{url:this.options.url+e,params:i,method:t},!0);const n=this._createServiceCallback(t,e,i,r,s);if(this.options.token&&(i.token=this.options.token),this.options.requestParam
2s&&a.Util.extend(i,this.options.requestParams),!this._authenticating){const r=this.options.proxy?`${this.options.proxy}?${this.options.url}${e}`:this.options.url+e;return"get"!==t&&"request"!==t||this.options.useCors?g[t](r,i,n,s):g.get.JSONP(r,i,n,s)}this._requestQueue.push([t,e,i,r,s])},_createServiceCallback(t,e,i,r,s){return a.Util.bind(function(n,o){!n||499!==n.code&&498!==n.code||(this._authenticating=!0,this._requestQueue.push([t,e,i,r,s]),this.fire("authenticationrequired",{authenticate:a.Util.bind(this.authenticate,this)},!0),n.authenticate=a.Util.bind(this.authenticate,this)),r.call(s,n,o),n?this.fire("requesterror",{url:this.options.url+e,params:i,message:n.message,code:n.code,method:t},!0):this.fire("requestsuccess",{url:this.options.url+e,params:i,response:o,method:t},!0),this.fire("requestend",{url:this.options.url+e,params:i,method:t},!0)},this)},_runQueue(){for(let t=this._requestQueue.length-1;t>=0;t--){const e=this._requestQueue[t];this[e.shift()].apply(this,e)}this._requestQueue=[]}});function ct(t){return t=B(t),new lt(t)}const ht=lt.extend({identify(){return st(this)},find(){return Q(this)},query(){return J(this)}});function ut(t){return new ht(t)}const pt=ut,dt=lt.extend({query(){return J(this)},identify(){return at(this)}});function mt(t){return new dt(t)}const ft=mt,_t=lt.extend({options:{idAttribute:"OBJECTID"},query(){return J(this)},addFeature(t,e,i){this.addFeatures(t,e,i)},addFeatures(t,e,i){const r=t.features?t.features:[t];for(let t=r.length-1;t>=0;t--)delete r[t].id;return t=P(t),t=r.length>1?t:[t],this.post("addFeatures",{features:t},(t,r)=>{const s=r&&r.addResults?r.addResults.length>1?r.addResults:r.addResults[0]:void 0;e&&e.call(i,t||r.addResults[0].error,s)},i)},updateFeature(t,e,i){this.updateFeatures(t,e,i)},updateFeatures(t,e,i){const r=t.features?t.features:[t];return t=P(t,this.options.idAttribute),t=r.length>1?t:[t],this.post("updateFeatures",{features:t},(t,r)=>{const s=r&&r.updateResults?r.updateResults.length>1?r.updateResults:r.updateResults[0]:void 0;e&&e.call(i,t||r.updateResults[0].error,s)},i)},deleteFeature(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures(t,e,i){return this.post("deleteFeatures",{objectIds:t},(t,r)=>{const s=r&&r.deleteResults?r.deleteResults.length>1?r.deleteResults:r.deleteResults[0]:void 0;e&&e.call(i,t||r.deleteResults[0].error,s)},i)}});function gt(t){return new _t(t)}const yt=gt,xt="https:"!==window.location.protocol?"http:":"https:",vt=a.TileLayer.extend({statics:{TILES:{Streets:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Street_Map"}},Topographic:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/World_Topo_Map"}},Oceans:{urlTemplate:`${xt}//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"USGS, NOAA",attributionUrl:"https://static.arcgis.com/attribution/Ocean_Basemap"}},OceansLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},NationalGeographic:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"National Geographic, DeLorme, HERE, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, increment P Corp."}},DarkGray:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, &copy; OpenStreetMap contributors"}},DarkGrayLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Reference/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},Gray:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],attribution:"HERE, DeLorme, MapmyIndia, &copy; OpenStreetMap contributors"}},GrayLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:16,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},Imagery:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,subdomains:["server","services"],attribution:"DigitalGlobe, GeoEye, i-cubed, USDA, USGS, AEX, Getmapping, Aerogrid, IGN, IGP, swisstopo, and the GIS User Community",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}},ImageryLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},ImageryTransportation:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},ShadedRelief:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS"}},ShadedReliefLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:12,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},Terrain:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:13,subdomains:["server","services"],attribution:"USGS, NOAA"}},TerrainLabels:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:13,subdomains:["server","services"],pane:s?"esri-labels":"tilePane",attribution:""}},USATopo:{urlTemplate:`${xt}//{s}.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:15,subdomains:["server","services"],attribution:"USGS, National Geographic Society, i-cubed"}},ImageryClarity:{urlTemplate:`${xt}//clarity.maptiles.arcgis.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community"}},Physical:{urlTemplate:`${xt}//{s}.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:8,subdomains:["server","services"],attribution:"U.S. National Park Service"}},ImageryFirefly:{urlTemplate:`${xt}//fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{z}/{y}/{x}`,options:{minZoom:1,maxZoom:19,attribution:"Esri, DigitalGlobe, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community",attributionUrl:"https://static.arcgis.com/attribution/World_Imagery"}}}},initialize(t,e){let i;if("object"==typeof t&&t.urlTemplate&&t.options)i=t;else{if("string"!=typeof t||!vt.TILES[t])throw new Error('L.esri.BasemapLayer: Invalid parameter. Use one of "Streets", "Topographic", "Oceans", "OceansLabels", "NationalGeographic", "Physical", "Gray", "GrayLabels", "DarkGray", "DarkGrayLabels", "Imagery", "ImageryLabels", "ImageryTransportation", "ImageryClarity", "ImageryFirefly", ShadedRelief", "ShadedReliefLabels", "Terrain", "TerrainLabels" or "USATopo"');i=vt.TILES[t]}const r=a.Util.extend(i.options,e);a.Util.setOptions(this,r),this.options.ignoreDeprecationWarning||console.warn("WARNING: L.esri.BasemapLayer uses data services that are in mature support and are not being updated. Please use L.esri.Vector.vectorBasemapLayer instead. More info: https://esriurl.com/esri-leaflet-basemap"),this.options.token&&-1===i.urlTemplate.indexOf("token=")&&(i.urlTemplate+=`?token=${this.options.token}`),this.options.proxy&&(i.urlTemplate=`${this.options.proxy}?${i.urlTemplate}`),a.TileLayer.prototype.initialize.call(this,i.urlTemplate,r)},onAdd(t){U(t),"esri-labels"===this.options.pane&&this._initPane(),this.options.attributionUrl&&$((this.options.proxy?`${this.options.proxy}?`:"")+this.options.attributionUrl,t),t.on("moveend",q),a.TileLayer.prototype.onAdd.call(this,t)},onRemove(t){N(t),t.off("moveend",q),a.TileLayer.prototype.onRemove.call(this,t)},_initPane(){if(!this._map.getPane(this.options.pane)){const t=this._map.createPane(this.options.pane);t.style.pointerEvents="none",t.style.zIndex=500}},getAttribution(){let t;return this.options.attribution&&(t=`<span class="esri-dynamic-attribution">${this.options.attribution}</span>`),t}});function bt(t,e){return new vt(t,e)}const wt=a.TileLayer.extend({options:{zoomOffsetAllowance:.1,errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEABAMAAACuXLVVAAAAA1BMVEUzNDVszlHHAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAAAAAAAAAB6mUWpAAAADZJREFUeJztwQEBAAAAgiD/r25IQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7waBAAABw08RwAAAAABJRU5ErkJggg=="},statics:{MercatorZoomLevels:{0:156543.033928,1:78271.5169639999,2:39135.7584820001,3:19567.8792409999,4:9783.93962049996,5:4891.96981024998,6:2445.98490512499,7:1222.99245256249,8:611.49622628138,9:305.748113140558,10:152.874056570411,11:76.4370282850732,12:38.2185141425366,13:19.1092570712683,14:9.55462853563415,15:4.77731426794937,16:2.38865713397468,17:1.19432856685505,18:.597164283559817,19:.298582141647617,20:.14929107082381,21:.07464553541191,22:.0373227677059525,23:.0186613838529763}},initialize(t){(t=a.Util.setOptions(this,t)).apikey&&(t.token=t.apikey),t=B(t),this.tileUrl=`${(t.proxy?`${t.proxy}?`:"")+t.url}tile/{z}/{y}/{x}
2${t.requestParams&&Object.keys(t.requestParams).length>0?a.Util.getParamString(t.requestParams):""}`,-1!==t.url.indexOf("{s}")&&t.subdomains&&(t.url=t.url.replace("{s}",t.subdomains[0])),this.service=pt(t),this.service.addEventParent(this),new RegExp(/tiles.arcgis(online)?\.com/g).test(t.url)&&(this.tileUrl=this.tileUrl.replace("://tiles","://tiles{s}"),t.subdomains=["1","2","3","4"]),this.options.token&&(this.tileUrl+=`?token=${this.options.token}`),a.TileLayer.prototype.initialize.call(this,this.tileUrl,t)},getTileUrl(t){const e=this._getZoomForUrl();return a.Util.template(this.tileUrl,a.Util.extend({s:this._getSubdomain(t),x:t.x,y:t.y,z:this._lodMap&&void 0!==this._lodMap[e]?this._lodMap[e]:e},this.options))},createTile(t,e){const i=document.createElement("img");return a.DomEvent.on(i,"load",a.Util.bind(this._tileOnLoad,this,e,i)),a.DomEvent.on(i,"error",a.Util.bind(this._tileOnError,this,e,i)),this.options.crossOrigin&&(i.crossOrigin=""),i.alt="","crs"===this._lodMap||this._lodMap&&void 0!==this._lodMap[this._getZoomForUrl()]?i.src=this.getTileUrl(t):this.once("lodmap",function(){i.src=this.getTileUrl(t)},this),i},onAdd(t){U(t),this._lodMap||this.metadata(function(e,i){if(!e&&i.spatialReference){const e=i.spatialReference.latestWkid||i.spatialReference.wkid;if(!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution())),t.options.crs!==a.CRS.EPSG3857||102100!==e&&3857!==e)t.options.crs&&t.options.crs.code&&t.options.crs.code.indexOf(e)>-1?(this._lodMap="crs",this.fire("lodmap")):_("L.esri.TiledMapLayer is using a non-mercator spatial reference. Support may be available through Proj4Leaflet https://developers.arcgis.com/esri-leaflet/samples/non-mercator-projection/");else{this._lodMap={};const t=i.tileInfo.lods,e=wt.MercatorZoomLevels;for(let i=0;i<t.length;i++){const r=t[i];for(const t in e){const i=e[t];if(this._withinPercentage(r.resolution,i,this.options.zoomOffsetAllowance)){this._lodMap[t]=r.level;break}}}this.fire("lodmap")}}},this),a.TileLayer.prototype.onAdd.call(this,t)},onRemove(t){N(t),a.TileLayer.prototype.onRemove.call(this,t)},metadata(t,e){return this.service.metadata(t,e),this},identify(){return this.service.identify()},find(){return this.service.find()},query(){return this.service.query()},authenticate(t){const e=`?token=${t}`;return this.tileUrl=this.options.token?this.tileUrl.replace(/\?token=(.+)/g,e):this.tileUrl+e,this.options.token=t,this.service.authenticate(t),this},_withinPercentage:(t,e,i)=>Math.abs(t/e-1)<i});function Tt(t,e){return new wt(t,e)}const St=a.ImageOverlay.extend({onAdd(t){this._topLeft=t.getPixelBounds().min,a.ImageOverlay.prototype.onAdd.call(this,t)},_reset(){this._map.options.crs===a.CRS.EPSG3857?a.ImageOverlay.prototype._reset.call(this):a.DomUtil.setPosition(this._image,this._topLeft.subtract(this._map.getPixelOrigin()))}}),It=a.Layer.extend({options:{opacity:1,position:"front",f:"image",useCors:r,attribution:null,interactive:!1,alt:""},onAdd(t){U(t),this.options.zIndex&&(this.options.position=null),this._update=a.Util.throttle(this._update,this.options.updateInterval,this),t.on("moveend",this._update,this),this._currentImage&&this._currentImage._bounds.equals(this._map.getBounds())?t.addLayer(this._currentImage):this._currentImage&&(this._map.removeLayer(this._currentImage),this._currentImage=null),this._update(),this._popup&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this.metadata(function(e,i){!e&&!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution()))},this)},onRemove(t){N(t),this._currentImage&&this._map.removeLayer(this._currentImage),this._popup&&(this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._map.off("moveend",this._update,this)},bindPopup(t,e){return this._shouldRenderPopup=!1,this._lastClick=!1,this._popup=(0,a.popup)(e),this._popupFunction=t,this._map&&(this._map.on("click",this._getPopupData,this),this._map.on("dblclick",this._resetPopupState,this)),this},unbindPopup(){return this._map&&(this._map.closePopup(this._popup),this._map.off("click",this._getPopupData,this),this._map.off("dblclick",this._resetPopupState,this)),this._popup=!1,this},bringToFront(){return this.options.position="front",this._currentImage&&(this._currentImage.bringToFront(),this._setAutoZIndex(Math.max)),this},bringToBack(){return this.options.position="back",this._currentImage&&(this._currentImage.bringToBack(),this._setAutoZIndex(Math.min)),this},setZIndex(t){return this.options.zIndex=t,this._currentImage&&this._currentImage.setZIndex(t),this},_setAutoZIndex(t){if(!this._currentImage)return;const e=this._currentImage.getPane().children;let i=-t(-1/0,1/0);for(let r,s=0,n=e.length;s<n;s++)r=e[s].style.zIndex,e[s]!==this._currentImage._image&&r&&(i=t(i,+r));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this.setZIndex(this.options.zIndex))},getAttribution(){return this.options.attribution},getOpacity(){return this.options.opacity},setOpacity(t){return this.options.opacity=t,this._currentImage&&this._currentImage.setOpacity(t),this},getTimeRange(){return[this.options.from,this.options.to]},setTimeRange(t,e){return this.options.from=t,this.options.to=e,this._update(),this},metadata(t,e){return this.service.metadata(t,e),this},authenticate(t){return this.service.authenticate(t),this},redraw(){this._update()},_renderImage(t,e,i){if(this._map){if(i&&(t=`data:${i};base64,${t}`),!t)return;const r=new St(t,e,{opacity:0,crossOrigin:this.options.withCredentials?"use-credentials":this.options.useCors,alt:this.options.alt,pane:this.options.pane||this.getPane(),interactive:this.options.interactive}).addTo(this._map);let s;const n=function(){this._map.removeLayer(r),this.fire("error"),r.off("load",s,this)};s=function(t){if(r.off("error",n,this),this._map){const i=t.target,r=this._currentImage;i._bounds.equals(e)&&i._bounds.equals(this._map.getBounds())?(this._currentImage=i,"front"===this.options.position?this.bringToFront():"back"===this.options.position&&this.bringToBack(),this.options.zIndex&&this.setZIndex(this.options.zIndex),this._map&&this._currentImage._map?this._currentImage.setOpacity(this.options.opacity):this._currentImage._map.removeLayer(this._currentImage),r&&this._map&&this._map.removeLayer(r),r&&r._map&&r._map.removeLayer(r)):this._map.removeLayer(i)}this.fire("load",{bounds:e})},r.once("error",n,this),r.once("load",s,this)}},_update(){if(!this._map)return;const t=this._map.getZoom(),e=this._map.getBounds();if(this._animatingZoom)return;if(this._map._panTransition&&this._map._panTransition._inProgress)return;if(t>this.options.maxZoom||t<this.options.minZoom)return void(this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null));const i=this._buildExportParams();
2a.Util.extend(i,this.options.requestParams),i?(this._requestExport(i,e),this.fire("loading",{bounds:e})):this._currentImage&&(this._currentImage._map.removeLayer(this._currentImage),this._currentImage=null)},_renderPopup(t,e,i,r){if(t=(0,a.latLng)(t),this._shouldRenderPopup&&this._lastClick.equals(t)){const s=this._popupFunction(e,i,r);s&&this._popup.setLatLng(t).setContent(s).openOn(this._map)}},_resetPopupState(t){this._shouldRenderPopup=!1,this._lastClick=t.latlng},_calculateBbox(){const t=this._map.getPixelBounds(),e=this._map.unproject(t.getBottomLeft()),i=this._map.unproject(t.getTopRight()),r=this._map.options.crs.project(i),s=this._map.options.crs.project(e),n=(0,a.bounds)(r,s);return[n.getBottomLeft().x,n.getBottomLeft().y,n.getTopRight().x,n.getTopRight().y].join(",")},_calculateImageSize(){const t=this._map.getPixelBounds(),e=this._map.getSize(),i=this._map.unproject(t.getBottomLeft()),r=this._map.unproject(t.getTopRight()),s=this._map.latLngToLayerPoint(r).y,n=this._map.latLngToLayerPoint(i).y;return(s>0||n<e.y)&&(e.y=n-s),`${e.x},${e.y}`}}),At=It.extend({options:{updateInterval:150,format:"jpgpng",transparent:!0,f:"image"},query(){return this.service.query()},identify(){return this.service.identify()},initialize(t){t=B(t),this.service=ft(t),this.service.addEventParent(this),a.Util.setOptions(this,t)},setPixelType(t){return this.options.pixelType=t,this._update(),this},getPixelType(){return this.options.pixelType},setBandIds(t){return a.Util.isArray(t)?this.options.bandIds=t.join(","):this.options.bandIds=t.toString(),this._update(),this},getBandIds(){return this.options.bandIds},setNoData(t,e){return a.Util.isArray(t)?this.options.noData=t.join(","):this.options.noData=t.toString(),e&&(this.options.noDataInterpretation=e),this._update(),this},getNoData(){return this.options.noData},getNoDataInterpretation(){return this.options.noDataInterpretation},setRenderingRule(t){this.options.renderingRule=t,this._update()},getRenderingRule(){return this.options.renderingRule},setMosaicRule(t){this.options.mosaicRule=t,this._update()},getMosaicRule(){return this.options.mosaicRule},_getPopupData(t){const e=a.Util.bind(function(e,i,r){e||setTimeout(a.Util.bind(function(){this._renderPopup(t.latlng,e,i,r)},this),300)},this),i=this.identify().at(t.latlng);this.options.mosaicRule&&i.setMosaicRule(this.options.mosaicRule),i.run(e),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams(){const t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};return this.options.from&&this.options.to&&(e.time=`${this.options.from.valueOf()},${this.options.to.valueOf()}`),this.options.pixelType&&(e.pixelType=this.options.pixelType),this.options.interpolation&&(e.interpolation=this.options.interpolation),this.options.compressionQuality&&(e.compressionQuality=this.options.compressionQuality),this.options.bandIds&&(e.bandIds=this.options.bandIds),(0===this.options.noData||this.options.noData)&&(e.noData=this.options.noData),this.options.noDataInterpretation&&(e.noDataInterpretation=this.options.noDataInterpretation),this.service.options.token&&(e.token=this.service.options.token),this.options.renderingRule&&(e.renderingRule=JSON.stringify(this.options.renderingRule)),this.options.mosaicRule&&(e.mosaicRule=JSON.stringify(this.options.mosaicRule)),e},_requestExport(t,e){if("json"===this.options.f)this.service.request("exportImage",t,function(t,i){t||(this.options.token&&(i.href+=`?token=${this.options.token}`),this.options.proxy&&(i.href=`${this.options.proxy}?${i.href}`),this._renderImage(i.href,e))},this);else{t.f="image";let i=`${this.options.url}exportImage${a.Util.getParamString(t)}`;this.options.proxy&&(i=`${this.options.proxy}?${i}`),this._renderImage(i,e)}}});function Pt(t,e){return new At(t,e)}const Ct=It.extend({options:{updateInterval:150,layers:!1,layerDefs:!1,timeOptions:!1,format:"png32",transparent:!0,f:"json"},initialize(t){t=B(t),this.service=pt(t),this.service.addEventParent(this),a.Util.setOptions(this,t)},getDynamicLayers(){return this.options.dynamicLayers},setDynamicLayers(t){return this.options.dynamicLayers=t,this._update(),this},getLayers(){return this.options.layers}
2,setLayers(t){return this.options.layers=t,this._update(),this},getLayerDefs(){return this.options.layerDefs},setLayerDefs(t){return this.options.layerDefs=t,this._update(),this},getTimeOptions(){return this.options.timeOptions},setTimeOptions(t){return this.options.timeOptions=t,this._update(),this},query(){return this.service.query()},identify(){return this.service.identify()},find(){return this.service.find()},_getPopupData(t){const e=a.Util.bind(function(e,i,r){e||setTimeout(a.Util.bind(function(){this._renderPopup(t.latlng,e,i,r)},this),300)},this);let i;if(i=this.options.popup?this.options.popup.on(this._map).at(t.latlng):this.identify().on(this._map).at(t.latlng),i.params.maxAllowableOffset||i.simplify(this._map,.5),this.options.popup&&this.options.popup.params&&this.options.popup.params.layers||(this.options.layers?i.layers(`visible:${this.options.layers.join(",")}`):i.layers("visible")),this.options.layerDefs&&"string"!=typeof this.options.layerDefs&&!i.params.layerDefs)for(const t in this.options.layerDefs)Object.hasOwn(this.options.layerDefs,t)&&i.layerDef(t,this.options.layerDefs[t]);i.run(e),this._shouldRenderPopup=!0,this._lastClick=t.latlng},_buildExportParams(){const t=parseInt(this._map.options.crs.code.split(":")[1],10),e={bbox:this._calculateBbox(),size:this._calculateImageSize(),dpi:96,format:this.options.format,transparent:this.options.transparent,bboxSR:t,imageSR:t};if(this.options.dynamicLayers&&(e.dynamicLayers=this.options.dynamicLayers),this.options.layers){if(0===this.options.layers.length)return;e.layers=`show:${this.options.layers.join(",")}`}return this.options.layerDefs&&(e.layerDefs="string"==typeof this.options.layerDefs?this.options.layerDefs:JSON.stringify(this.options.layerDefs)),this.options.timeOptions&&(e.timeOptions=JSON.stringify(this.options.timeOptions)),this.options.from&&this.options.to&&(e.time=`${this.options.from.valueOf()},${this.options.to.valueOf()}`),this.service.options.token&&(e.token=this.service.options.token),this.options.proxy&&(e.proxy=this.options.proxy),this.options.disableCache&&(e._ts=Date.now()),e},_requestExport(t,e){if("json"===this.options.f)this.service.request("export",t,function(t,i){t||(this.options.token&&i.href&&(i.href+=`?token=${this.options.token}`),this.options.proxy&&i.href&&(i.href=`${this.options.proxy}?${i.href}`),i.href?this._renderImage(i.href,e):this._renderImage(i.imageData,e,i.contentType))},this);else{t.f="image";let i=`${this.options.url}export${a.Util.getParamString(t)}`;this.options.proxy&&(i=`${this.options.proxy}?${i}`),this._renderImage(i,e)}}});function Mt(t,e){return new Ct(t,e)}const kt=a.Layer.extend({options:{cellSize:512,updateWhenIdle:a.Browser.mobile,updateInterval:150,noWrap:!1,keepBuffer:1.5},initialize(t){a.Util.setOptions(this,t)},onAdd(){this._cells={},this._activeCells={},this._resetView(),this._update()},onRemove(){this._removeAllCells(),this._cellZoom=void 0},isLoading(){return this._loading},redraw(){return this._map&&(this._removeAllCells(),this._update()),this},getEvents(){const t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=a.Util.throttle(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),t},createCell:()=>document.createElement("div"),removeCell(){},reuseCell(){},cellLeave(){},cellEnter(){},getCellSize(){const t=this.options.cellSize;return t instanceof a.Point?t:new a.Point(t,t)},_pruneCells(){if(!this._map)return;let t,e;for(t in this._cells)e=this._cells[t],e.retain=e.current;for(t in this._cells)if(e=this._cells[t],e.current&&!e.active){const t=e.coords;this._retainParent(t.x,t.y,t.z,t.z-5)||this._retainChildren(t.x,t.y,t.z,t.z+2)}for(t in this._cells)this._cells[t].retain||this._removeCell(t)},_removeAllCells(){for(const t in this._cells)this._removeCell(t)},_invalidateAll(){this._removeAllCells(),this._cellZoom=void 0},_retainParent(t,e,i,r){const s=Math.floor(t/2),n=Math.floor(e/2),o=i-1,l=new a.Point(+s,+n);l.z=+o;const c=this._cellCoordsToKey(l),h=this._cells[c];return h&&h.active?(h.retain=!0,!0):(h&&h.loaded&&(h.retain=!0),o>r&&this._retainParent(s,n,o,r))},_retainChildren(t,e,i,r){for(let s=2*t;s<2*t+2;s++)for(let t=2*e;t<2*e+2;t++){const e=new a.Point(s,t);e.z=i+1;const n=this._cellCoordsToKey(e),o=this._cells[n];o&&o.active?o.retain=!0:(o&&o.loaded&&(o.retain=!0),i+1<r&&this._retainChildren(s,t,i+1,r))}},_resetView(t){const e=t&&(t.pinch||t.flyTo);
2e||this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_setView(t,e,i,r){const s=Math.round(e);r||(this._cellZoom=s,this._abortLoading&&this._abortLoading(),this._resetGrid(),void 0!==s&&this._update(t),i||this._pruneCells(),this._noPrune=!!i)},_resetGrid(){const t=this._map,e=t.options.crs,i=this._cellSize=this.getCellSize(),r=this._cellZoom,s=this._map.getPixelWorldBounds(this._cellZoom);s&&(this._globalCellRange=this._pxBoundsToCellRange(s)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],r).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],r).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],r).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],r).y/i.y)]},_onMoveEnd(t){t&&(t.pinch||t.flyTo)||!this._map||this._map._animatingZoom||this._update()},_getCelldPixelBounds(t){const e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),r=e.getZoomScale(i,this._cellZoom),s=e.project(t,this._cellZoom).floor(),n=e.getSize().divideBy(2*r);return new a.Bounds(s.subtract(n),s.add(n))},_update(t){const e=this._map;if(!e)return;const i=Math.round(e.getZoom());void 0===t&&(t=e.getCenter());const r=this._getCelldPixelBounds(t),s=this._pxBoundsToCellRange(r),n=s.getCenter(),o=[],l=this.options.keepBuffer,c=new a.Bounds(s.getBottomLeft().subtract([l,-l]),s.getTopRight().add([l,-l]));if(!(isFinite(s.min.x)&&isFinite(s.min.y)&&isFinite(s.max.x)&&isFinite(s.max.y)))throw new Error("Attempted to load an infinite number of cells");for(const t in this._cells){const e=this._cells[t].coords;e.z===this._cellZoom&&c.contains(new a.Point(e.x,e.y))||(this._cells[t].current=!1)}if(Math.abs(i-this._cellZoom)>1)this._setView(t,i);else{for(let t=s.min.y;t<=s.max.y;t++)for(let e=s.min.x;e<=s.max.x;e++){const i=new a.Point(e,t);if(i.z=this._cellZoom,!this._isValidCell(i))continue;const r=this._cells[this._cellCoordsToKey(i)];r?r.current=!0:o.push(i)}if(o.sort((t,e)=>t.distanceTo(n)-e.distanceTo(n)),0!==o.length){this._loading||(this._loading=!0);for(let t=0;t<o.length;t++){const e=this._cellCoordsToKey(o[t]),i=this._keyToCellCoords(e);this._activeCells[i]?this._reuseCell(o[t]):this._createCell(o[t])}}}},_isValidCell(t){const e=this._map.options.crs;if(!e.infinite){const i=this._globalCellRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;const i=this._cellCoordsToBounds(t);return(0,a.latLngBounds)(this.options.bounds).overlaps(i)},_keyToBounds(t){return this._cellCoordsToBounds(this._keyToCellCoords(t))},_cellCoordsToNwSe(t){const e=this._map,i=this.getCellSize(),r=t.scaleBy(i),s=r.add(i);return[e.unproject(r,t.z),e.unproject(s,t.z)]},_cellCoordsToBounds(t){const e=this._cellCoordsToNwSe(t);let i=new a.LatLngBounds(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_cellCoordsToKey:t=>`${t.x}:${t.y}:${t.z}`,_keyToCellCoords(t){const e=t.split(":"),i=new a.Point(+e[0],+e[1]);return i.z=+e[2],i},_removeCell(t){const e=this._cells[t];if(!e)return;const i=this._keyToCellCoords(t),r=this._wrapCoords(i),s=this._cellCoordsToBounds(this._wrapCoords(i));e.current=!1,delete this._cells[t],this._activeCells[t]=e,this.cellLeave(s,r,t),this.fire("cellleave",{key:t,coords:r,bounds:s})},_reuseCell(t){const e=this._cellCoordsToKey(t);this._cells[e]=this._activeCells[e],this._cells[e].current=!0;const i=this._wrapCoords(t),r=this._cellCoordsToBounds(this._wrapCoords(t));this.cellEnter(r,i,e),this.fire("cellenter",{key:e,coords:i,bounds:r})},_createCell(t){const e=this._cellCoordsToKey(t),i=this._wrapCoords(t),r=this._cellCoordsToBounds(this._wrapCoords(t));this.createCell(r,i,e),this.fire("cellcreate",{key:e,coords:i,bounds:r}),this._cells[e]={coords:t,current:!0},a.Util.requestAnimFrame(this._pruneCells,this)},_cellReady(t,e,i){const r=this._cellCoordsToKey(t);(i=this._cells[r])&&(i.loaded=+new Date,i.active=!0)},_getCellPos(t){return t.scaleBy(this.getCellSize())},_wrapCoords(t){const e=new a.Point(this._wrapX?a.Util.wrapNum(t.x,this._wrapX):t.x,this._wrapY?a.Util.wrapNum(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToCellRange(t){const e=this.getCellSize();return new a.Bounds(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))}});function zt(t){this.values=[].concat(t||[])}zt.prototype.query=function(t){var e=this.getIndex(t);return this.values[e]},zt.prototype.getIndex=function(t){this.dirty&&this.sort();for(var e,i,r=0,s=this.values.length-1;r<=s;)if(e=(r+s)/2|0,+(i=this.values[Math.round(e)]).value<+t)r=e+1;else{if(!(+i.value>+t))return e;s=e-1}return Math.abs(~s)},zt.prototype.between=function(t,e){var i=this.getIndex(t),r=this.getIndex(e);if(0===i&&0===r)return[];for(;this.values[i-1]&&this.values[i-1].value===t;)i--;for(;this.values[r+1]&&this.values[r+1].value===e;)r++;return this.values[r]&&this.values[r].value===e&&this.values[r+1]&&r++,this.values.slice(i,r)},zt.prototype.insert=function(t){return this.values.splice(this.getIndex(t.value),0,t),this},zt.prototype.bulkAdd=function(t,e){return this.values=this.values.concat([].concat(t||[])),e?this.sort():this.dirty=!0,this},zt.prototype.sort=function(){return this.values.sort(function(t,e){return+e.value-+t.value}).reverse(),this.dirty=!1,this};const Et=zt,Dt=kt.extend({options:{attribution:null,where:"1=1",fields:["*"],from:!1,to:!1,timeField:!1,timeFilterMode:"server",simplifyFactor:0,precision:6,fetchAllFeatures:!1},initialize(t){if(kt.prototype.initialize.call(this,t),t=B(t),t=a.Util.setOptions(this,t),this.service=yt(t),this.service.addEventParent(this),"*"!==this.options.fields[0]){let t=!1;for(let e=0;e<this.options.fields.length;e++)this.options.fields[e].match(/^(OBJECTID|FID|OID|ID)$/i)&&(t=!0);!1===t&&_("no known esriFieldTypeOID field detected in fields Array.  Please add an attribute field containing unique IDs to ensure the layer can be drawn correctly.")}this.options.timeField.start&&this.options.timeField.end?(this._startTimeIndex=new Et,this._endTimeIndex=new Et):this.options.timeField&&(this._timeIndex=new Et),this._cache={},this._currentSnapshot=[],this._activeRequests=0},onAdd(t){return U(t),this.service.metadata(function(e,i){if(!e){const e=i.supportedQueryFormats;let r=!1;(!1===this.service.options.isModern||this.options.fetchAllFeatures)&&(r=!0),!r&&e&&-1!==e.indexOf("geoJSON")&&(this.service.options.isModern=!0),i.objectIdField&&(this.service.options.idAttribute=i.objectIdField),!this.options.attribution&&t.attributionControl&&i.copyrightText&&(this.options.attribution=i.copyrightText,t.attributionControl.addAttribution(this.getAttribution()))}},this),t.on("zoomend",this._handleZoomChange,this),kt.prototype.onAdd.call(this,t)},onRemove(t){return N(t),t.off("zoomend",this._handleZoomChange,this),kt.prototype.onRemove.call(this,t)},getAttribution(){return this.options.attribution},createCell(t,e){this._visibleZoom()&&this._requestFeatures(t,e)},_requestFeatures(t,e,i,r){this._activeRequests++,r=r||0;const s=this.options.where;return 1===this._activeRequests&&this.fire("loading",{bounds:t},!0),this._buildQuery(t,r).run(function(n,o,l){l&&l.exceededTransferLimit&&this.fire("drawlimitexceeded"),this.options.where===s&&(!n&&o&&o.features.length&&a.Util.requestAnimFrame
2(a.Util.bind(function(){this._addFeatures(o.features,e),this._postProcessFeatures(t)},this)),n||!o||o.features.length||this._postProcessFeatures(t),n&&this._postProcessFeatures(t),i&&i.call(this,n,o),l&&(l.exceededTransferLimit||l.properties&&l.properties.exceededTransferLimit)&&this.options.fetchAllFeatures&&this._requestFeatures(t,e,i,r+o.features.length))},this)},_postProcessFeatures(t){this._activeRequests--,this._activeRequests<=0&&this.fire("load",{bounds:t})},_cacheKey:t=>`${t.z}:${t.x}:${t.y}`,_addFeatures(t,e){let i;e&&(i=this._cacheKey(e),this._cache[i]=this._cache[i]||[]);for(let e=t.length-1;e>=0;e--){const r=t[e].id;-1===this._currentSnapshot.indexOf(r)&&this._currentSnapshot.push(r),void 0!==i&&-1===this._cache[i].indexOf(r)&&this._cache[i].push(r)}this.options.timeField&&this._buildTimeIndexes(t),this.createLayers(t)},_buildQuery(t,e){let i=this.service.query().intersects(t).where(this.options.where).fields(this.options.fields).precision(this.options.precision);return this.options.fetchAllFeatures&&!isNaN(parseInt(e))&&(i=i.offset(e)),i.params.resultType="tile",this.options.requestParams&&a.Util.extend(i.params,this.options.requestParams),this.options.simplifyFactor&&i.simplify(this._map,this.options.simplifyFactor),"server"===this.options.timeFilterMode&&this.options.from&&this.options.to&&i.between(this.options.from,this.options.to),i},setWhere(t,e,i){this.options.where=t&&t.length?t:"1=1";const r=[],s=[];let n=0,o=null;const l=a.Util.bind(function(l,c){if(l&&(o=l),c)for(let t=c.features.length-1;t>=0;t--)s.push(c.features[t].id);n--,n<=0&&this._visibleZoom()&&t===this.options.where&&(this._currentSnapshot=s,a.Util.requestAnimFrame(a.Util.bind(function(){this.removeLayers(r),this.addLayers(s),e&&e.call(i,o)},this)))},this);for(let t=this._currentSnapshot.length-1;t>=0;t--)r.push(this._currentSnapshot[t]);this._cache={};for(const t in this._cells){n++;const e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,e,l)}return this},getWhere(){return this.options.where},getTimeRange(){return[this.options.from,this.options.to]},setTimeRange(t,e,i,r){const s=this.options.from,n=this.options.to;let o=0,l=null;const c=a.Util.bind(function(a){a&&(l=a),this._filterExistingFeatures(s,n,t,e),o--,i&&o<=0&&i.call(r,l)},this);if(this.options.from=t,this.options.to=e,this._filterExistingFeatures(s,n,t,e),"server"===this.options.timeFilterMode)for(const t in this._cells){o++;const e=this._keyToCellCoords(t),i=this._cellCoordsToBounds(e);this._requestFeatures(i,e,c)}return this},refresh(){this.setWhere(this.options.where)},_filterExistingFeatures(t,e,i,r){const s=t&&e?this._getFeaturesInTimeRange(t,e):this._currentSnapshot,n=this._getFeaturesInTimeRange(i,r);if(n.indexOf)for(let t=0;t<n.length;t++){const e=s.indexOf(n[t]);e>=0&&s.splice(e,1)}a.Util.requestAnimFrame(a.Util.bind(function(){this.removeLayers(s),this.addLayers(n)},this))},_getFeaturesInTimeRange(t,e){const i=[];let r;if(this.options.timeField.start&&this.options.timeField.end){const i=this._startTimeIndex.between(t,e),s=this._endTimeIndex.between(t,e);r=i.concat(s)}else{if(!this._timeIndex)return _("You must set timeField in the layer constructor in order to manipulate the start and end time filter."),[];r=this._timeIndex.between(t,e)}for(let t=r.length-1;t>=0;t--)i.push(r[t].id);return i},_buildTimeIndexes(t){let e,i;if(this.options.timeField.start&&this.options.timeField.end){const r=[],s=[];for(e=t.length-1;e>=0;e--)i=t[e],r.push({id:i.id,value:new Date(i.properties[this.options.timeField.start])}),s.push({id:i.id,value:new Date(i.properties[this.options.timeField.end])});this._startTimeIndex.bulkAdd(r),this._endTimeIndex.bulkAdd(s)}else{const r=[];for(e=t.length-1;e>=0;e--)i=t[e],r.push({id:i.id,value:new Date(i.properties[this.options.timeField])});this._timeIndex.bulkAdd(r)}},_featureWithinTimeRange(t){if(!this.options.from||!this.options.to)return!0;const e=+this.options.from.valueOf(),i=+this.options.to.valueOf();if("string"==typeof this.options.timeField){const r=+t.properties[this.options.timeField];return r>=e&&r<=i}if(this.options.timeField.start&&this.options.timeField.end){const r=+t.properties[this.options.timeField.start],s=+t.properties[this.options.timeField.end];return r>=e&&r<=i||s>=e&&s<=i||r<=e&&s>=i}}
2,_visibleZoom(){if(!this._map)return!1;const t=this._map.getZoom();return!(t>this.options.maxZoom||t<this.options.minZoom)},_handleZoomChange(){if(this._visibleZoom())for(const t in this._cells){const e=this._cells[t].coords,i=this._cacheKey(e);this._cache[i]&&this.addLayers(this._cache[i])}else this.removeLayers(this._currentSnapshot),this._currentSnapshot=[]},authenticate(t){return this.service.authenticate(t),this},metadata(t,e){return this.service.metadata(t,e),this},query(){return this.service.query()},_getMetadata(t){if(this._metadata){let e;t(e,this._metadata)}else this.metadata(a.Util.bind(function(e,i){this._metadata=i,t(e,this._metadata)},this))},addFeature(t,e,i){this.addFeatures(t,e,i)},addFeatures(t,e,i){this._getMetadata(a.Util.bind(function(r,s){if(r)return void(e&&e.call(this,r,null));const n=t.features?t.features:[t];this.service.addFeatures(t,a.Util.bind(function(t,r){if(!t){for(let t=n.length-1;t>=0;t--)n[t].properties[s.objectIdField]=n.length>1?r[t].objectId:r.objectId,n[t].id=n.length>1?r[t].objectId:r.objectId;this._addFeatures(n)}e&&e.call(i,t,r)},this))},this))},updateFeature(t,e,i){this.updateFeatures(t,e,i)},updateFeatures(t,e,i){const r=t.features?t.features:[t];this.service.updateFeatures(t,function(t,s){if(!t){for(let t=r.length-1;t>=0;t--)this.removeLayers([r[t].id],!0);this._addFeatures(r)}e&&e.call(i,t,s)},this)},deleteFeature(t,e,i){this.deleteFeatures(t,e,i)},deleteFeatures(t,e,i){return this.service.deleteFeatures(t,function(t,r){const s=r.length?r:[r];if(!t&&s.length>0)for(let t=s.length-1;t>=0;t--)this.removeLayers([s[t].objectId],!0);e&&e.call(i,t,r)},this)}}),Lt=Dt.extend({options:{cacheLayers:!0},initialize(t){t.apikey&&(t.token=t.apikey),Dt.prototype.initialize.call(this,t),this._originalStyle=this.options.style,this._layers={}},onRemove(t){for(const e in this._layers)t.removeLayer(this._layers[e]),this.fire("removefeature",{feature:this._layers[e].feature,permanent:!1},!0);return Dt.prototype.onRemove.call(this,t)},createNewLayer(t){const e=a.GeoJSON.geometryToLayer(t,this.options);return e&&(e.defaultOptions=e.options),e},_updateLayer(t,e){let i=[];const r=this.options.coordsToLatLng||a.GeoJSON.coordsToLatLng;switch(e.properties&&(t.feature.properties=e.properties),e.geometry.type){case"Point":i=a.GeoJSON.coordsToLatLng(e.geometry.coordinates),t.setLatLng(i);break;case"LineString":i=a.GeoJSON.coordsToLatLngs(e.geometry.coordinates,0,r),t.setLatLngs(i);break;case"MultiLineString":case"Polygon":i=a.GeoJSON.coordsToLatLngs(e.geometry.coordinates,1,r),t.setLatLngs(i);break;case"MultiPolygon":i=a.GeoJSON.coordsToLatLngs(e.geometry.coordinates,2,r),t.setLatLngs(i)}this.redraw(t.feature.id)},createLayers(t){for(let e=t.length-1;e>=0;e--){const i=t[e],r=this._layers[i.id];let s;!this._visibleZoom()||!r||this._map.hasLayer(r)||this.options.timeField&&!this._featureWithinTimeRange(i)||(this._map.addLayer(r),this.fire("addfeature",{feature:r.feature},!0)),r&&(r.setLatLngs||r.setLatLng)&&this._updateLayer(r,i),r||(s=this.createNewLayer(i),s?(s.feature=i,s.addEventParent(this),this.options.onEachFeature&&this.options.onEachFeature(s.feature,s),this._layers[s.feature.id]=s,this.setFeatureStyle(s.feature.id,this.options.style),this.fire("createfeature",{feature:s.feature},!0),this._visibleZoom()&&(!this.options.timeField||this.options.timeField&&this._featureWithinTimeRange(i))&&this._map.addLayer(s)):_("invalid GeoJSON encountered"))}},addLayers(t){for(let e=t.length-1;e>=0;e--){const i=this._layers[t[e]];!i||this.options.timeField&&!this._featureWithinTimeRange(i.feature)||(this._map.addLayer(i),this.fire("addfeature",{feature:i.feature},!0))}},removeLayers(t,e){for(let i=t.length-1;i>=0;i--){const r=t[i],s=this._layers[r];s&&(this.fire("removefeature",{feature:s.feature,permanent:e},!0),this._map.removeLayer(s)),s&&e&&delete this._layers[r]}},cellEnter(t,e){this._visibleZoom()&&!this._zooming&&this._map&&a.Util.requestAnimFrame(a.Util.bind(function(){const t=this._cacheKey(e),i=this._cellCoordsToKey(e),r=this._cache[t];this._activeCells[i]&&r&&this.addLayers(r)},this))}
2,cellLeave(t,e){this._zooming||a.Util.requestAnimFrame(a.Util.bind(function(){if(this._map){const t=this._cacheKey(e),i=this._cellCoordsToKey(e),r=this._cache[t],s=this._map.getBounds();if(!this._activeCells[i]&&r){let e=!0;for(let t=0;t<r.length;t++){const i=this._layers[r[t]];i&&i.getBounds&&s.intersects(i.getBounds())&&(e=!1)}e&&this.removeLayers(r,!this.options.cacheLayers),!this.options.cacheLayers&&e&&(delete this._cache[t],delete this._cells[i],delete this._activeCells[i])}}},this))},resetStyle(){return this.options.style=this._originalStyle,this.eachFeature(function(t){this.resetFeatureStyle(t.feature.id)},this),this},setStyle(t){return this.options.style=t,this.eachFeature(function(e){this.setFeatureStyle(e.feature.id,t)},this),this},resetFeatureStyle(t){const e=this._layers[t],i=this._originalStyle||a.Path.prototype.options;return e&&(a.Util.extend(e.options,e.defaultOptions),this.setFeatureStyle(t,i)),this},setFeatureStyle(t,e){const i=this._layers[t];return"function"==typeof e&&(e=e(i.feature)),i.setStyle&&i.setStyle(e),this}
2,eachActiveFeature(t,e){if(this._map){const i=this._map.getBounds();for(const r in this._layers)-1!==this._currentSnapshot.indexOf(this._layers[r].feature.id)&&("function"==typeof this._layers[r].getLatLng&&i.contains(this._layers[r].getLatLng())||"function"==typeof this._layers[r].getBounds&&i.intersects(this._layers[r].getBounds()))&&t.call(e,this._layers[r])}return this},eachFeature(t,e){for(const i in this._layers)t.call(e,this._layers[i]);return this},getFeature(t){return this._layers[t]},bringToBack(){this.eachFeature(t=>{t.bringToBack&&t.bringToBack()})},bringToFront(){this.eachFeature(t=>{t.bringToFront&&t.bringToFront()})},redraw(t){return t&&this._redraw(t),this},_redraw(t){const e=this._layers[t],i=e.feature;if(e&&e.setIcon&&this.options.pointToLayer&&this.options.pointToLayer){const t=this.options.pointToLayer(i,(0,a.latLng)(i.geometry.coordinates[1],i.geometry.coordinates[0])).options.icon;e.setIcon(t)}if(e&&e.setStyle&&this.options.pointToLayer){const t=this.options.pointToLayer(i,(0,a.latLng)(i.geometry.coordinates[1],i.geometry.coordinates[0])).options;this.setFeatureStyle(i.id,t)}e&&e.setStyle&&this.options.style&&this.resetFeatureStyle(i.id)},openPopup(t){return this._popup&&this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map),this},openTooltip(t){return this._tooltip&&this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this)),this}});function Rt(t){return new Lt(t)}const Bt="3.0.19"}}]);

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.