@mapcreator/mapcreator-gl 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/index.html +128 -0
- package/dist/lib/lib.js +2 -0
- package/dist/lib/lib.js.LICENSE.txt +4 -0
- package/dist/lib/lib.js.map +1 -0
- package/dist/lib/style.css +9 -0
- package/dist/lib/style.css.map +1 -0
- package/package.json +78 -0
- package/readme.md +29 -0
package/dist/lib/lib.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see lib.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mapcreatorgl=e():t.mapcreatorgl=e()}(this,(function(){return function(){var t={1042:function(t,e,i){"use strict";i.d(e,{YE:function(){return p},d9:function(){return h},Ds:function(){return a},PQ:function(){return l},z5:function(){return f},vU:function(){return r},tq:function(){return o},G6:function(){return n},TS:function(){return u},f:function(){return d},Pm:function(){return c}});const n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=(navigator.userAgent.match(/(iPod|iPhone|iPad)/)&&navigator.userAgent.match(/AppleWebKit/),"undefined"!=typeof InstallTrigger),o=(navigator.msSaveBlob,/MSIE|Trident/.test(window.navigator.userAgent),navigator.userAgent.toLowerCase().indexOf("mobile")>=0),s=/chrome|chromium/i.test(navigator.userAgent);/safari/i.test(navigator.userAgent)&&/webkit/i.test(navigator.userAgent),navigator.platform.toUpperCase().indexOf("MAC");function a(t,e,i){let n;const r=(...r)=>{const o=i&&void 0===n;void 0!==n&&clearTimeout(n),n=setTimeout((()=>{n=void 0,i||t(...r)}),e),o&&t(...r)};return r.cancel=()=>{clearTimeout(n),n=void 0},r}function l(t=null){const e=new Promise((t=>{l.queue.push(t)}));return null!==t&&l.queue.push(t),l.waiting||(l.waiting=!0,requestAnimationFrame((()=>{l.waiting=!1;const t=l.queue;l.queue=[],t.forEach((t=>t()))}))),e}function c(t,e,i=null){return t=t.replace("maps4news.com","mapcreator.io"),e&&(t=(t=t.replace(/vapi\.(mc-cdn|mapcreator)/,"vapi.bleeding.$1")).replace("://cdn.mapcreator.io/live-data-layers/live/","://cdn.mapcreator.io/live-data-layers/bleeding/")),i&&/vapi\..*(mc-cdn|mapcreator)\.io/.test(t)&&(t=`${t}?access_token=${i}`),t}function u(...t){let e=10;if("number"==typeof t[t.length-1]&&(e=t.pop()),t.length<2||e<=0)return t[0];let i=t.shift();"object"!=typeof i&&(i={});for(const n of t)for(const t of Object.keys(n))if("object"==typeof n[t]&&null!==n[t]){"object"!=typeof i[t]&&(i[t]={});let r=Array.isArray(n[t])||Array.isArray(i[t]);if(u(i[t],n[t],e-1),r&=Object.keys(i[t]).every((t=>!Number.isNaN(Number(t)))),r){const e=i[t],n=Object.keys(e).length;i[t]=[];for(let r=0;r<n;r++)i[t].push(e[r])}}else i[t]=n[t];return i}function h(t,e=!0){const i=t=>h(t,e);if("object"!=typeof t||null===t)return t;if(Array.isArray(t))return t.map(i);const n={};for(const r of Object.keys(t))!e&&r.startsWith("_")||(n[r]=i(t[r]));return n}function d(t){let e=1;if("rgba"===t.substring(4,-1)){const i=t.substring(5).split(",").map((t=>t.trim()));t=`rgb(${i[0]}, ${i[1]}, ${i[2]})`,e=Number.parseFloat(i[3])}return{color:t,opacity:e}}function p(t,e){const i=Math.PI/180,n=t.lat*i,r=e.lat*i,o=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-t.lng)*i);return 6371e3*Math.acos(Math.min(o,1))}function f(t,e=1e-6){const i=Math.floor(t);if((t-=i)<e)return[i,1];if(1-e<t)return[i+1,1];let n=0,r=1,o=1,s=1;for(;;){const a=n+o,l=r+s;if(l*(t+e)<a)o=a,s=l;else{if(!(a<(t-e)*l))return[i*l+a,l];n=a,r=l}}}l.queue=[]},1527:function(t){t.exports=function(){"use strict";var t,e,i;function n(n,r){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",s={};t(s),i=r(s),"undefined"!=typeof window&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=r;else t=r}return n(["exports"],(function(t){var e=i;function i(t,e,i,n){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*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}function n(t,i,n,r){const o=new e(t,i,n,r);return function(t){return o.solve(t)}}i.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,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var s=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};const r=n(.25,.1,.25,1);function o(t,e,i){return Math.min(i,Math.max(e,t))}function s(t,e,i){const n=i-e,r=((t-e)%n+n)%n+e;return r===e?i:r}function a(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}let l=1;function c(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function u(t,e,i){const n={};for(const r in t)n[r]=e.call(i||this,t[r],r,t);return n}function h(t,e,i){const n={};for(const r in t)e.call(i||this,t[r],r,t)&&(n[r]=t[r]);return n}function d(t){return Array.isArray(t)?t.map(d):"object"==typeof t&&t?u(t,d):t}const p={};function f(t){p[t]||("undefined"!=typeof console&&console.warn(t),p[t]=!0)}function m(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function g(t){let e=0;for(let i,n,r=0,o=t.length,s=o-1;r<o;s=r++)i=t[r],n=t[s],e+=(n.x-i.x)*(i.y+n.y);return e}function y(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function _(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,i,n,r)=>{const o=n||r;return e[i]=!o||o.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let v,x,b=null;function w(t){if(null==b){const e=t.navigator?t.navigator.userAgent:null;b=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return b}function S(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const E={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const i=window.document.createElement("canvas"),n=i.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return i.width=t.width,i.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:t=>(v||(v=document.createElement("a")),v.href=t,v.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==x&&(x=matchMedia("(prefers-reduced-motion: reduce)")),x.matches)},dynamicScale:1,detailLevel:0};var k=T;function T(t,e){this.x=t,this.y=e}T.prototype={clone:function(){return new T(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),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),r=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(t){return t instanceof T?t:Array.isArray(t)?new T(t[0],t[1]):t};const A={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},I="mapbox-tiles";let M,C,z=500,P=50;function L(){"undefined"==typeof caches||M||(M=caches.open(I))}let D=1/0;const R={supported:!1,testSupport:function(t){!B&&F&&(j?$(t):O=t)}};let O,F,B=!1,j=!1;function $(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,F),t.isContextLost())return;R.supported=!0}catch(t){}t.deleteTexture(e),B=!0}"undefined"!=typeof document&&(F=document.createElement("img"),F.onload=function(){O&&$(O),O=null,j=!0},F.onerror=function(){B=!0,O=null},F.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const N={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(N);class U extends Error{constructor(t,e,i,n){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=n}}const V=y()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function q(t,e){const i=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:V(),signal:i.signal});let r=!1,o=!1;return"json"===t.type&&n.headers.set("Accept","application/json"),((i,s,a)=>{if(o)return;const l=Date.now();fetch(n).then((i=>i.ok?((i,s,a)=>{("arrayBuffer"===t.type?i.arrayBuffer():"json"===t.type?i.json():i.text()).then((t=>{o||(s&&a&&function(t,e,i){if(L(),!M)return;const n={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>n.headers.set(e,t)));const r=_(e.headers.get("Cache-Control")||"");r["no-store"]||(r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-i<42e4||function(t,e){if(void 0===C)try{new Response(new ReadableStream),C=!0}catch(t){C=!1}C?e(t.body):t.blob().then(e)}(e,(e=>{const i=new Response(e,n);L(),M&&M.then((e=>e.put(function(t){const e=t.indexOf("?");return e<0?t:t.slice(0,e)}(t.url),i))).catch((t=>f(t.message)))})))}(n,s,a),r=!0,e(null,t,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((t=>{o||e(new Error(t.message))}))})(i,null,l):i.blob().then((n=>e(new U(i.status,i.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message))}))})(),{cancel:()=>{o=!0,r||i.abort()}}}const Z=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(y()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!y()){const i=t.url.substring(0,t.url.indexOf("://"));return(A.REGISTERED_PROTOCOLS[i]||q)(t,e)}}if(!(/^file:/.test(i=t.url)||/^file:/.test(V())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return q(t,e);if(y()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(t,e){const i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(i.responseType="arraybuffer");for(const e in t.headers)i.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===t.credentials,i.onerror=()=>{e(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let n=i.response;if("json"===t.type)try{n=JSON.parse(i.response)}catch(t){return e(t)}e(null,n,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else{const n=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});e(new U(i.status,i.statusText,t.url,n))}},i.send(t.body),{cancel:()=>i.abort()}}(t,e)},G=function(t,e){return Z(a(t,{type:"arrayBuffer"}),e)};function H(t){const e=window.document.createElement("a");return e.href=t,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const W="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let X,J;X=[],J=0;const K=function(t,e){if(R.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),J>=A.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return X.push(i),i}J++;let i=!1;const n=()=>{if(!i)for(i=!0,J--;X.length&&J<A.MAX_PARALLEL_IMAGE_REQUESTS;){const t=X.shift(),{requestParameters:e,callback:i,cancelled:n}=t;n||(t.cancel=K(e,i).cancel)}},r=G(t,((t,i,r,o)=>{n(),t?e(t):i&&function(t,e){"function"==typeof createImageBitmap?function(t,e){const i=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(i).then((t=>{e(null,t)})).catch((t=>{e(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):function(t,e){const i=new Image;i.onload=()=>{e(null,i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame((()=>{i.src=W}))},i.onerror=()=>e(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 n=new Blob([new Uint8Array(t)],{type:"image/png"});i.src=t.byteLength?URL.createObjectURL(n):W}(t,e)}(i,((t,i)=>{null!=t?e(t):null!=i&&e(null,i,{cacheControl:r,expires:o})}))}));return{cancel:()=>{r.cancel(),n()}}};function Y(t,e,i){i[t]&&-1!==i[t].indexOf(e)||(i[t]=i[t]||[],i[t].push(e))}function Q(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);-1!==n&&i[t].splice(n,1)}}class tt{constructor(t,e={}){a(this,e),this.type=t}}class et extends tt{constructor(t,e={}){super("error",a({error:t},e))}}class it{on(t,e){return this._listeners=this._listeners||{},Y(t,e,this._listeners),this}off(t,e){return Q(t,e,this._listeners),Q(t,e,this._oneTimeListeners),this}once(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},Y(t,e,this._oneTimeListeners),this}fire(t,e){"string"==typeof t&&(t=new tt(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 n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const e of n)Q(i,e,this._oneTimeListeners),e.call(this,t);const r=this._eventedParent;r&&(a(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(t))}else t instanceof et&&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 nt={$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"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{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"},"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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},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":{},within:{}}},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}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},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"},"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"}}};class rt{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}function ot(t){const e=t.value;return e?[new rt(t.key,e,"constants have been deprecated as of v8")]:[]}function st(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}function at(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function lt(t){if(Array.isArray(t))return t.map(lt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=lt(t[i]);return e}return at(t)}class ct extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class ut{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new ut(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 ht={kind:"null"},dt={kind:"number"},pt={kind:"string"},ft={kind:"boolean"},mt={kind:"color"},gt={kind:"object"},yt={kind:"value"},_t={kind:"collator"},vt={kind:"formatted"},xt={kind:"padding"},bt={kind:"resolvedImage"};function wt(t,e){return{kind:"array",itemType:t,N:e}}function St(t){if("array"===t.kind){const e=St(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Et=[ht,dt,pt,ft,mt,vt,gt,wt(yt),xt,bt];function kt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!kt(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 Et)if(!kt(t,e))return null}return`Expected ${St(t)} but found ${St(e)} instead.`}function Tt(t,e){return e.some((e=>e.kind===t.kind))}function At(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))}var It,Mt={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ct(t){return(t=Math.round(t))<0?0:t>255?255:t}function zt(t){return Ct("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Pt(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function Lt(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{It={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Mt)return Mt[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),s=i.substr(n+1,r-(n+1)).split(","),a=1;switch(o){case"rgba":if(4!==s.length)return null;a=Pt(s.pop());case"rgb":return 3!==s.length?null:[zt(s[0]),zt(s[1]),zt(s[2]),a];case"hsla":if(4!==s.length)return null;a=Pt(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,c=Pt(s[1]),u=Pt(s[2]),h=u<=.5?u*(c+1):u+c-u*c,d=2*u-h;return[Ct(255*Lt(d,h,l+1/3)),Ct(255*Lt(d,h,l)),Ct(255*Lt(d,h,l-1/3)),a];default:return null}}return null}}catch(t){}class Dt{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof Dt)return t;if("string"!=typeof t)return;const e=It(t);return e?new Dt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}}Dt.black=new Dt(0,0,0,1),Dt.white=new Dt(1,1,1,1),Dt.transparent=new Dt(0,0,0,0),Dt.red=new Dt(1,0,0,1);class Rt{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 Ot{constructor(t,e,i,n,r){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Ft{constructor(t){this.sections=t}static fromString(t){return new Ft([new Ot(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 Ft?t:Ft.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Bt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Bt)return t;if("number"==typeof t)return new Bt([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 Bt(t)}}toString(){return JSON.stringify(this.values)}}class jt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new jt({name:t,available:!1}):null}}function $t(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Nt(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof Dt)return!0;if(t instanceof Rt)return!0;if(t instanceof Ft)return!0;if(t instanceof Bt)return!0;if(t instanceof jt)return!0;if(Array.isArray(t)){for(const e of t)if(!Nt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Nt(t[e]))return!1;return!0}return!1}function Ut(t){if(null===t)return ht;if("string"==typeof t)return pt;if("boolean"==typeof t)return ft;if("number"==typeof t)return dt;if(t instanceof Dt)return mt;if(t instanceof Rt)return _t;if(t instanceof Ft)return vt;if(t instanceof Bt)return xt;if(t instanceof jt)return bt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Ut(e);if(i){if(i===t)continue;i=yt;break}i=t}return wt(i||yt,e)}return gt}function Vt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Dt||t instanceof Ft||t instanceof Bt||t instanceof jt?t.toString():JSON.stringify(t)}class qt{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(!Nt(t[1]))return e.error("invalid value");const i=t[1];let n=Ut(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new qt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Zt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Gt={string:pt,number:dt,boolean:ft,object:gt};class Ht{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,n=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Gt)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Gt[i],n++}else r=yt;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);o=t[2],n++}i=wt(r,o)}else{if(!Gt[r])throw new Error(`Types doesn't contain name = ${r}`);i=Gt[r]}const o=[];for(;n<t.length;n++){const i=e.parse(t[n],n,yt);if(!i)return null;o.push(i)}return new Ht(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!kt(this.type,Ut(i)))return i;if(e===this.args.length-1)throw new Zt(`Expected value to be of type ${St(this.type)}, but found ${St(Ut(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Wt={"to-boolean":ft,"to-color":mt,"to-number":dt,"to-string":pt};class Xt{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(!Wt[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 n=Wt[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,yt);if(!n)return null;r.push(n)}return new Xt(n,r)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof Dt)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.`:$t(e[0],e[1],e[2],e[3]),!i))return new Dt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Zt(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("padding"===this.type.kind){let e;for(const i of this.args){e=i.evaluate(t);const n=Bt.parse(e);if(n)return n}throw new Zt(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Zt(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Ft.fromString(Vt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?jt.fromString(Vt(this.args[0].evaluate(t))):Vt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Jt=["Unknown","Point","LineString","Polygon"];class Kt{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?Jt[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]=Dt.parse(t)),e}}class Yt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}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],n=Yt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,o]of s){a=new be(e.registry,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,o=a.parse(i,1+s.length,r);if(!o){l=!0;break}s.push(o)}if(!l)if(Array.isArray(n)&&n.length!==s.length)a.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=s[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new Yt(i,r,o,s)}}if(1===s.length)e.errors.push(...a.errors);else{const i=(s.length?s:o).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(St).join(", ")})`:`(${St(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(St(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){Yt.definitions=e;for(const i in e)t[i]=Yt}}class Qt{constructor(t,e,i){this.type=_t,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 n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ft);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ft);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,pt),!o)?null:new Qt(n,r,o)}evaluate(t){return new Rt(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}}const te=8192;function ee(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 ie(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ne(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,r=Math.pow(2,e.z);return[Math.round(i*r*te),Math.round(n*r*te)]}function re(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return n*s-o*r==0&&n*o<=0&&r*s<=0}function oe(t,e){let i=!1;for(let s=0,a=e.length;s<a;s++){const a=e[s];for(let e=0,s=a.length;e<s-1;e++){if(re(t,a[e],a[e+1]))return!1;(r=a[e])[1]>(n=t)[1]!=(o=a[e+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function se(t,e){for(let i=0;i<e.length;i++)if(oe(t,e[i]))return!0;return!1}function ae(t,e,i,n){const r=n[0]-i[0],o=n[1]-i[1],s=(t[0]-i[0])*o-r*(t[1]-i[1]),a=(e[0]-i[0])*o-r*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function le(t,e,i){for(const c of i)for(let i=0;i<c.length-1;++i)if(0!=(a=[(s=c[i+1])[0]-(o=c[i])[0],s[1]-o[1]])[0]*(l=[(r=e)[0]-(n=t)[0],r[1]-n[1]])[1]-a[1]*l[0]&&ae(n,r,o,s)&&ae(o,s,n,r))return!0;var n,r,o,s,a,l;return!1}function ce(t,e){for(let i=0;i<t.length;++i)if(!oe(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(le(t[i],t[i+1],e))return!1;return!0}function ue(t,e){for(let i=0;i<e.length;i++)if(ce(t,e[i]))return!0;return!1}function he(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=[];for(let n=0;n<t[r].length;n++){const s=ne(t[r][n],i);ee(e,s),o.push(s)}n.push(o)}return n}function de(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=he(t[r],e,i);n.push(o)}return n}function pe(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}ee(e,t)}function fe(t,e,i,n){const r=Math.pow(2,n.z)*te,o=[n.x*te,n.y*te],s=[];for(const n of t)for(const t of n){const n=[t.x+o[0],t.y+o[1]];pe(n,e,i,r),s.push(n)}return s}function me(t,e,i,n){const r=Math.pow(2,n.z)*te,o=[n.x*te,n.y*te],s=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];ee(e,i),t.push(i)}s.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of s)for(const n of t)pe(n,e,i,r)}var a;return s}class ge{constructor(t,e){this.type=ft,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(Nt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new ge(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ge(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new ge(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],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=he(e.coordinates,n,r),s=fe(t.geometry(),i,n,r);if(!ie(i,n))return!1;for(const t of s)if(!oe(t,o))return!1}if("MultiPolygon"===e.type){const o=de(e.coordinates,n,r),s=fe(t.geometry(),i,n,r);if(!ie(i,n))return!1;for(const t of s)if(!se(t,o))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],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=he(e.coordinates,n,r),s=me(t.geometry(),i,n,r);if(!ie(i,n))return!1;for(const t of s)if(!ce(t,o))return!1}if("MultiPolygon"===e.type){const o=de(e.coordinates,n,r),s=me(t.geometry(),i,n,r);if(!ie(i,n))return!1;for(const t of s)if(!ue(t,o))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function ye(t){if(t instanceof Yt){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 ge)return!1;let e=!0;return t.eachChild((t=>{e&&!ye(t)&&(e=!1)})),e}function _e(t){if(t instanceof Yt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!_e(t)&&(e=!1)})),e}function ve(t,e){if(t instanceof Yt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ve(t,e)&&(i=!1)})),i}class xe{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 xe(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 be{constructor(t,e=[],i,n=new ut,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new Ht(e,[t]):"coerce"===i?new Xt(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 n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==t.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof qt)&&"resolvedImage"!==n.type.kind&&we(n)){const e=new Kt;try{n=new qt(n.type,n.evaluate(e))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". 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 n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new be(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new ct(i,t))}checkSubtype(t,e){const i=kt(t,e);return i&&this.error(i),i}}function we(t){if(t instanceof xe)return we(t.boundExpression);if(t instanceof Yt&&"error"===t.name)return!1;if(t instanceof Qt)return!1;if(t instanceof ge)return!1;const e=t instanceof Xt||t instanceof Ht;let i=!0;return t.eachChild((t=>{i=e?i&&we(t):i&&t instanceof qt})),!!i&&ye(t)&&ve(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Se(t,e){const i=t.length-1;let n,r,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;o=a+1}else{if(!(n>e))throw new Zt("Input is not a number.");s=a-1}return 0}class Ee{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,dt);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],s=t[i+1],a=i,l=i+1;if("number"!=typeof o)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(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(s,l,r);if(!c)return null;r=r||c.type,n.push([o,c])}return new Ee(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Se(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function ke(t,e,i){return t*(1-i)+e*i}var Te=Object.freeze({__proto__:null,number:ke,color:function(t,e,i){return new Dt(ke(t.r,e.r,i),ke(t.g,e.g,i),ke(t.b,e.b,i),ke(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>ke(t,e[n],i)))},padding:function(t,e,i){const n=t.values,r=e.values;return new Bt([ke(n[0],r[0],i),ke(n[1],r[1],i),ke(n[2],r[2],i),ke(n[3],r[3],i)])}});const Ae=.95047,Ie=1.08883,Me=4/29,Ce=6/29,ze=3*Ce*Ce,Pe=Math.PI/180,Le=180/Math.PI;function De(t){return t>.008856451679035631?Math.pow(t,1/3):t/ze+Me}function Re(t){return t>Ce?t*t*t:ze*(t-Me)}function Oe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Be(t){const e=Fe(t.r),i=Fe(t.g),n=Fe(t.b),r=De((.4124564*e+.3575761*i+.1804375*n)/Ae),o=De((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-De((.0193339*e+.119192*i+.9503041*n)/Ie)),alpha:t.a}}function je(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Re(e),i=Ae*Re(i),n=Ie*Re(n),new Dt(Oe(3.2404542*i-1.5371385*e-.4985314*n),Oe(-.969266*i+1.8760108*e+.041556*n),Oe(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function $e(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Ne={forward:Be,reverse:je,interpolate:function(t,e,i){return{l:ke(t.l,e.l,i),a:ke(t.a,e.a,i),b:ke(t.b,e.b,i),alpha:ke(t.alpha,e.alpha,i)}}},Ue={forward:function(t){const{l:e,a:i,b:n}=Be(t),r=Math.atan2(n,i)*Le;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Pe,i=t.c;return je({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:$e(t.h,e.h,i),c:ke(t.c,e.c,i),l:ke(t.l,e.l,i),alpha:ke(t.alpha,e.alpha,i)}}};var Ve=Object.freeze({__proto__:null,lab:Ne,hcl:Ue});class qe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,i,n,r){let o=0;if("exponential"===t.name)o=Ze(i,t.base,n,r);else if("linear"===t.name)o=Ze(i,1,n,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;o=new e(s[0],s[1],s[2],s[3]).solve(Ze(i,1,n,r))}return o}static parse(t,e){let[i,n,r,...o]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.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);n={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(r=e.parse(r,2,dt),!r)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=mt:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],n=o[t+1],r=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 computed expressions) for the input values.',r);if(s.length&&s[s.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(n,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"padding"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new qe(a,i,n,r,s):e.error(`Type ${St(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const o=Se(e,n),s=qe.interpolationFactor(this.interpolation,n,e[o],e[o+1]),a=i[o].evaluate(t),l=i[o+1].evaluate(t);return"interpolate"===this.operator?Te[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?Ue.reverse(Ue.interpolate(Ue.forward(a),Ue.forward(l),s)):Ne.reverse(Ne.interpolate(Ne.forward(a),Ne.forward(l),s))}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,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}class Ge{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 n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const o=n&&r.some((t=>kt(n,t.type)));return new Ge(o?yt:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof jt&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class He{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 n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new He(i,n):null}outputDefined(){return this.result.outputDefined()}}class We{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,dt),n=e.parse(t[2],2,wt(e.expectedType||yt));return i&&n?new We(n.type.itemType,i,n):null}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Zt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Zt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Zt(`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 Xe{constructor(t,e){this.type=ft,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,yt),n=e.parse(t[2],2,yt);return i&&n?Tt(i.type,[ft,pt,dt,ht,yt])?new Xe(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!At(e,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Ut(e))} instead.`);if(!At(i,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${St(Ut(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Je{constructor(t,e,i){this.type=dt,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,yt),n=e.parse(t[2],2,yt);if(!i||!n)return null;if(!Tt(i.type,[ft,pt,dt,ht,yt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,dt);return r?new Je(i,n,r):null}return new Je(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!At(e,["boolean","string","number","null"]))throw new Zt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Ut(e))} instead.`);if(!At(i,["string","array"]))throw new Zt(`Expected second argument to be of type array or string, but found ${St(Ut(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Ke{constructor(t,e,i,n,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}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,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},o=[];for(let s=2;s<t.length-1;s+=2){let a=t[s];const l=t[s+1];Array.isArray(a)||(a=[a]);const c=e.concat(s);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,Ut(t)))return null}else i=Ut(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=o.length}const u=e.parse(l,s,n);if(!u)return null;n=n||u.type,o.push(u)}const s=e.parse(t[1],1,yt);if(!s)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==s.type.kind&&e.concat(1).checkSubtype(i,s.type)?null:new Ke(i,n,s,r,o,a):null}evaluate(t){const e=this.input.evaluate(t);return(Ut(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 Ye{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 n=[];for(let r=1;r<t.length-1;r+=2){const o=e.parse(t[r],r,ft);if(!o)return null;const s=e.parse(t[r+1],r+1,i);if(!s)return null;n.push([o,s]),i=i||s.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Ye(i,n,r)}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 Qe{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}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,yt),n=e.parse(t[2],2,dt);if(!i||!n)return null;if(!Tt(i.type,[wt(yt),pt,yt]))return e.error(`Expected first argument to be of type array or string, but found ${St(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,dt);return r?new Qe(i.type,i,n,r):null}return new Qe(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!At(e,["string","array"]))throw new Zt(`Expected first argument to be of type array or string, but found ${St(Ut(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ti(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 ei(t,e,i,n){return 0===n.compare(e,i)}function ii(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=ft,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 o=e.parse(t[1],1,yt);if(!o)return null;if(!ti(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${St(o.type)}'.`);let s=e.parse(t[2],2,yt);if(!s)return null;if(!ti(i,s.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${St(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${St(o.type)}' and '${St(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Ht(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Ht(o.type,[s])));let a=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,_t),!a)return null}return new r(o,s,a)}evaluate(r){const o=this.lhs.evaluate(r),s=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Ut(o),i=Ut(s);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Zt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Ut(o),i=Ut(s);if("string"!==t.kind||"string"!==i.kind)return e(r,o,s)}return this.collator?i(r,o,s,this.collator.evaluate(r)):e(r,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const ni=ii("==",(function(t,e,i){return e===i}),ei),ri=ii("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!ei(0,e,i,n)})),oi=ii("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),si=ii(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),ai=ii("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),li=ii(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class ci{constructor(t,e,i,n,r){this.type=pt,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,dt);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,pt),!r))return null;let o=null;if(n.currency&&(o=e.parse(n.currency,1,pt),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=e.parse(n["min-fraction-digits"],1,dt),!s))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,dt),!a)?null:new ci(i,r,o,s,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 ui{constructor(t){this.type=vt,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 n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,dt),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,wt(pt)),!i))return null;let s=null;if(o["text-color"]&&(s=e.parse(o["text-color"],1,mt),!s))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=s}else{const o=e.parse(t[i],1,yt);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new ui(n)}evaluate(t){return new Ft(this.sections.map((e=>{const i=e.content.evaluate(t);return Ut(i)===bt?new Ot("",i,null,null,null):new Ot(Vt(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 hi{constructor(t){this.type=bt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,pt);return i?new hi(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=jt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class di{constructor(t){this.type=dt,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 ${St(i.type)} instead.`):new di(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 Zt(`Expected value to be of type string or array, but found ${St(Ut(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const pi={"==":ni,"!=":ri,">":si,"<":oi,">=":li,"<=":ai,array:Ht,at:We,boolean:Ht,case:Ye,coalesce:Ge,collator:Qt,format:ui,image:hi,in:Xe,"index-of":Je,interpolate:qe,"interpolate-hcl":qe,"interpolate-lab":qe,length:di,let:He,literal:qt,match:Ke,number:Ht,"number-format":ci,object:Ht,slice:Qe,step:Ee,string:Ht,"to-boolean":Xt,"to-color":Xt,"to-number":Xt,"to-string":Xt,var:xe,within:ge};function fi(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const o=r?r.evaluate(t):1,s=$t(e,i,n,o);if(s)throw new Zt(s);return new Dt(e/255*o,i/255*o,n/255*o,o)}function mi(t,e){return t in e}function gi(t,e){const i=e[t];return void 0===i?null:i}function yi(t){return{type:t}}function _i(t){return{result:"success",value:t}}function vi(t){return{result:"error",value:t}}function xi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function bi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function wi(t){return!!t.expression&&t.expression.interpolated}function Si(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Ei(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function ki(t){return t}function Ti(t,e){const i="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],r=n||!(n||void 0!==t.property),o=t.type||(wi(e)?"exponential":"interval");if(i||"padding"===e.type){const n=i?Dt.parse:Bt.parse;(t=st({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default)}if(t.colorSpace&&"rgb"!==t.colorSpace&&!Ve[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let s,a,l;if("exponential"===o)s=Ci;else if("interval"===o)s=Mi;else if("categorical"===o){s=Ii,a=Object.create(null);for(const e of t.stops)a[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=zi}if(n){const i={},n=[];for(let e=0;e<t.stops.length;e++){const r=t.stops[e],o=r[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},n.push(o)),i[o].stops.push([r[0].value,r[1]])}const r=[];for(const t of n)r.push([i[t].zoom,Ti(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:qe.interpolationFactor.bind(void 0,o),zoomStops:r.map((t=>t[0])),evaluate:({zoom:i},n)=>Ci({stops:r,base:t.base},e,i).evaluate(i,n)}}if(r){const i="exponential"===o?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:qe.interpolationFactor.bind(void 0,i),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:i})=>s(t,e,i,a,l)}}return{kind:"source",evaluate(i,n){const r=n&&n.properties?n.properties[t.property]:void 0;return void 0===r?Ai(t.default,e.default):s(t,e,r,a,l)}}}function Ai(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function Ii(t,e,i,n,r){return Ai(typeof i===r?n[i]:void 0,t.default,e.default)}function Mi(t,e,i){if("number"!==Si(i))return Ai(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const r=Se(t.stops.map((t=>t[0])),i);return t.stops[r][1]}function Ci(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==Si(i))return Ai(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 o=Se(t.stops.map((t=>t[0])),i),s=function(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(i,n,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],l=t.stops[o+1][1];let c=Te[e.type]||ki;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Ve[t.colorSpace];c=(t,i)=>e.reverse(e.interpolate(e.forward(t),e.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...t){const e=a.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==i)return c(e,i,s)}}:c(a,l,s)}function zi(t,e,i){switch(e.type){case"color":i=Dt.parse(i);break;case"formatted":i=Ft.fromString(i.toString());break;case"resolvedImage":i=jt.fromString(i.toString());break;case"padding":i=Bt.parse(i);break;default:Si(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return Ai(i,t.default,e.default)}Yt.register(pi,{error:[{kind:"error"},[pt],(t,[e])=>{throw new Zt(e.evaluate(t))}],typeof:[pt,[yt],(t,[e])=>St(Ut(e.evaluate(t)))],"to-rgba":[wt(dt,4),[mt],(t,[e])=>e.evaluate(t).toArray()],rgb:[mt,[dt,dt,dt],fi],rgba:[mt,[dt,dt,dt,dt],fi],has:{type:ft,overloads:[[[pt],(t,[e])=>mi(e.evaluate(t),t.properties())],[[pt,gt],(t,[e,i])=>mi(e.evaluate(t),i.evaluate(t))]]},get:{type:yt,overloads:[[[pt],(t,[e])=>gi(e.evaluate(t),t.properties())],[[pt,gt],(t,[e,i])=>gi(e.evaluate(t),i.evaluate(t))]]},"feature-state":[yt,[pt],(t,[e])=>gi(e.evaluate(t),t.featureState||{})],properties:[gt,[],t=>t.properties()],"geometry-type":[pt,[],t=>t.geometryType()],id:[yt,[],t=>t.id()],zoom:[dt,[],t=>t.globals.zoom],"heatmap-density":[dt,[],t=>t.globals.heatmapDensity||0],"line-progress":[dt,[],t=>t.globals.lineProgress||0],accumulated:[yt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[dt,yi(dt),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[dt,yi(dt),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:dt,overloads:[[[dt,dt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[dt],(t,[e])=>-e.evaluate(t)]]},"/":[dt,[dt,dt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[dt,[dt,dt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[dt,[],()=>Math.LN2],pi:[dt,[],()=>Math.PI],e:[dt,[],()=>Math.E],"^":[dt,[dt,dt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[dt,[dt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[dt,[dt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[dt,[dt],(t,[e])=>Math.log(e.evaluate(t))],log2:[dt,[dt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[dt,[dt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[dt,[dt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[dt,[dt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[dt,[dt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[dt,[dt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[dt,[dt],(t,[e])=>Math.atan(e.evaluate(t))],min:[dt,yi(dt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[dt,yi(dt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[dt,[dt],(t,[e])=>Math.abs(e.evaluate(t))],round:[dt,[dt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[dt,[dt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[dt,[dt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ft,[pt,yt],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ft,[yt],(t,[e])=>t.id()===e.value],"filter-type-==":[ft,[pt],(t,[e])=>t.geometryType()===e.value],"filter-<":[ft,[pt,yt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[ft,[yt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[ft,[pt,yt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[ft,[yt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[ft,[pt,yt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[ft,[yt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[ft,[pt,yt],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[ft,[yt],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[ft,[yt],(t,[e])=>e.value in t.properties()],"filter-has-id":[ft,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ft,[wt(pt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ft,[wt(yt)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ft,[pt,wt(yt)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ft,[pt,wt(yt)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ft,overloads:[[[ft,ft],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[yi(ft),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ft,overloads:[[[ft,ft],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[yi(ft),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ft,[ft],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ft,[pt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[pt,[pt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[pt,[pt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[pt,yi(yt),(t,e)=>e.map((e=>Vt(e.evaluate(t)))).join("")],"resolved-locale":[pt,[_t],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Pi{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=e?function(t){return"color"===t.type&&Ei(t.default)?new Dt(0,0,0,0):"color"===t.type?Dt.parse(t.default)||null:"padding"===t.type?Bt.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||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 Zt(`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 Li(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in pi}function Di(t,e){const i=new be(pi,[],e?function(t){const e={color:mt,string:pt,number:dt,enum:pt,boolean:ft,formatted:vt,padding:xt,resolvedImage:bt};return"array"===t.type?wt(e[t.value]||yt,t.length):e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?_i(new Pi(n,e)):vi(i.errors)}class Ri{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!_e(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}}class Oi{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!_e(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}interpolationFactor(t,e,i){return this.interpolationType?qe.interpolationFactor(this.interpolationType,t,e,i):0}}function Fi(t,e){const i=Di(t,e);if("error"===i.result)return i;const n=i.value.expression,r=ye(n);if(!r&&!xi(e))return vi([new ct("","data expressions not supported")]);const o=ve(n,["zoom"]);if(!o&&!bi(e))return vi([new ct("","zoom expressions not supported")]);const s=ji(n);return s||o?s instanceof ct?vi([s]):s instanceof qe&&!wi(e)?vi([new ct("",'"interpolate" expressions cannot be used with this property')]):_i(s?new Oi(r?"camera":"composite",i.value,s.labels,s instanceof qe?s.interpolation:void 0):new Ri(r?"constant":"source",i.value)):vi([new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Bi{constructor(t,e){this._parameters=t,this._specification=e,st(this,Ti(this._parameters,this._specification))}static deserialize(t){return new Bi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function ji(t){let e=null;if(t instanceof He)e=ji(t.result);else if(t instanceof Ge){for(const i of t.args)if(e=ji(i),e)break}else(t instanceof Ee||t instanceof qe)&&t.input instanceof Yt&&"zoom"===t.input.name&&(e=t);return e instanceof ct||t.eachChild((t=>{const i=ji(t);i instanceof ct?e=i:!e&&i?e=new ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function $i(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,s=t.styleSpec;let a=[];const l=Si(i);if("object"!==l)return[new rt(e,i,`object expected, ${l} found`)];for(const t in i){const l=t.split(".")[0],c=n[l]||n["*"];let u;if(r[l])u=r[l];else if(n[l])u=mn;else if(r["*"])u=r["*"];else{if(!n["*"]){a.push(new rt(e,i[t],`unknown property "${t}"`));continue}u=mn}a=a.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:c,style:o,styleSpec:s,object:i,objectKey:t},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&a.push(new rt(e,i,`missing required property "${t}"`));return a}function Ni(t){const e=t.value,i=t.valueSpec,n=t.style,r=t.styleSpec,o=t.key,s=t.arrayElementValidator||mn;if("array"!==Si(e))return[new rt(o,e,`array expected, ${Si(e)} found`)];if(i.length&&e.length!==i.length)return[new rt(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new rt(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};r.$version<7&&(a.function=i.function),"object"===Si(i.value)&&(a=i.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(s({array:e,arrayIndex:t,value:e[t],valueSpec:a,style:n,styleSpec:r,key:`${o}[${t}]`}));return l}function Ui(t){const e=t.key,i=t.value,n=t.valueSpec;let r=Si(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new rt(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new rt(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new rt(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Vi(t){const e=t.valueSpec,i=at(t.value.type);let n,r,o,s={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===Si(t.value.stops)&&"array"===Si(t.value.stops[0])&&"object"===Si(t.value.stops[0][0]),u=$i({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new rt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Ni({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Si(n)&&0===n.length&&e.push(new rt(t.key,n,"array must have at least one stop")),e},default:function(t){return mn({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&a&&u.push(new rt(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new rt(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!wi(t.valueSpec)&&u.push(new rt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!xi(t.valueSpec)?u.push(new rt(t.key,t.value,"property functions not supported")):a&&!bi(t.valueSpec)&&u.push(new rt(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||u.push(new rt(t.key,t.value,'"property" property is required')),u;function h(t){let i=[];const n=t.value,a=t.key;if("array"!==Si(n))return[new rt(a,n,`array expected, ${Si(n)} found`)];if(2!==n.length)return[new rt(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==Si(n[0]))return[new rt(a,n,`object expected, ${Si(n[0])} found`)];if(void 0===n[0].zoom)return[new rt(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new rt(a,n,"object stop key must have value")];if(o&&o>at(n[0].zoom))return[new rt(a,n[0].zoom,"stop zoom values must appear in ascending order")];at(n[0].zoom)!==o&&(o=at(n[0].zoom),r=void 0,s={}),i=i.concat($i({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ui,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Li(lt(n[1]))?i.concat([new rt(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(mn({key:`${a}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function d(t,o){const a=Si(t.value),l=at(t.value),c=null!==t.value?t.value:o;if(n){if(a!==n)return[new rt(t.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new rt(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return xi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new rt(t.key,c,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new rt(t.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in s?[new rt(t.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new rt(t.key,c,`integer expected, found ${l}`)]}}function qi(t){const e=("property"===t.expressionContext?Fi:Di)(lt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new rt(`${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 rt(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&&!_e(i))return[new rt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!_e(i))return[new rt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!ve(i,["zoom","feature-state"]))return[new rt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ye(i))return[new rt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Zi(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(at(i))&&r.push(new rt(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(at(i))&&r.push(new rt(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function Gi(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(!Gi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Hi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Wi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Gi(t)||(t=Ki(t));const e=Di(t,Hi);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:Ji(t)}}function Xi(t,e){return t<e?-1:t>e?1:0}function Ji(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(Ji(t[e]))return!0;return!1}function Ki(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?Yi(t[1],t[2],"=="):"!="===e?en(Yi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?Yi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map(Ki))):"all"===e?["all"].concat(t.slice(1).map(Ki)):"none"===e?["all"].concat(t.slice(1).map(Ki).map(en)):"in"===e?Qi(t[1],t.slice(2)):"!in"===e?en(Qi(t[1],t.slice(2))):"has"===e?tn(t[1]):"!has"===e?en(tn(t[1])):"within"!==e||t;var i}function Yi(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 Qi(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(Xi)]]:["filter-in-small",t,["literal",e]]}}function tn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function en(t){return["!",t]}function nn(t){return Gi(lt(t.value))?qi(st({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):rn(t)}function rn(t){const e=t.value,i=t.key;if("array"!==Si(e))return[new rt(i,e,`array expected, ${Si(e)} found`)];const n=t.styleSpec;let r,o=[];if(e.length<1)return[new rt(i,e,"filter array must have at least 1 element")];switch(o=o.concat(Zi({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),at(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===at(e[1])&&o.push(new rt(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new rt(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=Si(e[1]),"string"!==r&&o.push(new rt(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let s=2;s<e.length;s++)r=Si(e[s]),"$type"===at(e[1])?o=o.concat(Zi({key:`${i}[${s}]`,value:e[s],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&o.push(new rt(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)o=o.concat(rn({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=Si(e[1]),2!==e.length?o.push(new rt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&o.push(new rt(`${i}[1]`,e[1],`string expected, ${r} found`));break;case"within":r=Si(e[1]),2!==e.length?o.push(new rt(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==r&&o.push(new rt(`${i}[1]`,e[1],`object expected, ${r} found`))}return o}function on(t,e){const i=t.key,n=t.style,r=t.styleSpec,o=t.value,s=t.objectKey,a=r[`${e}_${t.layerType}`];if(!a)return[];const l=s.match(/^(.*)-transition$/);if("paint"===e&&l&&a[l[1]]&&a[l[1]].transition)return mn({key:i,value:o,valueSpec:r.transition,style:n,styleSpec:r});const c=t.valueSpec||a[s];if(!c)return[new rt(i,o,`unknown property "${s}"`)];let u;if("string"===Si(o)&&xi(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new rt(i,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&h.push(new rt(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Ei(lt(o))&&"identity"===at(o.type)&&h.push(new rt(i,o,'"text-font" does not support identity functions'))),h.concat(mn({key:t.key,value:o,valueSpec:c,style:n,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:s}))}function sn(t){return on(t,"paint")}function an(t){return on(t,"layout")}function ln(t){let e=[];const i=t.value,n=t.key,r=t.style,o=t.styleSpec;i.type||i.ref||e.push(new rt(n,i,'either "type" or "ref" is required'));let s=at(i.type);const a=at(i.ref);if(i.id){const o=at(i.id);for(let s=0;s<t.arrayIndex;s++){const t=r.layers[s];at(t.id)===o&&e.push(new rt(n,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 rt(n,i[t],`"${t}" is prohibited for ref layers`))})),r.layers.forEach((e=>{at(e.id)===a&&(t=e)})),t?t.ref?e.push(new rt(n,i.ref,"ref cannot reference another ref layer")):s=at(t.type):e.push(new rt(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const t=r.sources&&r.sources[i.source],o=t&&at(t.type);t?"vector"===o&&"raster"===s?e.push(new rt(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==s?e.push(new rt(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?e.push(new rt(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new rt(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new rt(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new rt(n,i.source,`source "${i.source}" not found`))}else e.push(new rt(n,i,'missing required property "source"'));return e=e.concat($i({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>mn({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"}),filter:nn,layout:t=>$i({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>an(st({layerType:s},t))}}),paint:t=>$i({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>sn(st({layerType:s},t))}})}})),e}function cn(t){const e=t.value,i=t.key,n=Si(e);return"string"!==n?[new rt(i,e,`string expected, ${n} found`)]:[]}const un={promoteId:function({key:t,value:e}){if("string"===Si(e))return cn({key:t,value:e});{const i=[];for(const n in e)i.push(...cn({key:`${t}.${n}`,value:e[n]}));return i}}};function hn(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style;if(!e.type)return[new rt(i,e,'"type" is required')];const o=at(e.type);let s;switch(o){case"vector":case"raster":case"raster-dem":return s=$i({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:un}),s;case"geojson":if(s=$i({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:un}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;s.push(...qi({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),s.push(...qi({key:`${i}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return $i({key:i,value:e,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return $i({key:i,value:e,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new rt(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Zi({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:n})}}function dn(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let o=[];const s=Si(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new rt("light",e,`object expected, ${s} found`)]),o;for(const t in e){const s=t.match(/^(.*)-transition$/);o=o.concat(s&&n[s[1]]&&n[s[1]].transition?mn({key:t,value:e[t],valueSpec:i.transition,style:r,styleSpec:i}):n[t]?mn({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i}):[new rt(t,e[t],`unknown property "${t}"`)])}return o}function pn(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let o=[];const s=Si(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new rt("terrain",e,`object expected, ${s} found`)]),o;for(const t in e)o=o.concat(n[t]?mn({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i}):[new rt(t,e[t],`unknown property "${t}"`)]);return o}const fn={"*":()=>[],array:Ni,boolean:function(t){const e=t.value,i=t.key,n=Si(e);return"boolean"!==n?[new rt(i,e,`boolean expected, ${n} found`)]:[]},number:Ui,color:function(t){const e=t.key,i=t.value,n=Si(i);return"string"!==n?[new rt(e,i,`color expected, ${n} found`)]:null===It(i)?[new rt(e,i,`color expected, "${i}" found`)]:[]},constants:ot,enum:Zi,filter:nn,function:Vi,layer:ln,object:$i,source:hn,light:dn,terrain:pn,string:cn,formatted:function(t){return 0===cn(t).length?[]:qi(t)},resolvedImage:function(t){return 0===cn(t).length?[]:qi(t)},padding:function(t){const e=t.key,i=t.value;if("array"===Si(i)){if(i.length<1||i.length>4)return[new rt(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const t={type:"number"};let n=[];for(let r=0;r<i.length;r++)n=n.concat(mn({key:`${e}[${r}]`,value:i[r],valueSpec:t}));return n}return Ui({key:e,value:i,valueSpec:{}})}};function mn(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return i.expression&&Ei(at(e))?Vi(t):i.expression&&Li(lt(e))?qi(t):i.type&&fn[i.type]?fn[i.type](t):$i(st({},t,{valueSpec:i.type?n[i.type]:i}))}function gn(t){const e=t.value,i=t.key,n=cn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new rt(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new rt(i,e,'"glyphs" url must include a "{range}" token'))),n}function yn(t,e=nt){let i=[];return i=i.concat(mn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:gn,"*":()=>[]}})),t.constants&&(i=i.concat(ot({key:"constants",value:t.constants,style:t,styleSpec:e}))),_n(i)}function _n(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function vn(t){return function(...e){return _n(t.apply(this,e))}}yn.source=vn(hn),yn.light=vn(dn),yn.terrain=vn(pn),yn.layer=vn(ln),yn.filter=vn(nn),yn.paintProperty=vn(sn),yn.layoutProperty=vn(an);const xn=yn,bn=xn.light,wn=xn.paintProperty,Sn=xn.layoutProperty;function En(t,e){let i=!1;if(e&&e.length)for(const n of e)t.fire(new et(new Error(n.message))),i=!0;return i}class kn{constructor(t,e,i){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const r=new Int32Array(this.arrayBuffer);t=r[0],this.d=(e=r[1])+2*(i=r[2]);for(let t=0;t<this.d*this.d;t++){const e=r[3+t],i=r[3+t+1];n.push(e===i?null:r.subarray(e,i))}const o=r[3+n.length+1];this.keys=r.subarray(r[3+n.length],o),this.bboxes=r.subarray(o),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;const r=i/e*t;this.min=-r,this.max=t+r}insert(t,e,i,n,r){this._forEachCell(e,i,n,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,n,r,o){this.cells[r].push(o)}query(t,e,i,n,r){const o=this.min,s=this.max;if(t<=o&&e<=o&&s<=i&&s<=n&&!r)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(t,e,i,n,this._queryCell,o,{},r),o}}_queryCell(t,e,i,n,r,o,s,a){const l=this.cells[r];if(null!==l){const r=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const h=l[u];if(void 0===s[h]){const l=4*h;(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]&&n>=c[l+1])?(s[h]=!0,o.push(r[h])):s[h]=!1}}}}_forEachCell(t,e,i,n,r,o,s,a){const l=this._convertToCellCoord(t),c=this._convertToCellCoord(e),u=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&r.call(this,t,e,i,n,c,o,s,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 n=new Int32Array(e+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let r=e;for(let e=0;e<t.length;e++){const i=t[e];n[3+e]=r,n.set(i,r),r+=i.length}return n[3+t.length]=r,n.set(this.keys,r),r+=this.keys.length,n[3+t.length+1]=r,n.set(this.bboxes,r),r+=this.bboxes.length,n.buffer}static serialize(t,e){const i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new kn(t.buffer)}}const Tn={};function An(t,e,i={}){if(Tn[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Tn[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}An("Object",Object),An("TransferableGridIndex",kn),An("Color",Dt),An("Error",Error),An("AJAXError",U),An("ResolvedImage",jt),An("StylePropertyFunction",Bi),An("StyleExpression",Pi,{omit:["_evaluator"]}),An("ZoomDependentExpression",Oi),An("ZoomConstantExpression",Ri),An("CompoundExpression",Yt,{omit:["_evaluate"]});for(const t in pi)pi[t]._classRegistryKey||An(`Expression_${t}`,pi[t]);function In(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Mn(t,e){if(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)return t;if(In(t))return e&&e.push(t),t;if(S(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.push(i.buffer),i}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(Mn(n,e));return i}if("object"==typeof t){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error("can't serialize object of unregistered class");if(!Tn[n])throw new Error(`${n} is not registered.`);const r=i.serialize?i.serialize(t,e):{};if(i.serialize){if(e&&r===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in t){if(!t.hasOwnProperty(i))continue;if(Tn[n].omit.indexOf(i)>=0)continue;const o=t[i];r[i]=Tn[n].shallow.indexOf(i)>=0?o:Mn(o,e)}t instanceof Error&&(r.message=t.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof t)}function Cn(t){if(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||In(t)||S(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Cn);if("object"==typeof t){const e=t.$name||"Object";if(!Tn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=Tn[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const i of Object.keys(t)){if("$name"===i)continue;const r=t[i];n[i]=Tn[e].shallow.indexOf(i)>=0?r:Cn(r)}return n}throw new Error("can't deserialize object of type "+typeof t)}class zn{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 Pn={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function Ln(t){for(const e of t)if(On(e.charCodeAt(0)))return!0;return!1}function Dn(t){for(const e of t)if(!Rn(e.charCodeAt(0)))return!1;return!0}function Rn(t){return!(Pn.Arabic(t)||Pn["Arabic Supplement"](t)||Pn["Arabic Extended-A"](t)||Pn["Arabic Presentation Forms-A"](t)||Pn["Arabic Presentation Forms-B"](t))}function On(t){return!(746!==t&&747!==t&&(t<4352||!(Pn["Bopomofo Extended"](t)||Pn.Bopomofo(t)||Pn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Pn["CJK Compatibility Ideographs"](t)||Pn["CJK Compatibility"](t)||Pn["CJK Radicals Supplement"](t)||Pn["CJK Strokes"](t)||!(!Pn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Pn["CJK Unified Ideographs Extension A"](t)||Pn["CJK Unified Ideographs"](t)||Pn["Enclosed CJK Letters and Months"](t)||Pn["Hangul Compatibility Jamo"](t)||Pn["Hangul Jamo Extended-A"](t)||Pn["Hangul Jamo Extended-B"](t)||Pn["Hangul Jamo"](t)||Pn["Hangul Syllables"](t)||Pn.Hiragana(t)||Pn["Ideographic Description Characters"](t)||Pn.Kanbun(t)||Pn["Kangxi Radicals"](t)||Pn["Katakana Phonetic Extensions"](t)||Pn.Katakana(t)&&12540!==t||!(!Pn["Halfwidth and Fullwidth Forms"](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)||!(!Pn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Pn["Unified Canadian Aboriginal Syllabics"](t)||Pn["Unified Canadian Aboriginal Syllabics Extended"](t)||Pn["Vertical Forms"](t)||Pn["Yijing Hexagram Symbols"](t)||Pn["Yi Syllables"](t)||Pn["Yi Radicals"](t))))}function Fn(t){return!(On(t)||function(t){return!!(Pn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Pn["General Punctuation"](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)||Pn["Letterlike Symbols"](t)||Pn["Number Forms"](t)||Pn["Miscellaneous Technical"](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)||Pn["Control Pictures"](t)&&9251!==t||Pn["Optical Character Recognition"](t)||Pn["Enclosed Alphanumerics"](t)||Pn["Geometric Shapes"](t)||Pn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Pn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Pn["CJK Symbols and Punctuation"](t)||Pn.Katakana(t)||Pn["Private Use Area"](t)||Pn["CJK Compatibility Forms"](t)||Pn["Small Form Variants"](t)||Pn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Bn(t){return t>=1424&&t<=2303||Pn["Arabic Presentation Forms-A"](t)||Pn["Arabic Presentation Forms-B"](t)}function jn(t,e){return!(!e&&Bn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Pn.Khmer(t))}function $n(t){for(const e of t)if(Bn(e.charCodeAt(0)))return!0;return!1}const Nn="deferred",Un="loading",Vn="loaded";let qn=null,Zn="unavailable",Gn=null;const Hn=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(Zn="error"),qn&&qn(t)};function Wn(){Xn.fire(new tt("pluginStateChange",{pluginStatus:Zn,pluginURL:Gn}))}const Xn=new it,Jn=function(){return Zn},Kn=function(){if(Zn!==Nn||!Gn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Zn=Un,Wn(),Gn&&G({url:Gn},(t=>{t?Hn(t):(Zn=Vn,Wn())}))},Yn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Zn===Vn||null!=Yn.applyArabicShaping,isLoading:()=>Zn===Un,setState(t){if(!y())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Zn=t.pluginStatus,Gn=t.pluginURL},isParsed(){if(!y())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Yn.applyArabicShaping&&null!=Yn.processBidirectionalText&&null!=Yn.processStyledBidirectionalText},getPluginURL(){if(!y())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gn}};class Qn{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 zn,this.transition={})}isSupportedScript(t){return function(t,e){for(const i of t)if(!jn(i.charCodeAt(0),e))return!1;return!0}(t,Yn.isLoaded())}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 tr{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Ei(t))return new Bi(t,e);if(Li(t)){const i=Fi(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=Dt.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(i=Bt.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 er{constructor(t){this.property=t,this.value=new tr(t,void 0)}transitioned(t,e){return new nr(this.property,this.value,e,a({},t.transition,this.transition),t.now)}untransitioned(){return new nr(this.property,this.value,null,{},0)}}class ir{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return d(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new er(this._values[t].property)),this._values[t].value=new tr(this._values[t].property,null===e?void 0:d(e))}getTransition(t){return d(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new er(this._values[t].property)),this._values[t].transition=d(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 n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const i=new rr(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(t,e._values[n]);return i}untransitioned(){const t=new rr(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class nr{constructor(t,e,i,n,r){this.property=t,this.value=e,this.begin=r+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){const n=t.now||0,r=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n<this.begin)return o.possiblyEvaluate(t,e,i);{const s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),r,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)}(s))}}return r}}class rr{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){const n=new ar(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(t,e,i);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class or{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return d(this._values[t].value)}setValue(t,e){this._values[t]=new tr(this._values[t].property,null===e?void 0:d(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 n=new ar(this._properties);for(const r of Object.keys(this._values)){const o="text-letter-spacing"===r?a({},t,{zoom:Math.floor(t.zoom)}):t;n._values[r]=this._values[r].possiblyEvaluate(o,e,i)}return n}}class sr{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,n){return this.property.evaluate(this.value,this.parameters,t,e,i,n)}}class ar{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class lr{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 n=Te[this.specification.type];return n?n(t,e,i):t}}class cr{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,n){return new sr(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},i,n)}: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 sr(this,{kind:"constant",value:void 0},t.parameters);const n=Te[this.specification.type];return n?new sr(this,{kind:"constant",value:n(t.value.value,e.value.value,i)},t.parameters):t}evaluate(t,e,i,n,r,o){return"constant"===t.kind?t.value:t.evaluate(e,i,n,r,o)}}class ur extends cr{possiblyEvaluate(t,e,i,n){if(void 0===t.value)return new sr(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof r?r.name:r,s=this._calculate(o,o,o,e);return new sr(this,{kind:"constant",value:s},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 sr(this,{kind:"constant",value:i},e)}return new sr(this,t.expression,e)}evaluate(t,e,i,n,r,o){if("source"===t.kind){const s=t.evaluate(e,i,n,r,o);return this._calculate(s,s,s,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,n),t.evaluate({zoom:Math.floor(e.zoom)},i,n),t.evaluate({zoom:Math.floor(e.zoom)+1},i,n),e):t.value}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class hr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){if(void 0!==t.value){if("constant"===t.expression.kind){const r=t.expression.evaluate(e,null,{},i,n);return this._calculate(r,r,r,e)}return this._calculate(t.expression.evaluate(new Qn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class dr{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,n){return!!t.expression.evaluate(e,null,{},i,n)}interpolate(){return!1}}class pr{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 n=this.defaultPropertyValues[e]=new tr(i,void 0),r=this.defaultTransitionablePropertyValues[e]=new er(i);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}}}An("DataDrivenProperty",cr),An("DataConstantProperty",lr),An("CrossFadedDataDrivenProperty",ur),An("CrossFadedProperty",hr),An("ColorRampProperty",dr);const fr="-transition";class mr extends it{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 or(e.layout)),e.paint)){this._transitionablePaint=new ir(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 ar(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(Sn,`layers.${this.id}.layout.${t}`,t,e,i)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)}getPaintProperty(t){return t.endsWith(fr)?this._transitionablePaint.getTransition(t.slice(0,-fr.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){if(null!=e&&this._validate(wn,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(fr))return this._transitionablePaint.setTransition(t.slice(0,-fr.length),e||void 0),!1;{const i=this._transitionablePaint._values[t],n="cross-faded-data-driven"===i.property.specification["property-type"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(t,o,s)}}_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),h(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,i,n,r={}){return(!r||!1!==r.validate)&&En(this,t.call(xn,{key:e,layerType:this.type,objectKey:i,value:n,styleSpec:nt,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 sr&&xi(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1}}const gr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class yr{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 _r{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 vr(t,e=1){let i=0,n=0;return{members:t.map((t=>{const r=gr[t.type].BYTES_PER_ELEMENT,o=i=xr(i,Math.max(e,r)),s=t.components||1;return n=Math.max(n,r),i+=r*s,{name:t.name,type:t.type,components:s,offset:o}})),size:xr(i,Math.max(n,e)),alignment:e}}function xr(t,e){return Math.ceil(t/e)*e}class br extends _r{_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 n=2*t;return this.int16[n+0]=e,this.int16[n+1]=i,t}}br.prototype.bytesPerElement=4,An("StructArrayLayout2i4",br);class wr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,t}}wr.prototype.bytesPerElement=8,An("StructArrayLayout4i8",wr);class Sr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=o,this.int16[a+5]=s,t}}Sr.prototype.bytesPerElement=12,An("StructArrayLayout2i4i12",Sr);class Er extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=r,this.uint8[l+6]=o,this.uint8[l+7]=s,t}}Er.prototype.bytesPerElement=8,An("StructArrayLayout2i4ub8",Er);class kr extends _r{_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 n=2*t;return this.float32[n+0]=e,this.float32[n+1]=i,t}}kr.prototype.bytesPerElement=8,An("StructArrayLayout2f8",kr);class Tr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,s,a,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,n,r,o,s,a,l,c)}emplace(t,e,i,n,r,o,s,a,l,c,u){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,t}}Tr.prototype.bytesPerElement=20,An("StructArrayLayout10ui20",Tr);class Ar extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,i,n,r,o,s,a,l,c,u,h)}emplace(t,e,i,n,r,o,s,a,l,c,u,h,d){const p=12*t;return this.int16[p+0]=e,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=r,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,t}}Ar.prototype.bytesPerElement=24,An("StructArrayLayout4i4ui4i24",Ar);class Ir extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.float32[r+0]=e,this.float32[r+1]=i,this.float32[r+2]=n,t}}Ir.prototype.bytesPerElement=12,An("StructArrayLayout3f12",Ir);class Mr extends _r{_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}}Mr.prototype.bytesPerElement=4,An("StructArrayLayout1ul4",Mr);class Cr extends _r{_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,n,r,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,n,r,o,s,a,l)}emplace(t,e,i,n,r,o,s,a,l,c){const u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.int16[u+2]=n,this.int16[u+3]=r,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=l,this.uint16[u+9]=c,t}}Cr.prototype.bytesPerElement=20,An("StructArrayLayout6i1ul2ui20",Cr);class zr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,n,r,o)}emplace(t,e,i,n,r,o,s){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=o,this.int16[a+5]=s,t}}zr.prototype.bytesPerElement=12,An("StructArrayLayout2i2i2i12",zr);class Pr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,n,r)}emplace(t,e,i,n,r,o){const s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[a+6]=r,this.int16[a+7]=o,t}}Pr.prototype.bytesPerElement=16,An("StructArrayLayout2f1f2i16",Pr);class Lr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=12*t,s=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=i,this.float32[s+1]=n,this.float32[s+2]=r,t}}Lr.prototype.bytesPerElement=12,An("StructArrayLayout2ub2f12",Lr);class Dr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,this.uint16[r+2]=n,t}}Dr.prototype.bytesPerElement=6,An("StructArrayLayout3ui6",Dr);class Rr extends _r{_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),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g){const y=this.length;return this.resize(y+1),this.emplace(y,t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g)}emplace(t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g,y){const _=26*t,v=13*t,x=52*t;return this.int16[_+0]=e,this.int16[_+1]=i,this.uint32[v+1]=n,this.uint32[v+2]=r,this.uint32[v+3]=o,this.uint32[v+4]=s,this.uint32[v+5]=a,this.uint16[_+12]=l,this.uint16[_+13]=c,this.uint16[_+14]=u,this.float32[v+8]=h,this.float32[v+9]=d,this.uint8[x+40]=p,this.uint8[x+41]=f,this.uint8[x+42]=m,this.uint32[v+11]=g,this.int16[_+24]=y,t}}Rr.prototype.bytesPerElement=52,An("StructArrayLayout2i5ul3ui2f3ub1ul1i52",Rr);class Or extends _r{_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,n,r,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,x,b,w,S,E,k,T,A,I){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,x,b,w,S,E,k,T,A,I)}emplace(t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g,y,_,v,x,b,w,S,E,k,T,A,I,M){const C=36*t,z=18*t;return this.int16[C+0]=e,this.int16[C+1]=i,this.int16[C+2]=n,this.int16[C+3]=r,this.int16[C+4]=o,this.int16[C+5]=s,this.int16[C+6]=a,this.int16[C+7]=l,this.uint16[C+8]=c,this.uint16[C+9]=u,this.uint16[C+10]=h,this.uint16[C+11]=d,this.uint16[C+12]=p,this.uint16[C+13]=f,this.uint16[C+14]=m,this.uint16[C+15]=g,this.uint16[C+16]=y,this.uint16[C+17]=_,this.uint16[C+18]=v,this.uint16[C+19]=x,this.uint16[C+20]=b,this.uint16[C+21]=w,this.uint16[C+22]=S,this.uint32[z+12]=E,this.float32[z+13]=k,this.float32[z+14]=T,this.float32[z+15]=A,this.float32[z+16]=I,this.float32[z+17]=M,t}}Or.prototype.bytesPerElement=72,An("StructArrayLayout8i15ui1ul5f72",Or);class Fr extends _r{_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}}Fr.prototype.bytesPerElement=4,An("StructArrayLayout1f4",Fr);class Br extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=3*t;return this.int16[r+0]=e,this.int16[r+1]=i,this.int16[r+2]=n,t}}Br.prototype.bytesPerElement=6,An("StructArrayLayout3i6",Br);class jr extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,i)}emplace(t,e,i,n){const r=4*t;return this.uint32[2*t+0]=e,this.uint16[r+2]=i,this.uint16[r+3]=n,t}}jr.prototype.bytesPerElement=8,An("StructArrayLayout1ul2ui8",jr);class $r extends _r{_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 n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,t}}$r.prototype.bytesPerElement=4,An("StructArrayLayout2ui4",$r);class Nr extends _r{_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}}Nr.prototype.bytesPerElement=2,An("StructArrayLayout1ui2",Nr);class Ur extends _r{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,i,n)}emplace(t,e,i,n,r){const o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,t}}Ur.prototype.bytesPerElement=16,An("StructArrayLayout4f16",Ur);class Vr extends yr{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 k(this.anchorPointX,this.anchorPointY)}}Vr.prototype.size=20;class qr extends Cr{get(t){return new Vr(this,t)}}An("CollisionBoxArray",qr);class Zr extends yr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint32[this._pos4+1]}get numGlyphs(){return this._structArray.uint32[this._pos4+2]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineStartIndex(){return this._structArray.uint32[this._pos4+4]}get lineLength(){return this._structArray.uint32[this._pos4+5]}get segment(){return this._structArray.uint16[this._pos2+12]}get lowerSize(){return this._structArray.uint16[this._pos2+13]}get upperSize(){return this._structArray.uint16[this._pos2+14]}get lineOffsetX(){return this._structArray.float32[this._pos4+8]}get lineOffsetY(){return this._structArray.float32[this._pos4+9]}get writingMode(){return this._structArray.uint8[this._pos1+40]}get placedOrientation(){return this._structArray.uint8[this._pos1+41]}set placedOrientation(t){this._structArray.uint8[this._pos1+41]=t}get hidden(){return this._structArray.uint8[this._pos1+42]}set hidden(t){this._structArray.uint8[this._pos1+42]=t}get crossTileID(){return this._structArray.uint32[this._pos4+11]}set crossTileID(t){this._structArray.uint32[this._pos4+11]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+24]}}Zr.prototype.size=52;class Gr extends Rr{get(t){return new Zr(this,t)}}An("PlacedSymbolArray",Gr);class Hr extends yr{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}get angle(){return this._structArray.float32[this._pos4+17]}set angle(t){this._structArray.float32[this._pos4+17]=t}}Hr.prototype.size=72;class Wr extends Or{get(t){return new Hr(this,t)}}An("SymbolInstanceArray",Wr);class Xr extends Fr{getoffsetX(t){return this.float32[1*t+0]}}An("GlyphOffsetArray",Xr);class Jr extends Br{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}An("SymbolLineVertexArray",Jr);class Kr extends yr{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]}}Kr.prototype.size=8;class Yr extends jr{get(t){return new Kr(this,t)}}An("FeatureIndexArray",Yr);class Qr extends br{}class to extends br{}class eo extends br{}class io extends Sr{}class no extends Er{}class ro extends kr{}class oo extends Tr{}class so extends Ar{}class ao extends Ir{}class lo extends Mr{}class co extends zr{}class uo extends Lr{}class ho extends Dr{}class po extends $r{}const fo=vr([{name:"a_pos",components:2,type:"Int16"}],4),{members:mo}=fo;class go{constructor(t=[]){this.segments=t}prepareSegment(t,e,i,n){let r=this.segments[this.segments.length-1];return t>go.MAX_VERTEX_ARRAY_LENGTH&&f(`Max vertices per segment is ${go.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!r||r.vertexLength+t>go.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}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,n){return new go([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function yo(t,e){return 256*(t=o(Math.floor(t),0,255))+o(Math.floor(e),0,255)}go.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,An("SegmentVector",go);const _o=vr([{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 vo={exports:{}},xo={exports:{}};xo.exports=function(t,e){var i,n,r,o,s,a,l,c;for(n=t.length-(i=3&t.length),r=e,s=3432918353,a=461845907,c=0;c<n;)l=255&t.charCodeAt(c)|(255&t.charCodeAt(++c))<<8|(255&t.charCodeAt(++c))<<16|(255&t.charCodeAt(++c))<<24,++c,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>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:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0};var bo={exports:{}};bo.exports=function(t,e){for(var i,n=t.length,r=e^n,o=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};var wo=xo.exports,So=bo.exports;vo.exports=wo,vo.exports.murmur3=wo,vo.exports.murmur2=So;class Eo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,n){this.ids.push(ko(t)),this.positions.push(e,i,n)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=ko(t);let i=0,n=this.ids.length-1;for(;i<n;){const t=i+n>>1;this.ids[t]>=e?n=t:i=t+1}const r=[];for(;this.ids[i]===e;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(t,e){const i=new Float64Array(t.ids),n=new Uint32Array(t.positions);return To(i,n,0,i.length-1),e&&e.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(t){const e=new Eo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function ko(t){const e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:vo.exports(String(t))}function To(t,e,i,n){for(;i<n;){const r=t[i+n>>1];let o=i-1,s=n+1;for(;;){do{o++}while(t[o]<r);do{s--}while(t[s]>r);if(o>=s)break;Ao(t,o,s),Ao(e,3*o,3*s),Ao(e,3*o+1,3*s+1),Ao(e,3*o+2,3*s+2)}s-i<n-s?(To(t,e,i,s),i=s+1):(To(t,e,s+1,n),n=s)}}function Ao(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}An("FeaturePositionMap",Eo);class Io{constructor(t,e){this.gl=t.gl,this.location=e}}class Mo extends Io{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Co extends Io{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 Io{constructor(t,e){super(t,e),this.current=Dt.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 Po=new Float32Array(16);function Lo(t){return[yo(255*t.r,255*t.g),yo(255*t.b,255*t.a)]}class Do{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 Mo(t,e)}}class Ro{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,n){const r="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;r&&t.set(r)}getBinding(t,e,i){return"u_pattern"===i.substr(0,9)?new Co(t,e):new Mo(t,e)}}class Oo{constructor(t,e,i,n){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 n}populatePaintArray(t,e,i,n,r){const o=this.paintVertexArray.length,s=this.expression.evaluate(new Qn(0),e,{},n,[],r);this.paintVertexArray.resize(t),this._setPaintValue(o,t,s)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(t,e,r)}_setPaintValue(t,e,i){if("color"===this.type){const n=Lo(i);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,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 Fo{constructor(t,e,i,n,r,o){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(t,e,i,n,r){const o=this.expression.evaluate(new Qn(this.zoom),e,{},n,[],r),s=this.expression.evaluate(new Qn(this.zoom+1),e,{},n,[],r),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,o,s)}updatePaintArray(t,e,i,n){const r=this.expression.evaluate({zoom:this.zoom},i,n),o=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(t,e,r,o)}_setPaintValue(t,e,i,n){if("color"===this.type){const r=Lo(i),o=Lo(n);for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}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,n=o(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(n)}getBinding(t,e,i){return new Mo(t,e)}}class Bo{constructor(t,e,i,n,r,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(t,e,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],i)}updatePaintArray(t,e,i,n,r){this._setPaintValues(t,e,i.patterns&&i.patterns[this.layerId],r)}_setPaintValues(t,e,i,n){if(!n||!i)return;const{min:r,mid:o,max:s}=i,a=n[r],l=n[o],c=n[s];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,_o.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,_o.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class jo{constructor(t,e,i){this.binders={},this._buffers=[];const n=[];for(const r in t.paint._values){if(!i(r))continue;const o=t.paint.get(r);if(!(o instanceof sr&&xi(o.property.specification)))continue;const s=No(r,t.type),a=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===a.kind)this.binders[r]=h?new Ro(a.value,s):new Do(a.value,s,l),n.push(`/u_${r}`);else if("source"===a.kind||h){const i=Uo(r,l,"source");this.binders[r]=h?new Bo(a,l,c,e,i,t.id):new Oo(a,s,l,i),n.push(`/a_${r}`)}else{const t=Uo(r,l,"composite");this.binders[r]=new Fo(a,s,l,c,e,t),n.push(`/z_${r}`)}}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Oo||e instanceof Fo?e.maxValue:0}populatePaintArrays(t,e,i,n,r){for(const o in this.binders){const s=this.binders[o];(s instanceof Oo||s instanceof Fo||s instanceof Bo)&&s.populatePaintArray(t,e,i,n,r)}}setConstantPatternPositions(t,e){for(const i in this.binders){const n=this.binders[i];n instanceof Ro&&n.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,i,n,r){let o=!1;for(const s in t){const a=e.getPositions(s);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 Oo||l instanceof Fo||l instanceof Bo)&&!0===l.expression.isStateDependent){const c=n.paint.get(i);l.expression=c.value,l.updatePaintArray(e.start,e.end,a,t[s],r),o=!0}}}}return o}defines(){const t=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Do||i instanceof Ro)&&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 Oo||i instanceof Fo)for(let e=0;e<i.paintVertexAttributes.length;e++)t.push(i.paintVertexAttributes[e].name);else if(i instanceof Bo)for(let e=0;e<_o.members.length;e++)t.push(_o.members[e].name)}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const i=this.binders[e];if(i instanceof Do||i instanceof Ro||i instanceof Fo)for(const e of i.uniformNames)t.push(e)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const i=[];for(const n in this.binders){const r=this.binders[n];if(r instanceof Do||r instanceof Ro||r instanceof Fo)for(const o of r.uniformNames)if(e[o]){const s=r.getBinding(t,e[o],o);i.push({name:o,property:n,binding:s})}}return i}setUniforms(t,e,i,n){for(const{name:t,property:r,binding:o}of e)this.binders[r].setUniform(o,n,i.get(r),t)}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const i=this.binders[e];if(t&&i instanceof Bo){const e=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;e&&this._buffers.push(e)}else(i instanceof Oo||i instanceof Fo)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(const e in this.binders){const i=this.binders[e];(i instanceof Oo||i instanceof Fo||i instanceof Bo)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Oo||e instanceof Fo||e instanceof Bo)&&e.destroy()}}}class $o{constructor(t,e,i=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new jo(n,e,i);this.needsUpload=!1,this._featureMap=new Eo,this._bufferOffset=0}populatePaintArrays(t,e,i,n,r,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(t,e,n,r,o);void 0!==e.id&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,n){for(const r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(t,this._featureMap,e,r,n)||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 No(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 Uo(t,e,i){const n={color:{source:kr,composite:Ur},number:{source:Fr,composite:kr}},r=function(t){return{"line-pattern":{source:oo,composite:oo},"fill-pattern":{source:oo,composite:oo},"fill-extrusion-pattern":{source:oo,composite:oo}}[t]}(t);return r&&r[i]||n[e][i]}An("ConstantBinder",Do),An("CrossFadedConstantBinder",Ro),An("SourceExpressionBinder",Oo),An("CrossFadedCompositeBinder",Bo),An("CompositeExpressionBinder",Fo),An("ProgramConfiguration",jo,{omit:["_buffers"]}),An("ProgramConfigurationSet",$o);var Vo=8192;const qo=Math.pow(2,14)-1,Zo=-qo-1;function Go(t){const e=Vo/t.extent,i=t.loadGeometry();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t],r=Math.round(i.x*e),s=Math.round(i.y*e);i.x=o(r,Zo,qo),i.y=o(s,Zo,qo),(r<i.x||r>i.x+1||s<i.y||s>i.y+1)&&f("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Ho(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Go(t):[]}}function Wo(t,e,i,n,r){t.emplaceBack(2*e+(n+1)/2,2*i+(r+1)/2)}class Xo{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 to,this.indexArray=new ho,this.segments=new go,this.programConfigurations=new $o(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){const n=this.layers[0],r=[];let o=null,s=!1;"circle"===n.type&&(o=n.layout.get("circle-sort-key"),s=!o.isConstant());for(const{feature:e,id:n,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ho(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),c,i))continue;const u=s?o.evaluate(c,{},i):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Go(e),patterns:{},sortKey:u};r.push(h)}s&&r.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of r){const{geometry:r,index:o,sourceLayerIndex:s}=n,a=t[o].feature;this.addFeature(n,r,o,i),e.featureIndex.insert(a,r,o,s,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,mo),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,n){for(const i of e)for(const e of i){const i=e.x,n=e.y;if(i<0||i>=Vo||n<0||n>=Vo)continue;const r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=r.vertexLength;Wo(this.layoutVertexArray,i,n,-1,-1),Wo(this.layoutVertexArray,i,n,1,-1),Wo(this.layoutVertexArray,i,n,1,1),Wo(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+3,o+2),r.vertexLength+=4,r.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{},n)}}function Jo(t,e){for(let i=0;i<t.length;i++)if(os(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(os(t,e[i]))return!0;return!!ts(t,e)}function Ko(t,e,i){return!!os(t,e)||!!is(e,t,i)}function Yo(t,e){if(1===t.length)return rs(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++)if(os(t,n[e]))return!0}for(let i=0;i<t.length;i++)if(rs(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(ts(t,e[i]))return!0;return!1}function Qo(t,e,i){if(t.length>1){if(ts(t,e))return!0;for(let n=0;n<e.length;n++)if(is(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(is(t[n],e,i))return!0;return!1}function ts(t,e){if(0===t.length||0===e.length)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];for(let t=0;t<e.length-1;t++)if(es(n,r,e[t],e[t+1]))return!0}return!1}function es(t,e,i,n){return m(t,i,n)!==m(e,i,n)&&m(t,e,i)!==m(t,e,n)}function is(t,e,i){const n=i*i;if(1===e.length)return t.distSqr(e[0])<n;for(let i=1;i<e.length;i++)if(ns(t,e[i-1],e[i])<n)return!0;return!1}function ns(t,e,i){const n=e.distSqr(i);if(0===n)return t.distSqr(e);const r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(r<0?e:r>1?i:i.sub(e)._mult(r)._add(e))}function rs(t,e){let i,n,r,o=!1;for(let s=0;s<t.length;s++){i=t[s];for(let t=0,s=i.length-1;t<i.length;s=t++)n=i[t],r=i[s],n.y>e.y!=r.y>e.y&&e.x<(r.x-n.x)*(e.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function os(t,e){let i=!1;for(let n=0,r=t.length-1;n<t.length;r=n++){const o=t[n],s=t[r];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function ss(t,e,i){const n=i[0],r=i[2];if(t.x<n.x&&e.x<n.x||t.x>r.x&&e.x>r.x||t.y<n.y&&e.y<n.y||t.y>r.y&&e.y>r.y)return!1;const o=m(t,e,i[0]);return o!==m(t,e,i[1])||o!==m(t,e,i[2])||o!==m(t,e,i[3])}function as(t,e,i){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ls(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function cs(t,e,i,n,r){if(!e[0]&&!e[1])return t;const o=k.convert(e)._mult(r);"viewport"===i&&o._rotate(-n);const s=[];for(let e=0;e<t.length;e++)s.push(t[e].sub(o));return s}An("CircleBucket",Xo,{omit:["layers"]});const us=new pr({"circle-sort-key":new cr(nt.layout_circle["circle-sort-key"])});var hs={paint:new pr({"circle-radius":new cr(nt.paint_circle["circle-radius"]),"circle-color":new cr(nt.paint_circle["circle-color"]),"circle-blur":new cr(nt.paint_circle["circle-blur"]),"circle-opacity":new cr(nt.paint_circle["circle-opacity"]),"circle-translate":new lr(nt.paint_circle["circle-translate"]),"circle-translate-anchor":new lr(nt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new lr(nt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new lr(nt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new cr(nt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new cr(nt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new cr(nt.paint_circle["circle-stroke-opacity"])}),layout:us},ds=1e-6,ps="undefined"!=typeof Float32Array?Float32Array:Array;function fs(){var t=new ps(9);return ps!=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}function ms(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 gs(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],y=e[14],_=e[15],v=i[0],x=i[1],b=i[2],w=i[3];return t[0]=v*n+x*a+b*h+w*m,t[1]=v*r+x*l+b*d+w*g,t[2]=v*o+x*c+b*p+w*y,t[3]=v*s+x*u+b*f+w*_,t[4]=(v=i[4])*n+(x=i[5])*a+(b=i[6])*h+(w=i[7])*m,t[5]=v*r+x*l+b*d+w*g,t[6]=v*o+x*c+b*p+w*y,t[7]=v*s+x*u+b*f+w*_,t[8]=(v=i[8])*n+(x=i[9])*a+(b=i[10])*h+(w=i[11])*m,t[9]=v*r+x*l+b*d+w*g,t[10]=v*o+x*c+b*p+w*y,t[11]=v*s+x*u+b*f+w*_,t[12]=(v=i[12])*n+(x=i[13])*a+(b=i[14])*h+(w=i[15])*m,t[13]=v*r+x*l+b*d+w*g,t[14]=v*o+x*c+b*p+w*y,t[15]=v*s+x*u+b*f+w*_,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var ys,_s=gs;function vs(){var t=new ps(3);return ps!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function xs(t,e,i){var n=new ps(3);return n[0]=t,n[1]=e,n[2]=i,n}function bs(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*s,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*s,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*s,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*s,t}function ws(){var t=new ps(4);return ps!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ss(t,e){const i=bs([],[t.x,t.y,0,1],e);return new k(i[0]/i[3],i[1]/i[3])}vs(),ys=new ps(4),ps!=Float32Array&&(ys[0]=0,ys[1]=0,ys[2]=0,ys[3]=0),vs(),xs(1,0,0),xs(0,1,0),ws(),ws(),fs(),function(){var t;t=new ps(2),ps!=Float32Array&&(t[0]=0,t[1]=0)}();class Es extends Xo{}An("HeatmapBucket",Es,{omit:["layers"]});var ks={paint:new pr({"heatmap-radius":new cr(nt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new cr(nt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new lr(nt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new dr(nt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new lr(nt.paint_heatmap["heatmap-opacity"])})};function Ts(t,{width:e,height:i},n,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==e*i*n)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${e*i*n}`)}else r=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=r,t}function As(t,{width:e,height:i},n){if(e===t.width&&i===t.height)return;const r=Ts({},{width:e,height:i},n);Is(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},n),t.width=e,t.height=i,t.data=r.data}function Is(t,e,i,n,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||n.x>e.width-r.width||n.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const s=t.data,a=e.data;if(s===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<r.height;l++){const c=((i.y+l)*t.width+i.x)*o,u=((n.y+l)*e.width+n.x)*o;for(let t=0;t<r.width*o;t++)a[u+t]=s[c+t]}return e}class Ms{constructor(t,e){Ts(this,t,1,e)}resize(t){As(this,t,1)}clone(){return new Ms({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){Is(t,e,i,n,r,1)}}class Cs{constructor(t,e){Ts(this,t,4,e)}resize(t){As(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Cs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,n,r){Is(t,e,i,n,r,4)}}function zs(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,r=t.image||new Cs({width:i,height:n});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(i,n,o)=>{e[t.evaluationKey]=o;const s=t.expression.evaluate(e);r.data[i+n+0]=Math.floor(255*s.r/s.a),r.data[i+n+1]=Math.floor(255*s.g/s.a),r.data[i+n+2]=Math.floor(255*s.b/s.a),r.data[i+n+3]=Math.floor(255*s.a)};if(t.clips)for(let e=0,r=0;e<n;++e,r+=4*i)for(let n=0,s=0;n<i;n++,s+=4){const a=n/(i-1),{start:l,end:c}=t.clips[e];o(r,s,l*(1-a)+c*a)}else for(let t=0,e=0;t<i;t++,e+=4)o(0,e,t/(i-1));return r}An("AlphaImage",Ms),An("RGBAImage",Cs);var Ps={paint:new pr({"hillshade-illumination-direction":new lr(nt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new lr(nt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new lr(nt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new lr(nt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new lr(nt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new lr(nt.paint_hillshade["hillshade-accent-color"])})};const Ls=vr([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ds}=Ls;var Rs={exports:{}};function Os(t,e,i){i=i||2;var n,r,o,s,a,l,c,u=e&&e.length,h=u?e[0]*i:t.length,d=Fs(t,0,h,i,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(t,e,i,n){var r,o,s,a=[];for(r=0,o=e.length;r<o;r++)(s=Fs(t,e[r]*n,r<o-1?e[r+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(Ws(s));for(a.sort(qs),r=0;r<a.length;r++)i=Zs(a[r],i);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],r=s=t[1];for(var f=i;f<h;f+=i)(a=t[f])<n&&(n=a),(l=t[f+1])<r&&(r=l),a>o&&(o=a),l>s&&(s=l);c=0!==(c=Math.max(o-n,s-r))?32767/c:0}return js(d,p,i,n,r,c,0),p}function Fs(t,e,i,n,r){var o,s;if(r===aa(t,e,i,n)>0)for(o=e;o<i;o+=n)s=ra(o,t[o],t[o+1],s);else for(o=i-n;o>=e;o-=n)s=ra(o,t[o],t[o+1],s);return s&&Ys(s,s.next)&&(oa(s),s=s.next),s}function Bs(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Ys(n,n.next)&&0!==Ks(n.prev,n,n.next))n=n.next;else{if(oa(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function js(t,e,i,n,r,o,s){if(t){!s&&o&&function(t,e,i,n){var r=t;do{0===r.z&&(r.z=Hs(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,s,a,l,c=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,n=i,a=0,e=0;e<c&&(a++,n=n.nextZ);e++);for(l=c;a>0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,c*=2}while(s>1)}(r)}(t,n,r,o);for(var a,l,c=t;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Ns(t,n,r,o):$s(t))e.push(a.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),oa(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?js(t=Us(Bs(t),e,i),e,i,n,r,o,2):2===s&&Vs(t,e,i,n,r,o):js(Bs(t),e,i,n,r,o,1);break}}}function $s(t){var e=t.prev,i=t,n=t.next;if(Ks(e,i,n)>=0)return!1;for(var r=e.x,o=i.x,s=n.x,a=e.y,l=i.y,c=n.y,u=r<o?r<s?r:s:o<s?o:s,h=a<l?a<c?a:c:l<c?l:c,d=r>o?r>s?r:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c,f=n.next;f!==e;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Xs(r,a,o,l,s,c,f.x,f.y)&&Ks(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Ns(t,e,i,n){var r=t.prev,o=t,s=t.next;if(Ks(r,o,s)>=0)return!1;for(var a=r.x,l=o.x,c=s.x,u=r.y,h=o.y,d=s.y,p=a<l?a<c?a:c:l<c?l:c,f=u<h?u<d?u:d:h<d?h:d,m=a>l?a>c?a:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,y=Hs(p,f,e,i,n),_=Hs(m,g,e,i,n),v=t.prevZ,x=t.nextZ;v&&v.z>=y&&x&&x.z<=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==s&&Xs(a,u,l,h,c,d,v.x,v.y)&&Ks(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==s&&Xs(a,u,l,h,c,d,x.x,x.y)&&Ks(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==s&&Xs(a,u,l,h,c,d,v.x,v.y)&&Ks(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==s&&Xs(a,u,l,h,c,d,x.x,x.y)&&Ks(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Us(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!Ys(r,o)&&Qs(r,n,n.next,o)&&ia(r,o)&&ia(o,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(o.i/i|0),oa(n),oa(n.next),n=t=o),n=n.next}while(n!==t);return Bs(n)}function Vs(t,e,i,n,r,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Js(s,a)){var l=na(s,a);return s=Bs(s,s.next),l=Bs(l,l.next),js(s,e,i,n,r,o,0),void js(l,e,i,n,r,o,0)}a=a.next}s=s.next}while(s!==t)}function qs(t,e){return t.x-e.x}function Zs(t,e){var i=function(t,e){var i,n=e,r=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>s&&(s=a,i=n.x<n.next.x?n:n.next,a===r))return i}n=n.next}while(n!==e);if(!i)return null;var l,c=i,u=i.x,h=i.y,d=1/0;n=i;do{r>=n.x&&n.x>=u&&r!==n.x&&Xs(o<h?r:s,o,u,h,o<h?s:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),ia(n,t)&&(l<d||l===d&&(n.x>i.x||n.x===i.x&&Gs(i,n)))&&(i=n,d=l)),n=n.next}while(n!==c);return i}(t,e);if(!i)return e;var n=na(i,t);return Bs(n,n.next),Bs(i,i.next)}function Gs(t,e){return Ks(t.prev,t,e.prev)<0&&Ks(e.next,t,t.next)<0}function Hs(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ws(t){var 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 Xs(t,e,i,n,r,o,s,a){return(r-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(i-s)*(e-a)&&(i-s)*(o-a)>=(r-s)*(n-a)}function Js(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Qs(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ia(t,e)&&ia(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Ks(t.prev,t,e.prev)||Ks(t,e.prev,e))||Ys(t,e)&&Ks(t.prev,t,t.next)>0&&Ks(e.prev,e,e.next)>0)}function Ks(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ys(t,e){return t.x===e.x&&t.y===e.y}function Qs(t,e,i,n){var r=ea(Ks(t,e,i)),o=ea(Ks(t,e,n)),s=ea(Ks(i,n,t)),a=ea(Ks(i,n,e));return r!==o&&s!==a||!(0!==r||!ta(t,i,e))||!(0!==o||!ta(t,n,e))||!(0!==s||!ta(i,t,n))||!(0!==a||!ta(i,e,n))}function ta(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 ea(t){return t>0?1:t<0?-1:0}function ia(t,e){return Ks(t.prev,t,t.next)<0?Ks(t,e,t.next)>=0&&Ks(t,t.prev,e)>=0:Ks(t,e,t.prev)<0||Ks(t,t.next,e)<0}function na(t,e){var i=new sa(t.i,t.x,t.y),n=new sa(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function ra(t,e,i,n){var r=new sa(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function oa(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 sa(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function aa(t,e,i,n){for(var r=0,o=e,s=i-n;o<i;o+=n)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}function la(t,e,i,n,r){ca(t,e,i||0,n||t.length-1,r||ha)}function ca(t,e,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=e-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);ca(t,e,Math.max(i,Math.floor(e-s*l/o+c)),Math.min(n,Math.floor(e+(o-s)*l/o+c)),r)}var u=t[e],h=i,d=n;for(ua(t,i,e),r(t[n],u)>0&&ua(t,i,n);h<d;){for(ua(t,h,d),h++,d--;r(t[h],u)<0;)h++;for(;r(t[d],u)>0;)d--}0===r(t[i],u)?ua(t,i,d):ua(t,++d,n),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function ua(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function ha(t,e){return t<e?-1:t>e?1:0}function da(t,e){const i=t.length;if(i<=1)return[t];const n=[];let r,o;for(let e=0;e<i;e++){const i=g(t[e]);0!==i&&(t[e].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(r&&n.push(r),r=[t[e]]):r.push(t[e]))}if(r&&n.push(r),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(la(n[t],e,1,n[t].length-1,pa),n[t]=n[t].slice(0,e));return n}function pa(t,e){return e.area-t.area}function fa(t,e,i){const n=i.patternDependencies;let r=!1;for(const i of e){const e=i.paint.get(`${t}-pattern`);e.isConstant()||(r=!0);const o=e.constantOr(null);o&&(r=!0,n[o.to]=!0,n[o.from]=!0)}return r}function ma(t,e,i,n,r){const o=r.patternDependencies;for(const s of e){const e=s.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n-1},i,{},r.availableImages),a=e.evaluate({zoom:n},i,{},r.availableImages),l=e.evaluate({zoom:n+1},i,{},r.availableImages);t=t&&t.name?t.name:t,a=a&&a.name?a.name:a,l=l&&l.name?l.name:l,o[t]=!0,o[a]=!0,o[l]=!0,i.patterns[s.id]={min:t,mid:a,max:l}}}return i}Rs.exports=Os,Rs.exports.default=Os,Os.deviation=function(t,e,i,n){var r=e&&e.length,o=Math.abs(aa(t,0,r?e[0]*i:t.length,i));if(r)for(var s=0,a=e.length;s<a;s++)o-=Math.abs(aa(t,e[s]*i,s<a-1?e[s+1]*i:t.length,i));var l=0;for(s=0;s<n.length;s+=3){var c=n[s]*i,u=n[s+1]*i,h=n[s+2]*i;l+=Math.abs((t[c]-t[h])*(t[u+1]-t[c+1])-(t[c]-t[u])*(t[h+1]-t[c+1]))}return 0===o&&0===l?0:Math.abs((l-o)/o)},Os.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<e;s++)i.vertices.push(t[r][o][s]);r>0&&i.holes.push(n+=t[r-1].length)}return i};class ga{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 eo,this.indexArray=new ho,this.indexArray2=new po,this.programConfigurations=new $o(t.layers,t.zoom),this.segments=new go,this.segments2=new go,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=fa("fill",this.layers,e);const n=this.layers[0].layout.get("fill-sort-key"),r=!n.isConstant(),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ho(s,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),u,i))continue;const h=r?n.evaluate(u,{},i,e.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:t?u.geometry:Go(s),patterns:{},sortKey:h};o.push(d)}r&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n;if(this.hasPattern){const t=ma("fill",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,s,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,Ds),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,n,r){for(const t of da(e,500)){let e=0;for(const i of t)e+=i.length;const i=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=i.vertexLength,r=[],o=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&o.push(r.length/2);const i=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),r.push(e[0].x),r.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),r.push(e[t].x),r.push(e[t].y);i.vertexLength+=e.length,i.primitiveLength+=e.length}const s=Rs.exports(r,o);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(n+s[t],n+s[t+1],n+s[t+2]);i.vertexLength+=e,i.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}An("FillBucket",ga,{omit:["layers","patternFeatures"]});const ya=new pr({"fill-sort-key":new cr(nt.layout_fill["fill-sort-key"])});var _a={paint:new pr({"fill-antialias":new lr(nt.paint_fill["fill-antialias"]),"fill-opacity":new cr(nt.paint_fill["fill-opacity"]),"fill-color":new cr(nt.paint_fill["fill-color"]),"fill-outline-color":new cr(nt.paint_fill["fill-outline-color"]),"fill-translate":new lr(nt.paint_fill["fill-translate"]),"fill-translate-anchor":new lr(nt.paint_fill["fill-translate-anchor"]),"fill-pattern":new ur(nt.paint_fill["fill-pattern"])}),layout:ya};const va=vr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),xa=vr([{name:"a_centroid",components:2,type:"Int16"}],4),{members:ba}=va;var wa={},Sa=k,Ea=ka;function ka(t,e,i,n,r){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=r,t.readFields(Ta,this,e)}function Ta(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 n=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[n]=r}}(i,e):3==t?e.type=i.readVarint():4==t&&(e._geometry=i.pos)}function Aa(t){for(var e,i,n=0,r=0,o=t.length,s=o-1;r<o;s=r++)n+=((i=t[s]).x-(e=t[r]).x)*(e.y+i.y);return n}ka.types=["Unknown","Point","LineString","Polygon"],ka.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,r=0,o=0,s=0,a=[];t.pos<i;){if(r<=0){var l=t.readVarint();n=7&l,r=l>>3}if(r--,1===n||2===n)o+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&a.push(e),e=[]),e.push(new Sa(o,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&a.push(e),a},ka.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,r=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;t.pos<e;){if(n<=0){var u=t.readVarint();i=7&u,n=u>>3}if(n--,1===i||2===i)(r+=t.readSVarint())<s&&(s=r),r>a&&(a=r),(o+=t.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},ka.prototype.toGeoJSON=function(t,e,i){var n,r,o=this.extent*Math.pow(2,i),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),c=ka.types[this.type];function u(t){for(var e=0;e<t.length;e++){var i=t[e];t[e]=[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];u(l=h);break;case 2:for(n=0;n<l.length;n++)u(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var i,n,r=[],o=0;o<e;o++){var s=Aa(t[o]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[o]]):i.push(t[o]))}return i&&r.push(i),r}(l),n=0;n<l.length;n++)for(r=0;r<l[n].length;r++)u(l[n][r])}1===l.length?l=l[0]:c="Multi"+c;var d={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(d.id=this.id),d};var Ia=Ea,Ma=Ca;function Ca(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(za,this,e),this.length=this._features.length}function za(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 n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(i))}Ca.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 Ia(this._pbf,e,this.extent,this._keys,this._values)};var Pa=Ma;function La(t,e,i){if(3===t){var n=new Pa(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}wa.VectorTile=function(t,e){this.layers=t.readFields(La,{},e)},wa.VectorTileFeature=Ea,wa.VectorTileLayer=Ma;const Da=wa.VectorTileFeature.types,Ra=Math.pow(2,13);function Oa(t,e,i,n,r,o,s,a){t.emplaceBack(e,i,2*Math.floor(n*Ra)+s,r*Ra*2,o*Ra*2,Math.round(a))}class Fa{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 io,this.centroidVertexArray=new Qr,this.indexArray=new ho,this.programConfigurations=new $o(t.layers,t.zoom),this.segments=new go,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.features=[],this.hasPattern=fa("fill-extrusion",this.layers,e);for(const{feature:n,id:r,index:o,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,a=Ho(n,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),a,i))continue;const l={id:r,sourceLayerIndex:s,index:o,geometry:t?a.geometry:Go(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(ma("fill-extrusion",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,o,i,{}),e.featureIndex.insert(n,l.geometry,o,s,this.index,!0)}}addFeatures(t,e,i){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,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,ba),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,xa.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,n,r){const o={x:0,y:0,vertexCount:0};for(const i of da(e,500)){let e=0;for(const t of i)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of i){if(0===t.length)continue;if(ja(t))continue;let e=0;for(let i=0;i<t.length;i++){const r=t[i];if(i>=1){const s=t[i-1];if(!Ba(r,s)){n.vertexLength+4>go.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=r.sub(s)._perp()._unit(),i=s.dist(r);e+i>32768&&(e=0),Oa(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,0,e),Oa(this.layoutVertexArray,r.x,r.y,t.x,t.y,0,1,e),o.x+=2*r.x,o.y+=2*r.y,o.vertexCount+=2,e+=i,Oa(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),Oa(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e),o.x+=2*s.x,o.y+=2*s.y,o.vertexCount+=2;const a=n.vertexLength;this.indexArray.emplaceBack(a,a+2,a+1),this.indexArray.emplaceBack(a+1,a+2,a+3),n.vertexLength+=4,n.primitiveLength+=2}}}}if(n.vertexLength+e>go.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),"Polygon"!==Da[t.type])continue;const r=[],s=[],a=n.vertexLength;for(const t of i)if(0!==t.length){t!==i[0]&&s.push(r.length/2);for(let e=0;e<t.length;e++){const i=t[e];Oa(this.layoutVertexArray,i.x,i.y,0,0,1,1,0),o.x+=i.x,o.y+=i.y,o.vertexCount+=1,r.push(i.x),r.push(i.y)}}const l=Rs.exports(r,s);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(a+l[t],a+l[t+2],a+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e}for(let t=0;t<o.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(o.x/o.vertexCount),Math.floor(o.y/o.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}}function Ba(t,e){return t.x===e.x&&(t.x<0||t.x>Vo)||t.y===e.y&&(t.y<0||t.y>Vo)}function ja(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Vo))||t.every((t=>t.y<0))||t.every((t=>t.y>Vo))}An("FillExtrusionBucket",Fa,{omit:["layers","features"]});var $a={paint:new pr({"fill-extrusion-opacity":new lr(nt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new cr(nt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new lr(nt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new lr(nt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ur(nt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new cr(nt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new cr(nt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new lr(nt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Na(t,e){return t.x*e.x+t.y*e.y}function Ua(t,e){if(1===t.length){let i=0;const n=e[i++];let r;for(;!r||n.equals(r);)if(r=e[i++],!r)return 1/0;for(;i<e.length;i++){const o=e[i],s=t[0],a=r.sub(n),l=o.sub(n),c=s.sub(n),u=Na(a,a),h=Na(a,l),d=Na(l,l),p=Na(c,a),f=Na(c,l),m=u*d-h*h,g=(d*p-h*f)/m,y=(u*f-h*p)/m,_=n.z*(1-g-y)+r.z*g+o.z*y;if(isFinite(_))return _}return 1/0}{let t=1/0;for(const i of e)t=Math.min(t,i.z);return t}}const Va=vr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:qa}=Va,Za=vr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ga}=Za,Ha=wa.VectorTileFeature.types,Wa=Math.cos(Math.PI/180*37.5),Xa=Math.pow(2,14)/.5;class Ja{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 no,this.layoutVertexArray2=new ro,this.indexArray=new ho,this.programConfigurations=new $o(t.layers,t.zoom),this.segments=new go,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id))}populate(t,e,i){this.hasPattern=fa("line",this.layers,e);const n=this.layers[0].layout.get("line-sort-key"),r=!n.isConstant(),o=[];for(const{feature:e,id:s,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ho(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),c,i))continue;const u=r?n.evaluate(c,{},i):void 0,h={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?c.geometry:Go(e),patterns:{},sortKey:u};o.push(h)}r&&o.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n;if(this.hasPattern){const t=ma("line",this.layers,n,this.zoom,e);this.patternFeatures.push(t)}else this.addFeature(n,r,o,i,{});e.featureIndex.insert(t[o].feature,r,o,s,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,Ga)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,qa),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,n,r){const o=this.layers[0].layout,s=o.get("line-join").evaluate(t,{}),a=o.get("line-cap"),l=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const i of e)this.addLine(i,t,s,a,l,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,r,n)}addLine(t,e,i,n,r,o){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 s="Polygon"===Ha[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<(s?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?122880/(512*this.overscaling):0,u=this.segments.prepareSegment(10*a,this.layoutVertexArray,this.indexArray);let h,d,p,f,m;this.e1=this.e2=-1,s&&(h=t[a-2],m=t[l].sub(h)._unit()._perp());for(let e=l;e<a;e++){if(p=e===a-1?s?t[l+1]:void 0:t[e+1],p&&t[e].equals(p))continue;m&&(f=m),h&&(d=h),h=t[e],m=p?p.sub(h)._unit()._perp():f,f=f||m;let g=f.add(m);0===g.x&&0===g.y||g._unit();const y=f.x*m.x+f.y*m.y,_=g.x*m.x+g.y*m.y,v=0!==_?1/_:1/0,x=2*Math.sqrt(2-2*_),b=_<Wa&&d&&p,w=f.x*m.y-f.y*m.x>0;if(b&&e>l){const t=h.dist(d);if(t>2*c){const e=h.sub(h.sub(d)._mult(c/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,f,0,0,u),d=e}}const S=d&&p;let E=S?i:s?"butt":n;if(S&&"round"===E&&(v<o?E="miter":v<=2&&(E="fakeround")),"miter"===E&&v>r&&(E="bevel"),"bevel"===E&&(v>2&&(E="flipbevel"),v<r&&(E="miter")),d&&this.updateDistance(d,h),"miter"===E)g._mult(v),this.addCurrentVertex(h,g,0,0,u);else if("flipbevel"===E){if(v>100)g=m.mult(-1);else{const t=v*f.add(m).mag()/f.sub(m).mag();g._perp()._mult(t*(w?-1:1))}this.addCurrentVertex(h,g,0,0,u),this.addCurrentVertex(h,g.mult(-1),0,0,u)}else if("bevel"===E||"fakeround"===E){const t=-Math.sqrt(v*v-1),e=w?t:0,i=w?0:t;if(d&&this.addCurrentVertex(h,f,e,i,u),"fakeround"===E){const t=Math.round(180*x/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+y*(y*(3.55645-1.43519*y)-3.2452))*t*t+(.848013+y*(.215638*y-1.06021)))}const n=m.sub(f)._mult(i)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,n.x,n.y,!1,w,0,u)}}p&&this.addCurrentVertex(h,m,-e,-i,u)}else if("butt"===E)this.addCurrentVertex(h,g,0,0,u);else if("square"===E){const t=d?1:-1;this.addCurrentVertex(h,g,t,t,u)}else"round"===E&&(d&&(this.addCurrentVertex(h,f,0,0,u),this.addCurrentVertex(h,f,1,1,u,!0)),p&&(this.addCurrentVertex(h,m,-1,-1,u,!0),this.addCurrentVertex(h,m,0,0,u)));if(b&&e<a-1){const t=h.dist(p);if(t>2*c){const e=h.add(p.sub(h)._mult(c/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,m,0,0,u),h=e}}}}addCurrentVertex(t,e,i,n,r,o=!1){const s=e.y*n-e.x,a=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,r),this.addHalfVertex(t,s,a,o,!0,-n,r),this.distance>Xa/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,i,n,r,o))}addHalfVertex({x:t,y:e},i,n,r,o,s,a){const l=.5*(this.lineClips?this.scaledDistance*(Xa-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(r?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),o?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()}}An("LineBucket",Ja,{omit:["layers","patternFeatures"]});const Ka=new pr({"line-cap":new lr(nt.layout_line["line-cap"]),"line-join":new cr(nt.layout_line["line-join"]),"line-miter-limit":new lr(nt.layout_line["line-miter-limit"]),"line-round-limit":new lr(nt.layout_line["line-round-limit"]),"line-sort-key":new cr(nt.layout_line["line-sort-key"])});var Ya={paint:new pr({"line-opacity":new cr(nt.paint_line["line-opacity"]),"line-color":new cr(nt.paint_line["line-color"]),"line-translate":new lr(nt.paint_line["line-translate"]),"line-translate-anchor":new lr(nt.paint_line["line-translate-anchor"]),"line-width":new cr(nt.paint_line["line-width"]),"line-gap-width":new cr(nt.paint_line["line-gap-width"]),"line-offset":new cr(nt.paint_line["line-offset"]),"line-blur":new cr(nt.paint_line["line-blur"]),"line-dasharray":new hr(nt.paint_line["line-dasharray"]),"line-pattern":new ur(nt.paint_line["line-pattern"]),"line-gradient":new dr(nt.paint_line["line-gradient"])}),layout:Ka};const Qa=new class extends cr{possiblyEvaluate(t,e){return e=new Qn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=a({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(Ya.paint.properties["line-width"].specification);function tl(t,e){return e>0?e+2*t:t}Qa.useIntegerZoom=!0;const el=vr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),il=vr([{name:"a_projected_pos",components:3,type:"Float32"}],4);vr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const nl=vr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);vr([{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 rl=vr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ol=vr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function sl(t,e,i){return t.sections.forEach((t=>{t.text=function(t,e,i){const n=e.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Yn.applyArabicShaping&&(t=Yn.applyArabicShaping(t)),t}(t.text,e,i)})),t}vr([{name:"triangle",components:3,type:"Uint16"}]),vr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint32",name:"glyphStartIndex"},{type:"Uint32",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"}]),vr([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"angle"}]),vr([{type:"Float32",name:"offsetX"}]),vr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const al={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ll=24,cl=dl,ul=function(t,e,i,n,r){var o,s,a=8*r-n-1,l=(1<<a)-1,c=l>>1,u=-7,h=i?r-1:0,d=i?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},hl=function(t,e,i,n,r,o){var s,a,l,c=8*o-r-1,u=(1<<c)-1,h=u>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(e*l-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[i+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[i+p]=255&s,p+=f,s/=256,c-=8);t[i+p-f]|=128*m};function dl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}dl.Varint=0,dl.Fixed64=1,dl.Bytes=2,dl.Fixed32=5;var pl,fl=4294967296,ml=1/fl,gl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function yl(t){return t.type===dl.Bytes?t.readVarint()+t.pos:t.pos+1}function _l(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function vl(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function xl(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function bl(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function wl(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function Sl(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function El(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function kl(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function Tl(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Al(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function Il(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Ml(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Cl(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function zl(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Pl(t,e,i){1===t&&i.readMessage(Ll,e)}function Ll(t,e,i){if(3===t){const{id:t,bitmap:n,width:r,height:o,left:s,top:a,advance:l}=i.readMessage(Dl,{});e.push({id:t,bitmap:new Ms({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:s,top:a,advance:l}})}}function Dl(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 Rl(t){let e=0,i=0;for(const n of t)e+=n.w*n.h,i=Math.max(i,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let r=0,o=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const i=n[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,o=Math.max(o,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=n.pop();t<n.length&&(n[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):(n.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:r,h:o,fill:e/(r*o)||0}}dl.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),r=n>>3,o=this.pos;this.type=7&n,t(r,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ml(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=zl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ml(this.buf,this.pos)+Ml(this.buf,this.pos+4)*fl;return this.pos+=8,t},readSFixed64:function(){var t=Ml(this.buf,this.pos)+zl(this.buf,this.pos+4)*fl;return this.pos+=8,t},readFloat:function(){var t=ul(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ul(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return _l(t,n,e);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return _l(t,n,e);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return _l(t,n,e);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return _l(t,n,e);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return _l(t,n,e);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return _l(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[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&&gl?function(t,e,i){return gl.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){for(var n="",r=e;r<i;){var o,s,a,l=t[r],c=null,u=l>239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=t[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=t[r+2],128==(192&(o=t[r+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=t[r+2],a=t[r+3],128==(192&(o=t[r+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),r+=u}return n}(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!==dl.Bytes)return t.push(this.readVarint(e));var i=yl(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==dl.Bytes)return t.push(this.readSVarint());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==dl.Bytes)return t.push(this.readBoolean());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==dl.Bytes)return t.push(this.readFloat());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==dl.Bytes)return t.push(this.readDouble());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==dl.Bytes)return t.push(this.readFixed32());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==dl.Bytes)return t.push(this.readSFixed32());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==dl.Bytes)return t.push(this.readFixed64());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==dl.Bytes)return t.push(this.readSFixed64());var e=yl(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===dl.Varint)for(;this.buf[this.pos++]>127;);else if(e===dl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===dl.Fixed32)this.pos+=4;else{if(e!==dl.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),Cl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Cl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Cl(this.buf,-1&t,this.pos),Cl(this.buf,Math.floor(t*ml),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Cl(this.buf,-1&t,this.pos),Cl(this.buf,Math.floor(t*ml),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var i,n;if(t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+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)))))}(n,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;this.pos=function(t,e,i){for(var n,r,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!r){n>56319||o+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&vl(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),hl(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),hl(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 n=this.pos-i;n>=128&&vl(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,dl.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,xl,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,bl,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,El,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,wl,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Sl,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,kl,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Tl,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Al,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Il,e)},writeBytesField:function(t,e){this.writeTag(t,dl.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,dl.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,dl.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,dl.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,dl.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,dl.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,dl.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,dl.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,dl.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,dl.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};class Ol{constructor(t,{pixelRatio:e,version:i,stretchX:n,stretchY:r,content:o}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i}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 Fl{constructor(t,e){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(t,i,r),this.addImages(e,n,r);const{w:o,h:s}=Rl(r),a=new Cs({width:o||1,height:s||1});for(const e in t){const n=t[e],r=i[e].paddedRect;Cs.copy(n.data,a,{x:0,y:0},{x:r.x+1,y:r.y+1},n.data)}for(const t in e){const i=e[t],r=n[t].paddedRect,o=r.x+1,s=r.y+1,l=i.data.width,c=i.data.height;Cs.copy(i.data,a,{x:0,y:0},{x:o,y:s},i.data),Cs.copy(i.data,a,{x:0,y:c-1},{x:o,y:s-1},{width:l,height:1}),Cs.copy(i.data,a,{x:0,y:0},{x:o,y:s+c},{width:l,height:1}),Cs.copy(i.data,a,{x:l-1,y:0},{x:o-1,y:s},{width:1,height:c}),Cs.copy(i.data,a,{x:0,y:0},{x:o+l,y:s},{width:1,height:c})}this.image=a,this.iconPositions=i,this.patternPositions=n}addImages(t,e,i){for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),e[n]=new Ol(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}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[n,r]=t.tl;i.update(e.data,void 0,{x:n,y:r})}}An("ImagePosition",Ol),An("ImageAtlas",Fl),t.WritingMode=void 0,(pl=t.WritingMode||(t.WritingMode={}))[pl.none=0]="none",pl[pl.horizontal=1]="horizontal",pl[pl.vertical=2]="vertical",pl[pl.horizontalOnly=3]="horizontalOnly";const Bl=-17;class jl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,e){const i=new jl;return i.scale=t||1,i.fontStack=e,i}static forImage(t){const e=new jl;return e.imageName=t,e}}class $l{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e){const i=new $l;for(let n=0;n<t.sections.length;n++){const r=t.sections[n];r.image?i.addImageSection(r):i.addTextSection(r,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 n=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;e+=n&&Fn(n)&&!al[t[i+1]]||r&&Fn(r)&&!al[t[i-1]]||!al[t[i]]?t[i]:al[t[i]]}return e}(this.text)}trim(){let t=0;for(let e=0;e<this.text.length&&Vl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let i=this.text.length-1;i>=0&&i>=t&&Vl[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 $l;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(jl.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 f("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(jl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):f("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Nl(t,e){const i=[],n=t.text;let r=0;for(const n of e)i.push(t.substring(r,n)),r=n;return r<n.length&&i.push(t.substring(r,n.length)),i}function Ul(e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g){const y=$l.fromFeature(e,o);let _;d===t.WritingMode.vertical&&y.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:x}=Yn;if(v&&1===y.sections.length){_=[];const t=v(y.toString(),Jl(y,u,s,i,r,f,m));for(const e of t){const t=new $l;t.text=e,t.sections=y.sections;for(let i=0;i<e.length;i++)t.sectionIndex.push(0);_.push(t)}}else if(x){_=[];const t=x(y.text,y.sectionIndex,Jl(y,u,s,i,r,f,m));for(const e of t){const t=new $l;t.text=e[0],t.sectionIndex=e[1],t.sections=y.sections,_.push(t)}}else _=Nl(y,Jl(y,u,s,i,r,f,m));const b=[],w={positionedLines:b,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,i,n,r,o,s,a,l,c,u,h,d){let p=0,f=Bl,m=0,g=0;const y="right"===l?1:"left"===l?0:.5;let _=0;for(const a of o){a.trim();const o=a.getMaxScale(),l=(o-1)*ll,x={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=x;const b=x.positionedGlyphs;let w=0;if(!a.length()){f+=s,++_;continue}for(let s=0;s<a.length();s++){const m=a.getSection(s),g=a.getSectionIndex(s),y=a.getCharCode(s);let _=0,x=null,S=null,E=null,k=ll;const T=!(c===t.WritingMode.horizontal||!h&&!On(y)||h&&(Vl[y]||(v=y,Pn.Arabic(v)||Pn["Arabic Supplement"](v)||Pn["Arabic Extended-A"](v)||Pn["Arabic Presentation Forms-A"](v)||Pn["Arabic Presentation Forms-B"](v))));if(m.imageName){const t=r[m.imageName];if(!t)continue;E=m.imageName,e.iconsInText=e.iconsInText||!0,S=t.paddedRect;const i=t.displaySize;m.scale=m.scale*ll/d,x={width:i[0],height:i[1],left:1,top:-3,advance:T?i[1]:i[0]},_=l+(ll-i[1]*m.scale),k=x.advance;const n=T?i[0]*m.scale-ll*o:i[1]*m.scale-ll*o;n>0&&n>w&&(w=n)}else{const t=n[m.fontStack],e=t&&t[y];if(e&&e.rect)S=e.rect,x=e.metrics;else{const t=i[m.fontStack],e=t&&t[y];if(!e)continue;x=e.metrics}_=(o-m.scale)*ll}T?(e.verticalizable=!0,b.push({glyph:y,imageName:E,x:p,y:f+_,vertical:T,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:x,rect:S}),p+=k*m.scale+u):(b.push({glyph:y,imageName:E,x:p,y:f+_,vertical:T,scale:m.scale,fontStack:m.fontStack,sectionIndex:g,metrics:x,rect:S}),p+=x.advance*m.scale+u)}0!==b.length&&(m=Math.max(p-u,m),Yl(b,0,b.length-1,y,w)),p=0;const S=s*o+w;x.lineOffset=Math.max(w,l),f+=S,g=Math.max(S,g),++_}var v;const x=f-Bl,{horizontalAlign:b,verticalAlign:w}=Kl(a);(function(t,e,i,n,r,o,s,a,l){const c=(e-i)*r;let u=0;u=o!==s?-a*n-Bl:(-n*l+.5)*s;for(const e of t)for(const t of e.positionedGlyphs)t.x+=c,t.y+=u})(e.positionedLines,y,b,w,m,g,s,x,o.length),e.top+=-w*x,e.bottom=e.top+x,e.left+=-b*m,e.right=e.left+m}(w,i,n,r,_,a,l,c,d,u,p,g),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(b)&&w}const Vl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ql={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Zl(t,e,i,n,r,o){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*ll/o+r:0}{const n=i[e.fontStack],o=n&&n[t];return o?o.metrics.advance*e.scale+r:0}}function Gl(t,e,i,n){const r=Math.pow(t-e,2);return n?t<e?r/2:2*r:r+Math.abs(i)*i}function Hl(t,e,i){let n=0;return 10===t&&(n-=1e4),i&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Wl(t,e,i,n,r,o){let s=null,a=Gl(e,i,r,o);for(const t of n){const n=Gl(e-t.x,i,r,o)+t.badness;n<=a&&(s=t,a=n)}return{index:t,x:e,priorBreak:s,badness:a}}function Xl(t){return t?Xl(t.priorBreak).concat(t.index):[]}function Jl(t,e,i,n,r,o,s){if("point"!==o)return[];if(!t)return[];const a=[],l=function(t,e,i,n,r,o){let s=0;for(let i=0;i<t.length();i++){const a=t.getSection(i);s+=Zl(t.getCharCode(i),a,n,r,e,o)}return s/Math.max(1,Math.ceil(s/i))}(t,e,i,n,r,s),c=t.text.indexOf("")>=0;let u=0;for(let i=0;i<t.length();i++){const o=t.getSection(i),d=t.getCharCode(i);if(Vl[d]||(u+=Zl(d,o,n,r,e,s)),i<t.length()-1){const e=!((h=d)<11904||!(Pn["Bopomofo Extended"](h)||Pn.Bopomofo(h)||Pn["CJK Compatibility Forms"](h)||Pn["CJK Compatibility Ideographs"](h)||Pn["CJK Compatibility"](h)||Pn["CJK Radicals Supplement"](h)||Pn["CJK Strokes"](h)||Pn["CJK Symbols and Punctuation"](h)||Pn["CJK Unified Ideographs Extension A"](h)||Pn["CJK Unified Ideographs"](h)||Pn["Enclosed CJK Letters and Months"](h)||Pn["Halfwidth and Fullwidth Forms"](h)||Pn.Hiragana(h)||Pn["Ideographic Description Characters"](h)||Pn["Kangxi Radicals"](h)||Pn["Katakana Phonetic Extensions"](h)||Pn.Katakana(h)||Pn["Vertical Forms"](h)||Pn["Yi Radicals"](h)||Pn["Yi Syllables"](h)));(ql[d]||e||o.imageName)&&a.push(Wl(i+1,u,l,a,Hl(d,t.getCharCode(i+1),e&&c),!1))}}var h;return Xl(Wl(t.length(),u,l,a,0,!0))}function Kl(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 Yl(t,e,i,n,r){if(!n&&!r)return;const o=t[i],s=(t[i].x+o.metrics.advance*o.scale)*n;for(let n=e;n<=i;n++)t[n].x-=s,t[n].y+=r}function Ql(t,e,i){const{horizontalAlign:n,verticalAlign:r}=Kl(i),o=e[0]-t.displaySize[0]*n,s=e[1]-t.displaySize[1]*r;return{image:t,top:s,bottom:s+t.displaySize[1],left:o,right:o+t.displaySize[0]}}function tc(t,e,i,n,r,o){const s=t.image;let a;if(s.content){const t=s.content,e=s.pixelRatio||1;a=[t[0]/e,t[1]/e,s.displaySize[0]-t[2]/e,s.displaySize[1]-t[3]/e]}const l=e.left*o,c=e.right*o;let u,h,d,p;"width"===i||"both"===i?(p=r[0]+l-n[3],h=r[0]+c+n[1]):(p=r[0]+(l+c-s.displaySize[0])/2,h=p+s.displaySize[0]);const f=e.top*o,m=e.bottom*o;return"height"===i||"both"===i?(u=r[1]+f-n[0],d=r[1]+m+n[2]):(u=r[1]+(f+m-s.displaySize[1])/2,d=u+s.displaySize[1]),{image:s,top:u,right:h,bottom:d,left:p,collisionPadding:a}}const ec=128;function ic(t,e){const{expression:i}=e;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Qn(t+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:n}=i;let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let o=r;for(;o<e.length&&e[o]<t+1;)o++;o=Math.min(e.length-1,o);const s=e[r],a=e[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:a,minSize:i.evaluate(new Qn(s)),maxSize:i.evaluate(new Qn(a)),interpolationType:n}}}class nc extends k{constructor(t,e,i,n){super(t,e),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new nc(this.x,this.y,this.angle,this.segment)}}function rc(t,e,i,n,r){if(void 0===e.segment)return!0;let o=e,s=e.segment+1,a=0;for(;a>-i/2&&(s--,!(s<0));)a-=t[s].dist(o),o=t[s];s=Math.max(s,0),a+=t[s].dist(t[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const e=t[s-1],i=t[s],o=t[s+1];if(!o)break;let u=e.angleTo(i)-i.angleTo(o);for(u=Math.abs((u+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:u}),c+=u;a-l[0].distance>n;)c-=l.shift().angleDelta;if(c>r)return!1;s++,a+=i.dist(o)}return!0}function oc(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function sc(t,e,i){return t?.6*e*i:0}function ac(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function lc(t,e){return 0===t.x||t.x===e||0===t.y||t.y===e}function cc(t,e,i,n,r,o){const s=sc(i,r,o),a=ac(i,n)*o;let l=0;const c=oc(t)/2;for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1],o=n.dist(r);if(l+o>c){const u=(c-l)/o,h=ke(n.x,r.x,u),d=ke(n.y,r.y,u),p=new nc(h,d,r.angleTo(n),i);return p._round(),!s||rc(t,p,a,s,e)?p:void 0}l+=o}}function uc(t,e,i,n,r,o,s,a,l){const c=sc(n,o,s),u=ac(n,r),h=u*s,d=h/4,p=oc(t),f=lc(t[0],l),m=lc(t[t.length-1],l),g=f||m;let y;e=Math.max(e,h+e/4),y=g?f?e/2*a%e:(u/2+2*o)*s*a%e:(p-(1+2*Math.floor(p/e/2)-1)*e)/2;let _=0,v=y-e;const x=[];for(let n=0;n<t.length-1;n++){const r=t[n],o=t[n+1],s=r.dist(o),a=o.angleTo(r);for(;v+e<_+s;){v+=e;const u=(v-_)/s,f=ke(r.x,o.x,u),m=ke(r.y,o.y,u);if(f>=0&&f<l&&m>=0&&m<l&&v-d>=0&&v+d<=p){const e=new nc(f,m,a,n);e._round(),c&&!rc(t,e,h,c,i)||x.push(e)}}_+=s}return x}function hc(t,e,i,n,r){const o=[];for(let s=0;s<t.length;s++){const a=t[s];let l;for(let t=0;t<a.length-1;t++){let s=a[t],c=a[t+1];s.x<e&&c.x<e||(s.x<e?s=new k(e,s.y+(e-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x<e&&(c=new k(e,s.y+(e-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y<i&&c.y<i||(s.y<i?s=new k(s.x+(i-s.y)/(c.y-s.y)*(c.x-s.x),i)._round():c.y<i&&(c=new k(s.x+(i-s.y)/(c.y-s.y)*(c.x-s.x),i)._round()),s.x>=n&&c.x>=n||(s.x>=n?s=new k(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=n&&(c=new k(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=r&&c.y>=r||(s.y>=r?s=new k(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round():c.y>=r&&(c=new k(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}function dc(t,e,i,n){const r=[],o=t.image,s=o.pixelRatio,a=o.paddedRect.w-2,l=o.paddedRect.h-2,c=t.right-t.left,u=t.bottom-t.top,h=o.stretchX||[[0,a]],d=o.stretchY||[[0,l]],p=(t,e)=>t+e[1]-e[0],f=h.reduce(p,0),m=d.reduce(p,0),g=a-f,y=l-m;let _=0,v=f,x=0,b=m,w=0,S=g,E=0,T=y;if(o.content&&n){const t=o.content;_=pc(h,0,t[0]),x=pc(d,0,t[1]),v=pc(h,t[0],t[2]),b=pc(d,t[1],t[3]),w=t[0]-_,E=t[1]-x,S=t[2]-t[0]-v,T=t[3]-t[1]-b}const A=(n,r,a,l)=>{const h=mc(n.stretch-_,v,c,t.left),d=gc(n.fixed-w,S,n.stretch,f),p=mc(r.stretch-x,b,u,t.top),g=gc(r.fixed-E,T,r.stretch,m),y=mc(a.stretch-_,v,c,t.left),A=gc(a.fixed-w,S,a.stretch,f),I=mc(l.stretch-x,b,u,t.top),M=gc(l.fixed-E,T,l.stretch,m),C=new k(h,p),z=new k(y,p),P=new k(y,I),L=new k(h,I),D=new k(d/s,g/s),R=new k(A/s,M/s),O=e*Math.PI/180;if(O){const t=Math.sin(O),e=Math.cos(O),i=[e,-t,t,e];C._matMult(i),z._matMult(i),L._matMult(i),P._matMult(i)}const F=n.stretch+n.fixed,B=r.stretch+r.fixed;return{tl:C,tr:z,bl:L,br:P,tex:{x:o.paddedRect.x+1+F,y:o.paddedRect.y+1+B,w:a.stretch+a.fixed-F,h:l.stretch+l.fixed-B},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:S/s/c,minFontScaleY:T/s/u,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const t=fc(h,g,f),e=fc(d,y,m);for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let t=0;t<e.length-1;t++)r.push(A(n,e[t],o,e[t+1]))}}else r.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:a+1},{fixed:0,stretch:l+1}));return r}function pc(t,e,i){let n=0;for(const r of t)n+=Math.max(e,Math.min(i,r[1]))-Math.max(e,Math.min(i,r[0]));return n}function fc(t,e,i){const n=[{fixed:-1,stretch:0}];for(const[e,i]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(i-e)})}return n.push({fixed:e+1,stretch:i}),n}function mc(t,e,i,n){return t/e*i+n}function gc(t,e,i,n){return t-e*i/n}An("Anchor",nc);class yc{constructor(t,e,i,n,r,o,s,a,l,c){if(this.boxStartIndex=t.length,l){let t=o.top,e=o.bottom;const i=o.collisionPadding;i&&(t-=i[1],e+=i[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let l=o.top*s-a[0],u=o.bottom*s+a[2],h=o.left*s-a[3],d=o.right*s+a[1];const p=o.collisionPadding;if(p&&(h-=p[0]*s,l-=p[1]*s,d+=p[2]*s,u+=p[3]*s),c){const t=new k(h,l),e=new k(d,l),i=new k(h,u),n=new k(d,u),r=c*Math.PI/180;t._rotate(r),e._rotate(r),i._rotate(r),n._rotate(r),h=Math.min(t.x,e.x,i.x,n.x),d=Math.max(t.x,e.x,i.x,n.x),l=Math.min(t.y,e.y,i.y,n.y),u=Math.max(t.y,e.y,i.y,n.y)}t.emplaceBack(e.x,e.y,h,l,d,u,i,n,r)}this.boxEndIndex=t.length}}class _c{constructor(t=[],e=vc){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.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:i}=this,n=e[t];for(;t>0;){const r=t-1>>1,o=e[r];if(i(n,o)>=0)break;e[t]=o,t=r}e[t]=n}_down(t){const{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1),o=e[n];const s=n+1;if(s<this.length&&i(e[s],o)<0&&(n=s,o=e[s]),i(o,r)>=0)break;e[t]=o,t=n}e[t]=r}}function vc(t,e){return t<e?-1:t>e?1:0}function xc(t,e=1,i=!1){let n=1/0,r=1/0,o=-1/0,s=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const e=a[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<r)&&(r=e.y),(!t||e.x>o)&&(o=e.x),(!t||e.y>s)&&(s=e.y)}const l=Math.min(o-n,s-r);let c=l/2;const u=new _c([],bc);if(0===l)return new k(n,r);for(let e=n;e<o;e+=l)for(let i=r;i<s;i+=l)u.push(new wc(e+c,i+c,c,t));let h=function(t){let e=0,i=0,n=0;const r=t[0];for(let t=0,o=r.length,s=o-1;t<o;s=t++){const o=r[t],a=r[s],l=o.x*a.y-a.x*o.y;i+=(o.x+a.x)*l,n+=(o.y+a.y)*l,e+=3*l}return new wc(i/e,n/e,0,t)}(t),d=u.length;for(;u.length;){const n=u.pop();(n.d>h.d||!h.d)&&(h=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,d)),n.max-h.d<=e||(c=n.h/2,u.push(new wc(n.p.x-c,n.p.y-c,c,t)),u.push(new wc(n.p.x+c,n.p.y-c,c,t)),u.push(new wc(n.p.x-c,n.p.y+c,c,t)),u.push(new wc(n.p.x+c,n.p.y+c,c,t)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function bc(t,e){return e.max-t.max}function wc(t,e,i,n){this.p=new k(t,e),this.h=i,this.d=function(t,e){let i=!1,n=1/0;for(let r=0;r<e.length;r++){const o=e[r];for(let e=0,r=o.length,s=r-1;e<r;s=e++){const r=o[e],a=o[s];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),n=Math.min(n,ns(t,r,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}const Sc=Number.POSITIVE_INFINITY;function Ec(t,e){return e[1]!==Sc?function(t,e,i){let n=0,r=0;switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,r]}(t,e[0],e[1]):function(t,e){let i=0,n=0;e<0&&(e=0);const r=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=e;break;case"right":i=-e}return[i,n]}(t,e[0])}function kc(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 Tc(e,i,n,r,o,s,a,l,c,u,h){let d=s.textMaxSize.evaluate(i,{});void 0===d&&(d=a);const p=e.layers[0].layout,m=p.get("icon-offset").evaluate(i,{},h),g=Mc(n.horizontal),y=a/24,_=e.tilePixelRatio*y,v=e.tilePixelRatio*d/24,x=e.tilePixelRatio*l,b=e.tilePixelRatio*p.get("symbol-spacing"),w=p.get("text-padding")*e.tilePixelRatio,S=function(t,e,i,n=1){const r=t.get("icon-padding").evaluate(e,{},i),o=r&&r.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}(p,i,h,e.tilePixelRatio),E=p.get("text-max-angle")/180*Math.PI,k="viewport"!==p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),T="map"===p.get("icon-rotation-alignment")&&"point"!==p.get("symbol-placement"),A=p.get("symbol-placement"),I=b/2,M=p.get("icon-text-fit");let C;r&&"none"!==M&&(e.allowVerticalPlacement&&n.vertical&&(C=tc(r,n.vertical,M,p.get("icon-text-fit-padding"),m,y)),g&&(r=tc(r,g,M,p.get("icon-text-fit-padding"),m,y)));const z=(l,d)=>{d.x<0||d.x>=Vo||d.y<0||d.y>=Vo||function(e,i,n,r,o,s,a,l,c,u,h,d,p,m,g,y,_,v,x,b,w,S,E,k,T){const A=e.addToLineVertexArray(i,n);let I,M,C,z,P=0,L=0,D=0,R=0,O=-1,F=-1;const B={};let j=vo.exports(""),$=0,N=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[$,N]=l.layout.get("text-offset").evaluate(w,{},k).map((t=>t*ll)):($=l.layout.get("text-radial-offset").evaluate(w,{},k)*ll,N=Sc),e.allowVerticalPlacement&&r.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},k)+90;C=new yc(c,i,u,h,d,r.vertical,p,m,g,t),a&&(z=new yc(c,i,u,h,d,a,_,v,g,t))}if(o){const n=l.layout.get("icon-rotate").evaluate(w,{}),r="none"!==l.layout.get("icon-text-fit"),s=dc(o,n,E,r),p=a?dc(a,n,E,r):void 0;M=new yc(c,i,u,h,d,o,_,v,!1,n),P=4*s.length;const m=e.iconSizeData;let g=null;"source"===m.kind?(g=[ec*l.layout.get("icon-size").evaluate(w,{})],g[0]>Ac&&f(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===m.kind&&(g=[ec*S.compositeIconSizes[0].evaluate(w,{},k),ec*S.compositeIconSizes[1].evaluate(w,{},k)],(g[0]>Ac||g[1]>Ac)&&f(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,g,b,x,w,t.WritingMode.none,i,A.lineStartIndex,A.lineLength,-1,k),O=e.icon.placedSymbolArray.length-1,p&&(L=4*p.length,e.addSymbols(e.icon,p,g,b,x,w,t.WritingMode.vertical,i,A.lineStartIndex,A.lineLength,-1,k),F=e.icon.placedSymbolArray.length-1)}const U=Object.keys(r.horizontal);for(const n of U){const o=r.horizontal[n];if(!I){j=vo.exports(o.text);const t=l.layout.get("text-rotate").evaluate(w,{},k);I=new yc(c,i,u,h,d,o,p,m,g,t)}const a=1===o.positionedLines.length;if(D+=Ic(e,i,o,s,l,g,w,y,A,r.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,a?U:[n],B,O,S,k),a)break}r.vertical&&(R+=Ic(e,i,r.vertical,s,l,g,w,y,A,t.WritingMode.vertical,["vertical"],B,F,S,k));const V=I?I.boxStartIndex:e.collisionBoxArray.length,q=I?I.boxEndIndex:e.collisionBoxArray.length,Z=C?C.boxStartIndex:e.collisionBoxArray.length,G=C?C.boxEndIndex:e.collisionBoxArray.length,H=M?M.boxStartIndex:e.collisionBoxArray.length,W=M?M.boxEndIndex:e.collisionBoxArray.length,X=z?z.boxStartIndex:e.collisionBoxArray.length,J=z?z.boxEndIndex:e.collisionBoxArray.length;let K=-1;const Y=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;K=Y(I,K),K=Y(C,K),K=Y(M,K),K=Y(z,K);const Q=K>-1?1:0;Q&&(K*=T/ll),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,O,F,j,V,q,Z,G,H,W,X,J,u,D,R,P,L,Q,0,p,$,N,K,i.angle)}(e,d,l,n,r,o,C,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,_,[w,w,w,w],k,c,x,S,T,m,i,s,u,h,a)};if("line"===A)for(const t of hc(i.geometry,0,0,Vo,Vo)){const i=uc(t,b,E,n.vertical||g,r,24,v,e.overscaling,Vo);for(const n of i)g&&Cc(e,g.text,I,n)||z(t,n)}else if("line-center"===A){for(const t of i.geometry)if(t.length>1){const e=cc(t,E,n.vertical||g,r,24,v);e&&z(t,e)}}else if("Polygon"===i.type)for(const t of da(i.geometry,0)){const e=xc(t,16);z(t[0],new nc(e.x,e.y,0))}else if("LineString"===i.type)for(const t of i.geometry)z(t,new nc(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 nc(e.x,e.y,0))}const Ac=32640;function Ic(t,e,i,n,r,o,s,a,l,c,u,h,d,p,m){const g=function(t,e,i,n,r,o,s,a){const l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const o=n.rect||{};let u=4,h=!0,d=1,p=0;const f=(r||a)&&n.vertical,m=n.metrics.advance*n.scale/2;if(a&&e.verticalizable){const e=(n.scale-1)*ll,i=(ll-n.metrics.width*n.scale)/2;p=t.lineOffset/2-(n.imageName?-i:e)}if(n.imageName){const t=s[n.imageName];h=t.sdf,d=t.pixelRatio,u=1/d}const g=r?[n.x+m,n.y]:[0,0];let y=r?[0,0]:[n.x+m+i[0],n.y+i[1]-p],_=[0,0];f&&(_=y,y=[0,0]);const v=(n.metrics.left-u)*n.scale-m+y[0],x=(-n.metrics.top-u)*n.scale+y[1],b=v+o.w*n.scale/d,w=x+o.h*n.scale/d,S=new k(v,x),E=new k(b,x),T=new k(v,w),A=new k(b,w);if(f){const t=new k(-m,m-Bl),e=-Math.PI/2,i=12-m,r=new k(22-i,-(n.imageName?i:0)),o=new k(..._);S._rotateAround(e,t)._add(r)._add(o),E._rotateAround(e,t)._add(r)._add(o),T._rotateAround(e,t)._add(r)._add(o),A._rotateAround(e,t)._add(r)._add(o)}if(l){const t=Math.sin(l),e=Math.cos(l),i=[e,-t,t,e];S._matMult(i),E._matMult(i),T._matMult(i),A._matMult(i)}const I=new k(0,0),M=new k(0,0);c.push({tl:S,tr:E,bl:T,br:A,tex:o,writingMode:e.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:h,pixelOffsetTL:I,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return c}(0,i,a,r,o,s,n,t.allowVerticalPlacement),y=t.textSizeData;let _=null;"source"===y.kind?(_=[ec*r.layout.get("text-size").evaluate(s,{})],_[0]>Ac&&f(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===y.kind&&(_=[ec*p.compositeTextSizes[0].evaluate(s,{},m),ec*p.compositeTextSizes[1].evaluate(s,{},m)],(_[0]>Ac||_[1]>Ac)&&f(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,g,_,a,o,s,c,e,l.lineStartIndex,l.lineLength,d,m);for(const e of u)h[e]=t.text.placedSymbolArray.length-1;return 4*g.length}function Mc(t){for(const e in t)return t[e];return null}function Cc(t,e,i,n){const r=t.compareText;if(e in r){const t=r[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<i)return!0}else r[e]=[];return r[e].push(n),!1}const zc=wa.VectorTileFeature.types,Pc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Lc(t,e,i,n,r,o,s,a,l,c,u,h,d){const p=a?Math.min(Ac,Math.round(a[0])):0,f=a?Math.min(Ac,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*r),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function Dc(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 Rc(t){for(const e of t.sections)if($n(e.text))return!0;return!1}class Oc{constructor(t){this.layoutVertexArray=new so,this.indexArray=new ho,this.programConfigurations=t,this.segments=new go,this.dynamicLayoutVertexArray=new ao,this.opacityVertexArray=new lo,this.placedSymbolArray=new Gr}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,el.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,il.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Pc,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&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())}}An("SymbolBuffers",Oc);class Fc{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new go,this.collisionVertexArray=new uo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,nl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}An("CollisionBuffers",Fc);class Bc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.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=ms([]),this.placementViewportMatrix=ms([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ic(this.zoom,i["text-size"]),this.iconSizeData=ic(this.zoom,i["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap="never"!==Vc(n,"text-overlap","text-allow-overlap")||"never"!==Vc(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Oc(new $o(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new Oc(new $o(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Xr,this.lineVertexArray=new Jr,this.symbolInstances=new Wr}calculateGlyphDependencies(t,e,i,n,r){for(let o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(i||n)&&r){const i=al[t.charAt(o)];i&&(e[i.charCodeAt(0)]=!0)}}populate(e,i,n){const r=this.layers[0],o=r.layout,s=o.get("text-font"),a=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==a.value.kind||a.value.value instanceof Ft&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,m=new Qn(this.zoom);for(const{feature:i,id:a,index:l,sourceLayerIndex:g}of e){const e=r._featureFilter.needGeometry,y=Ho(i,e);if(!r._featureFilter.filter(m,y,n))continue;let _,v;if(e||(y.geometry=Go(i)),c){const t=r.getValueAndResolveTokens("text-field",y,n,f),e=Ft.factory(t);Rc(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Jn()||this.hasRTLText&&Yn.isParsed())&&(_=sl(e,r,y))}if(u){const t=r.getValueAndResolveTokens("icon-image",y,n,f);v=t instanceof jt?t:jt.fromString(t)}if(!_&&!v)continue;const x=this.sortFeaturesByKey?h.evaluate(y,{},n):void 0;if(this.features.push({id:a,text:_,icon:v,index:l,sourceLayerIndex:g,geometry:y.geometry,properties:i.properties,type:zc[i.type],sortKey:x}),v&&(d[v.name]=!0),_){const e=s.evaluate(y,{},n).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of _.sections)if(t.image)d[t.image.name]=!0;else{const n=Ln(_.toString()),r=t.fontStack||e,o=p[r]=p[r]||{};this.calculateGlyphDependencies(t.text,o,i,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(t){const e={},i={},n=[];let r=0;function o(e){n.push(t[e]),r++}function s(t,e,r){const o=i[t];return delete i[t],i[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function a(t,i,r){const o=e[i];return delete e[i],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(t,e,i){const n=i?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let c=0;c<t.length;c++){const u=t[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in i&&f in e&&i[p]!==e[f]){const t=a(p,f,h),r=s(p,f,n[t].geometry);delete e[p],delete i[f],i[l(d,n[r].geometry,!0)]=r,n[t].geometry=null}else p in i?s(p,f,h):f in e?a(p,f,h):(o(c),e[p]=r-1,i[f]=r-1)}return n.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]),n=t.dist(e[t.segment]);const r={};for(let n=t.segment+1;n<e.length;n++)r[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:i},n<e.length-1&&(i+=e[n+1].dist(e[n]));for(let i=t.segment||0;i>=0;i--)r[i]={x:e[i].x,y:e[i].y,tileUnitDistanceFromAnchor:n},i>0&&(n+=e[i-1].dist(e[i]));for(let t=0;t<e.length;t++){const e=r[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,i,n,r,o,s,a,l,c,u,h,d){const p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*i.length,f,p,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,y=m.vertexLength,_=this.allowVerticalPlacement&&a===t.WritingMode.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let t=0;t<i.length;t++){const{tl:r,tr:o,bl:a,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:S}=i[t],E=m.vertexLength,k=b[1];Lc(f,l.x,l.y,r.x,k+r.y,u.x,u.y,n,w,h.x,h.y,y,x),Lc(f,l.x,l.y,o.x,k+o.y,u.x+u.w,u.y,n,w,g.x,h.y,y,x),Lc(f,l.x,l.y,a.x,k+a.y,u.x,u.y+u.h,n,w,h.x,g.y,y,x),Lc(f,l.x,l.y,c.x,k+c.y,u.x+u.w,u.y+u.h,n,w,g.x,g.y,y,x),Dc(e.dynamicLayoutVertexArray,l,_),p.emplaceBack(E,E+1,E+2),p.emplaceBack(E+1,E+2,E+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),t!==i.length-1&&S===i[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(f.length,s,s.index,{},d,v&&v[S])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,y,c,u,l.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],a,0,!1,0,h)}_addCollisionDebugVertex(t,e,i,n,r,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,n,r,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,n,r,o,s){const a=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=a.vertexLength,c=r.layoutVertexArray,u=r.collisionVertexArray,h=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(c,u,o,h,d,new k(t,e)),this._addCollisionDebugVertex(c,u,o,h,d,new k(i,e)),this._addCollisionDebugVertex(c,u,o,h,d,new k(i,n)),this._addCollisionDebugVertex(c,u,o,h,d,new k(t,n)),a.vertexLength+=4;const p=r.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),a.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,n){for(let r=t;r<e;r++){const t=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Fc(co,rl.members,po),this.iconCollisionBox=new Fc(co,rl.members,po);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,n,r,o,s,a,l){const c={};for(let n=e;n<i;n++){const e=t.get(n);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=n;e<r;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=o;e<s;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),n=i.vertexStartIndex+4*i.numGlyphs;for(let e=i.vertexStartIndex;e<n;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),n=[],r=[],o=[];for(let t=0;t<this.symbolInstances.length;++t){o.push(t);const s=this.symbolInstances.get(t);n.push(0|Math.round(e*s.anchorX+i*s.anchorY)),r.push(s.featureIndex)}return o.sort(((t,e)=>n[t]-n[e]||r[e]-r[t])),o}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)}}}An("SymbolBucket",Bc,{omit:["layers","collisionBoxArray","features","compareText"]}),Bc.addDynamicAttributes=Dc;const jc=new pr({"symbol-placement":new lr(nt.layout_symbol["symbol-placement"]),"symbol-spacing":new lr(nt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new lr(nt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new cr(nt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new lr(nt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new lr(nt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new lr(nt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new lr(nt.layout_symbol["icon-ignore-placement"]),"icon-optional":new lr(nt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new lr(nt.layout_symbol["icon-rotation-alignment"]),"icon-size":new cr(nt.layout_symbol["icon-size"]),"icon-text-fit":new lr(nt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new lr(nt.layout_symbol["icon-text-fit-padding"]),"icon-image":new cr(nt.layout_symbol["icon-image"]),"icon-rotate":new cr(nt.layout_symbol["icon-rotate"]),"icon-padding":new cr(nt.layout_symbol["icon-padding"]),"icon-keep-upright":new lr(nt.layout_symbol["icon-keep-upright"]),"icon-offset":new cr(nt.layout_symbol["icon-offset"]),"icon-anchor":new cr(nt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new lr(nt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new lr(nt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new lr(nt.layout_symbol["text-rotation-alignment"]),"text-field":new cr(nt.layout_symbol["text-field"]),"text-font":new cr(nt.layout_symbol["text-font"]),"text-size":new cr(nt.layout_symbol["text-size"]),"text-max-width":new cr(nt.layout_symbol["text-max-width"]),"text-line-height":new lr(nt.layout_symbol["text-line-height"]),"text-letter-spacing":new cr(nt.layout_symbol["text-letter-spacing"]),"text-justify":new cr(nt.layout_symbol["text-justify"]),"text-radial-offset":new cr(nt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new lr(nt.layout_symbol["text-variable-anchor"]),"text-anchor":new cr(nt.layout_symbol["text-anchor"]),"text-max-angle":new lr(nt.layout_symbol["text-max-angle"]),"text-writing-mode":new lr(nt.layout_symbol["text-writing-mode"]),"text-rotate":new cr(nt.layout_symbol["text-rotate"]),"text-padding":new lr(nt.layout_symbol["text-padding"]),"text-keep-upright":new lr(nt.layout_symbol["text-keep-upright"]),"text-transform":new cr(nt.layout_symbol["text-transform"]),"text-offset":new cr(nt.layout_symbol["text-offset"]),"text-allow-overlap":new lr(nt.layout_symbol["text-allow-overlap"]),"text-overlap":new lr(nt.layout_symbol["text-overlap"]),"text-ignore-placement":new lr(nt.layout_symbol["text-ignore-placement"]),"text-optional":new lr(nt.layout_symbol["text-optional"])});var $c={paint:new pr({"icon-opacity":new cr(nt.paint_symbol["icon-opacity"]),"icon-color":new cr(nt.paint_symbol["icon-color"]),"icon-halo-color":new cr(nt.paint_symbol["icon-halo-color"]),"icon-halo-width":new cr(nt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new cr(nt.paint_symbol["icon-halo-blur"]),"icon-translate":new lr(nt.paint_symbol["icon-translate"]),"icon-translate-anchor":new lr(nt.paint_symbol["icon-translate-anchor"]),"text-opacity":new cr(nt.paint_symbol["text-opacity"]),"text-color":new cr(nt.paint_symbol["text-color"],{runtimeType:mt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new cr(nt.paint_symbol["text-halo-color"]),"text-halo-width":new cr(nt.paint_symbol["text-halo-width"]),"text-halo-blur":new cr(nt.paint_symbol["text-halo-blur"]),"text-translate":new lr(nt.paint_symbol["text-translate"]),"text-translate-anchor":new lr(nt.paint_symbol["text-translate-anchor"])}),layout:jc};class Nc{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:ht,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}}An("FormatSectionOverride",Nc,{omit:["defaultValue"]});class Uc extends mr{constructor(t){super(t,$c)}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,n){const r=this.layout.get(t).evaluate(e,{},i,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Li(o.value)||!r?r:function(t,e){return e.replace(/{([^{}]+)}/g,((e,i)=>i in t?String(t[i]):""))}(e.properties,r)}createBucket(t){return new Bc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of $c.paint.overridableProperties){if(!Uc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),i=new Nc(e),n=new Pi(i,e.property.specification);let r=null;r="constant"===e.value.kind||"source"===e.value.kind?new Ri("source",n):new Oi("composite",n,e.value.zoomStops),this.paint._values[t]=new sr(e.property,r,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Uc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const i=t.get("text-field"),n=$c.paint.properties[e];let r=!1;const o=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof Ft)o(i.value.value.sections);else if("source"===i.value.kind){const t=e=>{r||(e instanceof qt&&Ut(e.value)===vt?o(e.value.sections):e instanceof ui?o(e.sections):e.eachChild(t))},e=i.value;e._styleExpression&&t(e._styleExpression.expression)}return r}}function Vc(t,e,i){let n="never";const r=t.get(e);return r?n=r:t.get(i)&&(n="always"),n}var qc={paint:new pr({"background-color":new lr(nt.paint_background["background-color"]),"background-pattern":new hr(nt.paint_background["background-pattern"]),"background-opacity":new lr(nt.paint_background["background-opacity"])})},Zc={paint:new pr({"raster-opacity":new lr(nt.paint_raster["raster-opacity"]),"raster-hue-rotate":new lr(nt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new lr(nt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new lr(nt.paint_raster["raster-brightness-max"]),"raster-saturation":new lr(nt.paint_raster["raster-saturation"]),"raster-contrast":new lr(nt.paint_raster["raster-contrast"]),"raster-resampling":new lr(nt.paint_raster["raster-resampling"]),"raster-fade-duration":new lr(nt.paint_raster["raster-fade-duration"])})};class Gc extends mr{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")}}const Hc={circle:class extends mr{constructor(t){super(t,hs)}createBucket(t){return new Xo(t)}queryRadius(t){const e=t;return as("circle-radius",this,e)+as("circle-stroke-width",this,e)+ls(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,r,o,s,a){const l=cs(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,s),c=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),u="map"===this.paint.get("circle-pitch-alignment"),h=u?l:function(t,e){return t.map((t=>Ss(t,e)))}(l,a),d=u?c*s:c;for(const t of n)for(const e of t){const t=u?e:Ss(e,a);let i=d;const n=bs([],[e.x,e.y,0,1],a);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=n[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=o.cameraToCenterDistance/n[3]),Ko(h,t,i))return!0}return!1}},heatmap:class extends mr{constructor(t){super(t,ks),this._updateColorRamp()}createBucket(t){return new Es(t)}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=zs({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},hillshade:class extends mr{constructor(t){super(t,Ps)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends mr{constructor(t){super(t,_a)}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 ga(t)}queryRadius(){return ls(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,r,o,s){return Yo(cs(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,s),n)}isTileClipped(){return!0}},"fill-extrusion":class extends mr{constructor(t){super(t,$a)}createBucket(t){return new Fa(t)}queryRadius(){return ls(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,e,i,n,r,o,s,a){const l=cs(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(e,i),u=this.paint.get("fill-extrusion-base").evaluate(e,i),h=function(t,e,i,n){const r=[];for(const i of t){const t=[i.x,i.y,0,1];bs(t,t,e),r.push(new k(t[0]/t[3],t[1]/t[3]))}return r}(l,a),d=function(t,e,i,n){const r=[],o=[],s=n[8]*e,a=n[9]*e,l=n[10]*e,c=n[11]*e,u=n[8]*i,h=n[9]*i,d=n[10]*i,p=n[11]*i;for(const e of t){const t=[],i=[];for(const r of e){const e=r.x,o=r.y,f=n[0]*e+n[4]*o+n[12],m=n[1]*e+n[5]*o+n[13],g=n[2]*e+n[6]*o+n[14],y=n[3]*e+n[7]*o+n[15],_=g+l,v=y+c,x=f+u,b=m+h,w=g+d,S=y+p,E=new k((f+s)/v,(m+a)/v);E.z=_/v,t.push(E);const T=new k(x/S,b/S);T.z=w/S,i.push(T)}r.push(t),o.push(i)}return[r,o]}(n,u,c,a);return function(t,e,i){let n=1/0;Yo(i,e)&&(n=Ua(i,e[0]));for(let r=0;r<e.length;r++){const o=e[r],s=t[r];for(let t=0;t<o.length-1;t++){const e=o[t],r=[e,o[t+1],s[t+1],s[t],e];Jo(i,r)&&(n=Math.min(n,Ua(i,r)))}}return n!==1/0&&n}(d[0],d[1],h)}},line:class extends mr{constructor(t){super(t,Ya),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ee,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"]=Qa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Ja(t)}queryRadius(t){const e=t,i=tl(as("line-width",this,e),as("line-gap-width",this,e)),n=as("line-offset",this,e);return i/2+Math.abs(n)+ls(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,r,o,s){const a=cs(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,s),l=s/2*tl(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(n=function(t,e){const i=[];for(let n=0;n<t.length;n++){const r=t[n],o=[];for(let t=0;t<r.length;t++){const i=r[t-1],n=r[t],s=r[t+1],a=0===t?new k(0,0):n.sub(i)._unit()._perp(),l=t===r.length-1?new k(0,0):s.sub(n)._unit()._perp(),c=a._add(l)._unit(),u=c.x*l.x+c.y*l.y;0!==u&&c._mult(1/u),o.push(c._mult(e)._add(n))}i.push(o)}return i}(n,c*s)),function(t,e,i){for(let n=0;n<e.length;n++){const r=e[n];if(t.length>=3)for(let e=0;e<r.length;e++)if(os(t,r[e]))return!0;if(Qo(t,r,i))return!0}return!1}(a,n,l)}isTileClipped(){return!0}},symbol:Uc,background:class extends mr{constructor(t){super(t,qc)}},raster:class extends mr{constructor(t){super(t,Zc)}}};class Wc{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}}const Xc=6371008.8;class Jc{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 Jc(s(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,n=t.lat*e,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Xc*Math.acos(Math.min(r,1))}toBounds(t=0){const e=360*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return new Kc(new Jc(this.lng-i,this.lat-e),new Jc(this.lng+i,this.lat+e))}static convert(t){if(t instanceof Jc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Jc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Jc(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>]")}}class Kc{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):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 Jc?new Jc(t.lng,t.lat):Jc.convert(t),this}setSouthWest(t){return this._sw=t instanceof Jc?new Jc(t.lng,t.lat):Jc.convert(t),this}extend(t){const e=this._sw,i=this._ne;let n,r;if(t instanceof Jc)n=t,r=t;else{if(!(t instanceof Kc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Kc.convert(t)):this.extend(Jc.convert(t)):this;if(n=t._sw,r=t._ne,!n||!r)return this}return e||i?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Jc(n.lng,n.lat),this._ne=new Jc(r.lng,r.lat)),this}getCenter(){return new Jc((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 Jc(this.getWest(),this.getNorth())}getSouthEast(){return new Jc(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:e,lat:i}=Jc.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(t){return t instanceof Kc?t:t?new Kc(t):t}}const Yc=2*Math.PI*Xc;function Qc(t){return Yc*Math.cos(t*Math.PI/180)}function tu(t){return(180+t)/360}function eu(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function iu(t,e){return t/Qc(e)}function nu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class ru{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){const i=Jc.convert(t);return new ru(tu(i.lng),eu(i.lat),iu(e,i.lat))}toLngLat(){return new Jc(360*this.x-180,nu(this.y))}toAltitude(){return this.z*Qc(nu(this.y))}meterInMercatorCoordinateUnits(){return 1/Yc*(t=nu(this.y),1/Math.cos(t*Math.PI/180));var t}}function ou(t,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class su{constructor(t,e,i){if(t<0||t>25||i<0||i>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))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=cu(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 n=(o=this.y,s=this.z,a=ou(256*(r=this.x),256*(o=Math.pow(2,s)-o-1),s),l=ou(256*(r+1),256*(o+1),s),a[0]+","+a[1]+","+l[0]+","+l[1]);var r,o,s,a,l;const c=function(t,e,i){let n,r="";for(let o=t;o>0;o--)n=1<<o-1,r+=(e&n?1:0)+(i&n?2:0);return r}(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,n)}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 k((t.x*e-this.x)*Vo,(t.y*e-this.y)*Vo)}toString(){return`${this.z}/${this.x}/${this.y}`}}class au{constructor(t,e){this.wrap=t,this.canonical=e,this.key=cu(t,e.z,e.z,e.x,e.y)}}class lu{constructor(t,e,i,n,r){if(t<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new su(i,+n,+r),this.key=cu(e,t,i,n,r)}clone(){return new lu(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 lu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new lu(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?cu(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):cu(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 lu(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,n=2*this.canonical.y;return[new lu(e,this.wrap,e,i,n),new lu(e,this.wrap,e,i+1,n),new lu(e,this.wrap,e,i,n+1),new lu(e,this.wrap,e,i+1,n+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 lu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new lu(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 au(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ru(t.x-this.wrap,t.y))}}function cu(t,e,i,n,r){(t*=2)<0&&(t=-1*t-1);const o=1<<i;return(o*o*t+o*r+n).toString(36)+i.toString(36)+e.toString(36)}An("CanonicalTileID",su),An("OverscaledTileID",lu,{omit:["posMatrix"]});class uu{constructor(t,e,i){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return void f(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=i||"mapbox";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<n;t++)for(let e=0;e<n;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),n=4*this._idx(t,e);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(i[n],i[n+1],i[n+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_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)}_unpackMapbox(t,e,i){return(256*t*256+256*e+i)/10-1e4}_unpackTerrarium(t,e,i){return 256*t+e+i/256-32768}getPixels(){return new Cs({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 n=e*this.dim,r=e*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(e){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-e*this.dim,l=-i*this.dim;for(let e=o;e<s;e++)for(let i=n;i<r;i++)this.data[this._idx(i,e)]=t.data[this._idx(i+a,e+l)]}}An("DEMData",uu);class hu{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 du{constructor(t,e,i,n,r){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=i,t._y=n,this.properties=t.properties,this.id=r}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 pu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new kn(Vo,16,0),this.grid3D=new kn(Vo,16,0),this.featureIndexArray=new Yr,this.promoteId=e}insert(t,e,i,n,r,o){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,r);const a=o?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const i=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<i.length;t++){const e=i[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}n[0]<Vo&&n[1]<Vo&&n[2]>=0&&n[3]>=0&&a.insert(s,n[0],n[1],n[2],n[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new wa.VectorTile(new cl(this.rawTileData)).layers,this.sourceLayerCoder=new hu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,i,n){this.loadVTLayers();const r=t.params||{},o=Vo/t.tileSize/t.scale,s=Wi(r.filter),a=t.queryGeometry,l=t.queryPadding*o,c=mu(a),u=this.grid.query(c.minX-l,c.minY-l,c.maxX+l,c.maxY+l),h=mu(t.cameraQueryGeometry),d=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((e,i,n,r)=>function(t,e,i,n,r){for(const o of t)if(e<=o.x&&i<=o.y&&n>=o.x&&r>=o.y)return!0;const o=[new k(e,i),new k(e,r),new k(n,r),new k(n,i)];if(t.length>2)for(const e of o)if(os(t,e))return!0;for(let e=0;e<t.length-1;e++)if(ss(t[e],t[e+1],o))return!0;return!1}(t.cameraQueryGeometry,e-l,i-l,n+l,r+l)));for(const t of d)u.push(t);u.sort(gu);const p={};let f;for(let l=0;l<u.length;l++){const c=u[l];if(c===f)continue;f=c;const h=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(p,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,s,r.layers,r.availableImages,e,i,n,((e,i,n)=>(d||(d=Go(e)),i.queryIntersectsFeature(a,e,n,d,this.z,t.transform,o,t.pixelPosMatrix))))}return p}loadMatchingFeature(t,e,i,n,r,o,s,l,c,u,h){const d=this.bucketLayerIDs[e];if(o&&!function(t,e){for(let i=0;i<t.length;i++)if(e.indexOf(t[i])>=0)return!0;return!1}(o,d))return;const p=this.sourceLayerCoder.decode(i),f=this.vtLayers[p].feature(n);if(r.needGeometry){const t=Ho(f,!0);if(!r.filter(new Qn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Qn(this.tileID.overscaledZ),f))return;const m=this.getId(f,p);for(let e=0;e<d.length;e++){const i=d[e];if(o&&o.indexOf(i)<0)continue;const r=l[i];if(!r)continue;let p={};m&&u&&(p=u.getState(r.sourceLayer||"_geojsonTileLayer",m));const g=a({},c[i]);g.paint=fu(g.paint,r.paint,f,p,s),g.layout=fu(g.layout,r.layout,f,p,s);const y=!h||h(f,r,p);if(!y)continue;const _=new du(f,this.z,this.x,this.y,m);_.layer=g;let v=t[i];void 0===v&&(v=t[i]=[]),v.push({featureIndex:n,feature:_,intersectionZ:y})}}lookupSymbolFeatures(t,e,i,n,r,o,s,a){const l={};this.loadVTLayers();const c=Wi(r);for(const r of t)this.loadMatchingFeature(l,i,n,r,c,o,s,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 fu(t,e,i,n,r){return u(t,((t,o)=>{const s=e instanceof ar?e.get(o):null;return s&&s.evaluate?s.evaluate(i,n,r):s}))}function mu(t){let e=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),r=Math.max(r,o.y);return{minX:e,minY:i,maxX:n,maxY:r}}function gu(t,e){return e-t}var yu;An("FeatureIndex",pu,{omit:["rawTileData","sourceLayerCoder"]}),t.PerformanceMarkers=void 0,(yu=t.PerformanceMarkers||(t.PerformanceMarkers={})).create="create",yu.load="load",yu.fullLoad="fullLoad";let _u=null,vu=[];const xu=1e3/30,bu={mark(t){performance.mark(t)},frame(t){const e=t;null!=_u&&vu.push(e-_u),_u=e},clearMetrics(){_u=null,vu=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e])},getPerformanceMetrics(){performance.measure("loadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure("fullLoadTime",t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName("loadTime")[0].duration,i=performance.getEntriesByName("fullLoadTime")[0].duration,n=vu.length,r=1/(vu.reduce(((t,e)=>t+e),0)/n/1e3),o=vu.filter((t=>t>xu)).reduce(((t,e)=>t+(e-xu)/xu),0);return{loadTime:e,fullLoadTime:i,fps:r,percentDroppedFrames:o/(n+o)*100}}};t.AJAXError=U,t.ARRAY_TYPE=ps,t.Actor=class{constructor(t,e,i){this.target=t,this.parent=e,this.mapId=i,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},c(["receive","process"],this),this.invoker=new Wc(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=y()?t:window}send(t,e,i,n,r=!1){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(this.callbacks[o]=i);const s=w(this.globalScope)?void 0:[];return this.target.postMessage({id:o,type:t,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:Mn(e,s)},s),{cancel:()=>{i&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data,i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[i];const t=this.cancelCallbacks[i];delete this.cancelCallbacks[i],t&&t()}else y()||e.mustQueue?(this.tasks[i]=e,this.taskQueue.push(i),this.invoker.trigger()):this.processTask(i,e)}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){if("<response>"===e.type){const i=this.callbacks[t];delete this.callbacks[t],i&&(e.error?i(Cn(e.error)):i(null,Cn(e.data)))}else{let i=!1;const n=w(this.globalScope)?void 0:[],r=e.hasCallback?(e,r)=>{i=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?Mn(e):null,data:Mn(r,n)},n)}:t=>{i=!0};let o=null;const s=Cn(e.data);if(this.parent[e.type])o=this.parent[e.type](e.sourceMapId,s,r);else if(this.parent.getWorkerSource){const t=e.type.split(".");o=this.parent.getWorkerSource(e.sourceMapId,t[0],s.source)[t[1]](s,r)}else r(new Error(`Could not find function ${e.type}`));!i&&o&&o.cancel&&(this.cancelCallbacks[t]=o.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},t.AlphaImage=Ms,t.CanonicalTileID=su,t.CollisionBoxArray=qr,t.CollisionCircleLayoutArray=class extends Pr{},t.Color=Dt,t.DEMData=uu,t.DataConstantProperty=lr,t.DictionaryCoder=hu,t.EXTENT=Vo,t.ErrorEvent=et,t.EvaluationParameters=Qn,t.Event=tt,t.Evented=it,t.FeatureIndex=pu,t.FillBucket=ga,t.FillExtrusionBucket=Fa,t.GeoJSONFeature=du,t.ImageAtlas=Fl,t.ImagePosition=Ol,t.LineBucket=Ja,t.LineStripIndexArray=class extends Nr{},t.LngLat=Jc,t.LngLatBounds=Kc,t.MercatorCoordinate=ru,t.ONE_EM=ll,t.OverscaledTileID=lu,t.PerformanceUtils=bu,t.PosArray=Qr,t.Properties=pr,t.QuadTriangleArray=class extends Dr{},t.RGBAImage=Cs,t.RasterBoundsArray=class extends wr{},t.RequestPerformance=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.ResourceType=N,t.SegmentVector=go,t.SymbolBucket=Bc,t.Transitionable=ir,t.TriangleIndexArray=ho,t.Uniform1f=Mo,t.Uniform1i=class extends Io{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}},t.Uniform2f=class extends Io{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.Uniform3f=class extends Io{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.Uniform4f=Co,t.UniformColor=zo,t.UniformMatrix4f=class extends Io{constructor(t,e){super(t,e),this.current=Po}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.UnwrappedTileID=au,t.ValidationError=rt,t.ZoomHistory=zn,t.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},t.addDynamicAttributes=Dc,t.asyncAll=function(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const r=new Array(t.length);let o=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(o=t),r[s]=e,0==--n&&i(o,r)}))}))},t.bezier=n,t.bindAll=c,t.cacheEntryPossiblyAdded=function(t){D++,D>P&&(t.getActor().send("enforceCacheSizeLimit",z),D=0)},t.calculateBreakLines=function(t,e,i,n,r,o,s,a){const l=n*ll,c=i*ll,u=Ft.fromString(t),h=$l.fromFeature(u,e);return Nl(h,Jl(h,c,l,s,a,o,r))},t.clamp=o,t.clearTileCache=function(t){const e=caches.delete(I);t&&e.catch(t).then((()=>t()))},t.clipLine=hc,t.clone=function(t){var e=new ps(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.clone$1=d,t.clone$2=function(t){var e=new ps(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=ol,t.config=A,t.copy=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.create=function(){var t=new ps(16);return ps!=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.create$1=fs,t.createExpression=Di,t.createFilter=Wi,t.createLayout=vr,t.createStyleLayer=function(t){return"custom"===t.type?new Gc(t):new Hc[t.type](t)},t.cross=function(t,e,i){var n=e[0],r=e[1],o=e[2],s=i[0],a=i[1],l=i[2];return t[0]=r*l-o*a,t[1]=o*s-n*l,t[2]=n*a-r*s,t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=r,t.emitValidationErrors=En,t.enforceCacheSizeLimit=function(t){L(),M&&M.then((e=>{e.keys().then((i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])}))}))},t.equals=function(t,e){var i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],_=e[0],v=e[1],x=e[2],b=e[3],w=e[4],S=e[5],E=e[6],k=e[7],T=e[8],A=e[9],I=e[10],M=e[11],C=e[12],z=e[13],P=e[14],L=e[15];return Math.abs(i-_)<=ds*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-v)<=ds*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-x)<=ds*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(o-b)<=ds*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=ds*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-S)<=ds*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(l-E)<=ds*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-k)<=ds*Math.max(1,Math.abs(c),Math.abs(k))&&Math.abs(u-T)<=ds*Math.max(1,Math.abs(u),Math.abs(T))&&Math.abs(h-A)<=ds*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-I)<=ds*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-M)<=ds*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(f-C)<=ds*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(m-z)<=ds*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(g-P)<=ds*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(y-L)<=ds*Math.max(1,Math.abs(y),Math.abs(L))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:r}){return"source"===t.kind?n/ec:"composite"===t.kind?ke(n/ec,r/ec,i):e},t.evaluateSizeForZoom=function(t,e){let i=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){const{interpolationType:r,minZoom:s,maxZoom:a}=t,l=r?o(qe.interpolationFactor(r,e,s,a),0,1):0;"camera"===t.kind?n=ke(t.minSize,t.maxSize,l):i=l}return{uSizeT:i,uSize:n}},t.evaluateVariableOffset=Ec,t.evented=Xn,t.exported=E,t.exported$1=R,t.extend=a,t.filterObject=h,t.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.fromScaling=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.getAnchorAlignment=Kl,t.getAnchorJustification=kc,t.getArrayBuffer=G,t.getImage=K,t.getJSON=function(t,e){return Z(a(t,{type:"json"}),e)},t.getOverlapMode=Vc,t.getRTLTextPluginStatus=Jn,t.getReferrer=V,t.getVideo=function(t,e){const i=window.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let e=0;e<t.length;e++){const n=window.document.createElement("source");H(t[e])||(i.crossOrigin="Anonymous"),n.src=t[e],i.appendChild(n)}return{cancel:()=>{}}},t.identity=ms,t.invert=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],y=e[15],_=i*a-n*s,v=i*l-r*s,x=i*c-o*s,b=n*l-r*a,w=n*c-o*a,S=r*c-o*l,E=u*m-h*f,k=u*g-d*f,T=u*y-p*f,A=h*g-d*m,I=h*y-p*m,M=d*y-p*g,C=_*M-v*I+x*A+b*T-w*k+S*E;return C?(t[0]=(a*M-l*I+c*A)*(C=1/C),t[1]=(r*I-n*M-o*A)*C,t[2]=(m*S-g*w+y*b)*C,t[3]=(d*w-h*S-p*b)*C,t[4]=(l*T-s*M-c*k)*C,t[5]=(i*M-r*T+o*k)*C,t[6]=(g*x-f*S-y*v)*C,t[7]=(u*S-d*x+p*v)*C,t[8]=(s*I-a*T+c*E)*C,t[9]=(n*T-i*I-o*E)*C,t[10]=(f*w-m*x+y*_)*C,t[11]=(h*x-u*w-p*_)*C,t[12]=(a*k-s*A-l*E)*C,t[13]=(i*A-n*k+r*E)*C,t[14]=(m*v-f*b-g*_)*C,t[15]=(u*b-h*v+d*_)*C,t):null},t.isImageBitmap=S,t.isSafari=w,t.isWorker=y,t.keysDifference=function(t,e){const i=[];for(const n in t)n in e||i.push(n);return i},t.lazyLoadRTLTextPlugin=function(){Yn.isLoading()||Yn.isLoaded()||"deferred"!==Jn()||Kn()},t.makeRequest=Z,t.mapObject=u,t.mercatorXfromLng=tu,t.mercatorYfromLat=eu,t.mercatorZfromAltitude=iu,t.mul=_s,t.mul$1=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.multiply=gs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var i=e[0],n=e[1],r=e[2],o=i*i+n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=ke,t.ortho=function(t,e,i,n,r,o,s){var a=1/(e-i),l=1/(n-r),c=1/(o-s);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]=(r+n)*l,t[14]=(s+o)*c,t[15]=1,t},t.parseCacheControl=_,t.parseGlyphPbf=function(t){return new cl(t).readFields(Pl,[])},t.pbf=cl,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=Vo/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const i=e.bucket.layers[0].layout,n=e.bucket.layers[0].metadata||{},r=e.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Qn(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Qn(t),e.canonical),r["text-size"].possiblyEvaluate(new Qn(i),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Qn(t),e.canonical),r["icon-size"].possiblyEvaluate(new Qn(i),e.canonical)]}const s=i.get("text-line-height")*ll,a="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),l=i.get("text-keep-upright"),c=i.get("text-size");for(const r of e.bucket.features){const u=i.get("text-font").evaluate(r,{},e.canonical).join(","),h=c.evaluate(r,{},e.canonical),d=o.layoutTextSize.evaluate(r,{},e.canonical),p=o.layoutIconSize.evaluate(r,{},e.canonical),m={horizontal:{},vertical:void 0},g=r.text;let y,_=[0,0];if(g){const o=g.toString(),c=n["text-letter-spacing-correction"]||0,p=(i.get("text-letter-spacing").evaluate(r,{},e.canonical)+c)*ll,f=Dn(o)?p:0,y=i.get("text-anchor").evaluate(r,{},e.canonical),v=i.get("text-variable-anchor");if(!v){const t=i.get("text-radial-offset").evaluate(r,{},e.canonical);_=t?Ec(y,[t*ll,Sc]):i.get("text-offset").evaluate(r,{},e.canonical).map((t=>t*ll))}let x=a?"center":i.get("text-justify").evaluate(r,{},e.canonical);const b=i.get("symbol-placement"),w="point"===b?i.get("text-max-width").evaluate(r,{},e.canonical)*ll:0,S=()=>{e.bucket.allowVerticalPlacement&&Ln(o)&&(m.vertical=Ul(g,e.glyphMap,e.glyphPositions,e.imagePositions,u,w,s,y,"left",f,_,t.WritingMode.vertical,!0,b,d,h))};if(!a&&v){const i="auto"===x?v.map((t=>kc(t))):[x];let n=!1;for(let r=0;r<i.length;r++){const o=i[r];if(!m.horizontal[o])if(n)m.horizontal[o]=m.horizontal[0];else{const i=Ul(g,e.glyphMap,e.glyphPositions,e.imagePositions,u,w,s,"center",o,f,_,t.WritingMode.horizontal,!1,b,d,h);i&&(m.horizontal[o]=i,n=1===i.positionedLines.length)}}S()}else{"auto"===x&&(x=kc(y));const i=Ul(g,e.glyphMap,e.glyphPositions,e.imagePositions,u,w,s,y,x,f,_,t.WritingMode.horizontal,!1,b,d,h);i&&(m.horizontal[x]=i),S(),Ln(o)&&a&&l&&(m.vertical=Ul(g,e.glyphMap,e.glyphPositions,e.imagePositions,u,w,s,y,x,f,_,t.WritingMode.vertical,!1,b,d,h))}}let v=!1;if(r.icon&&r.icon.name){const t=e.imageMap[r.icon.name];if(t){y=Ql(e.imagePositions[r.icon.name],i.get("icon-offset").evaluate(r,{},e.canonical),i.get("icon-anchor").evaluate(r,{},e.canonical)),v=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&f("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer");const n=void 0!==r.properties?r.properties["icon-rotate"]:void 0,o=void 0!==n?n:i.get("icon-rotate").constantOr(1),s=void 0!==r.properties?r.properties["icon-size"]:void 0,a=void 0!==s?s:i.get("icon-size").constantOr(1);(t.pixelRatio!==e.bucket.pixelRatio||0!==o||1!==a)&&(e.bucket.iconsNeedLinear=!0)}}const x=Mc(m.horizontal)||m.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||y)&&Tc(e.bucket,r,m,y,e.imageMap,o,d,p,_,v,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()},t.perspective=function(t,e,i,n,r){var o,s=1/Math.tan(e/2);return t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,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!=r&&r!==1/0?(t[10]=(r+n)*(o=1/(n-r)),t[14]=2*r*n*o):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const i={};for(let n=0;n<e.length;n++){const r=e[n];r in t&&(i[r]=t[r])}return i},t.plugin=Yn,t.pointGeometry=k,t.polygonIntersectsPolygon=Jo,t.potpack=Rl,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=An,t.registerForPluginStateChange=function(t){return t({pluginStatus:Zn,pluginURL:Gn}),Xn.on("pluginStateChange",t),t},t.renderColorRamp=zs,t.rotateX=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=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]=o*r+c*n,t[5]=s*r+u*n,t[6]=a*r+h*n,t[7]=l*r+d*n,t[8]=c*r-o*n,t[9]=u*r-s*n,t[10]=h*r-a*n,t[11]=d*r-l*n,t},t.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],u=e[5],h=e[6],d=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]=o*r+c*n,t[1]=s*r+u*n,t[2]=a*r+h*n,t[3]=l*r+d*n,t[4]=c*r-o*n,t[5]=u*r-s*n,t[6]=h*r-a*n,t[7]=d*r-l*n,t},t.scale=function(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},t.setCacheLimits=function(t,e){z=t,P=e},t.setRTLTextPlugin=function(t,e,i=!1){if(Zn===Nn||Zn===Un||Zn===Vn)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gn=E.resolveURL(t),Zn=Nn,qn=e,Wn(),i||Kn()},t.spec=nt,t.sphericalToCartesian=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.sqrLen=function(t){var e=t[0],i=t[1];return e*e+i*i},t.sub=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},t.toEvaluationFeature=Ho,t.transformMat3=function(t,e,i){var n=e[0],r=e[1],o=e[2];return t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8],t},t.transformMat4=bs,t.transformMat4$1=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t},t.translate=function(t,e,i){var n,r,o,s,a,l,c,u,h,d,p,f,m=i[0],g=i[1],y=i[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*y+e[12],t[13]=e[1]*m+e[5]*g+e[9]*y+e[13],t[14]=e[2]*m+e[6]*g+e[10]*y+e[14],t[15]=e[3]*m+e[7]*g+e[11]*y+e[15]):(r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],t[0]=n=e[0],t[1]=r,t[2]=o,t[3]=s,t[4]=a,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=d,t[10]=p,t[11]=f,t[12]=n*m+a*g+h*y+e[12],t[13]=r*m+l*g+d*y+e[13],t[14]=o*m+c*g+p*y+e[14],t[15]=s*m+u*g+f*y+e[15]),t},t.triggerPluginCompletionEvent=Hn,t.unicodeBlockLookup=Pn,t.uniqueId=function(){return l++},t.validateCustomStyleLayer=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.validateLight=bn,t.validateStyle=xn,t.vectorTile=wa,t.warnOnce=f,t.wrap=s})),n(["./shared"],(function(t){function e(t){const i=typeof t;if("number"===i||"boolean"===i||"string"===i||null==t)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(const n of t)i+=`${e(n)},`;return`${i}]`}const n=Object.keys(t).sort();let r="{";for(let i=0;i<n.length;i++)r+=`${JSON.stringify(n[i])}:${e(t[n[i]])},`;return`${r}}`}function i(i){let n="";for(const r of t.refProperties)n+=`/${e(i[r])}`;return n}class n{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(e,n){for(const i of e){this._layerConfigs[i.id]=i;const e=this._layers[i.id]=t.createStyleLayer(i);e._featureFilter=t.createFilter(e.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const t of n)delete this.keyCache[t],delete this._layerConfigs[t],delete this._layers[t];this.familiesBySource={};const r=function(t,e){const n={};for(let r=0;r<t.length;r++){const o=e&&e[t[r].id]||i(t[r]);e&&(e[t[r].id]=o);let s=n[o];s||(s=n[o]=[]),s.push(t[r])}const r=[];for(const t in n)r.push(n[t]);return r}(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 n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=r[o];s||(s=r[o]=[]),s.push(e)}}}class r{constructor(e){const i={},n=[];for(const t in e){const r=e[t],o=i[t]={};for(const t in r){const e=r[+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};n.push(i),o[t]={rect:i,metrics:e.metrics}}}const{w:r,h:o}=t.potpack(n),s=new t.AlphaImage({width:r||1,height:o||1});for(const n in e){const r=e[n];for(const e in r){const o=r[+e];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[n][e].rect;t.AlphaImage.copy(o.bitmap,s,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap)}}this.image=s,this.positions=i}}t.register("GlyphAtlas",r);class o{constructor(e){this.tileID=new t.OverscaledTileID(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}parse(e,i,n,o,a){this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;const l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},d=i.familiesBySource[this.source];for(const i in d){const r=e.layers[i];if(!r)continue;1===r.version&&t.warnOnce(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const o=l.encode(i),a=[];for(let t=0;t<r.length;t++){const e=r.feature(t),n=c.getId(e,i);a.push({feature:e,id:n,index:t,sourceLayerIndex:o})}for(const e of d[i]){const i=e[0];i.source!==this.source&&t.warnOnce(`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),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(e.map((t=>t.id))))}}let p,f,m,g;const y=t.mapObject(h.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(y).length?o.send("getGlyphs",{uid:this.uid,stacks:y},((t,e)=>{p||(p=t,f=e,x.call(this))})):f={};const _=Object.keys(h.iconDependencies);_.length?o.send("getImages",{icons:_,source:this.source,tileID:this.tileID,type:"icons"},((t,e)=>{p||(p=t,m=e,x.call(this))})):m={};const v=Object.keys(h.patternDependencies);function x(){if(p)return a(p);if(f&&m&&g){const e=new r(f),i=new t.ImageAtlas(m,g);for(const r in u){const o=u[r];o instanceof t.SymbolBucket?(s(o.layers,this.zoom,n),t.performSymbolLayout({bucket:o,glyphMap:f,glyphPositions:e.positions,imageMap:m,imagePositions:i.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):o.hasPattern&&(o instanceof t.LineBucket||o instanceof t.FillBucket||o instanceof t.FillExtrusionBucket)&&(s(o.layers,this.zoom,n),o.addFeatures(h,this.tileID.canonical,i.patternPositions))}this.status="done",a(null,{buckets:Object.values(u).filter((t=>!t.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:i,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?m:null,glyphPositions:this.returnDependencies?e.positions:null})}}v.length?o.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},((t,e)=>{p||(p=t,g=e,x.call(this))})):g={},x.call(this)}}function s(e,i,n){const r=new t.EvaluationParameters(i);for(const t of e)t.recalculate(r,n)}function a(e,i){const n=t.getArrayBuffer(e.request,((e,n,r,o)=>{e?i(e):n&&i(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:r,expires:o})}));return()=>{n.cancel(),i()}}class l{constructor(t,e,i,n){this.actor=t,this.layerIndex=e,this.availableImages=i,this.loadVectorData=n||a,this.loading={},this.loaded={}}loadTile(e,i){const n=e.uid;this.loading||(this.loading={});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[n]=new o(e);s.abort=this.loadVectorData(e,((e,o)=>{if(delete this.loading[n],e||!o)return s.status="done",this.loaded[n]=s,i(e);const a=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);const c={};if(r){const t=r.finish();t&&(c.resourceTiming=JSON.parse(JSON.stringify(t)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,n)=>{if(e||!n)return i(e);i(null,t.extend({rawTileData:a.slice(0)},n,l,c))})),this.loaded=this.loaded||{},this.loaded[n]=s}))}reloadTile(t,e){const i=this.loaded,n=t.uid,r=this;if(i&&i[n]){const o=i[n];o.showCollisionBoxes=t.showCollisionBoxes;const s=(t,i)=>{const n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,n)),e(t,i)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}abortTile(t,e){const i=this.loading,n=t.uid;i&&i[n]&&i[n].abort&&(i[n].abort(),delete i[n]),e()}removeTile(t,e){const i=this.loaded,n=t.uid;i&&i[n]&&delete i[n],e()}}class c{constructor(){this.loaded={}}loadTile(e,i){const{uid:n,encoding:r,rawImageData:o}=e,s=t.isImageBitmap(o)?this.getImageData(o):o,a=new t.DEMData(n,s,r);this.loaded=this.loaded||{},this.loaded[n]=a,i(null,a)}getImageData(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:i.width,height:i.height},i.data)}removeTile(t){const e=this.loaded,i=t.uid;e&&e[i]&&delete e[i]}}var u=function t(e,i){var n,r=e&&e.type;if("FeatureCollection"===r)for(n=0;n<e.features.length;n++)t(e.features[n],i);else if("GeometryCollection"===r)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],i);else if("Feature"===r)t(e.geometry,i);else if("Polygon"===r)h(e.coordinates,i);else if("MultiPolygon"===r)for(n=0;n<e.coordinates.length;n++)h(e.coordinates[n],i);return e};function h(t,e){if(0!==t.length){d(t[0],e);for(var i=1;i<t.length;i++)d(t[i],!e)}}function d(t,e){for(var i=0,n=0,r=0,o=t.length,s=o-1;r<o;s=r++){var a=(t[r][0]-t[s][0])*(t[s][1]+t[r][1]),l=i+a;n+=Math.abs(i)>=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!e&&t.reverse()}const p=t.vectorTile.VectorTileFeature.prototype.toGeoJSON;class f{constructor(e){this._feature=e,this.extent=t.EXTENT,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.pointGeometry(i[0],i[1])]);return e}{const e=[];for(const i of this._feature.geometry){const n=[];for(const e of i)n.push(new t.pointGeometry(e[0],e[1]));e.push(n)}return e}}toGeoJSON(t,e,i){return p.call(this,t,e,i)}}class m{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e}feature(t){return new f(this._features[t])}}var g={exports:{}},y=t.pointGeometry,_=t.vectorTile.VectorTileFeature,v=x;function x(t,e){this.options=e||{},this.features=t,this.length=t.length}function b(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}x.prototype.feature=function(t){return new b(this.features[t],this.options.extent)},b.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var i=t[e],n=[],r=0;r<i.length;r++)n.push(new y(i[r][0],i[r][1]));this.geometry.push(n)}return this.geometry},b.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,i=-1/0,n=1/0,r=-1/0,o=0;o<t.length;o++)for(var s=t[o],a=0;a<s.length;a++){var l=s[a];e=Math.min(e,l.x),i=Math.max(i,l.x),n=Math.min(n,l.y),r=Math.max(r,l.y)}return[e,n,i,r]},b.prototype.toGeoJSON=_.prototype.toGeoJSON;var w=t.pbf,S=v;function E(t){var e=new w;return function(t,e){for(var i in t.layers)e.writeMessage(3,k,t.layers[i])}(t,e),e.finish()}function k(t,e){var i;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<t.length;i++)n.feature=t.feature(i),e.writeMessage(2,T,n);var r=n.keys;for(i=0;i<r.length;i++)e.writeStringField(3,r[i]);var o=n.values;for(i=0;i<o.length;i++)e.writeMessage(4,z,o[i])}function T(t,e){var i=t.feature;void 0!==i.id&&e.writeVarintField(1,i.id),e.writeMessage(2,A,t),e.writeVarintField(3,i.type),e.writeMessage(4,C,i)}function A(t,e){var i=t.feature,n=t.keys,r=t.values,o=t.keycache,s=t.valuecache;for(var a in i.properties){var l=i.properties[a],c=o[a];if(null!==l){void 0===c&&(n.push(a),o[a]=c=n.length-1),e.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var h=u+":"+l,d=s[h];void 0===d&&(r.push(l),s[h]=d=r.length-1),e.writeVarint(d)}}}function I(t,e){return(e<<3)+(7&t)}function M(t){return t<<1^t>>31}function C(t,e){for(var i=t.loadGeometry(),n=t.type,r=0,o=0,s=i.length,a=0;a<s;a++){var l=i[a],c=1;1===n&&(c=l.length),e.writeVarint(I(1,c));for(var u=3===n?l.length-1:l.length,h=0;h<u;h++){1===h&&1!==n&&e.writeVarint(I(2,u-1));var d=l[h].x-r,p=l[h].y-o;e.writeVarint(M(d)),e.writeVarint(M(p)),r+=d,o+=p}3===n&&e.writeVarint(I(7,1))}}function z(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))}function P(t,e,i,n,r,o){if(r-n<=i)return;const s=n+r>>1;L(t,e,s,n,r,o%2),P(t,e,i,n,s-1,o+1),P(t,e,i,s+1,r,o+1)}function L(t,e,i,n,r,o){for(;r>n;){if(r-n>600){const s=r-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);L(t,e,i,Math.max(n,Math.floor(i-a*c/s+u)),Math.min(r,Math.floor(i+(s-a)*c/s+u)),o)}const s=e[2*i+o];let a=n,l=r;for(D(t,e,n,i),e[2*r+o]>s&&D(t,e,n,r);a<l;){for(D(t,e,a,l),a++,l--;e[2*a+o]<s;)a++;for(;e[2*l+o]>s;)l--}e[2*n+o]===s?D(t,e,n,l):(l++,D(t,e,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function D(t,e,i,n){R(t,i,n),R(e,2*i,2*n),R(e,2*i+1,2*n+1)}function R(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function O(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}g.exports=E,g.exports.fromVectorTileJs=E,g.exports.fromGeojsonVt=function(t,e){e=e||{};var i={};for(var n in t)i[n]=new S(t[n].features,e),i[n].name=n,i[n].version=e.version,i[n].extent=e.extent;return E({layers:i})},g.exports.GeoJSONWrapper=S;const F=t=>t[0],B=t=>t[1];class j{constructor(t,e=F,i=B,n=64,r=Float64Array){this.nodeSize=n,this.points=t;const o=t.length<65536?Uint16Array:Uint32Array,s=this.ids=new o(t.length),a=this.coords=new r(2*t.length);for(let n=0;n<t.length;n++)s[n]=n,a[2*n]=e(t[n]),a[2*n+1]=i(t[n]);P(s,a,n,0,s.length-1,0)}range(t,e,i,n){return function(t,e,i,n,r,o,s){const a=[0,t.length-1,0],l=[];let c,u;for(;a.length;){const h=a.pop(),d=a.pop(),p=a.pop();if(d-p<=s){for(let s=p;s<=d;s++)c=e[2*s],u=e[2*s+1],c>=i&&c<=r&&u>=n&&u<=o&&l.push(t[s]);continue}const f=Math.floor((p+d)/2);c=e[2*f],u=e[2*f+1],c>=i&&c<=r&&u>=n&&u<=o&&l.push(t[f]);const m=(h+1)%2;(0===h?i<=c:n<=u)&&(a.push(p),a.push(f-1),a.push(m)),(0===h?r>=c:o>=u)&&(a.push(f+1),a.push(d),a.push(m))}return l}(this.ids,this.coords,t,e,i,n,this.nodeSize)}within(t,e,i){return function(t,e,i,n,r,o){const s=[0,t.length-1,0],a=[],l=r*r;for(;s.length;){const c=s.pop(),u=s.pop(),h=s.pop();if(u-h<=o){for(let r=h;r<=u;r++)O(e[2*r],e[2*r+1],i,n)<=l&&a.push(t[r]);continue}const d=Math.floor((h+u)/2),p=e[2*d],f=e[2*d+1];O(p,f,i,n)<=l&&a.push(t[d]);const m=(c+1)%2;(0===c?i-r<=p:n-r<=f)&&(s.push(h),s.push(d-1),s.push(m)),(0===c?i+r>=p:n+r>=f)&&(s.push(d+1),s.push(u),s.push(m))}return a}(this.ids,this.coords,t,e,i,this.nodeSize)}}const $={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},N=Math.fround||(U=new Float32Array(1),t=>(U[0]=+t,U[0]));var U;class V{constructor(t){this.options=K(Object.create($),t),this.trees=new Array(this.options.maxZoom+1)}load(t){const{log:e,minZoom:i,maxZoom:n,nodeSize:r}=this.options;e&&console.time("total time");const o=`prepare ${t.length} points`;e&&console.time(o),this.points=t;let s=[];for(let e=0;e<t.length;e++)t[e].geometry&&s.push(Z(t[e],e));this.trees[n+1]=new j(s,Y,Q,r,Float32Array),e&&console.timeEnd(o);for(let t=n;t>=i;t--){const i=+Date.now();s=this._cluster(s,t),this.trees[t]=new j(s,Y,Q,r,Float32Array),e&&console.log("z%d: %d clusters in %dms",t,s.length,+Date.now()-i)}return e&&console.timeEnd("total time"),this}getClusters(t,e){let i=((t[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,t[1]));let r=180===t[2]?180:((t[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)i=-180,r=180;else if(i>r){const t=this.getClusters([i,n,180,o],e),s=this.getClusters([-180,n,r,o],e);return t.concat(s)}const s=this.trees[this._limitZoom(e)],a=s.range(W(i),X(o),W(r),X(n)),l=[];for(const t of a){const e=s.points[t];l.push(e.numPoints?G(e):this.points[e.index])}return l}getChildren(t){const e=this._getOriginId(t),i=this._getOriginZoom(t),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.points[e];if(!o)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=r.within(o.x,o.y,s),l=[];for(const e of a){const i=r.points[e];i.parentId===t&&l.push(i.numPoints?G(i):this.points[i.index])}if(0===l.length)throw new Error(n);return l}getLeaves(t,e,i){const n=[];return this._appendLeaves(n,t,e=e||10,i=i||0,0),n}getTile(t,e,i){const n=this.trees[this._limitZoom(t)],r=Math.pow(2,t),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/r,c=(i+1+a)/r,u={features:[]};return this._addTileFeatures(n.range((e-a)/r,l,(e+1+a)/r,c),n.points,e,i,r,u),0===e&&this._addTileFeatures(n.range(1-a/r,l,1,c),n.points,r,i,r,u),e===r-1&&this._addTileFeatures(n.range(0,l,a/r,c),n.points,-1,i,r,u),u.features.length?u: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,n,r){const o=this.getChildren(e);for(const e of o){const o=e.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(t,o.cluster_id,i,n,r):r<n?r++:t.push(e),t.length===i)break}return r}_addTileFeatures(t,e,i,n,r,o){for(const s of t){const t=e[s],a=t.numPoints;let l,c,u;if(a)l=H(t),c=t.x,u=t.y;else{const e=this.points[t.index];l=e.properties,c=W(e.geometry.coordinates[0]),u=X(e.geometry.coordinates[1])}const h={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(u*r-n))]],tags:l};let d;a?d=t.id:this.options.generateId?d=t.index:this.points[t.index].id&&(d=this.points[t.index].id),void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,e){const i=[],{radius:n,extent:r,reduce:o,minPoints:s}=this.options,a=n/(r*Math.pow(2,e));for(let n=0;n<t.length;n++){const r=t[n];if(r.zoom<=e)continue;r.zoom=e;const l=this.trees[e+1],c=l.within(r.x,r.y,a),u=r.numPoints||1;let h=u;for(const t of c){const i=l.points[t];i.zoom>e&&(h+=i.numPoints||1)}if(h>u&&h>=s){let t=r.x*u,s=r.y*u,a=o&&u>1?this._map(r,!0):null;const d=(n<<5)+(e+1)+this.points.length;for(const i of c){const n=l.points[i];if(n.zoom<=e)continue;n.zoom=e;const c=n.numPoints||1;t+=n.x*c,s+=n.y*c,n.parentId=d,o&&(a||(a=this._map(r,!0)),o(a,this._map(n)))}r.parentId=d,i.push(q(t/h,s/h,d,h,a))}else if(i.push(r),h>1)for(const t of c){const n=l.points[t];n.zoom<=e||(n.zoom=e,i.push(n))}}return i}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,e){if(t.numPoints)return e?K({},t.properties):t.properties;const i=this.points[t.index].properties,n=this.options.map(i);return e&&n===i?K({},n):n}}function q(t,e,i,n,r){return{x:N(t),y:N(e),zoom:1/0,id:i,parentId:-1,numPoints:n,properties:r}}function Z(t,e){const[i,n]=t.geometry.coordinates;return{x:N(W(i)),y:N(X(n)),zoom:1/0,index:e,parentId:-1}}function G(t){return{type:"Feature",id:t.id,properties:H(t),geometry:{type:"Point",coordinates:[(e=t.x,360*(e-.5)),J(t.y)]}};var e}function H(t){const e=t.numPoints,i=e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?Math.round(e/100)/10+"k":e;return K(K({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:i})}function W(t){return t/360+.5}function X(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 J(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function K(t,e){for(const i in e)t[i]=e[i];return t}function Y(t){return t.x}function Q(t){return t.y}function tt(t,e,i,n){for(var r,o=n,s=i-e>>1,a=i-e,l=t[e],c=t[e+1],u=t[i],h=t[i+1],d=e+3;d<i;d+=3){var p=et(t[d],t[d+1],l,c,u,h);if(p>o)r=d,o=p;else if(p===o){var f=Math.abs(d-s);f<a&&(r=d,a=f)}}o>n&&(r-e>3&&tt(t,e,r,n),t[r+2]=o,i-r>3&&tt(t,r,i,n))}function et(t,e,i,n,r,o){var s=r-i,a=o-n;if(0!==s||0!==a){var l=((t-i)*s+(e-n)*a)/(s*s+a*a);l>1?(i=r,n=o):l>0&&(i+=s*l,n+=a*l)}return(s=t-i)*s+(a=e-n)*a}function it(t,e,i,n){var r={id:void 0===t?null:t,type:e,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)nt(t,e);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n<e.length;n++)nt(t,e[n]);else if("MultiPolygon"===i)for(n=0;n<e.length;n++)for(var r=0;r<e[n].length;r++)nt(t,e[n][r])}(r),r}function nt(t,e){for(var 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 rt(t,e,i,n){if(e.geometry){var r=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],l=e.id;if(i.promoteId?l=e.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===o)ot(r,a);else if("MultiPoint"===o)for(var c=0;c<r.length;c++)ot(r[c],a);else if("LineString"===o)st(r,a,s,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(c=0;c<r.length;c++)st(r[c],a=[],s,!1),t.push(it(l,"LineString",a,e.properties));return}at(r,a,s,!1)}else if("Polygon"===o)at(r,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(c=0;c<e.geometry.geometries.length;c++)rt(t,{id:l,geometry:e.geometry.geometries[c],properties:e.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<r.length;c++){var u=[];at(r[c],u,s,!0),a.push(u)}}t.push(it(l,o,a,e.properties))}}function ot(t,e){e.push(lt(t[0])),e.push(ct(t[1])),e.push(0)}function st(t,e,i,n){for(var r,o,s=0,a=0;a<t.length;a++){var l=lt(t[a][0]),c=ct(t[a][1]);e.push(l),e.push(c),e.push(0),a>0&&(s+=n?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var u=e.length-3;e[2]=1,tt(e,0,u,i),e[u+2]=1,e.size=Math.abs(s),e.start=0,e.end=e.size}function at(t,e,i,n){for(var r=0;r<t.length;r++){var o=[];st(t[r],o,i,n),e.push(o)}}function lt(t){return t/360+.5}function ct(t){var 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 ut(t,e,i,n,r,o,s,a){if(n/=e,o>=(i/=e)&&s<n)return t;if(s<i||o>=n)return null;for(var l=[],c=0;c<t.length;c++){var u=t[c],h=u.geometry,d=u.type,p=0===r?u.minX:u.minY,f=0===r?u.maxX:u.maxY;if(p>=i&&f<n)l.push(u);else if(!(f<i||p>=n)){var m=[];if("Point"===d||"MultiPoint"===d)ht(h,m,i,n,r);else if("LineString"===d)dt(h,m,i,n,r,!1,a.lineMetrics);else if("MultiLineString"===d)ft(h,m,i,n,r,!1);else if("Polygon"===d)ft(h,m,i,n,r,!0);else if("MultiPolygon"===d)for(var g=0;g<h.length;g++){var y=[];ft(h[g],y,i,n,r,!0),y.length&&m.push(y)}if(m.length){if(a.lineMetrics&&"LineString"===d){for(g=0;g<m.length;g++)l.push(it(u.id,d,m[g],u.tags));continue}"LineString"!==d&&"MultiLineString"!==d||(1===m.length?(d="LineString",m=m[0]):d="MultiLineString"),"Point"!==d&&"MultiPoint"!==d||(d=3===m.length?"Point":"MultiPoint"),l.push(it(u.id,d,m,u.tags))}}}return l.length?l:null}function ht(t,e,i,n,r){for(var o=0;o<t.length;o+=3){var s=t[o+r];s>=i&&s<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function dt(t,e,i,n,r,o,s){for(var a,l,c=pt(t),u=0===r?gt:yt,h=t.start,d=0;d<t.length-3;d+=3){var p=t[d],f=t[d+1],m=t[d+2],g=t[d+3],y=t[d+4],_=0===r?p:f,v=0===r?g:y,x=!1;s&&(a=Math.sqrt(Math.pow(p-g,2)+Math.pow(f-y,2))),_<i?v>i&&(l=u(c,p,f,g,y,i),s&&(c.start=h+a*l)):_>n?v<n&&(l=u(c,p,f,g,y,n),s&&(c.start=h+a*l)):mt(c,p,f,m),v<i&&_>=i&&(l=u(c,p,f,g,y,i),x=!0),v>n&&_<=n&&(l=u(c,p,f,g,y,n),x=!0),!o&&x&&(s&&(c.end=h+a*l),e.push(c),c=pt(t)),s&&(h+=a)}var b=t.length-3;p=t[b],f=t[b+1],m=t[b+2],(_=0===r?p:f)>=i&&_<=n&&mt(c,p,f,m),b=c.length-3,o&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&mt(c,c[0],c[1],c[2]),c.length&&e.push(c)}function pt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function ft(t,e,i,n,r,o){for(var s=0;s<t.length;s++)dt(t[s],e,i,n,r,o,!1)}function mt(t,e,i,n){t.push(e),t.push(i),t.push(n)}function gt(t,e,i,n,r,o){var s=(o-e)/(n-e);return t.push(o),t.push(i+(r-i)*s),t.push(1),s}function yt(t,e,i,n,r,o){var s=(o-i)/(r-i);return t.push(e+(n-e)*s),t.push(o),t.push(1),s}function _t(t,e){for(var i=[],n=0;n<t.length;n++){var r,o=t[n],s=o.type;if("Point"===s||"MultiPoint"===s||"LineString"===s)r=vt(o.geometry,e);else if("MultiLineString"===s||"Polygon"===s){r=[];for(var a=0;a<o.geometry.length;a++)r.push(vt(o.geometry[a],e))}else if("MultiPolygon"===s)for(r=[],a=0;a<o.geometry.length;a++){for(var l=[],c=0;c<o.geometry[a].length;c++)l.push(vt(o.geometry[a][c],e));r.push(l)}i.push(it(o.id,s,r,o.tags))}return i}function vt(t,e){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var n=0;n<t.length;n+=3)i.push(t[n]+e,t[n+1],t[n+2]);return i}function xt(t,e){if(t.transformed)return t;var i,n,r,o=1<<t.z,s=t.x,a=t.y;for(i=0;i<t.features.length;i++){var l=t.features[i],c=l.geometry,u=l.type;if(l.geometry=[],1===u)for(n=0;n<c.length;n+=2)l.geometry.push(bt(c[n],c[n+1],e,o,s,a));else for(n=0;n<c.length;n++){var h=[];for(r=0;r<c[n].length;r+=2)h.push(bt(c[n][r],c[n][r+1],e,o,s,a));l.geometry.push(h)}}return t.transformed=!0,t}function bt(t,e,i,n,r,o){return[Math.round(i*(t*n-r)),Math.round(i*(e*n-o))]}function wt(t,e,i,n,r){for(var o=e===r.maxZoom?0:r.tolerance/((1<<e)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){s.numFeatures++,St(s,t[a],o,r);var l=t[a].minX,c=t[a].minY,u=t[a].maxX,h=t[a].maxY;l<s.minX&&(s.minX=l),c<s.minY&&(s.minY=c),u>s.maxX&&(s.maxX=u),h>s.maxY&&(s.maxY=h)}return s}function St(t,e,i,n){var r=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a<r.length;a+=3)s.push(r[a]),s.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)Et(s,r,t,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(a=0;a<r.length;a++)Et(s,r[a],t,i,"Polygon"===o,0===a);else if("MultiPolygon"===o)for(var l=0;l<r.length;l++){var c=r[l];for(a=0;a<c.length;a++)Et(s,c[a],t,i,!0,0===a)}if(s.length){var u=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var h in u={},e.tags)u[h]=e.tags[h];u.mapbox_clip_start=r.start/r.size,u.mapbox_clip_end=r.end/r.size}var d={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:u};null!==e.id&&(d.id=e.id),t.features.push(d)}}function Et(t,e,i,n,r,o){var s=n*n;if(n>0&&e.size<(r?s:n))i.numPoints+=e.length/3;else{for(var a=[],l=0;l<e.length;l+=3)(0===n||e[l+2]>s)&&(i.numSimplified++,a.push(e[l]),a.push(e[l+1])),i.numPoints++;r&&function(t,e){for(var i=0,n=0,r=t.length,o=r-2;n<r;o=n,n+=2)i+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(i>0===e)for(n=0,r=t.length;n<r/2;n+=2){var s=t[n],a=t[n+1];t[n]=t[r-2-n],t[n+1]=t[r-1-n],t[r-2-n]=s,t[r-1-n]=a}}(a,o),t.push(a)}}function kt(t,e){var i=(e=this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(Object.create(this.options),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.");var n=function(t,e){var i=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)rt(i,t.features[n],e,n);else rt(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),n=function(t,e){var i=e.buffer/e.extent,n=t,r=ut(t,1,-1-i,i,0,-1,2,e),o=ut(t,1,1-i,2+i,0,-1,2,e);return(r||o)&&(n=ut(t,1,-i,1+i,0,-1,2,e)||[],r&&(n=_t(r,1).concat(n)),o&&(n=n.concat(_t(o,-1)))),n}(n,e),n.length&&this.splitTile(n,0,0,0),i&&(n.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)))}function Tt(t,e,i){return 32*((1<<t)*i+e)+t}function At(t,e){const i=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);const n=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!n)return e(null,null);const r=new m(n.features);let o=g.exports(r);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:r,rawData:o.buffer})}kt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},kt.prototype.splitTile=function(t,e,i,n,r,o,s){for(var a=[t,e,i,n],l=this.options,c=l.debug;a.length;){n=a.pop(),i=a.pop(),e=a.pop(),t=a.pop();var u=1<<e,h=Tt(e,i,n),d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=wt(t,e,i,n,l),this.tileCoords.push({z:e,x:i,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,i,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(d.source=t,r){if(e===l.maxZoom||e===r)continue;var f=1<<r-e;if(i!==Math.floor(o/f)||n!==Math.floor(s/f))continue}else if(e===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==t.length){c>1&&console.time("clipping");var m,g,y,_,v,x,b=.5*l.buffer/l.extent,w=.5-b,S=.5+b,E=1+b;m=g=y=_=null,v=ut(t,u,i-b,i+S,0,d.minX,d.maxX,l),x=ut(t,u,i+w,i+E,0,d.minX,d.maxX,l),t=null,v&&(m=ut(v,u,n-b,n+S,1,d.minY,d.maxY,l),g=ut(v,u,n+w,n+E,1,d.minY,d.maxY,l),v=null),x&&(y=ut(x,u,n-b,n+S,1,d.minY,d.maxY,l),_=ut(x,u,n+w,n+E,1,d.minY,d.maxY,l),x=null),c>1&&console.timeEnd("clipping"),a.push(m||[],e+1,2*i,2*n),a.push(g||[],e+1,2*i,2*n+1),a.push(y||[],e+1,2*i+1,2*n),a.push(_||[],e+1,2*i+1,2*n+1)}}},kt.prototype.getTile=function(t,e,i){var n=this.options,r=n.extent,o=n.debug;if(t<0||t>24)return null;var s=1<<t,a=Tt(t,e=(e%s+s)%s,i);if(this.tiles[a])return xt(this.tiles[a],r);o>1&&console.log("drilling down to z%d-%d-%d",t,e,i);for(var l,c=t,u=e,h=i;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[Tt(c,u,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,u,h),o>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,t,e,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?xt(this.tiles[a],r):null):null};class It extends l{constructor(t,e,i,n){super(t,e,i,At),n&&(this.loadGeoJSON=n)}loadData(e,i){var n;null===(n=this._pendingRequest)||void 0===n||n.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request);this._pendingCallback=i,this._pendingRequest=this.loadGeoJSON(e,((n,o)=>{if(delete this._pendingCallback,delete this._pendingRequest,n||!o)return i(n);if("object"!=typeof o)return i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{u(o,!0);try{if(e.filter){const i=t.createExpression(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 n=o.features.filter((t=>i.value.evaluate({zoom:0},t)));o={type:"FeatureCollection",features:n}}this._geoJSONIndex=e.cluster?new V(function({superclusterOptions:e,clusterProperties:i}){if(!i||!e)return e;const n={},r={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const e of a){const[o,s]=i[e],a=t.createExpression(s),l=t.createExpression("string"==typeof o?[o,["accumulated"],["get",e]]:o);n[e]=a.value,r[e]=l.value}return e.map=t=>{s.properties=t;const e={};for(const t of a)e[t]=n[t].evaluate(o,s);return e},e.reduce=(t,e)=>{s.properties=e;for(const e of a)o.accumulated=t[e],t[e]=r[e].evaluate(o,s)},e}(e)).load(o.features):function(t,e){return new kt(t,e)}(o,e.geojsonVtOptions)}catch(n){return i(n)}this.loaded={};const s={};if(r){const t=r.finish();t&&(s.resourceTiming={},s.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}i(null,s)}}))}reloadTile(t,e){const i=this.loaded;return i&&i[t.uid]?super.reloadTile(t,e):this.loadTile(t,e)}loadGeoJSON(e,i){if(e.request)return t.getJSON(e.request,i);if("string"==typeof e.data)try{i(null,JSON.parse(e.data))}catch(t){i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}else i(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()}getClusterExpansionZoom(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}}getClusterChildren(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}}getClusterLeaves(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}}}class Mt{constructor(e){this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:l,geojson:It},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(t,e)=>{if(this.workerSourceTypes[t])throw new Error(`Worker source with name "${t}" already registered.`);this.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=e=>{if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}}setReferrer(t,e){this.referrer=e}setImages(t,e,i){this.availableImages[t]=e;for(const i in this.workerSources[t]){const n=this.workerSources[t][i];for(const t in n)n[t].availableImages=e}i()}setLayers(t,e,i){this.getLayerIndex(t).replace(e),i()}updateLayers(t,e,i){this.getLayerIndex(t).update(e.layers,e.removedIds),i()}loadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).loadTile(e,i)}loadDEMTile(t,e,i){this.getDEMWorkerSource(t,e.source).loadTile(e,i)}reloadTile(t,e,i){this.getWorkerSource(t,e.type,e.source).reloadTile(e,i)}abortTile(t,e,i){this.getWorkerSource(t,e.type,e.source).abortTile(e,i)}removeTile(t,e,i){this.getWorkerSource(t,e.type,e.source).removeTile(e,i)}removeDEMTile(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)}removeSource(t,e,i){if(!this.workerSources[t]||!this.workerSources[t][e.type]||!this.workerSources[t][e.type][e.source])return;const n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,i):i()}loadWorkerSource(t,e,i){try{this.self.importScripts(e.url),i()}catch(t){i(t.toString())}}syncRTLPluginState(e,i,n){try{t.plugin.setState(i);const e=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=e){this.self.importScripts(e);const i=t.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${e}`),i)}}catch(t){n(t.toString())}}getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e}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 n={send:(e,i,n)=>{this.actor.send(e,i,n,t)}};this.workerSources[t][e][i]=new this.workerSourceTypes[e](n,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 c),this.demWorkerSources[t][e]}enforceCacheSizeLimit(e,i){t.enforceCacheSizeLimit(i)}}return t.isWorker()&&(self.worker=new Mt(self)),Mt})),n(["./shared"],(function(t){var e=i;function i(t){return!function(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,i=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(i);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var i=e.getImageData(0,0,1,1);return i&&i.width===t.width}()?(void 0===n[e=t&&t.failIfMajorPerformanceCaveat]&&(n[e]=function(t){var e,n=function(t){var e=document.createElement("canvas"),n=Object.create(i.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,e.getContext("webgl",n)||e.getContext("experimental-webgl",n)}(t);if(!n)return!1;try{e=n.createShader(n.VERTEX_SHADER)}catch(t){return!1}return!(!e||n.isContextLost())&&(n.shaderSource(e,"void main() {}"),n.compileShader(e),!0===n.getShaderParameter(e,n.COMPILE_STATUS))}(e)),n[e]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var e}(t)}var n={};function r(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(!r(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(!r(t[i],e[i]))return!1;return!0}return t===e}i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};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 n=window.document.createElement(t);return void 0!==e&&(n.className=e),i&&i.appendChild(n),n}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,n={}){t.addEventListener(e,i,"passive"in n?n:n.capture)}static removeEventListener(t,e,i,n={}){t.removeEventListener(e,i,"passive"in n?n:n.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 mousePos(e,i){const n=e.getBoundingClientRect();return new t.pointGeometry((i.clientX-n.left)/t.exported.dynamicScale-e.clientLeft,(i.clientY-n.top)/t.exported.dynamicScale-e.clientTop)}static touchPos(e,i){const n=e.getBoundingClientRect(),r=[];for(let o=0;o<i.length;o++)r.push(new t.pointGeometry((i[o].clientX-n.left)/t.exported.dynamicScale-e.clientLeft,(i[o].clientY-n.top)/t.exported.dynamicScale-e.clientTop));return r}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"]);class s{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const n=function(t){const e=t.match(a);if(!e)throw new Error(`Unable to parse URL "${t}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}(t);return n.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}(n)}setTransformRequest(t){this._transformRequestFn=t}}const a=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class l{constructor(t,e,i,n){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,n)}update(e,i,n){const{width:r,height:o}=e,s=!(this.size&&this.size[0]===r&&this.size[1]===o||n),{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)),s)this.size=[r,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,r,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:s}=n||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,s,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,s,r,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,i){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),t!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,e),r.texParameteri(r.TEXTURE_2D,r.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 c(t){const{userImage:e}=t;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class u extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({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,callback:e}of this.requestors)this._notify(t,e);this.requestors=[]}}getImage(t){return this.images[t]}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(e,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(t,e){if(!t)return!0;let i=0;for(const n of t){if(n[0]<i||n[1]<n[0]||e<n[1])return!1;i=n[1]}return!0}_validateContent(t,e){return!(t&&(4!==t.length||t[0]<0||e.data.width<t[0]||t[1]<0||e.data.height<t[1]||t[2]<0||e.data.width<t[2]||t[3]<0||e.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,e){const i=this.images[t];if(i.data.width!==e.data.width||i.data.height!==e.data.height)throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=i.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,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e})}_notify(e,i){const n={};for(const i of e){this.images[i]||this.fire(new t.Event("styleimagemissing",{id:i}));const e=this.images[i];e?n[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}i(null,n)}getPixelSize(){const{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},r=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:r}}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new l(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.potpack(e),r=this.atlasImage;r.resize({width:i||1,height:n||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],n=i.x+1,o=i.y+1,s=this.images[e].data,a=s.width,l=s.height;t.RGBAImage.copy(s,r,{x:0,y:0},{x:n,y:o},{width:a,height:l}),t.RGBAImage.copy(s,r,{x:0,y:l-1},{x:n,y:o-1},{width:a,height:1}),t.RGBAImage.copy(s,r,{x:0,y:0},{x:n,y:o+l},{width:a,height:1}),t.RGBAImage.copy(s,r,{x:a-1,y:0},{x:n-1,y:o},{width:1,height:l}),t.RGBAImage.copy(s,r,{x:0,y:0},{x:n+a,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.images[i];e||t.warnOnce(`Image with ID: "${i}" was not found`),c(e)&&this.updateImage(i,e)}}}const h=1e20;function d(t,e,i,n,r,o,s,a,l){for(let c=e;c<e+n;c++)p(t,i*o+c,o,r,s,a,l);for(let c=i;c<i+r;c++)p(t,c*o+e,1,n,s,a,l)}function p(t,e,i,n,r,o,s){o[0]=0,s[0]=-h,s[1]=h,r[0]=t[e];for(let a=1,l=0,c=0;a<n;a++){r[a]=t[e+a*i];const n=a*a;do{const t=o[l];c=(r[a]-r[t]+n-t*t)/(a-t)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=h}for(let a=0,l=0;a<n;a++){for(;s[l+1]<a;)l++;const n=o[l],c=a-n;t[e+a*i]=r[n]+c*c}}class f{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(e,i){const n=[];for(const t in e)for(const i of e[t])n.push({stack:t,id:i});t.asyncAll(n,(({stack:t,id:e},i)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=n.glyphs[e];if(void 0!==r)return void i(null,{stack:t,id:e,glyph:r});if(r=this._tinySDF(n,t,e),r)return n.glyphs[e]=r,void i(null,{stack:t,id:e,glyph:r});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:t,id:e,glyph:r});let s=n.requests[o];s||(s=n.requests[o]=[],f.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e[+t]);n.ranges[o]=!0}for(const i of s)i(t,e);delete n.requests[o]}))),s.push(((n,r)=>{n?i(n):r&&i(null,{stack:t,id:e,glyph:r[e]||null})}))}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:n,glyph:r}of e)(t[i]||(t[i]={}))[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics};i(null,t)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(t.unicodeBlockLookup["CJK Unified Ideographs"](e)||t.unicodeBlockLookup["Hangul Syllables"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,n){const r=this.localIdeographFontFamily;if(!r)return;if(!this._doesCharSupportLocalGlyph(n))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new f.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:r,fontWeight:t})}const s=o.draw(String.fromCharCode(n));return{id:n,bitmap:new t.AlphaImage({width:s.width||30,height:s.height||30},s.data),metrics:{width:s.glyphWidth||24,height:s.glyphHeight||24,left:s.glyphLeft||0,top:s.glyphTop-27||-8,advance:s.glyphAdvance||24}}}}f.loadGlyphRange=function(e,i,n,r,o){const s=256*i,a=s+255,l=r.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${s}-${a}`),t.ResourceType.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)o(e);else if(i){const e={};for(const n of t.parseGlyphPbf(i))e[n.id]=n;o(null,e)}}))},f.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${t}px ${r}`,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:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),a=Math.min(this.size-this.buffer,Math.ceil(o-r)),l=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=a+2*this.buffer,u=l+2*this.buffer,p=Math.max(c*u,0),f=new Uint8ClampedArray(p),m={data:f,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return m;const{ctx:g,buffer:y,gridInner:_,gridOuter:v}=this;g.clearRect(y,y,a,l),g.fillText(t,y,y+s);const x=g.getImageData(y,y,a,l);v.fill(h,0,p),_.fill(0,0,p);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const i=x.data[4*(t*a+e)+3]/255;if(0===i)continue;const n=(t+y)*c+e+y;if(1===i)v[n]=0,_[n]=h;else{const t=.5-i;v[n]=t>0?t*t:0,_[n]=t<0?t*t:0}}d(v,0,0,c,u,c,this.f,this.v,this.z),d(_,y,y,a,l,c,this.f,this.v,this.z);for(let t=0;t<p;t++){const e=Math.sqrt(v[t])-Math.sqrt(_[t]);f[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return m}};const m=new t.Properties({anchor:new t.DataConstantProperty(t.spec.light.anchor),position:new class{constructor(){this.specification=t.spec.light.position}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.number(e.x,i.x,n),y:t.number(e.y,i.y,n),z:t.number(e.z,i.z,n)}}},color:new t.DataConstantProperty(t.spec.light.color),intensity:new t.DataConstantProperty(t.spec.light.intensity)}),g="-transition";class y extends t.Evented{constructor(e){super(),this._transitionable=new t.Transitionable(m),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith(g)?this._transitionable.setTransition(t.slice(0,-g.length),i):this._transitionable.setValue(t,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(e,i,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.spec})))}}class _{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 n=[];let r=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,s=!0;n.push({left:r,right:o,isDash:s,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){s=!s;const l=t[e];r=a*i,a+=l,o=a*i,n.push({left:r,right:o,isDash:s,zeroLength:0===l})}return n}addRoundDash(t,e,i){const n=e/2;for(let e=-i;e<=i;e++){const r=this.width*(this.nextRow+i+e);let o=0,s=t[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=t[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=e/i*(n+1);if(s.isDash){const t=n-Math.abs(d);h=Math.sqrt(u*u+t*t)}else h=n-Math.sqrt(u*u+d*d);this.data[r+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],n=t[e+1];i.zeroLength?t.splice(e,1):n&&n.isDash===i.isDash&&(n.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 n=this.width*this.nextRow;let r=0,o=t[r];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++r]);const i=Math.abs(e-o.left),s=Math.abs(e-o.right),a=Math.min(i,s);this.data[n+e]=Math.max(0,Math.min(255,(o.isDash?a:-a)+128))}}addDash(e,i){const n=i?7:0,r=2*n+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,r=this.getDashRanges(e,this.width,t);i?this.addRoundDash(r,t,n):this.addRegularDash(r)}const s={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=r,this.dirty=!0,s}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))}}class v{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t.uniqueId();const n=this.workerPool.acquire(this.id);for(let t=0;t<n.length;t++){const e=new v.Actor(n[t],i,this.id);e.name=`Worker ${t}`,this.actors.push(e)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i,n){t.asyncAll(this.actors,((t,n)=>{t.send(e,i,n)}),n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove()})),this.actors=[],this.workerPool.release(this.id)}}function x(e,i,n){const r=function(i,r){if(i)return n(i);if(r){const i=t.pick(t.extend(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),n(null,i)}};return e.url?t.getJSON(i.transformRequest(e.url,t.ResourceType.Source),r):t.exported.frame((()=>r(null,e)))}v.Actor=t.Actor;class b{constructor(e,i,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(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(e){const i=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=n&&e.x<o&&e.y>=r&&e.y<s}}class w extends t.Evented{constructor(e,i,n,r){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=x(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new b(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}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.cancel(),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.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:this.map._requestManager.transformRequest(n,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function o(n,r){return delete e.request,e.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&e.setExpiryData(r),e.loadVectorData(r,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=i:e.request=e.actor.send("reloadTile",r,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",r,o.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class S extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:"raster"},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=x(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new b(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return t.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),((n,r,o)=>{if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(o);const n=this.map.painter.context,s=n.gl;e.texture=this.map.painter.getTileTexture(r.width),e.texture?e.texture.update(r,{useMipmap:!0}):(e.texture=new l(n,r,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(this.dispatcher),i(null)}}))}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e()}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()}hasTransition(){return!1}}let E;class k extends S{constructor(e,i,n,r){super(e,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function r(t,n){t&&(e.state="errored",i(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",i(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",i(null);else if(n)e.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==E&&(E="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),E)?o:t.exported.getImageData(o,1),n={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",n,r.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?e.wrap-1:e.wrap,s=(i.x+1+n)%n,a=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,r,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}unloadTile(t){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&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class T extends t.Evented{constructor(e,i,n,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=n.getActor(),this.setEventedParent(r),this._data=i.data,this._options=t.extend({},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 o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,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:t.EXTENT,radius:(i.clusterRadius||50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:i},n),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions),n=this._data;"string"==typeof n?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(n),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(n),this._pendingLoads++,this.fire(new t.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,i,((i,n)=>{if(this._pendingLoads--,this._removed||n&&n.abandoned)return void this.fire(new t.Event("dataabort",{dataType:"source",sourceDataType:e}));let r=null;if(n&&n.resourceTiming&&n.resourceTiming[this.id]&&(r=n.resourceTiming[this.id].slice(0)),i)return void this.fire(new t.ErrorEvent(i));const o={dataType:"source",sourceDataType:e};this._collectResourceTiming&&r&&r.length>0&&t.extend(o,{resourceTiming:r}),this.fire(new t.Event("data",o))}))}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n={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.request=this.actor.send(i,n,((n,r)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):n?e(n):(t.loadVectorData(r,this.map.painter,"reloadTile"===i),e(null)))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var A=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class I extends t.Evented{constructor(t,e,i,n){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(n),this.options=e}load(e,i){this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),((n,r)=>{this._loaded=!0,n?this.fire(new t.ErrorEvent(n)):r&&(this.image=r,e&&(this.coordinates=e),i&&i(),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),n=Math.min(n,t.y),r=Math.max(r,t.x),o=Math.max(o,t.y);const s=Math.max(r-i,o-n),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new t.CanonicalTileID(a,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const n=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(n[0].x,n[0].y,0,0),this._boundsArray.emplaceBack(n[1].x,n[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(n[3].x,n[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(n[2].x,n[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new l(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class M extends I{constructor(t,e,i,n){super(t,e,i,n),this.roundZoom=!0,this.type="video",this.options=e}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,t.ResourceType.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(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 e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.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 l(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class C extends I{constructor(e,i,n,r){super(e,i,n,r),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 t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(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 e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,n=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l(i,this.canvas,n.RGBA,{premultiply:!0});for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}}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 z={vector:w,raster:S,"raster-dem":k,geojson:T,video:M,image:I,canvas:C};class P{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(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,n=this._distances[i];const r=e*this.paddedLength+this.padding;for(;n<r&&i<this._distances.length;)n=this._distances[++i];const o=i-1,s=this._distances[o],a=n-s,l=a>0?(r-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function L(t,e){let i=!0;return"always"===t||"never"!==t&&"never"!==e||(i=!1),i}class D{constructor(t,e,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)n.push([]),r.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,n,r){this._forEachCell(e,i,n,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}insertCircle(t,e,i,n){this._forEachCell(e-n,i-n,e+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(n)}_insertBoxCell(t,e,i,n,r,o){this.boxCells[r].push(o)}_insertCircleCell(t,e,i,n,r,o){this.circleCells[r].push(o)}_query(t,e,i,n,r,o,s){if(i<0||t>this.width||n<0||e>this.height)return[];const a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=n){if(r)return[{key:null,x1:t,y1:e,x2:i,y2:n}];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],n=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-n,y1:i-n,x2:e+n,y2:i+n})}}else this._forEachCell(t,e,i,n,this._queryCell,a,{hitTest:r,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(t,e,i,n){return this._query(t,e,i,n,!1,null)}hitTest(t,e,i,n,r,o){return this._query(t,e,i,n,!0,r,o).length>0}hitTestCircle(t,e,i,n,r){const o=t-i,s=t+i,a=e-i,l=e+i;if(s<0||o>this.width||l<0||a>this.height)return!1;const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:n,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},r),c.length>0}_queryCell(t,e,i,n,r,o,s,a){const{seenUids:l,hitTest:c,overlapMode:u}=s,h=this.boxCells[r];if(null!==h){const r=this.bboxes;for(const s of h)if(!l.box[s]){l.box[s]=!0;const h=4*s,d=this.boxKeys[s];if(t<=r[h+2]&&e<=r[h+3]&&i>=r[h+0]&&n>=r[h+1]&&(!a||a(d))&&(!c||!L(u,d.overlapMode))&&(o.push({key:d,x1:r[h],y1:r[h+1],x2:r[h+2],y2:r[h+3]}),c))return!0}}const d=this.circleCells[r];if(null!==d){const r=this.circles;for(const s of d)if(!l.circle[s]){l.circle[s]=!0;const h=3*s,d=this.circleKeys[s];if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],t,e,i,n)&&(!a||a(d))&&(!c||!L(u,d.overlapMode))){const t=r[h],e=r[h+1],i=r[h+2];if(o.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return!0}}}return!1}_queryCellCircle(t,e,i,n,r,o,s,a){const{circle:l,seenUids:c,overlapMode:u}=s,h=this.boxCells[r];if(null!==h){const t=this.bboxes;for(const e of h)if(!c.box[e]){c.box[e]=!0;const i=4*e,n=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(n))&&!L(u,n.overlapMode))return o.push(!0),!0}}const d=this.circleCells[r];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,n=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(n))&&!L(u,n.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,n,r,o,s,a){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,t,e,i,n,this.xCellCount*l+d,o,s,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,n,r,o){const s=n-t,a=r-e,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(t,e,i,n,r,o,s){const a=(o-n)/2,l=Math.abs(t-(n+a));if(l>a+i)return!1;const c=(s-r)/2,u=Math.abs(e-(r+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}function R(e,i,n,r,o){const s=t.create();return i?(t.scale(s,s,[1/o,1/o,1]),n||t.rotateZ(s,s,r.angle)):t.multiply(s,r.labelPlaneMatrix,e),s}function O(e,i,n,r,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),n||t.rotateZ(i,i,-r.angle),i}return r.glCoordMatrix}function F(e,i,n){let r;n?(r=[e.x,e.y,n(e.x,e.y),1],t.transformMat4(r,r,i)):(r=[e.x,e.y,0,1],W(r,r,i));const o=r[3];return{point:new t.pointGeometry(r[0]/o,r[1]/o),signedDistanceFromCamera:o}}function B(t,e){return.5+t/e*.5}function j(t,e){const i=t[0]/t[3],n=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&n>=-e[1]&&n<=e[1]}function $(e,i,n,r,o,s,a,l,c,u){const h=r?e.textSizeData:e.iconSizeData,d=t.evaluateSizeForZoom(h,n.transform.zoom),p=[256/n.width*2+1,256/n.height*2+1],f=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;f.clear();const m=e.lineVertexArray,g=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=n.transform.width/n.transform.height;let _=!1;for(let r=0;r<g.length;r++){const v=g.get(r);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!_){H(v.numGlyphs,f);continue}let x;if(_=!1,u?(x=[v.anchorX,v.anchorY,u(v.anchorX,v.anchorY),1],t.transformMat4(x,x,i)):(x=[v.anchorX,v.anchorY,0,1],W(x,x,i)),!j(x,p)){H(v.numGlyphs,f);continue}const b=B(n.transform.cameraToCenterDistance,x[3]),w=t.evaluateSizeForFeature(h,d,v),S=a?w/b:w*b,E=new t.pointGeometry(v.anchorX,v.anchorY),k=F(E,o,u).point,T={},A=V(v,S,!1,l,i,o,s,e.glyphOffsetArray,m,f,k,E,T,y,c,u);_=A.useVertical,(A.notEnoughRoom||_||A.needsFlipping&&V(v,S,!0,l,i,o,s,e.glyphOffsetArray,m,f,k,E,T,y,c,u).notEnoughRoom)&&H(v.numGlyphs,f)}r?e.text.dynamicLayoutVertexBuffer.updateData(f):e.icon.dynamicLayoutVertexBuffer.updateData(f)}function N(t,e,i,n,r,o,s,a,l,c,u,h,d){const p=a.glyphStartIndex+a.numGlyphs,f=a.lineStartIndex,m=a.lineStartIndex+a.lineLength,g=e.getoffsetX(a.glyphStartIndex),y=e.getoffsetX(p-1),_=Z(t*g,i,n,r,o,s,a.segment,f,m,l,c,u,h,d);if(!_)return null;const v=Z(t*y,i,n,r,o,s,a.segment,f,m,l,c,u,h,d);return v?{first:_,last:v}:null}function U(e,i,n,r){return e===t.WritingMode.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function V(e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g){const y=i/24,_=e.lineOffsetX*y,v=e.lineOffsetY*y;let x;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,u=N(y,l,_,v,n,h,d,e,c,s,p,m,g);if(!u)return{notEnoughRoom:!0};const b=F(u.first.point,a,g).point,w=F(u.last.point,a,g).point;if(r&&!n){const t=U(e.writingMode,b,w,f);if(t)return t}x=[u.first];for(let r=e.glyphStartIndex+1;r<t-1;r++)x.push(Z(y*l.getoffsetX(r),_,v,n,h,d,e.segment,i,o,c,s,p,m,g));x.push(u.last)}else{if(r&&!n){const i=F(d,o,g).point,n=e.lineStartIndex+e.segment+1,r=new t.pointGeometry(c.getx(n),c.gety(n)),s=F(r,o,g),a=s.signedDistanceFromCamera>0?s.point:q(d,r,i,1,o,g),l=U(e.writingMode,i,a,f);if(l)return l}const i=Z(y*l.getoffsetX(e.glyphStartIndex),_,v,n,h,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,s,p,m,g);if(!i)return{notEnoughRoom:!0};x=[i]}for(const e of x)t.addDynamicAttributes(u,e.point,e.angle);return{}}function q(t,e,i,n,r,o){const s=F(t.add(t.sub(e)._unit()),r,o).point,a=i.sub(s);return i.add(a._mult(n/a.mag()))}function Z(e,i,n,r,o,s,a,l,c,u,h,d,p,f){const m=r?e-i:e+i;let g=m>0?1:-1,y=0;r&&(g*=-1,y=Math.PI),g<0&&(y+=Math.PI);let _=g>0?l+a:l+a+1,v=o,x=o,b=0,w=0;const S=Math.abs(m),E=[];for(;b+w<=S;){if(_+=g,_<l||_>=c)return null;const e=v.sub(x);if(e.mag()>0?E.push(v.add(e.unit().perp().mult(n*g))):E.push(v),x=v,v=d[_],void 0===v){const e=new t.pointGeometry(u.getx(_),u.gety(_)),i=F(e,h,f);if(i.signedDistanceFromCamera>0)v=d[_]=i.point;else{const i=_-g;v=q(0===b?s:new t.pointGeometry(u.getx(i),u.gety(i)),e,x,S-b+1,h,f)}}b+=w,w=x.dist(v)}const k=(S-b)/w,T=v.sub(x),A=T.mult(k)._add(x);A._add(T._unit()._perp()._mult(n*g));const I=y+Math.atan2(v.y-x.y,v.x-x.x);return E.push(A),{point:A,angle:p?I:0,path:E}}const G=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function H(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(G,3*t)}}function W(t,e,i){const n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t[3]=i[3]*n+i[7]*r+i[15],t}const X=100;class J{constructor(t,e=new D(t.width+200,t.height+200,25),i=new D(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+X,this.screenBottomBoundary=t.height+X,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,i,n,r,o){const s=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY,o),a=i*s.perspectiveRatio,l=t.x1*a+s.point.x,c=t.y1*a+s.point.y,u=t.x2*a+s.point.x,h=t.y2*a+s.point.y;return!this.isInsideGrid(l,c,u,h)||"always"!==e&&this.grid.hitTest(l,c,u,h,e,r)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,u,h],offscreen:this.isOffscreen(l,c,u,h)}}placeCollisionCircles(e,i,n,r,o,s,a,l,c,u,h,d,p,f){const m=[],g=new t.pointGeometry(i.anchorX,i.anchorY),y=F(g,s,f),_=B(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),v=(u?o/_:o*_)/t.ONE_EM,x=F(g,a,f).point,b=N(v,r,i.lineOffsetX*v,i.lineOffsetY*v,!1,x,g,i,n,a,{},!1,f);let w=!1,S=!1,E=!0;if(b){const i=.5*d*_+p,n=new t.pointGeometry(-100,-100),r=new t.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),o=new P,s=b.first,a=b.last;let u=[];for(let t=s.path.length-1;t>=1;t--)u.push(s.path[t]);for(let t=1;t<a.path.length;t++)u.push(a.path[t]);const g=2.5*i;if(l){const t=u.map((t=>F(t,l,f)));u=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point))}let y=[];if(u.length>0){const e=u[0].clone(),i=u[0].clone();for(let t=1;t<u.length;t++)e.x=Math.min(e.x,u[t].x),e.y=Math.min(e.y,u[t].y),i.x=Math.max(i.x,u[t].x),i.y=Math.max(i.y,u[t].y);y=e.x>=n.x&&i.x<=r.x&&e.y>=n.y&&i.y<=r.y?[u]:i.x<n.x||e.x>r.x||i.y<n.y||e.y>r.y?[]:t.clipLine([u],n.x,n.y,r.x,r.y)}for(const t of y){o.reset(t,.25*i);let n=0;n=o.length<=.5*i?1:Math.ceil(o.paddedLength/g)+1;for(let t=0;t<n;t++){const r=t/Math.max(n-1,1),s=o.lerp(r),a=s.x+X,l=s.y+X;m.push(a,l,i,0);const u=a-i,d=l-i,p=a+i,f=l+i;if(E=E&&this.isOffscreen(u,d,p,f),S=S||this.isInsideGrid(u,d,p,f),"always"!==e&&this.grid.hitTestCircle(a,l,i,e,h)&&(w=!0,!c))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!c&&w||!S||_<this.perspectiveRatioCutoff?[]:m,offscreen:E,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let n=1/0,r=1/0,o=-1/0,s=-1/0;for(const a of e){const e=new t.pointGeometry(a.x+X,a.y+X);n=Math.min(n,e.x),r=Math.min(r,e.y),o=Math.max(o,e.x),s=Math.max(s,e.y),i.push(e)}const a=this.grid.query(n,r,o,s).concat(this.ignoredGrid.query(n,r,o,s)),l={},c={};for(const e of a){const n=e.key;if(void 0===l[n.bucketInstanceId]&&(l[n.bucketInstanceId]={}),l[n.bucketInstanceId][n.featureIndex])continue;const r=[new t.pointGeometry(e.x1,e.y1),new t.pointGeometry(e.x2,e.y1),new t.pointGeometry(e.x2,e.y2),new t.pointGeometry(e.x1,e.y2)];t.polygonIntersectsPolygon(i,r)&&(l[n.bucketInstanceId][n.featureIndex]=!0,void 0===c[n.bucketInstanceId]&&(c[n.bucketInstanceId]=[]),c[n.bucketInstanceId].push(n.featureIndex))}return c}insertCollisionBox(t,e,i,n,r,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,n,r,o){const s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)s.insertCircle(a,t[e],t[e+1],t[e+2])}projectAndGetPerspectiveRatio(e,i,n,r){let o;return r?(o=[i,n,r(i,n),1],t.transformMat4(o,o,e)):(o=[i,n,0,1],W(o,o,e)),{point:new t.pointGeometry((o[0]/o[3]+1)/2*this.transform.width+X,(-o[1]/o[3]+1)/2*this.transform.height+X),perspectiveRatio:.5+this.transform.cameraToCenterDistance/o[3]*.5}}isOffscreen(t,e,i,n){return i<X||t>=this.screenRightBoundary||n<X||e>this.screenBottomBoundary}isInsideGrid(t,e,i,n){return i>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function K(e,i){const n=t.create();return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(i.toUnwrapped()))}function Y(t,e,i,n,r,o){const s=function(t,e,i){if(t)for(const n of t){const t=e[n];if(t&&t.source===i&&"fill-extrusion"===t.type)return!0}else for(const t in e){const n=e[t];if(n.source===i&&"fill-extrusion"===n.type)return!0}return!1}(r&&r.layers,e,t.id),a=o.maxPitchScaleFactor(),l=t.tilesIn(n,a,s);l.sort(Q);const c=[];for(const n of l)c.push({wrappedTileID:n.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(e,i,t._state,n.queryGeometry,n.cameraQueryGeometry,n.scale,r,o,a,K(t.transform,n.tileID))});const u=function(t){const e={},i={};for(const n of t){const t=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in t){const n=t[i],r=o[i]=o[i]||{},s=e[i]=e[i]||[];for(const t of n)r[t.featureIndex]||(r[t.featureIndex]=!0,s.push(t))}}return e}(c);for(const e in u)u[e].forEach((e=>{const i=e.feature,n=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=n}));return u}function Q(t,e){const i=t.tileID,n=e.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function tt(e,i,n,r,o){const s=e[i[r].source],a=s.style.placement.glyphCircles,l=s.style.placement.placedBoxes,c=s.style.placement.anchorAngles,u=s.style.placement.variableAnchors,h=n.bucketInstanceId,d=o.featureIndex;if(h in a&&d in a[h]){const e=a[h][d],i=c[h][d];let n=0;o.feature.paths=[],e.forEach((e=>{let r=[];const s=e.length/4;for(let t=0;t<s;t++)r.push(e[4*t]-X),r.push(e[4*t+1]-X);const a=r.length/2;if(r[0]>r[r.length-2]){const t=[];for(let e=1;e<=a;e++)t.push(r[2*(a-e)]),t.push(r[2*(a-e)+1]);r=t}if(1===a){const e=i[n],s=new t.pointGeometry(r[0],r[1]);let a=new t.pointGeometry(r[0]-20,r[1]),l=new t.pointGeometry(r[0]+20,r[1]);a=a.rotateAround(e,s),l=l.rotateAround(e,s),o.feature.paths.push([a.x,a.y,l.x,l.y])}else{const t=et(r[2],r[3],r[0],r[1],20);void 0!==t&&(r[0]=t.x,r[1]=t.y);const e=r.length,i=et(r[e-4],r[e-3],r[e-2],r[e-1],20);void 0!==i&&(r[e-2]=i.x,r[e-1]=i.y),o.feature.paths.push(r)}n++}))}if(h in l&&d in l[h]){const t=l[h][d];o.feature.iconBoxes=[],o.feature.textBoxes=[],t.forEach((t=>{const{purpose:e,coords:i}=t;("icon"===e?o.feature.iconBoxes:o.feature.textBoxes).push(i.map((t=>t-X)))}))}if(h in c&&d in c[h]){const t=c[h][d];o.feature.angles=[],t.forEach((t=>{o.feature.angles.push(180*t/Math.PI)}))}h in u&&d in u[h]&&(o.feature["placement-anchor"]=u[h][d])}function et(t,e,i,n,r){if(t===i&&e===n)return;const o=Math.sqrt(Math.pow(t-i,2)+Math.pow(e-n,2)),s=(r+o)/o;return{x:t+(i-t)*s,y:e+(n-e)*s}}class it{constructor(e,i){this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<t.exported.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach((e=>t.saveTileTexture(e))),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const n of t){const t=n.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=n}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();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))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.CollisionBoxArray}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 l(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new l(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,n,r,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:r,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:a,params:s,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),o=i?i.sourceLayer:"",s=r._geojsonTileLayer||r[o];if(!s)return;const a=t.createFilter(i&&i.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let i=0;i<s.length;i++){const r=s.feature(i);if(a.needGeometry){const e=t.toEvaluationFeature(r,!0);if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!a.filter(new t.EvaluationParameters(this.tileID.overscaledZ),r))continue;const d=n.getId(r,o),p=new t.GeoJSONFeature(r,l,c,u,d);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else{const n=this.expirationTime-i;n?this.expirationTime=t+Math.max(n,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 n in this.buckets){if(!e.style.hasLayer(n))continue;const r=this.buckets[n],o=r.layers[0].sourceLayer||"_geojsonTileLayer",s=i[o],a=t[o];if(!s||!a||0===Object.keys(a).length)continue;r.update(a,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(n);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(r)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=t.exported.now()+e}setDependencies(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 nt{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 n=t.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:e,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout((()=>{this.remove(t,r)}),i)),this.data[n].push(r),this.order.push(n),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,n=void 0===e?0:this.data[i].indexOf(e),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.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 n of this.data[i])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t)}}class rt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const r=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},t.extend(this.stateChanges[e][r],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])n[t]||(this.deletedStates[e][r][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const n=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][n])for(i in this.deletedStates[t][n]={},this.stateChanges[t][n])this.deletedStates[t][n][i]=null;else this.deletedStates[t][n]=null;else this.deletedStates[t]=null}getState(e,i){const n=String(i),r=t.extend({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete r[e]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(e,i){const n={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const n in this.stateChanges[e])this.state[e][n]||(this.state[e][n]={}),t.extend(this.state[e][n],this.stateChanges[e][n]),i[n]=this.state[e][n];n[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}n[e]=n[e]||{},t.extend(n[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const t in e)e[t].setFeatureState(n,i)}}class ot extends t.Evented{constructor(e,i,n){super(),this.id=e,this.dispatcher=n,this.on("data",(t=>{"source"===t.dataType&&"metadata"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=function(e,i,n,r){const o=new z[i.type](e,i,n,r);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(e,i,n,this),this._tiles={},this._cache=new nt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new rt}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize: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;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,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event("dataabort",{tile:e,coord:e.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(st).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const n=e.tileID,r=i.tileID,o=new t.pointGeometry(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),s=new t.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-r.overscaledZ||s.y-o.y||s.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(st).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,e){const i=this._tiles[t];i&&("loading"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)))}_tileLoaded(e,i,n,r){if(r)return e.state="errored",void(404!==r.status?this._source.fire(new t.ErrorEvent(r,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.exported.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n<e.length;n++){const r=e[n];if(t.neighboringTiles&&t.neighboringTiles[r]){const e=this.getTileByID(r);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 n=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===n||Math.abs(n)>1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(s=t)}let a=s;for(;a.overscaledZ>e;)if(a=a.scaledTo(a.overscaledZ-1),t[a.key]){n[s.key]=s;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),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*i*5),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(r)}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 n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}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])}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=e.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&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const r=e.coveringZoomLevel(this._source),o=Math.max(r-ot.maxOverzooming,this._source.minzoom),s=Math.max(r+ot.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of n)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const n=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[n.key]=n}n=n.concat(Object.values(t))}const a=this._updateRetainedTiles(n,r);if(at(this._source.type)){const e={},l={},c=Object.keys(a);for(const i of c){const n=a[i],r=this._tiles[i];if(!r||r.fadeEndTime&&r.fadeEndTime<=t.exported.now())continue;const s=this.findLoadedParent(n,o);s&&(this._addTile(s.tileID),e[s.tileID.key]=s.tileID),l[i]=n}this._retainLoadedChildren(l,r,s,a);for(const t in e)a[t]||(this._coveredTiles[t]=!0,a[t]=e[t]);if(i){const t={},e={};for(const i of n)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const n=e[i].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(t[n[0].key]=a[n[0].key]=n[0],t[n[1].key]=a[n[1].key]=n[1],t[n[2].key]=a[n[2].key]=n[2],t[n[3].key]=a[n[3].key]=n[3],delete e[i])}for(const i in e){const n=this.findLoadedParent(e[i],this._source.minzoom);if(n){t[n.tileID.key]=a[n.tileID.key]=n.tileID;for(const e in t)t[e].isChildOf(n.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}for(const t in a)this._tiles[t].clearFadeHold();const l=t.keysDifference(this._tiles,a);for(const t of l){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){const i={},n={},r=Math.max(e-ot.maxOverzooming,this._source.minzoom),o=Math.max(e+ot.maxUnderzooming,this._source.minzoom),s={};for(const n of t){const t=this._addTile(n);i[n.key]=n,t.hasData()||e<this._source.maxzoom&&(s[n.key]=n)}this._retainLoadedChildren(s,e,o,i);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()){i[t.key]=t;continue}}else{const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let s=t.wasRequested();for(let e=o.overscaledZ-1;e>=r;--e){const r=o.scaledTo(e);if(n[r.key])break;if(n[r.key]=!0,t=this.getTile(r),!t&&s&&(t=this._addTile(r)),t&&(i[r.key]=r,s=t.wasRequested(),t.hasData()))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;n=t}for(const t of e)this._loadedParentTiles[t]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=i;return i||(i=new it(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,n||this._source.fire(new t.Event("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))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(e,i,n){const r=[],o=this.transform;if(!o)return r;const s=n?o.getCameraQueryGeometry(e):e,a=e.map((t=>o.pointCoordinate(t,this.terrain))),l=s.map((t=>o.pointCoordinate(t,this.terrain))),c=this.getIds();let u=1/0,h=1/0,d=-1/0,p=-1/0;for(const t of l)u=Math.min(u,t.x),h=Math.min(h,t.y),d=Math.max(d,t.x),p=Math.max(p,t.y);for(let e=0;e<c.length;e++){const n=this._tiles[c[e]];if(n.holdingForFade())continue;const s=n.tileID,f=Math.pow(2,o.zoom-n.tileID.overscaledZ),m=i*n.queryPadding*t.EXTENT/n.tileSize/f,g=[s.getTilePoint(new t.MercatorCoordinate(u,h)),s.getTilePoint(new t.MercatorCoordinate(d,p))];if(g[0].x-m<t.EXTENT&&g[0].y-m<t.EXTENT&&g[1].x+m>=0&&g[1].y+m>=0){const t=a.map((t=>s.getTilePoint(t))),e=l.map((t=>s.getTilePoint(t)));r.push({tile:n,tileID:s,queryGeometry:t,cameraQueryGeometry:e,scale:f})}}return r}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(at(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=t.exported.now())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 n=this._tiles[t];n&&n.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 st(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function at(t){return"raster"===t||"image"===t||"video"===t}ot.maxOverzooming=10,ot.maxUnderzooming=3;const lt="mapboxgl_preloaded_worker_pool";class ct{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<ct.workerCount;)this.workers.push(new Worker(Sr.workerUrl));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[lt]}numActive(){return Object.keys(this.active).length}}const ut=Math.floor(t.exported.hardwareConcurrency/2);let ht;function dt(){return ht||(ht=new ct),ht}function pt(e,i){const n={};for(const t in e)"ref"!==t&&(n[t]=e[t]);return t.refProperties.forEach((t=>{t in i&&(n[t]=i[t])})),n}function ft(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]=pt(t[i],e[t[i].ref]));return t}ct.workerCount=Math.max(Math.min(ut,6),1);const mt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function gt(t,e,i){i.push({command:mt.addSource,args:[t,e[t]]})}function yt(t,e,i){e.push({command:mt.removeSource,args:[t]}),i[t]=!0}function _t(t,e,i,n){yt(t,i,n),gt(t,e,i)}function vt(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!r(t[i][n],e[i][n]))return!1;return!0}function xt(t,e,i,n,o,s){let a;for(a in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,a)&&(r(t[a],e[a])||i.push({command:s,args:[n,a,e[a],o]}));for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&!Object.prototype.hasOwnProperty.call(t,a)&&(r(t[a],e[a])||i.push({command:s,args:[n,a,e[a],o]}))}function bt(t){return t.id}function wt(t,e){return t[e.id]=e,t}function St(e,i,n){return i*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))*2**t.exported.detailLevel}class Et{constructor(t,e,i,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class kt{constructor(t,e,i,n,r){this.text=new Et(t?t.text:null,e,i,r),this.icon=new Et(t?t.icon:null,e,n,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Tt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class At{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]}}class It{constructor(t,e,i,n,r){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=r}}class Mt{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 Ct(e,i,n,r,o){const{horizontalAlign:s,verticalAlign:a}=t.getAnchorAlignment(e),l=-(s-.5)*i,c=-(a-.5)*n,u=t.evaluateVariableOffset(e,r);return new t.pointGeometry(l+u[0]*o,c+u[1]*o)}function zt(e,i,n,r,o,s){const{x1:a,x2:l,y1:c,y2:u,anchorPointX:h,anchorPointY:d}=e,p=new t.pointGeometry(i,n);return r&&p._rotate(o?s:-s),{x1:a+p.x,y1:c+p.y,x2:l+p.x,y2:u+p.y,anchorPointX:h,anchorPointY:d}}class Pt{constructor(t,e,i,n,r){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new J(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Mt(n),this.collisionCircleArrays={},this.glyphCircles={},this.placedBoxes={},this.anchorAngles={},this.variableAnchors={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,i,n,r){const o=n.getBucket(i),s=n.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=n.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),u=n.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),d="map"===l.get("text-pitch-alignment"),p="map"===l.get("text-rotation-alignment"),f=St(n,1,this.transform.zoom),m=R(h,d,p,this.transform,f);let g=null;if(d){const e=O(h,d,p,this.transform,f);g=t.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[o.bucketInstanceId]=new It(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,n.tileID);const y={bucket:o,layout:l,posMatrix:h,textLabelPlaneMatrix:m,labelToScreenMatrix:g,scale:c,textPixelRatio:u,holdingForFade:n.holdingForFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m){const g=[h.textOffset0,h.textOffset1],y=Ct(t,i,n,g,r),_=this.collisionIndex.placeCollisionBox(zt(e,y.x,y.y,o,s,this.transform.angle),u,a,l,c.predicate,m);if((!f||0!==this.collisionIndex.placeCollisionBox(zt(f,y.x,y.y,o,s,this.transform.angle),u,a,l,c.predicate,m).box.length)&&_.box.length>0){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(e=this.prevPlacement.variableOffsets[h.crossTileID].anchor),0===h.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:g,width:i,height:n,anchor:t,textBoxScale:r,prevAnchor:e},this.markUsedJustification(d,t,h,p),d.allowVerticalPlacement&&(this.markUsedOrientation(d,p,h),this.placedOrientations[h.crossTileID]=p),{shift:y,placedGlyphBoxes:_}}}placeLayerBucketPart(e,i,n){const{bucket:r,layout:o,posMatrix:s,textLabelPlaneMatrix:a,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,f=o.get("text-optional"),m=o.get("icon-optional"),g=t.getOverlapMode(o,"text-overlap","text-allow-overlap"),y="always"===g,_=t.getOverlapMode(o,"icon-overlap","icon-allow-overlap"),v="always"===_,x="map"===o.get("text-rotation-alignment"),b="map"===o.get("text-pitch-alignment"),w="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),E=y&&(v||!r.hasIconData()||m),k=v&&(y||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);const T=(e,h)=>{if(i[e.crossTileID])return;if(u)return void(this.placements[e.crossTileID]=new Tt(!1,!1,!1));let v=!1,S=!1,T=!0,A=null,I={box:null,offscreen:null},M={box:null,offscreen:null},C=null,z=null,P=null,L=0,D=0,R=0;h.textFeatureIndex?L=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(L=e.featureIndex),h.verticalTextFeatureIndex&&(D=h.verticalTextFeatureIndex);const O=this.retainedQueryData[r.bucketInstanceId].tileID,F=this.terrain?(t,e)=>this.terrain.getElevation(O,t,e):null;for(const t of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const e=h[t];e&&(e.elevation=F?F(e.anchorPointX,e.anchorPointY):0)}const B=h.textBox;if(B){const i=i=>{let n=t.WritingMode.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},n=(i,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(const e of r.writingModes)if(e===t.WritingMode.vertical?(I=n(),M=I):I=i(),I&&I.box&&I.box.length)break}else I=i()};if(o.get("text-variable-anchor")){let a=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];a.indexOf(t.anchor)>0&&(a=a.filter((e=>e!==t.anchor)),a.unshift(t.anchor))}const l=(t,i,n)=>{const o=t.x2-t.x1,l=t.y2-t.y1,u=e.textBoxScale,h=w&&"never"===_?i:null;let d={box:[],offscreen:!1};const f="never"!==g?2*a.length:a.length;for(let i=0;i<f;++i){const f=a[i%a.length],m=this.attemptAnchorPlacement(f,t,o,l,u,x,b,c,s,p,i>=a.length?g:"never",e,r,n,h,F);if(m&&(d=m.placedGlyphBoxes,d&&d.box&&d.box.length)){v=!0,A=m.shift,this.addVariableAnchor(r.bucketInstanceId,L,f);break}}return d};n((()=>l(B,h.iconBox,t.WritingMode.horizontal)),(()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&!(I&&I.box&&I.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,h.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),I&&(v=I.box,T=I.offscreen);const u=i(I&&I.box);if(!v&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,u))}}else{const o=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,g,c,s,p.predicate,F);return n&&n.box&&n.box.length&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),n};n((()=>o(B,t.WritingMode.horizontal)),(()=>{const i=h.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(I&&I.box&&I.box.length)}}if(C=I,v=C&&C.box&&C.box.length>0,T=C&&C.offscreen,e.useRuntimeCollisionCircles){const i=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(r.textSizeData,d,i),u=o.get("text-padding");z=this.collisionIndex.placeCollisionCircles(g,i,r.lineVertexArray,r.glyphOffsetArray,c,s,a,l,n,b,p.predicate,e.collisionCircleDiameter,u,F),z.circles.length&&z.collisionDetected&&!n&&t.warnOnce("Collisions detected, but collision boxes are not shown"),v=y||z.circles.length>0&&!z.collisionDetected,T=T&&z.offscreen}if(h.iconFeatureIndex&&(R=h.iconFeatureIndex),h.iconBox){const t=t=>{const e=w&&A?zt(t,A.x,A.y,x,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,_,c,s,p.predicate,F)};M&&M.box&&M.box.length&&h.verticalIconBox?(P=t(h.verticalIconBox),S=P.box.length>0):(P=t(h.iconBox),S=P.box.length>0),T=T&&P.offscreen}const j=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=m||0===e.numIconVertices;if(j||$?$?j||(S=S&&v):v=S&&v:S=v=S&&v,v&&C&&C.box&&(this.collisionIndex.insertCollisionBox(C.box,g,o.get("text-ignore-placement"),r.bucketInstanceId,M&&M.box&&D?D:L,p.ID),this.addPlacedBox(r.bucketInstanceId,L,C.box,"text")),S&&P&&(this.collisionIndex.insertCollisionBox(P.box,_,o.get("icon-ignore-placement"),r.bucketInstanceId,R,p.ID),this.addPlacedBox(r.bucketInstanceId,R,P.box,"icon")),(v||S)&&this.addAnchorAngle(r.bucketInstanceId,L,e.angle),z&&(v&&(T||this.addGlyphCircles(r.bucketInstanceId,L,z.circles),this.collisionIndex.insertCollisionCircles(z.circles,g,o.get("text-ignore-placement"),r.bucketInstanceId,L,p.ID)),n)){const t=r.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new At);for(let t=0;t<z.circles.length;t+=4)e.circles.push(z.circles[t+0]),e.circles.push(z.circles[t+1]),e.circles.push(z.circles[t+2]),e.circles.push(z.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Tt(v||E,S||k,T||r.justReloaded),i[e.crossTileID]=!0};if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=r.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];T(r.symbolInstances.get(i),r.collisionArrays[i])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)T(r.symbolInstances.get(t),r.collisionArrays[t]);if(n&&r.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[r.bucketInstanceId];t.invert(e.invProjMatrix,s),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}r.justReloaded=!1}markUsedJustification(e,i,n,r){let o;o=r===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:n.crossTileID)}markUsedOrientation(e,i,n){const r=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of s)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}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 n=e?e.symbolFadeChange(t):1,r=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=r[t];o?(this.opacities[t]=new kt(o,n,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new kt(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const t in r){const e=r[t];if(!this.opacities[t]){const r=new kt(e,n,!1,!1);r.isHidden()||(this.opacities[t]=r,i=i||e.text.placed||e.icon.placed)}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in s)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=s[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 n of e){const e=n.getBucket(t);e&&n.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const r=e.layers[0].layout,o=new kt(null,0,!1,!1,!0),s=r.get("text-allow-overlap"),a=r.get("icon-allow-overlap"),l=r.get("text-variable-anchor"),c="map"===r.get("text-rotation-alignment"),u="map"===r.get("text-pitch-alignment"),h="none"!==r.get("icon-text-fit"),d=new kt(null,0,s&&(a||!e.hasIconData()||r.get("icon-optional")),a&&(s||!e.hasTextData()||r.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const p=(t,e,i)=>{for(let n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(i)};for(let n=0;n<e.symbolInstances.length;n++){const r=e.symbolInstances.get(n),{numHorizontalGlyphVertices:s,numVerticalGlyphVertices:a,crossTileID:f}=r;let m=this.opacities[f];i[f]?m=o:m||(m=d,this.opacities[f]=m),i[f]=!0;const g=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],_=y===t.WritingMode.vertical,v=y===t.WritingMode.horizontal||y===t.WritingMode.horizontalOnly;if(s>0||a>0){const t=Nt(m.text);p(e.text,s,_?Ut:t),p(e.text,a,v?Ut:t);const i=m.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||_?1:0)})),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||v?1:0);const n=this.variableOffsets[r.crossTileID];n&&this.markUsedJustification(e,n.anchor,r,y);const o=this.placedOrientations[r.crossTileID];o&&(this.markUsedJustification(e,"left",r,o),this.markUsedOrientation(e,o,r))}if(g){const t=Nt(m.icon),i=!(h&&r.verticalPlacedIconSymbolIndex&&_);r.placedIconSymbolIndex>=0&&(p(e.icon,r.numIconVertices,i?t:Ut),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=m.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(p(e.icon,r.numVerticalIconVertices,i?Ut:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[n];if(i){let n=new t.pointGeometry(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[f];e?(n=Ct(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&n._rotate(u?this.transform.angle:-this.transform.angle)):t=!1}i.textBox&&Lt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||_,n.x,n.y),i.verticalTextBox&&Lt(e.textCollisionBox.collisionVertexArray,m.text.placed,!t||v,n.x,n.y)}const r=Boolean(!v&&i.verticalIconBox);i.iconBox&&Lt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,r,h?n.x:0,h?n.y:0),i.verticalIconBox&&Lt(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!r,h?n.x:0,h?n.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.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}addGlyphCircles(t,e,i){t in this.glyphCircles||(this.glyphCircles[t]={}),e in this.glyphCircles[t]||(this.glyphCircles[t][e]=[]),this.glyphCircles[t][e].push(i)}addPlacedBox(t,e,i,n){t in this.placedBoxes||(this.placedBoxes[t]={}),e in this.placedBoxes[t]||(this.placedBoxes[t][e]=[]),this.placedBoxes[t][e].push({purpose:n,coords:i})}addAnchorAngle(t,e,i){t in this.anchorAngles||(this.anchorAngles[t]={}),e in this.anchorAngles[t]||(this.anchorAngles[t][e]=[]),this.anchorAngles[t][e].push(i)}addVariableAnchor(t,e,i){t in this.variableAnchors||(this.variableAnchors[t]={}),this.variableAnchors[t][e]=i}}function Lt(t,e,i,n,r){t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0),t.emplaceBack(e?1:0,i?1:0,n||0,r||0)}const Dt=Math.pow(2,25),Rt=Math.pow(2,24),Ot=Math.pow(2,17),Ft=Math.pow(2,16),Bt=Math.pow(2,9),jt=Math.pow(2,8),$t=Math.pow(2,1);function Nt(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*Dt+e*Rt+i*Ot+e*Ft+i*Bt+e*jt+i*$t+e}const Ut=0;class Vt{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,n,r){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,r())return!0;return!1}}class qt{constructor(t,e,i,n,r,o,s,a){this.placement=new Pt(t,e,o,s,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(e,i,n){const r=t.exported.now(),o=()=>{const e=t.exported.now()-r;return!this._forceFullPlacement&&e>2};for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===t.type&&(!t.minzoom||t.minzoom<=r)&&(!t.maxzoom||t.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Vt(t)),this._inProgressLayer.continuePlacement(n[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Zt=512/t.EXTENT/2;class Gt{constructor(t,e,i){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=i;for(let i=0;i<e.length;i++){const n=e.get(i),r=n.key;this.indexedSymbolInstances[r]||(this.indexedSymbolInstances[r]=[]),this.indexedSymbolInstances[r].push({crossTileID:n.crossTileID,coord:this.getScaledCoordinates(n,t)})}}getScaledCoordinates(e,i){const n=Zt/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*t.EXTENT+e.anchorX)*n),y:Math.floor((i.canonical.y*t.EXTENT+e.anchorY)*n)}}findMatches(t,e,i){const n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let r=0;r<t.length;r++){const o=t.get(r);if(o.crossTileID)continue;const s=this.indexedSymbolInstances[o.key];if(!s)continue;const a=this.getScaledCoordinates(o,e);for(const t of s)if(Math.abs(t.coord.x-a.x)<=n&&Math.abs(t.coord.y-a.y)<=n&&!i[t.crossTileID]){i[t.crossTileID]=!0,o.crossTileID=t.crossTileID;break}}}}class Ht{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Wt{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],n={};for(const t in i){const r=i[t];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),n[r.tileID.key]=r}this.indexes[t]=n}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 n=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,n)}else{const o=r[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,n)}}for(let t=0;t<e.symbolInstances.length;t++){const r=e.symbolInstances.get(t);r.crossTileID||(r.crossTileID=i.generate(),n[r.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Gt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i in e.indexedSymbolInstances)for(const n of e.indexedSymbolInstances[i])delete this.usedCrossTileIDs[t][n.crossTileID]}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const n=this.indexes[i];for(const r in n)t[n[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[r]),delete n[r],e=!0)}return e}}class Xt{constructor(){this.layerIndexes={},this.crossTileIDs=new Ht,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new Wt);let r=!1;const o={};n.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,e,this.crossTileIDs)&&(r=!0),o[e.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(r=!0),r}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t]}}var Jt=t.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Kt extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const e=this._tiles[t];e.textures.forEach((t=>t.destroy())),e.textures=[]}}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];for(const n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),t.ortho(n.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[n.key]=new it(n,this.tileSize))}removeOutdated(t){const e={};this.renderHistory=this.renderHistory.filter(((t,e)=>this.renderHistory.indexOf(t)===e)).slice(0,this.renderHistorySize);for(const t of this._renderableTilesKeys)e[t]=!0;for(const t of this.renderHistory)e[t]=!0;for(const i in this._tiles)e[i]||(this._tiles[i].clearTextures(t),delete this._tiles[i])}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const n of this._renderableTilesKeys){const r=this._tiles[n].tileID;if(r.canonical.equals(e.canonical)){const r=e.clone();r.posMatrix=new Float64Array(16),t.ortho(r.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[n]=r}else if(r.canonical.isChildOf(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=r.canonical.z-e.canonical.z,a=r.canonical.x-(r.canonical.x>>s<<s),l=r.canonical.y-(r.canonical.y>>s<<s),c=t.EXTENT>>s;t.ortho(o.posMatrix,0,c,0,c,0,1),t.translate(o.posMatrix,o.posMatrix,[-a*c,-l*c,0]),i[n]=o}else if(e.canonical.isChildOf(r.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const s=e.canonical.z-r.canonical.z,a=e.canonical.x-(e.canonical.x>>s<<s),l=e.canonical.y-(e.canonical.y>>s<<s),c=t.EXTENT>>s;t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(o.posMatrix,o.posMatrix,[a*c,l*c,0]),t.scale(o.posMatrix,o.posMatrix,[1/2**s,1/2**s,0]),i[n]=o}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let n=t.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(n).key);let r=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!r||!r.dem)&&e)for(;n>=i.minzoom&&(!r||!r.dem);)r=this.sourceCache.getTileByID(t.scaledTo(n--).key);return r}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeLoaded>=t))}}class Yt{constructor(t,e,i){this.style=t,this.sourceCache=new Kt(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.elevationOffset="number"==typeof i.elevationOffset?i.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(e,i,n,r=t.EXTENT){if(!(i>=0&&i<r&&n>=0&&n<r))return this.elevationOffset;let o=0;const s=this.getTerrainData(e);if(s.tile&&s.tile.dem){const e=t.transformMat4$1([],[i/r*t.EXTENT,n/r*t.EXTENT],s.u_terrain_matrix),a=[e[0]*s.tile.dem.dim,e[1]*s.tile.dem.dim],l=[Math.floor(a[0]),Math.floor(a[1])],c=s.tile.dem.get(l[0],l[1]),u=s.tile.dem.get(l[0],l[1]+1),h=s.tile.dem.get(l[0]+1,l[1]),d=s.tile.dem.get(l[0]+1,l[1]+1);o=t.number(t.number(c,u,a[0]-l[0]),t.number(h,d,a[0]-l[0]),a[1]-l[1])}return o}rememberForRerender(t,e){for(const i in this.sourceCache._tiles){const n=this.sourceCache._tiles[i];(n.tileID.equals(e)||n.tileID.isChildOf(e))&&(t===this.sourceCache.sourceCache.id&&(n.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][n.tileID.key]=!0)}}needsRerender(t,e){return this._rerender[t]&&this._rerender[t][e.key]}clearRerenderCache(){this._rerender={}}getElevation(e,i,n,r=t.EXTENT){return(this.getDEMElevation(e,i,n,r)+this.elevationOffset)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.style.map.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new l(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new l(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.style.map.painter.context;i.demTexture=this.style.map.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new l(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const n=i&&i+i.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){const n=this.sourceCache.sourceCache._source.maxzoom;let r=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?r=e.canonical.z-n:t.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>r<<r),s=e.canonical.y-(e.canonical.y>>r<<r),a=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<r),1/(t.EXTENT<<r),0]);t.translate(a,a,[o*t.EXTENT,s*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:a,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const e=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(e,e,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,e,e))}return this._rttFramebuffer}getFramebuffer(t){const e=this.style.map.painter,i=e.width/devicePixelRatio,n=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new l(e.context,{width:i,height:n,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 l(e.context,{width:i,height:n,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,n,!0),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.style.map.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 n=0;n<this._coordsTextureSize;n++,e+=4)i[e+0]=255&n,i[e+1]=255&t,i[e+2]=n>>8<<4|t>>8,i[e+3]=0;const n=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),r=new l(e,n,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){const i=new Uint8Array(4),n=this.style.map.painter,r=n.context,o=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),o.readPixels(e.x,n.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const s=i[0]+(i[2]>>4<<8),a=i[1]+((15&i[2])<<8),l=this.coordsIndex[255-i[3]],c=l&&this.sourceCache.getTileByID(l);if(!c)return null;const u=this._coordsTextureSize,h=(1<<c.tileID.canonical.z)*u;return new t.MercatorCoordinate((c.tileID.canonical.x*u+s)/h,(c.tileID.canonical.y*u+a)/h,this.getElevation(c.tileID,s,a,u))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.style.map.painter.context,i=new t.PosArray,n=new t.TriangleIndexArray,r=this.meshSize,o=t.EXTENT/r,s=r*r;for(let t=0;t<=r;t++)for(let e=0;e<=r;e++)i.emplaceBack(e*o,t*o);for(let t=0;t<s;t+=r+1)for(let e=0;e<r;e++)n.emplaceBack(e+t,r+e+t+1,r+e+t+2),n.emplaceBack(e+t,r+e+t+2,e+t+1);return this._mesh={indexBuffer:e.createIndexBuffer(n),vertexBuffer:e.createVertexBuffer(i,Jt.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,n.length)},this._mesh}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=(e.dem.min+this.elevationOffset)*this.exaggeration,i.maxElevation=(e.dem.max+this.elevationOffset)*this.exaggeration),i}}const Qt=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>"source.canvas"!==t.identifier))),te=t.pick(mt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),ee=t.pick(mt,["setCenter","setZoom","setBearing","setPitch"]),ie=function(){const e={},i=t.spec.$version;for(const n in t.spec.$root){const r=t.spec.$root[n];if(r.required){let t=null;t="version"===n?i:"array"===r.type?[]:{},null!=t&&(e[n]=t)}}return e}();class ne extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new v(dt(),this),this.imageManager=new u,this.imageManager.setEventedParent(this),this.glyphManager=new f(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new _(256,512),this.crossTileSymbolIndex=new Xt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());const n=this;this._rtlTextPluginCallback=ne.registerForPluginStateChange((e=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in n.sourceCaches)n.sourceCaches[t].reload()}))})),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(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"}));const n="boolean"!=typeof i.validate||i.validate,r=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(r,((e,i)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):i&&this._load(i,n)}))}loadJSON(e,i={}){this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.exported.frame((()=>{this._request=null,this._load(e,!1!==i.validate)}))}loadEmpty(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(ie,!1)}_load(e,i){if(i&&Qt(this,t.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(const t in e.sources)this.addSource(t,e.sources[t],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);const n=ft(this.stylesheet.layers);this._order=n.map((t=>t.id)),this._layers={},this._serializedLayers={};for(let e of n)e=t.createStyleLayer(e),e.setEventedParent(this,{layer:{id:e.id}}),this._layers[e.id]=e,this._serializedLayers[e.id]=e.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new y(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(e,i,n,r){let o,s,a;const l=n>1?"@2x":"";let c=t.getJSON(i.transformRequest(i.normalizeSpriteURL(e,l,".json"),t.ResourceType.SpriteJSON),((t,e)=>{c=null,a||(a=t,o=e,h())})),u=t.getImage(i.transformRequest(i.normalizeSpriteURL(e,l,".png"),t.ResourceType.SpriteImage),((t,e)=>{u=null,a||(a=t,s=e,h())}));function h(){if(a)r(a);else if(o&&s){const e=t.exported.getImageData(s),i={};for(const n in o){const{width:r,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=o[n],f=new t.RGBAImage({width:r,height:s});t.RGBAImage.copy(e,f,{x:a,y:l},{x:0,y:0},{width:r,height:s}),i[n]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}r(null,i)}}return{cancel(){c&&(c.cancel(),c=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(i)for(const t in i)this.imageManager.addImage(t,i[t]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${r.id}" as specified by style layer "${e.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()}_serializeLayers(t){const e=[];for(const i of t){const t=this._layers[i];"custom"!==t.type&&e.push(t.serialize())}return e}hasTransitions(){if(this.light&&this.light.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(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,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();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}const n={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];n[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in n){const i=this.sourceCaches[e];n[e]!==i.used&&i.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event("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={}}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(e){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),e){const t=this.sourceCaches[e.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain=new Yt(this,t,e),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=t=>{t.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=t=>{t.tile&&(t.sourceId===e.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(t.sourceId,t.tile.tileID)):"geojson"===t.source.type&&this.terrain.rememberForRerender(t.sourceId,t.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new t.Event("terrain",{terrain:e}))}setState(e){if(this._checkLoaded(),Qt(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=ft(e.layers);const i=function(t,e){if(!t)return[{command:mt.setStyle,args:[e]}];let i=[];try{if(!r(t.version,e.version))return[{command:mt.setStyle,args:[e]}];r(t.center,e.center)||i.push({command:mt.setCenter,args:[e.center]}),r(t.zoom,e.zoom)||i.push({command:mt.setZoom,args:[e.zoom]}),r(t.bearing,e.bearing)||i.push({command:mt.setBearing,args:[e.bearing]}),r(t.pitch,e.pitch)||i.push({command:mt.setPitch,args:[e.pitch]}),r(t.sprite,e.sprite)||i.push({command:mt.setSprite,args:[e.sprite]}),r(t.glyphs,e.glyphs)||i.push({command:mt.setGlyphs,args:[e.glyphs]}),r(t.transition,e.transition)||i.push({command:mt.setTransition,args:[e.transition]}),r(t.light,e.light)||i.push({command:mt.setLight,args:[e.light]});const n={},o=[];!function(t,e,i,n){let o;for(o in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,o)&&(Object.prototype.hasOwnProperty.call(e,o)||yt(o,i,n));for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Object.prototype.hasOwnProperty.call(t,o)?r(t[o],e[o])||("geojson"===t[o].type&&"geojson"===e[o].type&&vt(t,e,o)?i.push({command:mt.setGeoJSONSourceData,args:[o,e[o].data]}):_t(o,e,i,n)):gt(o,e,i))}(t.sources,e.sources,o,n);const s=[];t.layers&&t.layers.forEach((t=>{n[t.source]?i.push({command:mt.removeLayer,args:[t.id]}):s.push(t)})),i=i.concat(o),function(t,e,i){e=e||[];const n=(t=t||[]).map(bt),o=e.map(bt),s=t.reduce(wt,{}),a=e.reduce(wt,{}),l=n.slice(),c=Object.create(null);let u,h,d,p,f,m,g;for(u=0,h=0;u<n.length;u++)d=n[u],Object.prototype.hasOwnProperty.call(a,d)?h++:(i.push({command:mt.removeLayer,args:[d]}),l.splice(l.indexOf(d,h),1));for(u=0,h=0;u<o.length;u++)d=o[o.length-1-u],l[l.length-1-u]!==d&&(Object.prototype.hasOwnProperty.call(s,d)?(i.push({command:mt.removeLayer,args:[d]}),l.splice(l.lastIndexOf(d,l.length-h),1)):h++,m=l[l.length-u],i.push({command:mt.addLayer,args:[a[d],m]}),l.splice(l.length-u,0,d),c[d]=!0);for(u=0;u<o.length;u++)if(d=o[u],p=s[d],f=a[d],!c[d]&&!r(p,f))if(r(p.source,f.source)&&r(p["source-layer"],f["source-layer"])&&r(p.type,f.type)){for(g in xt(p.layout,f.layout,i,d,null,mt.setLayoutProperty),xt(p.paint,f.paint,i,d,null,mt.setPaintProperty),r(p.filter,f.filter)||i.push({command:mt.setFilter,args:[d,f.filter]}),r(p.minzoom,f.minzoom)&&r(p.maxzoom,f.maxzoom)||i.push({command:mt.setLayerZoomRange,args:[d,f.minzoom,f.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?xt(p[g],f[g],i,d,g.slice(6),mt.setPaintProperty):r(p[g],f[g])||i.push({command:mt.setLayerProperty,args:[d,g,f[g]]}));for(g in f)Object.prototype.hasOwnProperty.call(f,g)&&!Object.prototype.hasOwnProperty.call(p,g)&&"layout"!==g&&"paint"!==g&&"filter"!==g&&"metadata"!==g&&"minzoom"!==g&&"maxzoom"!==g&&(0===g.indexOf("paint.")?xt(p[g],f[g],i,d,g.slice(6),mt.setPaintProperty):r(p[g],f[g])||i.push({command:mt.setLayerProperty,args:[d,g,f[g]]}))}else i.push({command:mt.removeLayer,args:[d]}),m=l[l.lastIndexOf(d)+1],i.push({command:mt.addLayer,args:[f,m]})}(s,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:mt.setStyle,args:[e]}]}return i}(this.serialize(),e).filter((t=>!(t.command in ee)));if(0===i.length)return!1;const n=i.filter((t=>!(t.command in te)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((t=>t.command)).join(", ")}.`);return i.forEach((t=>{"setTransition"!==t.command&&this[t.command].apply(this,t.args)})),this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=this.sourceCaches[e]=new ot(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,(()=>({isSourceLoaded:this.loaded(),source:r.serialize(),sourceId:e}))),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),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(e,i,n={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.ErrorEvent(new Error(`Layer "${r}" already exists on this map.`)));let o;if("custom"===e.type){if(Qt(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone$1(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,`layers.${r}`,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize()}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)this.fire(new t.ErrorEvent(new Error(`Cannot add layer "${r}" before non-existing layer "${i}".`)));else{if(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){const t=this._removedLayers[r];delete this._removedLayers[r],t.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!r(o.filter,i))return null==i?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(t.validateStyle.filter,`layers.${o.id}.filter`,i,null,n)||(o.filter=t.clone$1(i),this._updateLayer(o)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,n,o={}){this._checkLoaded();const s=this.getLayer(e);s?r(s.getLayoutProperty(i),n)||(s.setLayoutProperty(i,n,o),this._updateLayer(s)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,o={}){this._checkLoaded();const s=this.getLayer(e);s?r(s.getPaintProperty(i),n)||(s.setPaintProperty(i,n,o)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const n=e.source,r=e.sourceLayer,o=this.sourceCaches[n];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const s=o.getSource().type;"geojson"===s&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||r?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(r,e.id,i)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,r=this.sourceCaches[n];if(void 0===r)return void this.fire(new t.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type,s="vector"===o?e.sourceLayer:void 0;"vector"!==o||s?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(s,e.id,i):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,r=this.sourceCaches[i];if(void 0!==r)return"vector"!==r.getSource().type||n?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),r.getFeatureState(n,e.id)):void this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(t=>t.serialize())),layers:this._serializeLayers(this._order)},(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._changed=!0}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(e(o)){i[o]=r;for(const e of t){const t=e[o];if(t)for(const e of t)n.push(e)}}}n.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const r=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(e(s))for(let t=n.length-1;t>=0;t--){const e=n[t].feature;if(i[e.layer.id]<o)break;r.push(e),n.pop()}else for(const e of t){const t=e[s];if(t)for(const e of t)r.push(e.feature)}}return r}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",i.filter,null,i);const r={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0}}const o=[];i.availableImages=this._availableImages;for(const t in this.sourceCaches)i.layers&&!r[t]||o.push(Y(this.sourceCaches[t],this._layers,this._serializedLayers,e,i,n));return this.placement&&o.push(function(t,e,i,n,r,o,s){const a={},l=o.queryRenderedSymbols(n),c=[];for(const t of Object.keys(l).map(Number))c.push(s[t]);c.sort(Q);for(const n of c){const o=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],e,n.bucketIndex,n.sourceLayerIndex,r.filter,r.layers,r.availableImages,t);for(const e in o){const r=a[e]=a[e]||[],s=o[e];s.sort(((t,e)=>{const i=n.featureSortOrder;if(i){const n=i.indexOf(t.featureIndex);return i.indexOf(e.featureIndex)-n}return e.featureIndex-t.featureIndex}));for(const o of s)tt(i,t,n,e,o),r.push(o)}}for(const e in a)a[e].forEach((n=>{const r=n.feature,o=i[t[e].source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=o}));return a}(this._layers,this._serializedLayers,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.sourceCaches[e];return n?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),n=[],r={};for(let t=0;t<i.length;t++){const o=i[t],s=o.tileID.canonical.key;r[s]||(r[s]=!0,o.querySourceFeatures(n,e))}return n}(n,i):[]}addSourceType(t,e,i){return ne.getSourceType(t)?i(new Error(`A source type called "${t}" already exists.`)):(ne.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const t in e)if(!r(e[t],n[t])){o=!0;break}if(!o)return;const s={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(s)}_validate(e,i,n,r,o={}){return(!o||!1!==o.validate)&&Qt(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:n,styleSpec:t.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginStateChange",this._rtlTextPluginCallback);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),this.dispatcher.remove()}_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.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(e,i,n,r,o=!1){let s=!1,a=!1;const l={};for(const t of this._order){const i=this._layers[t];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 n=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);s=s||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new qt(e,this.terrain,this._order,o,i,n,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(t.exported.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)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(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i)}getResource(e,i,n){return t.makeRequest(i,n)}}ne.getSourceType=function(t){return z[t]},ne.setSourceType=function(t,e){z[t]=e},ne.registerForPluginStateChange=t.registerForPluginStateChange;var re="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const oe={prelude:se("#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","#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_offset;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_offset)*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}"),background:se("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:se("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;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:se("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);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:se("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:se("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,0,1);gl_Position=u_matrix*pos;}"),heatmapTexture:se("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:se("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_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:se("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:se("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:se("#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:se("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:se("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:se("#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:se("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 baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;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:se("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 baseDelta=10.0;float ele=get_elevation(a_centroid);\n#else\nfloat baseDelta=0.0;float ele=0.0;\n#endif\nbase=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);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:se("#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:se("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;\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:se("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:se("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:se("#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:se("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform 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:se("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:se("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}","const float PI=3.141592653589793;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;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\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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);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:se("#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 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}","const float PI=3.141592653589793;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 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;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\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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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:se("#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;gl_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}","const float PI=3.141592653589793;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;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\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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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:se("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",re),terrainDepth:se("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);}",re),terrainCoords:se("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);}",re)};function se(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),r=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(r):r,a={};return{fragmentSource:t=t.replace(i,((t,e,i,n,r)=>(a[r]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,n,r)=>{const o="float"===n?"vec2":"vec4",s=r.match(/color/)?"color":o;return a[r]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\nvarying ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${s}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nattribute ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===s?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${s}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`})),staticAttributes:n,staticUniforms:s}}class ae{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,n,r,o,s,a,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!c&&t<n.length;t++)this.boundPaintVertexBuffers[t]!==n[t]&&(c=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===i&&!c&&this.boundIndexBuffer===r&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===s&&this.boundDynamicVertexBuffer2===a&&this.boundDynamicVertexBuffer3===l?(t.bindVertexArrayOES.set(this.vao),s&&s.bind(),r&&r.dynamicDraw&&r.bind(),a&&a.bind(),l&&l.bind()):this.freshBind(e,i,n,r,o,s,a,l)}freshBind(t,e,i,n,r,o,s,a){let l;const c=t.numAttributes,u=this.context,h=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),l=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=a;else{l=u.currentNumAttributes||0;for(let t=c;t<l;t++)h.disableVertexAttribArray(t)}e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),s&&s.enableAttributes(h,t),a&&a.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,r);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,r);o&&(o.bind(),o.setVertexAttribPointers(h,t,r)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,t,r)),a&&(a.bind(),a.setVertexAttribPointers(h,t,r)),u.currentNumAttributes=c}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function le(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const n=t[i].split(" ");e.push(n.pop())}return e}class ce{constructor(e,i,n,r,o,s,a,l){const c=e.gl;this.program=c.createProgram(),this.painter=l;const u=le(n.staticAttributes),h=r?r.getBinderAttributes():[],d=u.concat(h),p=oe.prelude.staticUniforms?le(oe.prelude.staticUniforms):[],f=n.staticUniforms?le(n.staticUniforms):[],m=r?r.getBinderUniforms():[],g=p.concat(f).concat(m),y=[];for(const t of g)y.indexOf(t)<0&&y.push(t);const _=r?r.defines():[];s&&_.push("#define OVERDRAW_INSPECTOR;"),a&&_.push("#define TERRAIN3D;");const v=_.concat(oe.prelude.fragmentSource,n.fragmentSource).join("\n"),x=_.concat(oe.prelude.vertexSource,n.vertexSource).join("\n"),b=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(b,v),c.compileShader(b),c.attachShader(this.program,b);const w=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);c.shaderSource(w,x),c.compileShader(w),c.attachShader(this.program,w),this.attributes={};const S={};this.numAttributes=d.length;for(let t=0;t<this.numAttributes;t++)d[t]&&(c.bindAttribLocation(this.program,t,d[t]),this.attributes[d[t]]=t);c.linkProgram(this.program),c.deleteShader(w),c.deleteShader(b);for(let t=0;t<y.length;t++){const e=y[t];if(e&&!S[e]){const t=c.getUniformLocation(this.program,e);t&&(S[e]=t)}}this.fixedUniforms=o(e,S),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_offset:new t.Uniform1f(e,i.u_terrain_offset),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,S),this.binderUniforms=r?r.getUniforms(e,S):[]}draw(t,e,i,n,r,o,s,a,l,c,u,h,d,p,f,m,g,y){const _=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(r),t.setCullFace(o),a){t.activeTexture.set(_.TEXTURE2),_.bindTexture(_.TEXTURE_2D,a.depthTexture),t.activeTexture.set(_.TEXTURE3),_.bindTexture(_.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(s[t]);f&&f.setUniforms(t,this.binderUniforms,d,{zoom:p});let v=0;switch(e){case _.LINES:v=2;break;case _.TRIANGLES:v=3;break;case _.LINE_STRIP:v=1}for(const i of h.get()){const n=i.vaos||(i.vaos={});(n[l]||(n[l]=new ae)).bind(t,this,c,f?f.getPaintVertexBuffers():[],u,i.vertexOffset,m,g,y),_.drawElements(e,i.primitiveLength*v,_.UNSIGNED_SHORT,i.primitiveOffset*v*2),this.painter.visibleLayers.add(l)}}}function ue(t,e,i){const n=1/St(i,1,e.transform.tileZoom),r=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/r,s=o*(i.tileID.canonical.x+i.tileID.wrap*r),a=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a]}}const he=(e,i,n,r)=>{const o=i.style.light,s=o.properties.get("position"),a=[s.x,s.y,s.z],l=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(l,-i.transform.angle),t.transformMat3(a,a,l);const c=o.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+n,u_opacity:r}},de=(e,i,n,r,o,s,a)=>t.extend(he(e,i,n,r),ue(s,i,a),{u_height_factor:-Math.pow(2,o.overscaledZ)/a.tileSize/8}),pe=t=>({u_matrix:t}),fe=(e,i,n,r)=>t.extend(pe(e),ue(n,i,r)),me=(t,e)=>({u_matrix:t,u_world:e}),ge=(e,i,n,r,o)=>t.extend(fe(e,i,n,r),{u_world:o}),ye=(t,e,i,n)=>{const r=t.transform;let o,s;if("map"===n.paint.get("circle-pitch-alignment")){const t=St(i,1,r.zoom);o=!0,s=[t,t]}else o=!1,s=r.pixelsToGLUnits;return{u_camera_to_center_distance:r.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,i,n.paint.get("circle-translate"),n.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:s}},_e=(t,e,i)=>{const n=St(i,1,e.zoom),r=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*r),e.pixelsToGLUnits[1]/(n*r)],u_overscale_factor:o}},ve=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),xe=t=>({u_matrix:t}),be=(t,e,i,n)=>({u_matrix:t,u_extrude_scale:St(e,1,i),u_intensity:n});function we(e,i){const n=Math.pow(2,i.canonical.z),r=i.canonical.y;return[new t.MercatorCoordinate(0,r/n).toLngLat().lat,new t.MercatorCoordinate(0,(r+1)/n).toLngLat().lat]}const Se=(t,e,i,n)=>{const r=t.transform;return{u_matrix:Ie(t,e,i,n),u_ratio:1/St(e,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},Ee=(e,i,n,r,o)=>t.extend(Se(e,i,n,o),{u_image:0,u_image_height:r}),ke=(t,e,i,n,r)=>{const o=t.transform,s=Ae(e,o);return{u_matrix:Ie(t,e,i,r),u_texsize:e.imageAtlasTexture.size,u_ratio:1/St(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Te=(e,i,n,r,o,s)=>{const a=e.lineAtlas,l=Ae(i,e.transform),c="round"===n.layout.get("line-cap"),u=a.getDash(r.from,c),h=a.getDash(r.to,c),d=u.width*o.fromScale,p=h.width*o.toScale;return t.extend(Se(e,i,n,s),{u_patternscale_a:[l/d,-u.height/2],u_patternscale_b:[l/p,-h.height/2],u_sdfgamma:a.width/(256*Math.min(d,p)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:o.t})};function Ae(t,e){return 1/St(t,1,e.tileZoom)}function Ie(t,e,i,n){return t.translatePosMatrix(n?n.posMatrix:e.tileID.posMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Me=(t,e,i,n,r)=>{return{u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Ce(r.paint.get("raster-hue-rotate"))};var o,s};function Ce(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 ze=(t,e,i,n,r,o,s,a,l,c)=>{const u=r.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:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:u.width/u.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:s,u_coord_matrix:a,u_is_text:+l,u_pitch_with_map:+n,u_texsize:c,u_texture:0}},Pe=(e,i,n,r,o,s,a,l,c,u,h)=>{const d=o.transform;return t.extend(ze(e,i,n,r,o,s,a,l,c,u),{u_gamma_scale:r?Math.cos(d._pitch)*d.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+h})},Le=(e,i,n,r,o,s,a,l,c,u)=>t.extend(Pe(e,i,n,r,o,s,a,l,!0,c,!0),{u_texsize_icon:u,u_texture_icon:1}),De=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Re=(e,i,n,r,o,s)=>t.extend(function(t,e,i,n){const r=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:s,height:a}=i.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,i.transform.tileZoom)/l,u=c*(n.tileID.canonical.x+n.tileID.wrap*l),h=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,a],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/St(n,1,i.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(r,s,n,o),{u_matrix:e,u_opacity:i}),Oe={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id)})};class Fe{constructor(t,e,i){this.context=t;const n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.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 Be={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class je{constructor(t,e,i,n){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;const r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.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 n=e.attributes[this.attributes[i].name];void 0!==n&&t.enableVertexAttribArray(n)}}setVertexAttribPointers(t,e,i){for(let n=0;n<this.attributes.length;n++){const r=this.attributes[n],o=e.attributes[r.name];void 0!==o&&t.vertexAttribPointer(o,r.components,t[Be[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class $e{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 Ne extends $e{getDefault(){return t.Color.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 Ue extends $e{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Ve extends $e{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class qe extends $e{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 Ze extends $e{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ge extends $e{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class He extends $e{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 We extends $e{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 Xe extends $e{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 Je extends $e{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 Ke extends $e{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 Ye extends $e{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Qe extends $e{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 ti extends $e{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 ei extends $e{getDefault(){return t.Color.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 ii extends $e{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class ni extends $e{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 ri extends $e{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class oi extends $e{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class si extends $e{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class ai extends $e{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class li extends $e{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 ci extends $e{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 ui extends $e{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 hi extends $e{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 di extends $e{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 pi extends $e{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class fi extends $e{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class mi extends $e{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 gi extends $e{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 yi extends $e{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 _i extends $e{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class vi extends _i{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 xi extends _i{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 bi{constructor(t,e,i,n){this.context=t,this.width=e,this.height=i;const r=t.gl,o=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new vi(t,o),n&&(this.depthAttachment=new xi(t,o)),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.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 wi{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}wi.Replace=[1,0],wi.disabled=new wi(wi.Replace,t.Color.transparent,[!1,!1,!1,!1]),wi.unblended=new wi(wi.Replace,t.Color.transparent,[!0,!0,!0,!0]),wi.alphaBlended=new wi([1,771],t.Color.transparent,[!0,!0,!0,!0]);class Si{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Ne(this),this.clearDepth=new Ue(this),this.clearStencil=new Ve(this),this.colorMask=new qe(this),this.depthMask=new Ze(this),this.stencilMask=new Ge(this),this.stencilFunc=new He(this),this.stencilOp=new We(this),this.stencilTest=new Xe(this),this.depthRange=new Je(this),this.depthTest=new Ke(this),this.depthFunc=new Ye(this),this.blend=new Qe(this),this.blendFunc=new ti(this),this.blendColor=new ei(this),this.blendEquation=new ii(this),this.cullFace=new ni(this),this.cullFaceSide=new ri(this),this.frontFace=new oi(this),this.program=new si(this),this.activeTexture=new ai(this),this.viewport=new li(this),this.bindFramebuffer=new ci(this),this.bindRenderbuffer=new ui(this),this.bindTexture=new hi(this),this.bindVertexBuffer=new di(this),this.bindElementBuffer=new pi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new fi(this),this.pixelStoreUnpack=new mi(this),this.pixelStoreUnpackPremultiplyAlpha=new gi(this),this.pixelStoreUnpackFlipY=new yi(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.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Fe(this,t,e)}createVertexBuffer(t,e,i){return new je(this,t,e,i)}createRenderbuffer(t,e,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),r}createFramebuffer(t,e,i){return new bi(this,t,e,i)}clear({color:t,depth:e}){const i=this.gl;let n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),i.clear(n)}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){r(t.blendFunction,wi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Ei{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}Ei.ReadOnly=!1,Ei.ReadWrite=!0,Ei.disabled=new Ei(519,Ei.ReadOnly,[0,1]);const ki=7680;class Ti{constructor(t,e,i,n,r,o){this.test=t,this.ref=e,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}Ti.disabled=new Ti({func:519,mask:0},0,0,ki,ki,ki);class Ai{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}let Ii;function Mi(e,i,n,r,o,s,a){const l=e.context,c=l.gl,u=e.useProgram("collisionBox"),h=[];let d=0,p=0;for(let f=0;f<r.length;f++){const m=r[f],g=i.getTile(m),y=g.getBucket(n);if(!y)continue;let _=m.posMatrix;0===o[0]&&0===o[1]||(_=e.translatePosMatrix(m.posMatrix,g,o,s));const v=a?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;if(x.length>0){const i=t.create(),n=_;t.mul(i,y.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,y.placementViewportMatrix),h.push({circleArray:x,circleOffset:p,transform:n,invTransform:i,coord:m}),d+=x.length/4,p=d}v&&u.draw(l,c.LINES,Ei.disabled,Ti.disabled,e.colorModeForRenderPass(),Ai.disabled,_e(_,e.transform,g),e.style.terrain&&e.style.terrain.getTerrainData(m),n.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,null,e.transform.zoom,null,null,v.collisionVertexBuffer)}if(!a||!h.length)return;const f=e.useProgram("collisionCircle"),m=new t.CollisionCircleLayoutArray;m.resize(4*d),m._trim();let g=0;for(const t of h)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],r=t.circleArray[i+1],o=t.circleArray[i+2],s=t.circleArray[i+3];m.emplace(g++,n,r,o,s,0),m.emplace(g++,n,r,o,s,1),m.emplace(g++,n,r,o,s,2),m.emplace(g++,n,r,o,s,3)}(!Ii||Ii.length<2*d)&&(Ii=function(e){const i=2*e,n=new t.QuadTriangleArray;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(d));const y=l.createIndexBuffer(Ii,!0),_=l.createVertexBuffer(m,t.collisionCircleLayout.members,!0);for(const i of h){const r={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(v=e.transform).cameraToCenterDistance,u_viewport_size:[v.width,v.height]};f.draw(l,c.TRIANGLES,Ei.disabled,Ti.disabled,e.colorModeForRenderPass(),Ai.disabled,r,e.style.terrain&&e.style.terrain.getTerrainData(i.coord),n.id,_,y,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}var v;_.destroy(),y.destroy()}Ai.disabled=new Ai(!1,1029,2305),Ai.backCCW=new Ai(!0,1029,2305);const Ci=t.identity(new Float32Array(16));function zi(e,i,n,r,o,s){const{horizontalAlign:a,verticalAlign:l}=t.getAnchorAlignment(e),c=-(a-.5)*i,u=-(l-.5)*n,h=t.evaluateVariableOffset(e,r);return new t.pointGeometry((c/o+h[0])*s,(u/o+h[1])*s)}function Pi(e,i,n,r,o,s,a,l,c,u,h){const d=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,m={};p.clear();for(let f=0;f<d.length;f++){const g=d.get(f),y=e.allowVerticalPlacement&&!g.placedOrientation,_=g.hidden||!g.crossTileID||y?null:r[g.crossTileID];if(_){const r=new t.pointGeometry(g.anchorX,g.anchorY),d=F(r,n?a:s,h),f=B(o.cameraToCenterDistance,d.signedDistanceFromCamera);let y=t.evaluateSizeForFeature(e.textSizeData,c,g)*f/t.ONE_EM;n&&(y*=e.tilePixelRatio/l);const{width:v,height:x,anchor:b,textOffset:w,textBoxScale:S}=_,E=zi(b,v,x,w,S,y),k=n?F(r.add(E),s,h).point:d.point.add(i?E.rotate(-o.angle):E),T=e.allowVerticalPlacement&&g.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<g.numGlyphs;e++)t.addDynamicAttributes(p,k,T);u&&g.associatedIconIndex>=0&&(m[g.associatedIconIndex]={shiftedAnchor:k,angle:T})}else H(g.numGlyphs,p)}if(u){f.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)H(n.numGlyphs,f);else{const i=m[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.addDynamicAttributes(f,i.shiftedAnchor,i.angle);else H(n.numGlyphs,f)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function Li(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function Di(e,i,n,r,o,s,a,l,c,u,h,d){const p=e.context,f=p.gl,m=e.transform,g="map"===l,y="map"===c,_="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),v=g&&!y&&!_,x=!n.layout.get("symbol-sort-key").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Ei.ReadOnly),S=n.layout.get("text-variable-anchor"),E=[];for(const l of r){const r=i.getTile(l),c=r.getBucket(n);if(!c)continue;const h=o?c.text:c.icon;if(!h||!h.segments.get().length)continue;const d=h.programConfigurations.get(n.id),p=o||c.sdfIcons,w=o?c.textSizeData:c.iconSizeData,k=y||0!==m.pitch,T=e.useProgram(Li(p,o,c),d),A=t.evaluateSizeForZoom(w,m.zoom),I=e.style.terrain&&e.style.terrain.getTerrainData(l);let M,C,z,P,L=[0,0],D=null;if(o){if(C=r.glyphAtlasTexture,z=f.LINEAR,M=r.glyphAtlasTexture.size,c.iconsInText){L=r.imageAtlasTexture.size,D=r.imageAtlasTexture;const t="composite"===w.kind||"camera"===w.kind;P=k||e.options.rotating||e.options.zooming||t?f.LINEAR:f.NEAREST}}else{const t=c.iconsNeedLinear;C=r.imageAtlasTexture,z=p||e.options.rotating||e.options.zooming||t||k?f.LINEAR:f.NEAREST,M=r.imageAtlasTexture.size}const F=St(r,1,e.transform.zoom),B=R(l.posMatrix,y,g,e.transform,F),j=O(l.posMatrix,y,g,e.transform,F),N=S&&c.hasTextData(),U="none"!==n.layout.get("icon-text-fit")&&N&&c.hasIconData();if(_){const t=e.style.terrain?(t,i)=>e.style.terrain.getElevation(l,t,i):null,i="map"===n.layout.get("text-rotation-alignment");$(c,l.posMatrix,e,o,B,j,y,u,i,t)}const V=e.translatePosMatrix(l.posMatrix,r,s,a),q=_||o&&S||U?Ci:B,Z=e.translatePosMatrix(j,r,s,a,!0),G=p&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=p?c.iconsInText?Le(w.kind,A,v,y,e,V,q,Z,M,L):Pe(w.kind,A,v,y,e,V,q,Z,o,M,!0):ze(w.kind,A,v,y,e,V,q,Z,o,M);const W={program:T,buffers:h,uniformValues:H,atlasTexture:C,atlasTextureIcon:D,atlasInterpolation:z,atlasInterpolationIcon:P,isSDF:p,hasHalo:G};if(x&&c.canOverlap){b=!0;const e=h.segments.get();for(const i of e)E.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:W,terrainData:I})}else E.push({segments:h.segments,sortKey:0,state:W,terrainData:I})}b&&E.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of E){const i=t.state;if(p.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,Ri(i.buffers,t.segments,n,e,i.program,w,h,d,r,t.terrainData)),r.u_is_halo=0}Ri(i.buffers,t.segments,n,e,i.program,w,h,d,i.uniformValues,t.terrainData)}}function Ri(t,e,i,n,r,o,s,a,l,c){const u=n.context;r.draw(u,u.gl.TRIANGLES,o,s,a,Ai.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,n.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Oi(t,e,i,n,r,o,s){const a=t.context.gl,l=i.paint.get("fill-pattern"),c=l&&l.constantOr(1),u=i.getCrossfadeParameters();let h,d,p,f,m;s?(d=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=a.LINES):(d=c?"fillPattern":"fill",h=a.TRIANGLES);for(const g of n){const n=e.getTile(g);if(c&&!n.patternsLoaded())continue;const y=n.getBucket(i);if(!y)continue;const _=y.programConfigurations.get(i.id),v=t.useProgram(d,_),x=t.style.terrain&&t.style.terrain.getTerrainData(g);c&&(t.context.activeTexture.set(a.TEXTURE0),n.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),_.updatePaintBuffers(u));const b=l.constantOr(null);if(b&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[b.to.toString()],i=t.patternPositions[b.from.toString()];e&&i&&_.setConstantPatternPositions(e,i)}const w=x?g:null,S=t.translatePosMatrix(w?w.posMatrix:g.posMatrix,n,i.paint.get("fill-translate"),i.paint.get("fill-translate-anchor"));if(s){f=y.indexBuffer2,m=y.segments2;const e=[a.drawingBufferWidth,a.drawingBufferHeight];p="fillOutlinePattern"===d&&c?ge(S,t,u,n,e):me(S,e)}else f=y.indexBuffer,m=y.segments,p=c?fe(S,t,u,n):pe(S);v.draw(t.context,h,r,t.stencilModeForClipping(g),o,Ai.disabled,p,x,i.id,y.layoutVertexBuffer,f,m,i.paint,t.transform.zoom,_)}}function Fi(t,e,i,n,r,o,s){const a=t.context,l=a.gl,c=i.paint.get("fill-extrusion-pattern"),u=c.constantOr(1),h=i.getCrossfadeParameters(),d=i.paint.get("fill-extrusion-opacity");for(const p of n){const n=e.getTile(p),f=n.getBucket(i);if(!f)continue;const m=t.style.terrain&&t.style.terrain.getTerrainData(p),g=f.programConfigurations.get(i.id),y=t.useProgram(u?"fillExtrusionPattern":"fillExtrusion",g);u&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(h));const _=c.constantOr(null);if(_&&n.imageAtlas){const t=n.imageAtlas,e=t.patternPositions[_.to.toString()],i=t.patternPositions[_.from.toString()];e&&i&&g.setConstantPatternPositions(e,i)}const v=t.translatePosMatrix(p.posMatrix,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),x=i.paint.get("fill-extrusion-vertical-gradient"),b=u?de(v,t,x,d,p,h,n):he(v,t,x,d);y.draw(a,a.gl.TRIANGLES,r,o,s,Ai.backCCW,b,m,i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,t.transform.zoom,g,t.style.terrain&&f.centroidVertexBuffer)}}function Bi(t,e,i,n,r,o,s){const a=t.context,l=a.gl,c=i.fbo;if(!c)return;const u=t.useProgram("hillshade"),h=t.style.terrain&&t.style.terrain.getTerrainData(e);a.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),u.draw(a,l.TRIANGLES,r,o,s,Ai.disabled,((t,e,i,n)=>{const r=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),s=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:n?n.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:we(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:r,u_highlight:o,u_accent:s}})(t,i,n,h?e:null),h,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}function ji(e,i,n,r,o,s){const a=e.context,c=a.gl,u=i.dem;if(u&&u.data){const h=u.dim,d=u.stride,p=u.getPixels();if(a.activeTexture.set(c.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(d),i.demTexture){const t=i.demTexture;t.update(p,{premultiply:!1}),t.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new l(a,p,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);a.activeTexture.set(c.TEXTURE0);let f=i.fbo;if(!f){const t=new l(a,{width:h,height:h,data:null},c.RGBA);t.bind(c.LINEAR,c.CLAMP_TO_EDGE),f=i.fbo=a.createFramebuffer(h,h,!0),f.colorAttachment.set(t.texture)}a.bindFramebuffer.set(f.framebuffer),a.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(a,c.TRIANGLES,r,o,s,Ai.disabled,((e,i)=>{const n=i.stride,r=t.create();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,u),null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function $i(e,i,n,r,o,s){const a=r.paint.get("raster-fade-duration");if(!s&&a>0){const r=t.exported.now(),s=(r-e.timeAdded)/a,l=i?(r-i.timeAdded)/a:-1,c=n.getSource(),u=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),d=h&&e.refreshedUponExpiration?1:t.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const Ni=new t.Color(1,0,0,1),Ui=new t.Color(0,1,0,1),Vi=new t.Color(0,0,1,1),qi=new t.Color(1,0,1,1),Zi=new t.Color(0,1,1,1);function Gi(t,e,i,n){Wi(t,0,e+i/2,t.transform.width,i,n)}function Hi(t,e,i,n){Wi(t,e-i/2,0,i,t.transform.height,n)}function Wi(t,e,i,n,r,o){const s=t.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,n*t.pixelRatio,r*t.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function Xi(e,i,n){const r=e.context,o=r.gl,s=n.posMatrix,a=e.useProgram("debug"),l=Ei.disabled,c=Ti.disabled,u=e.colorModeForRenderPass(),h="$debug",d=e.style.terrain&&e.style.terrain.getTerrainData(n);r.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);const p=i.getTileByID(n.key).latestRawTileData,f=Math.floor((p&&p.byteLength||0)/1024),m=i.getTile(n).tileSize,g=512/Math.min(m,512)*(n.overscaledZ/e.transform.zoom)*.5;let y=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(y+=` => ${n.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,n=t.context.gl,r=t.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(e,5,5),r.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${y} ${f}kB`),a.draw(r,o.TRIANGLES,l,c,wi.alphaBlended,Ai.disabled,ve(s,t.Color.transparent,g),null,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,o.LINE_STRIP,l,c,u,Ai.disabled,ve(s,t.Color.red),d,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Ji(t,e,i){const n=t.context,r=n.gl,o=t.colorModeForRenderPass(),s=new Ei(r.LEQUAL,Ei.ReadWrite,t.depthRangeFor3D),a=t.useProgram("terrain"),l=e.getTerrainMesh(),c=e.getTerrainData(i.tileID);n.bindFramebuffer.set(null),n.viewport.set([0,0,t.width,t.height]),n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,e.getRTTFramebuffer().colorAttachment.get());const u=t.transform.calculatePosMatrix(i.tileID.toUnwrapped());a.draw(n,r.TRIANGLES,s,Ti.disabled,o,Ai.backCCW,{u_matrix:u,u_texture:0},c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}function Ki(t,e,i,n){const r=t.context,o=i.tileSize*e.qualityFactor;i.textures[n]||(i.textures[n]=t.getTileTexture(o)||new l(r,{width:o,height:o,data:null},r.gl.RGBA),i.textures[n].bind(r.gl.LINEAR,r.gl.CLAMP_TO_EDGE),0===n&&e.sourceCache.renderHistory.unshift(i.tileID.key));const s=e.getRTTFramebuffer();s.colorAttachment.set(i.textures[n].texture),r.bindFramebuffer.set(s.framebuffer),r.viewport.set([0,0,o,o])}class Yi{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,e=t.terrain;for(const i in t.sourceCaches){this._coordsDescendingInv[i]={};const n=t.sourceCaches[i].getVisibleCoordinates();for(const t of n){const n=e.sourceCache.getTerrainCoords(t);for(const t in n)this._coordsDescendingInv[i][t]||(this._coordsDescendingInv[i][t]=[]),this._coordsDescendingInv[i][t].push(n[t])}}for(const e of t._order){const i=t._layers[e],n=i.source;if(this._renderToTexture[i.type]&&!this._coordsDescendingInvStr[n]){this._coordsDescendingInvStr[n]={};for(const t in this._coordsDescendingInv[n])this._coordsDescendingInvStr[n][t]=this._coordsDescendingInv[n][t].map((t=>t.key)).sort().join()}}return this._renderableTiles.forEach((t=>{for(const i in this._coordsDescendingInvStr){const n=this._coordsDescendingInvStr[i][t.tileID.key];n&&n!==t.textureCoords[i]&&t.clearTextures(this.painter),e.needsRerender(i,t.tileID)&&t.clearTextures(this.painter)}this._rerender[t.tileID.key]=!t.textures.length})),e.clearRerenderCache(),e.sourceCache.removeOutdated(this.painter),this}renderLayer(e){const i=e.type,n=this.painter,r=n.style._order,o=n.currentLayer,s=o+1===r.length;if(this._renderToTexture[i]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(r[o]),!s))return!0;if(this._renderToTexture[this._prevType]||"hillshade"===i||this._renderToTexture[i]&&s){this._prevType=i;const s=this._stacks.length-1,a=this._stacks[s]||[];for(const e of this._renderableTiles){if(Ki(n,n.style.terrain,e,s),this._rerender[e.tileID.key]){n.context.clear({color:t.Color.transparent});for(let t=0;t<a.length;t++){const i=n.style._layers[a[t]],r=i.source?this._coordsDescendingInv[i.source][e.tileID.key]:[e.tileID];n._renderTileClippingMasks(i,r),n.renderLayer(n,n.style.sourceCaches[i.source],i,r),i.source&&(e.textureCoords[i.source]=this._coordsDescendingInvStr[i.source][e.tileID.key])}}Ji(n,n.style.terrain,e)}if("hillshade"===i){this._stacks.push([r[o]]);for(const i of this._renderableTiles){const r=this._coordsDescendingInv[e.source][i.tileID.key];Ki(n,n.style.terrain,i,this._stacks.length-1),n.context.clear({color:t.Color.transparent}),n._renderTileClippingMasks(e,r),n.renderLayer(n,n.style.sourceCaches[e.source],e,r),Ji(n,n.style.terrain,i)}return!0}return this._renderToTexture[i]}return!1}}const Qi={symbol:function(e,i,n,r,o){if("translucent"!==e.renderPass)return;const s=Ti.disabled,a=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,i,n,r,o,s,a){const l=i.transform,c="map"===o,u="map"===s;for(const o of e){const e=r.getTile(o),s=e.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;const h=t.evaluateSizeForZoom(s.textSizeData,l.zoom),d=St(e,1,i.transform.zoom),p=R(o.posMatrix,u,c,i.transform,d),f="none"!==n.layout.get("icon-text-fit")&&s.hasIconData();if(h){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Pi(s,c,u,a,l,p,o.posMatrix,t,h,f,i.style.terrain?(t,e)=>i.style.terrain.getElevation(o,t,e):null)}}}(r,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&Di(e,i,n,r,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),s,a),0!==n.paint.get("text-opacity").constantOr(1)&&Di(e,i,n,r,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),s,a),i.map.showCollisionBoxes&&(Mi(e,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Mi(e,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("circle-opacity"),s=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=!n.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const c=e.context,u=c.gl,h=e.depthModeForSublayer(0,Ei.ReadOnly),d=Ti.disabled,p=e.colorModeForRenderPass(),f=[];for(let o=0;o<r.length;o++){const s=r[o],a=i.getTile(s),c=a.getBucket(n);if(!c)continue;const u=c.programConfigurations.get(n.id),h=e.useProgram("circle",u),d=c.layoutVertexBuffer,p=c.indexBuffer,m=e.style.terrain&&e.style.terrain.getTerrainData(s),g={programConfiguration:u,program:h,layoutVertexBuffer:d,indexBuffer:p,uniformValues:ye(e,s,a,n),terrainData:m};if(l){const e=c.segments.get();for(const i of e)f.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:g})}else f.push({segments:c.segments,sortKey:0,state:g})}l&&f.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of f){const{programConfiguration:i,program:r,layoutVertexBuffer:o,indexBuffer:s,uniformValues:a,terrainData:l}=t.state;r.draw(c,u.TRIANGLES,h,d,p,Ai.disabled,a,l,n.id,o,s,t.segments,n.paint,e.transform.zoom,i)}},heatmap:function(e,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){const o=e.context,s=o.gl,a=Ti.disabled,l=new wi([s.ONE,s.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let r=i.heatmapFbo;if(r)n.bindTexture(n.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{const 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),r=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,i,n){const r=t.gl;r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e.width/4,e.height/4,0,r.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:r.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(t,e,o,r)}}(o,e,n),o.clear({color:t.Color.transparent});for(let t=0;t<r.length;t++){const c=r[t];if(i.hasRenderableParent(c))continue;const u=i.getTile(c),h=u.getBucket(n);if(!h)continue;const d=h.programConfigurations.get(n.id),p=e.useProgram("heatmap",d),{zoom:f}=e.transform;p.draw(o,s.TRIANGLES,Ei.disabled,a,l,Ai.disabled,be(c.posMatrix,u,f,n.paint.get("heatmap-intensity")),null,n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,n.paint,e.transform.zoom,d)}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const n=e.context,r=n.gl,o=i.heatmapFbo;if(!o)return;n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1);let s=i.colorRampTexture;s||(s=i.colorRampTexture=new l(n,i.colorRamp,r.RGBA)),s.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,r.TRIANGLES,Ei.disabled,Ti.disabled,e.colorModeForRenderPass(),Ai.disabled,((e,i,n,r)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const s=e.context.gl;return{u_matrix:o,u_world:[s.drawingBufferWidth,s.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get("heatmap-opacity")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom)}(e,n))},line:function(e,i,n,r){if("translucent"!==e.renderPass)return;const o=n.paint.get("line-opacity"),s=n.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=e.depthModeForSublayer(0,Ei.ReadOnly),c=e.colorModeForRenderPass(),u=n.paint.get("line-dasharray"),h=n.paint.get("line-pattern"),d=h.constantOr(1),p=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),m=d?"linePattern":u?"lineSDF":p?"lineGradient":"line",g=e.context,y=g.gl;let _=!0;for(const o of r){const r=i.getTile(o);if(d&&!r.patternsLoaded())continue;const s=r.getBucket(n);if(!s)continue;const v=s.programConfigurations.get(n.id),x=e.context.program.get(),b=e.useProgram(m,v),w=_||b.program!==x,S=e.style.terrain&&e.style.terrain.getTerrainData(o),E=h.constantOr(null);if(E&&r.imageAtlas){const t=r.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&v.setConstantPatternPositions(e,i)}const k=S?o:null,T=d?ke(e,r,n,f,k):u?Te(e,r,n,u,f,k):p?Ee(e,r,n,s.lineClipsArray.length,k):Se(e,r,n,k);if(d)g.activeTexture.set(y.TEXTURE0),r.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),v.updatePaintBuffers(f);else if(u&&(w||e.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(g);else if(p){const r=s.gradients[n.id];let a=r.texture;if(n.gradientVersion!==r.version){let c=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;c=t.clamp(t.nextPowerOfTwo(s.maxLineLength/t.EXTENT*1024*r),256,g.maxTextureSize)}r.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:r.gradient||void 0,clips:s.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new l(g,r.gradient,y.RGBA),r.version=n.gradientVersion,a=r.texture}g.activeTexture.set(y.TEXTURE0),a.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}b.draw(g,y.TRIANGLES,a,e.stencilModeForClipping(o),c,Ai.disabled,T,S,n.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,n.paint,e.transform.zoom,v,s.layoutVertexBuffer2),_=!1}},fill:function(e,i,n,r){const o=n.paint.get("fill-color"),s=n.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=e.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===c){const t=e.depthModeForSublayer(1,"opaque"===e.renderPass?Ei.ReadWrite:Ei.ReadOnly);Oi(e,i,n,r,t,a,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ei.ReadOnly);Oi(e,i,n,r,t,a,!0)}},"fill-extrusion":function(t,e,i,n){const r=i.paint.get("fill-extrusion-opacity");if(0!==r&&"translucent"===t.renderPass){const o=new Ei(t.context.gl.LEQUAL,Ei.ReadWrite,t.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Fi(t,e,i,n,o,Ti.disabled,wi.disabled),Fi(t,e,i,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{const r=t.colorModeForRenderPass();Fi(t,e,i,n,o,Ti.disabled,r)}}},hillshade:function(t,e,i,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const r=t.context,o=t.depthModeForSublayer(0,Ei.ReadOnly),s=t.colorModeForRenderPass(),[a,l]="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n];for(const n of l){const r=e.getTile(n);void 0!==r.needsHillshadePrepare&&r.needsHillshadePrepare&&"offscreen"===t.renderPass?ji(t,r,i,o,Ti.disabled,s):"translucent"===t.renderPass&&Bi(t,n,r,i,o,a[n.overscaledZ],s)}r.viewport.set([0,0,t.width,t.height])},raster:function(t,e,i,n){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const r=t.context,o=r.gl,s=e.getSource(),a=t.useProgram("raster"),l=t.colorModeForRenderPass(),[c,u]=s instanceof I?[{},n]:t.stencilConfigForOverlap(n),h=u[u.length-1].overscaledZ,d=!t.options.moving;for(const n of u){const u=t.depthModeForSublayer(n.overscaledZ-h,1===i.paint.get("raster-opacity")?Ei.ReadWrite:Ei.ReadOnly,o.LESS),p=e.getTile(n);p.registerFadeDuration(i.paint.get("raster-fade-duration"));const f=e.findLoadedParent(n,0),m=$i(p,f,e,i,t.transform,t.style.terrain);let g,y;const _="nearest"===i.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;r.activeTexture.set(o.TEXTURE0),p.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(o.TEXTURE1),f?(f.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),g=Math.pow(2,f.tileID.overscaledZ-p.tileID.overscaledZ),y=[p.tileID.canonical.x*g%1,p.tileID.canonical.y*g%1]):p.texture.bind(_,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const v=t.style.terrain&&t.style.terrain.getTerrainData(n),x=v?n:null,b=x?x.posMatrix:t.transform.calculatePosMatrix(n.toUnwrapped(),d),w=Me(b,y||[0,0],g||1,m,i);s instanceof I?a.draw(r,o.TRIANGLES,u,Ti.disabled,l,Ai.disabled,w,v,i.id,s.boundsBuffer,t.quadTriangleIndexBuffer,s.boundsSegments):a.draw(r,o.TRIANGLES,u,c[n.overscaledZ],l,Ai.disabled,w,v,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,i,n){const r=i.paint.get("background-color"),o=i.paint.get("background-opacity");if(0===o)return;const s=t.context,a=s.gl,l=t.transform,c=l.tileSize,u=i.paint.get("background-pattern");if(t.isPatternMissing(u))return;const h=!u&&1===r.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==h)return;const d=Ti.disabled,p=t.depthModeForSublayer(0,"opaque"===h?Ei.ReadWrite:Ei.ReadOnly),f=t.colorModeForRenderPass(),m=t.useProgram(u?"backgroundPattern":"background"),g=n||l.coveringTiles({tileSize:c,terrain:t.style.terrain});u&&(s.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));const y=i.getCrossfadeParameters();for(const e of g){const l=n?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),h=u?Re(l,o,t,u,{tileID:e,tileSize:c},y):De(l,o,r),g=t.style.terrain&&t.style.terrain.getTerrainData(e);m.draw(s,a.TRIANGLES,p,d,f,Ai.disabled,h,g,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}},debug:function(t,e,i){for(let n=0;n<i.length;n++)Xi(t,e,i[n])},custom:function(t,e,i){const n=t.context,r=i.implementation;if("offscreen"===t.renderPass){const e=r.prerender;e&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),e.call(r,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ti.disabled);const e="3d"===r.renderingMode?new Ei(t.context.gl.LEQUAL,Ei.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ei.ReadOnly);n.setDepthMode(e),r.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}};class tn{constructor(e,i){this.context=new Si(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=ot.maxUnderzooming+ot.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xt,this.gpuTimers={},this.visibleLayers=new Set}resize(e,i,n){if(this.width=e*n/t.exported.dynamicScale,this.height=i*n/t.exported.dynamicScale,this.pixelRatio=n,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 e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,Jt.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const n=new t.PosArray;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,Jt.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const r=new t.RasterBoundsArray;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,A.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Jt.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const s=new t.LineStripIndexArray;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const a=new t.TriangleIndexArray;a.emplaceBack(0,1,2),a.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(a),this.emptyTexture=new l(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);const c=this.context.gl;this.stencilClearMode=new Ti({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,i.TRIANGLES,Ei.disabled,this.stencilClearMode,wi.disabled,Ai.disabled,xe(n),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,n=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(wi.disabled),i.setDepthMode(Ei.disabled);const r=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.terrain&&this.style.terrain.getTerrainData(t);r.draw(i,n.TRIANGLES,Ei.disabled,new Ti({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),wi.disabled,Ai.disabled,xe(t.posMatrix),o,"$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 Ti({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ti({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)),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const t={};for(let i=0;i<r;i++)t[i+n]=new Ti({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=r,[t,i]}return[{[n]:Ti.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new wi([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?wi.unblended:wi.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Ei.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ei(i||this.context.gl.LEQUAL,e,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame(),this.visibleLayers.clear();const n=this.style._order,r=this.style.sourceCaches,o=this.style.terrain&&new Yi(this);for(const t in r){const e=r[t];e.used&&e.prepare(this.context)}const s={},a={},l={};for(const t in r){const e=r[t];s[t]=e.getVisibleCoordinates(),a[t]=s[t].slice().reverse(),l[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<n.length;t++)if(this.style._layers[n[t]].is3D()){this.opaquePassCutoff=t;break}if(o){this.opaquePassCutoff=0;const e=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const n=e.context,r=n.gl,o=wi.unblended,s=new Ei(r.LEQUAL,Ei.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainDepth");n.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),u=e.transform.calculatePosMatrix(t.tileID.toUnwrapped());c.draw(n,r.TRIANGLES,s,Ti.disabled,o,Ai.backCCW,{u_matrix:u},l,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.terrain),function(e,i){const n=e.context,r=n.gl,o=wi.unblended,s=new Ei(r.LEQUAL,Ei.ReadWrite,[0,1]),a=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");n.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const c=i.getTerrainData(t.tileID);n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,l.texture);const h=e.transform.calculatePosMatrix(t.tileID.toUnwrapped());u.draw(n,r.TRIANGLES,s,Ti.disabled,o,Ai.backCCW,{u_matrix:h,u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0},c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),i.coordsIndex.push(t.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const t of n){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,r[e.source],e,i)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!o)for(this.renderPass="opaque",this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[n[this.currentLayer]],e=r[t.source],i=s[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){const t=this.style._layers[n[this.currentLayer]],e=r[t.source];if(o&&o.renderLayer(t))continue;const i=("symbol"===t.type?l:a)[t.source];this._renderTileClippingMasks(t,s[t.source]),this.renderLayer(this,e,t,i)}if(this.options.showTileBoundaries){let t,e;Object.values(this.style._layers).forEach((i=>{i.source&&!i.isHidden(this.transform.zoom)&&(i.source!==(e&&e.id)&&(e=this.style.sourceCaches[i.source]),(!t||t.getSource().maxzoom<e.getSource().maxzoom)&&(t=e))})),t&&Qi.debug(this,t,t.getVisibleCoordinates())}this.options.showPadding&&function(t){const e=t.transform.padding;Gi(t,t.transform.height-(e.top||0),3,Ni),Gi(t,e.bottom||0,3,Ui),Hi(t,e.left||0,3,Vi),Hi(t,t.transform.width-(e.right||0),3,qi);const i=t.transform.centerPoint;!function(t,e,i,n){Wi(t,e-1,i-10,2,20,n),Wi(t,e-10,i-1,20,2,n)}(t,i.x,t.transform.height-i.y,Zi)}(this),this.context.setDefault()}renderLayer(t,e,i,n){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,this.gpuTimingStart(i),Qi[i.type](t,e,i,n,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const e=this.context.extTimerQuery;let i=this.gpuTimers[t.id];i||(i=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),i.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,i.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const e={};for(const i in t){const n=t[i],r=this.context.extTimerQuery,o=r.getQueryObjectEXT(n.query,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(n.query),e[i]=o}return e}translatePosMatrix(e,i,n,r,o){if(!n[0]&&!n[1])return e;const s=o?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(s){const t=Math.sin(s),e=Math.cos(s);n=[n[0]*e-n[1]*t,n[0]*t+n[1]*e]}const a=[o?n[0]:St(i,n[0],this.transform.zoom),o?n[1]:St(i,n[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,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.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new ce(this.context,t,oe[t],e,Oe[t],this._showOverdrawInspector,this.style.terrain,this)),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 l(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class en{constructor(t,e){this.points=t,this.planes=e}static fromInvProjectionMatrix(e,i,n){const r=Math.pow(2,n),o=[[-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((n=>{const o=1/(n=t.transformMat4([],n,e))[3]/i*r;return t.mul$1(n,n,[o,o,1/n[3],o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const i=t.sub([],o[e[0]],o[e[1]]),n=t.sub([],o[e[2]],o[e[1]]),r=t.normalize([],t.cross([],i,n)),s=-t.dot(r,o[e[1]]);return r.concat(s)}));return new en(o,s)}}class nn{constructor(e,i){this.min=e,this.max=i,this.center=t.scale$1([],t.add([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=t.clone$2(this.min),r=t.clone$2(this.max);for(let t=0;t<i.length;t++)n[t]=i[t]?this.min[t]:this.center[t],r[t]=i[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new nn(n,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(e){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 n=!0;for(let r=0;r<e.planes.length;r++){const o=e.planes[r];let s=0;for(let e=0;e<i.length;e++)t.dot$1(o,i[e])>=0&&s++;if(0===s)return 0;s!==i.length&&(n=!1)}if(n)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;r<e.points.length;r++){const o=e.points[r][t]-this.min[t];i=Math.min(i,o),n=Math.max(n,o)}if(n<0||i>this.max[t]-this.min[t])return 0}return 1}}class rn{constructor(t=0,e=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(n)||n<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=n}interpolate(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.clamp((this.left+e-this.right)/2,0,e),r=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.pointGeometry(n,r)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new rn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class on{constructor(e,i,n,r,o){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this.alignRasterLayers=!0,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new rn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new on(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}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 t.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;var n;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(n=new t.ARRAY_TYPE(4),t.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),function(t,e,i){var n=e[0],r=e[1],o=e[2],s=e[3],a=Math.sin(i),l=Math.cos(i);t[0]=n*l+o*a,t[1]=r*l+s*a,t[2]=n*-a+o*l,t[3]=r*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,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.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,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(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const n=this.pointCoordinate(new t.pointGeometry(0,0)),r=this.pointCoordinate(new t.pointGeometry(this.width,0)),o=this.pointCoordinate(new t.pointGeometry(this.width,this.height)),s=this.pointCoordinate(new t.pointGeometry(0,this.height)),a=Math.floor(Math.min(n.x,r.x,o.x,s.x)),l=Math.floor(Math.max(n.x,r.x,o.x,s.x)),c=1;for(let n=a-c;n<=l+c;n++)0!==n&&i.push(new t.UnwrappedTileID(n,e))}return i}coveringTiles(e){var i,n;let r=this.coveringZoomLevel(e);const o=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);const s=this.pointCoordinate(this.getCameraPoint()),a=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,r),c=[l*s.x,l*s.y,0],u=[l*a.x,l*a.y,0],h=en.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r);let d=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(d=r);const p=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,f=t=>({aabb:new nn([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],g=[],y=r,_=e.reparseOverscaled?o:r;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(f(-t)),m.push(f(t));for(m.push(f(0));m.length>0;){const r=m.pop(),o=r.x,s=r.y;let a=r.fullyVisible;if(!a){const t=r.aabb.intersects(h);if(0===t)continue;a=2===t}const l=e.terrain?c:u,f=r.aabb.distanceX(l),v=r.aabb.distanceY(l),x=Math.max(Math.abs(f),Math.abs(v)),b=p+(1<<y-r.zoom)-2;if(r.zoom===y||x>b&&r.zoom>=d){const e=y-r.zoom,i=c[0]-.5-(o<<e),n=c[1]-.5-(s<<e);g.push({tileID:new t.OverscaledTileID(r.zoom===y?_:r.zoom,r.wrap,r.zoom,o,s),distanceSq:t.sqrLen([u[0]-.5-o,u[1]-.5-s]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let l=0;l<4;l++){const c=(o<<1)+l%2,u=(s<<1)+(l>>1),h=r.zoom+1;let d=r.aabb.quadrant(l);if(e.terrain){const o=new t.OverscaledTileID(h,r.wrap,h,c,u),s=e.terrain.getMinMaxElevation(o),a=null!==(i=s.minElevation)&&void 0!==i?i:this.elevation,l=null!==(n=s.maxElevation)&&void 0!==n?n:this.elevation;d=new nn([d.min[0],d.min[1],a],[d.max[0],d.max[1],l])}m.push({aabb:d,zoom:h,x:c,y:u,wrap:r.wrap,fullyVisible:a})}}return g.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(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.pointGeometry(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(e,i){const n=t.MercatorCoordinate.fromLngLat(e),r=(1<<this.tileZoom)*t.EXTENT,o=n.x*r,s=n.y*r,a=Math.floor(o/t.EXTENT),l=Math.floor(s/t.EXTENT),c=new t.OverscaledTileID(this.tileZoom,0,this.tileZoom,a,l);return i.getElevation(c,o%t.EXTENT,s%t.EXTENT,t.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),n=this.getElevation(i,e);if(!(this.elevation-n))return;const r=this.getCameraPosition(),o=t.MercatorCoordinate.fromLngLat(r.lngLat,r.altitude),s=t.MercatorCoordinate.fromLngLat(i,n),a=o.x-s.x,l=o.y-s.y,c=o.z-s.z,u=Math.sqrt(a*a+l*l+c*c),h=this.scaleZoom(this.cameraToCenterDistance/u/this.tileSize);this._elevation=n,this._center=i,this.zoom=h}setLocationAtPoint(e,i){const n=this.pointCoordinate(i),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),s=new t.MercatorCoordinate(o.x-(n.x-r.x),o.y-(n.y-r.y));this.center=this.coordinateLocation(s),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,e),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const n=[e.x,e.y,0,1],r=[e.x,e.y,1,1];t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(r,r,this.pixelMatrixInverse);const o=n[3],s=r[3],a=n[1]/o,l=r[1]/s,c=n[2]/o,u=r[2]/s,h=c===u?0:(0-c)/(u-c);return new t.MercatorCoordinate(t.number(n[0]/o,r[0]/s,h)/this.worldSize,t.number(a,l,h)/this.worldSize)}coordinatePoint(e,i=0,n=this.pixelMatrix){const r=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(r,r,n),new t.pointGeometry(r[0]/r[3],r[1]/r[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return(new t.LngLatBounds).extend(this.pointLocation(new t.pointGeometry(0,e))).extend(this.pointLocation(new t.pointGeometry(this.width,e))).extend(this.pointLocation(new t.pointGeometry(this.width,this.height))).extend(this.pointLocation(new t.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([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=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,i=!1){const n=e.key,r=i?this._alignedPosMatrixCache:this._posMatrixCache;if(r[n])return r[n];const o=e.canonical,s=this.worldSize/this.zoomScale(o.z),a=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[a*s,o.y*s,0]),t.scale(l,l,[s/t.EXTENT,s/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),r[n]=new Float32Array(l),r[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,n,r,o=-90,s=90,a=-180,l=180;const c=this.size,u=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,s=t.mercatorYfromLat(i[0])*this.worldSize,e=s-o<c.y?c.y/(s-o):0}if(this.lngRange){const e=this.lngRange;a=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<a&&(l+=this.worldSize),i=l-a<c.x?c.x/(l-a):0}const h=this.point,d=Math.max(i||0,e||0);if(d)return this.center=this.unproject(new t.pointGeometry(i?(l+a)/2:h.x,e?(s+o)/2:h.y)),this.zoom+=this.scaleZoom(d),this._unmodified=u,void(this._constraining=!1);if(this.latRange){const t=h.y,e=c.y/2;t-e<o&&(r=o+e),t+e>s&&(r=s-e)}if(this.lngRange){const e=(a+l)/2,i=t.wrap(h.x,e-this.worldSize/2,e+this.worldSize/2),r=c.x/2;i-r<a&&(n=a+r),i+r>l&&(n=l-r)}void 0===n&&void 0===r||(this.center=this.unproject(new t.pointGeometry(void 0!==n?n:h.x,void 0!==r?r:h.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height*2**t.exported.detailLevel,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let r=t.identity(new Float64Array(16));t.scale(r,r,[this.width/2,-this.height/2,1]),t.translate(r,r,[1,-1,0]),this.labelPlaneMatrix=r,r=t.identity(new Float64Array(16)),t.scale(r,r,[1,-1,1]),t.translate(r,r,[-1,-1,0]),t.scale(r,r,[2/this.width,2/this.height,1]),this.glCoordMatrix=r,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const o=Math.PI/2+this._pitch,s=this._fov*(.5+e.y/this.height),a=Math.sin(s)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-o-s,.01,Math.PI-.01)),l=this.getHorizon(),c=2*Math.atan(l/this.cameraToCenterDistance)*(.5+e.y/(2*l)),u=Math.sin(c)*this.cameraToSeaLevelDistance/Math.sin(t.clamp(Math.PI-o-c,.01,Math.PI-.01)),h=Math.cos(Math.PI/2-this._pitch)*a+this.cameraToSeaLevelDistance,d=Math.cos(Math.PI/2-this._pitch)*u+this.cameraToSeaLevelDistance,p=1.01*Math.min(h,d),f=this.height/50;if(r=new Float64Array(16),t.perspective(r,this._fov,this.width/this.height,f,p),r[8]=2*-e.x/this.width,r[9]=2*e.y/this.height,t.scale(r,r,[1,-1,1]),t.translate(r,r,[0,0,-this.cameraToCenterDistance]),t.rotateX(r,r,this._pitch),t.rotateZ(r,r,this.angle),t.translate(r,r,[-i,-n,0]),this.mercatorMatrix=t.scale([],r,[this.worldSize,this.worldSize,this.worldSize]),t.scale(r,r,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,r),t.translate(r,r,[0,0,-this.elevation]),this.projMatrix=r,this.invProjMatrix=t.invert([],r),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,r),this.alignRasterLayers){const e=this.width%2/2,o=this.height%2/2,s=Math.cos(this.angle),a=Math.sin(this.angle),l=i-Math.round(i)+s*e+a*o,c=n-Math.round(n)+s*o+a*e,u=new Float64Array(r);t.translate(u,u,[l>.5?l-1:l,c>.5?c-1:c,0]),this.alignedProjMatrix=u}else this.alignedProjMatrix=r;if(r=t.invert(new Float64Array(16),this.pixelMatrix),!r)throw new Error("failed to invert matrix");this.pixelMatrixInverse=r,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.pointGeometry(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.pointGeometry(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return[e[0],i];{let n=i.x,r=i.y,o=i.x,s=i.y;for(const t of e)n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y);return[new t.pointGeometry(n,r),new t.pointGeometry(o,r),new t.pointGeometry(o,s),new t.pointGeometry(n,s),new t.pointGeometry(n,r)]}}}class sn{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(t,e){let i=!1,n=null;const r=()=>{n=null,i&&(t(),n=setTimeout(r,300),i=!1)};return()=>(i=!0,n||r(),n)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,n),o=Math.round(e.lng*r)/r,s=Math.round(e.lat*r)/r,a=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=t?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(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 n=i.split("=")[0];return n===t?(e=!0,`${n}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join("&")}`}return`#${c}`}_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("/")}_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}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch(t){}}}const an={linearity:.3,easing:t.bezier(0,0,.3,1)},ln=t.extend({deceleration:2500,maxSpeed:1400},an),cn=t.extend({deceleration:20,maxSpeed:1400},an),un=t.extend({deceleration:1e3,maxSpeed:360},an),hn=t.extend({deceleration:1e3,maxSpeed:90},an);class dn{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.pointGeometry(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 n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=fn(i.pan.mag(),n,t.extend({},ln,e||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,pn(r,o)}if(i.zoom){const t=fn(i.zoom,n,cn);r.zoom=this._map.transform.zoom+t.amount,pn(r,t)}if(i.bearing){const e=fn(i.bearing,n,un);r.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),pn(r,e)}if(i.pitch){const t=fn(i.pitch,n,hn);r.pitch=this._map.transform.pitch+t.amount,pn(r,t)}if(r.zoom||r.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;r.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),t.extend(r,{noMoveStart:!0})}}function pn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function fn(e,i,n){const{maxSpeed:r,linearity:o,deceleration:s}=n,a=t.clamp(e*o/(i/1e3),-r,r),l=Math.abs(a)/(s*o);return{easing:n.easing,duration:1e3*l,amount:a*(l/2)}}class mn extends t.Event{constructor(e,i,n,r={}){const s=o.mousePos(i.getCanvasContainer(),n),a=i.unproject(s);super(e,t.extend({point:s,lngLat:a,originalEvent:n},r)),this._defaultPrevented=!1,this.target=i}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class gn extends t.Event{constructor(e,i,n){const r="touchend"===e?n.changedTouches:n.touches,s=o.touchPos(i.getCanvasContainer(),r),a=s.map((t=>i.unproject(t))),l=s.reduce(((t,e,i,n)=>t.add(e.div(n.length))),new t.pointGeometry(0,0));super(e,{points:s,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class yn extends t.Event{constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class _n{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new yn(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new mn(t.type,this._map,t))}mouseup(t){this._map.fire(new mn(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new mn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new mn(t.type,this._map,t))}mouseover(t){this._map.fire(new mn(t.type,this._map,t))}mouseout(t){this._map.fire(new mn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new gn(t.type,this._map,t))}touchmove(t){this._map.fire(new gn(t.type,this._map,t))}touchend(t){this._map.fire(new gn(t.type,this._map,t))}touchcancel(t){this._map.fire(new gn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class vn{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new mn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new mn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new mn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xn{constructor(t,e){this._map=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 n=this._startPos;this._lastPos=i,this._box||(this._box=o.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const r=Math.min(n.x,i.x),s=Math.max(n.x,i.x),a=Math.min(n.y,i.y),l=Math.max(n.y,i.y);o.setTransform(this._box,`translate(${r}px,${a}px)`),this._box.style.width=s-r+"px",this._box.style.height=l-a+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,r=i;if(this.reset(),o.suppressClick(),n.x!==r.x||n.y!==r.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(o.remove(this._box),this._box=null),o.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function bn(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 n=0;n<t.length;n++)i[t[n].identifier]=e[n];return i}class wn{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.pointGeometry(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=bn(n,i)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const n=bn(i,e);for(const t in this.touches){const e=this.touches[t],i=n[t];(!i||i.dist(e)>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 Sn{constructor(t){this.singleTap=new wn(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 n=this.singleTap.touchend(t,e,i);if(n){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class En{constructor(){this._zoomIn=new Sn({numTouches:1,numTaps:2}),this._zoomOut=new Sn({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 n=this._zoomIn.touchend(t,e,i),r=this._zoomOut.touchend(t,e,i);return n?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(n)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(r)},{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}}const kn={0:1,2:2};class Tn{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,e){return!1}_move(t,e){return{}}mousedown(t,e){if(this._lastPoint)return;const i=o.mouseButton(t);this._correctButton(t,i)&&(this._lastPoint=e,this._eventButton=i)}mousemoveWindow(t,e){const i=this._lastPoint;if(i)if(t.preventDefault(),function(t,e){const i=kn[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(i,e)}mouseupWindow(t){this._lastPoint&&o.mouseButton(t)===this._eventButton&&(this._moved&&o.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class An extends Tn{mousedown(t,e){super.mousedown(t,e),this._lastPoint&&(this._active=!0)}_correctButton(t,e){return 0===e&&!t.ctrlKey}_move(t,e){return{around:e,panDelta:e.sub(t)}}}class In extends Tn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=.8*(e.x-t.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(t){t.preventDefault()}}class Mn extends Tn{_correctButton(t,e){return 0===e&&t.ctrlKey||2===e}_move(t,e){const i=-.5*(e.y-t.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(t){t.preventDefault()}}class Cn{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.pointGeometry(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1}),200)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const r=bn(n,i),o=new t.pointGeometry(0,0),s=new t.pointGeometry(0,0);let a=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),s._add(e.sub(i)),a++,r[t]=e)}if(this._touches=r,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,e,i){return{}}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[n,r]=this._firstTwoTouches,o=Pn(i,e,n),s=Pn(i,e,r);if(!o||!s)return;const a=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,s=Pn(i,e,n),a=Pn(i,e,r);s&&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 Pn(t,e,i){for(let n=0;n<t.length;n++)if(t[n].identifier===i)return e[n]}function Ln(t,e){return Math.log(t/e)/Math.LN2}class Dn extends zn{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(Ln(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ln(this._distance,i),pinchAround:e}}}function Rn(t,e){return 180*t.angleWith(e)/Math.PI}class On extends zn{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){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Rn(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Rn(t,this._startVector);return Math.abs(i)<e}}function Fn(t){return Math.abs(t.y)>Math.abs(t.x)}class Bn extends zn{constructor(t){super(),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,Fn(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const n=t[0].sub(this._lastPoints[0]),r=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,r,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+r.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const n=t.mag()>=2,r=e.mag()>=2;if(!n&&!r)return;if(!n||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Fn(t)&&Fn(e)&&o}}const jn={panStep:100,bearingStep:15,pitchStep:10};class $n{constructor(){const t=jn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,n=0,r=0,o=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(),r=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Nn,zoom:e?Math.round(a)+e*(t.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:s.getCenter()},{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 Nn(t){return t*(2-t)}const Un=4.000244140625;class Vn{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll(["_onTimeout"],this)}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)}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;e.preventDefault()}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const n=t.exported.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%Un==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(e){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._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._map.transform;if(0!==this._delta){const t="wheel"===this._type&&Math.abs(this._delta)>Un?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const n="number"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(n*i))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"==typeof this._targetZoom?this._targetZoom:e.zoom,n=this._startZoom,r=this._easing;let o,s=!1;if("wheel"===this._type&&n&&r){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),a=r(e);o=t.number(n,i,a),e<1?this._frameId||(this._frameId=!0):s=!0}else o=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,n=(t.exported.now()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=t.bezier(o,s,.25,1)}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1}}class qn{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 Zn{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(t.shiftKey?-1:1),around:i.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gn{constructor(){this._tap=new Sn({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i))}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=e[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Hn{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","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Wn{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 Xn{constructor(t,e,i,n){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=n,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","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-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()}}const Jn=t=>t.zoom||t.drag||t.pitch||t.rotate;class Kn extends t.Event{}function Yn(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class Qn{constructor(e,i){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new dn(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i),t.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"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 _n(e,t));const n=e.boxZoom=new xn(e,t);this._add("boxZoom",n);const r=new En,o=new Zn;e.doubleClickZoom=new qn(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const s=new Gn;this._add("tapDragZoom",s);const a=e.touchPitch=new Bn(e);this._add("touchPitch",a);const l=new In(t),c=new Mn(t);e.dragRotate=new Wn(t,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new An(t),h=new Cn(t,e);e.dragPan=new Hn(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new On,p=new Dn;e.touchZoomRotate=new Xn(i,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]);const f=e.scrollZoom=new Vn(e,this);this._add("scrollZoom",f,["mousePan"]);const m=e.keyboard=new $n;this._add("keyboard",m),this._add("blockableMapEvent",new vn(e));for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[i]&&e[i].enable(t[i])}_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(Jn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const n in t)if(n!==i&&(!e||e.indexOf(n)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},r={},s={},a=t.touches,l=a?this._getMapTouches(a):void 0,c=l?o.touchPos(this._el,l):o.mousePos(this._el,t);for(const{handlerName:o,handler:a,allowed:u}of this._handlers){if(!a.isEnabled())continue;let h;this._blockedByActive(s,u,o)?a.reset():a[e||t.type]&&(h=a[e||t.type](t,c,l),this.mergeHandlerResult(n,r,h,o,i),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||a.isActive())&&(s[o]=a)}const u={};for(const t in this._previousActiveHandlers)s[t]||(u[t]=i);this._previousActiveHandlers=s,(Object.keys(u).length||Yn(n))&&(this._changes.push([n,r,u]),this._triggerRenderFrame()),(Object.keys(s).length||Yn(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=n;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))}mergeHandlerResult(e,i,n,r,o){if(!n)return;t.extend(e,n);const s={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=s),void 0!==n.panDelta&&(i.drag=s),void 0!==n.pitchDelta&&(i.pitch=s),void 0!==n.bearingDelta&&(i.rotate=s)}_applyChanges(){const e={},i={},n={};for(const[r,o,s]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.pointGeometry(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.extend(i,o),t.extend(n,s);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(e,i,n){const r=this._map,o=r.transform,s=r.style&&r.style.terrain;if(!(Yn(e)||s&&this._drag))return this._fireEvents(i,n,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),r._stop(!0),h=h||r.transform.centerPoint;const p=o.pointLocation(a?h.sub(a):h);c&&(o.bearing+=c),u&&(o.pitch+=u),l&&(o.zoom+=l),s?i.drag&&!this._drag?(this._drag={center:o.centerPoint,lngLat:o.pointLocation(h),point:h,handlerName:i.drag.handlerName},r.fire(new t.Event("freezeElevation",{freeze:!0}))):this._drag&&n[this._drag.handlerName]?(r.fire(new t.Event("freezeElevation",{freeze:!1})),this._drag=null):i.drag&&this._drag&&(o.center=o.pointLocation(o.centerPoint.sub(a))):o.setLocationAtPoint(p,h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,n,!0)}_fireEvents(e,i,n){const r=Jn(this._eventsInProgress),o=Jn(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in s)this._fireEvent(t,s[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const a={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||n,a[`${t}end`]=l)}for(const t in a)this._fireEvent(t,a[t]);const c=Jn(this._eventsInProgress);if(n&&(r||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Kn("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const tr={extend:(e,...i)=>t.extend(e,...i),run(t){t()},logToElement(t,e=!1,i="log"){const n=window.document.getElementById(i);n&&(e&&(n.innerHTML=""),n.innerHTML+=`<br>${t}`)}};class er extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,n){return e=t.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.extend({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,n){return this.easeTo(t.extend({zoom:e},i),n)}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(e,i,n){return this.easeTo(t.extend({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),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(e,i){e=t.LngLatBounds.convert(e);const n=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,i)}_cameraForBoxAndBearing(e,i,n,r){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const t=r.padding;r.padding={top:t,bottom:t,right:t,left:t}}r.padding=t.extend(o,r.padding);const s=this.transform,a=s.padding,l=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(i)),u=l.rotate(-n*Math.PI/180),h=c.rotate(-n*Math.PI/180),d=new t.pointGeometry(Math.max(u.x,h.x),Math.max(u.y,h.y)),p=new t.pointGeometry(Math.min(u.x,h.x),Math.min(u.y,h.y)),f=d.sub(p),m=(s.width-(a.left+a.right+r.padding.left+r.padding.right))/f.x,g=(s.height-(a.top+a.bottom+r.padding.top+r.padding.bottom))/f.y;if(g<0||m<0)return void t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const y=Math.min(s.scaleZoom(s.scale*Math.min(m,g)),r.maxZoom),_=t.pointGeometry.convert(r.offset),v=new t.pointGeometry((r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2).rotate(n*Math.PI/180),x=_.add(v).mult(s.scale/s.zoomScale(y));return{center:s.unproject(l.add(c).div(2).sub(x)),zoom:y,bearing:n}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,n,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.pointGeometry.convert(e)),this.transform.pointLocation(t.pointGeometry.convert(i)),n,r),r,o)}_fitInternal(e,i,n){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this.transform;let r=!1,o=!1,s=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(r=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(s=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this.fire(new t.Event("movestart",i)).fire(new t.Event("move",i)),r&&this.fire(new t.Event("zoomstart",i)).fire(new t.Event("zoom",i)).fire(new t.Event("zoomend",i)),o&&this.fire(new t.Event("rotatestart",i)).fire(new t.Event("rotate",i)).fire(new t.Event("rotateend",i)),s&&this.fire(new t.Event("pitchstart",i)).fire(new t.Event("pitch",i)).fire(new t.Event("pitchend",i)),this.fire(new t.Event("moveend",i))}calculateCameraOptionsFromTo(e,i,n,r=0){const o=t.MercatorCoordinate.fromLngLat(e,i),s=t.MercatorCoordinate.fromLngLat(n,r),a=s.x-o.x,l=s.y-o.y,c=s.z-o.z,u=Math.hypot(a,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(a,l),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(a,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:s.toLngLat(),zoom:d,pitch:f,bearing:p}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const n=this.transform,r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?+e.zoom:r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,u="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:n.padding,d=t.pointGeometry.convert(e.offset);let p=n.centerPoint.add(d);const f=n.pointLocation(p),m=t.LngLat.convert(e.center||f);this._normalizeCenter(m);const g=n.project(f),y=n.project(m).sub(g),_=n.zoomScale(l-r);let v,x;e.around&&(v=t.LngLat.convert(e.around),x=n.locationPoint(v));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==r,this._rotating=this._rotating||o!==c,this._pitching=this._pitching||u!==s,this._padding=!n.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this._ease((e=>{if(this._zooming&&(n.zoom=t.number(r,l,e)),this._rotating&&(n.bearing=t.number(o,c,e)),this._pitching&&(n.pitch=t.number(s,u,e)),this._padding&&(n.interpolatePadding(a,h,e),p=n.centerPoint.add(d)),v)n.setLocationAtPoint(v,x);else{const t=n.zoomScale(n.zoom-r),i=l>r?Math.min(2,_):Math.max(.5,_),o=Math.pow(i,1-e),s=n.unproject(g.add(y.mult(e*o)).mult(t));n.setLocationAtPoint(n.renderWorldCopies?s.wrap():s,p)}this._fireMoveEvents(i)}),(t=>{this._afterEase(i,t)}),e),this}_prepareEase(e,i,n={}){this._moving=!0,this.fire(new t.Event("freezeElevation",{freeze:!0})),i||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId,this.fire(new t.Event("freezeElevation",{freeze:!1}));const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),r&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const n=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const n=this.transform,r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in e?t.clamp(+e.zoom,n.minZoom,n.maxZoom):r,c="bearing"in e?this._normalizeBearing(e.bearing,o):o,u="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:n.padding,d=n.zoomScale(l-r),p=t.pointGeometry.convert(e.offset);let f=n.centerPoint.add(p);const m=n.pointLocation(f),g=t.LngLat.convert(e.center||m);this._normalizeCenter(g);const y=n.project(m),_=n.project(g).sub(y);let v=e.curve;const x=Math.max(n.width,n.height),b=x/d,w=_.mag();if("minZoom"in e){const i=t.clamp(Math.min(e.minZoom,r,l),n.minZoom,n.maxZoom),o=x/n.zoomScale(i-r);v=Math.sqrt(o/w*2)}const S=v*v;function E(t){const e=(b*b-x*x+(t?-1:1)*S*S*w*w)/(2*(t?b:x)*S*w);return Math.log(Math.sqrt(e*e+1)-e)}function k(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}const A=E(0);let I=function(t){return T(A)/T(A+v*t)},M=function(t){return x*((T(A)*(k(e=A+v*t)/T(e))-k(A))/S)/w;var e},C=(E(1)-A)/v;if(Math.abs(w)<1e-6||!isFinite(C)){if(Math.abs(x-b)<1e-6)return this.easeTo(e,i);const t=b<x?-1:1;C=Math.abs(Math.log(b/x))/v,M=function(){return 0},I=function(e){return Math.exp(t*v*e)}}return e.duration="duration"in e?+e.duration:1e3*C/("screenSpeed"in e?+e.screenSpeed/v:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=u!==s,this._padding=!n.isPaddingEqual(h),this._prepareEase(i,!1),this._ease((e=>{const d=e*C,m=1/I(d);n.zoom=1===e?l:r+n.scaleZoom(m),this._rotating&&(n.bearing=t.number(o,c,e)),this._pitching&&(n.pitch=t.number(s,u,e)),this._padding&&(n.interpolatePadding(a,h,e),f=n.centerPoint.add(p));const v=1===e?g:n.unproject(y.add(_.mult(M(d))).mult(m));n.setLocationAtPoint(n.renderWorldCopies?v.wrap():v,f),this._fireMoveEvents(i)}),(()=>this._afterEase(i)),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){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)}if(!t){const t=this.handlers;t&&t.stop(!1)}return this}_ease(e,i,n){!1===n.animate||0===n.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}}class ir{constructor(e={}){this.options=e,t.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o.create("summary","maplibregl-ctrl-attrib-button mapboxgl-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 mapboxgl-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)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions()}_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 n=e[i];if(n.used||n.usedForTerrain){const e=n.getSource();if("string"==typeof e.attribution){const i=e.attribution.split("|").map((t=>t.trim()));for(let e of i)e=e.replace(/©/g,"©"),e=e.replace(/©/g,"©"),e=e.replace("©","©"),t.indexOf(e)<0&&t.push(e)}}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let n=i+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0}));const i=t.findIndex((t=>t.includes("mapcreator")));if(-1!==i&&0!==i){const e=t[i];t.splice(i,1),t.unshift(e)}const n=t.join(" | ");n!==this._attribHTML&&(this._attribHTML=n,t.length?(this._innerContainer.innerHTML=n,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._map.fire("attributionchange"),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class nr{constructor(e={}){this.options=e,t.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=o.create("div","maplibregl-ctrl mapboxgl-ctrl");const e=o.create("a","maplibregl-ctrl-logo mapboxgl-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}_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","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class rr{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=[]}}const or={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},sr={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ar={showCompass:!0,showZoom:!0,visualizePitch:!1};class lr{constructor(e,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new In({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,n&&(this.mousePitch=new Mn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener(i,"mousedown",this.mousedown),o.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),o.addEventListener(i,"touchmove",this.touchmove),o.addEventListener(i,"touchend",this.touchend),o.addEventListener(i,"touchcancel",this.reset)}down(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),o.disableDrag()}move(t,e){const i=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&i.setBearing(i.getBearing()+n.bearingDelta),this.mousePitch){const n=this.mousePitch.mousemoveWindow(t,e);n&&n.pitchDelta&&i.setPitch(i.getPitch()+n.pitchDelta)}}off(){const t=this.element;o.removeEventListener(t,"mousedown",this.mousedown),o.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),o.removeEventListener(t,"touchmove",this.touchmove),o.removeEventListener(t,"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)}mousedown(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),o.mousePos(this.element,e)),o.addEventListener(window,"mousemove",this.mousemove),o.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,o.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=o.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function cr(e,i,n){if(e=new t.LngLat(e.lng,e.lat),i){const r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),s=n.locationPoint(e).distSqr(i);n.locationPoint(r).distSqr(i)<s?e=r:n.locationPoint(o).distSqr(i)<s&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}const ur={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 hr(t,e,i){const n=t.classList;for(const t in ur)n.remove(`maplibregl-${i}-anchor-${t}`,`mapboxgl-${i}-anchor-${t}`);n.add(`maplibregl-${i}-anchor-${e}`,`mapboxgl-${i}-anchor-${e}`)}class dr extends t.Evented{constructor(e,i){if(super(),(e instanceof HTMLElement||i)&&(e=t.extend({element:e},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=o.create("div"),this._element.setAttribute("aria-label","Map marker");const i=o.createNS("http://www.w3.org/2000/svg","svg"),n=41,r=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${n}px`),i.setAttributeNS(null,"width",`${r}px`),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${n}`);const s=o.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"stroke","none"),s.setAttributeNS(null,"stroke-width","1"),s.setAttributeNS(null,"fill","none"),s.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 u=o.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=o.createNS("http://www.w3.org/2000/svg","path");h.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"),u.appendChild(h);const d=o.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=o.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(p);const f=o.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=o.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=o.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const y=o.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(y),a.appendChild(l),a.appendChild(u),a.appendChild(d),a.appendChild(f),a.appendChild(m),i.appendChild(a),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(i),this._offset=t.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault()})),this._element.addEventListener("mousedown",(t=>{t.preventDefault()})),hr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",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("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(e){return this._lngLat=t.LngLat.convert(e),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,n=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-e],"bottom-left":[n,-1*(e-i+n)],"bottom-right":[-n,-1*(e-i+n)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==i&&13!==i||this.togglePopup()}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=cr(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),t&&"moveend"!==t.type||(this._pos=this._pos.round()),o.setTransform(this._element,`${ur[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${e}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?"0.2":"1.0",this._opacityTimeout=null}),100))}getOffset(){return this._offset}setOffset(e){return this._offset=t.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"}_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))}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}}const pr={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let fr,mr=0,gr=!1;const yr={maxWidth:100,unit:"metric"};function _r(t,e,i){const n=i&&i.maxWidth||100,r=t._container.clientHeight/2,o=t.unproject([0,r]),s=t.unproject([n,r]),a=o.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*a;i>5280?vr(e,n,i/5280,t._getUIString("ScaleControl.Miles")):vr(e,n,i,t._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?vr(e,n,a/1852,t._getUIString("ScaleControl.NauticalMiles")):a>=1e3?vr(e,n,a/1e3,t._getUIString("ScaleControl.Kilometers")):vr(e,n,a,t._getUIString("ScaleControl.Meters"))}function vr(t,e,i,n){const r=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*(r/i)+"px",t.innerHTML=`${r} ${n}`}const xr={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},br=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function wr(e){if(e){if("number"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new t.pointGeometry(0,0),top:new t.pointGeometry(0,e),"top-left":new t.pointGeometry(i,i),"top-right":new t.pointGeometry(-i,i),bottom:new t.pointGeometry(0,-e),"bottom-left":new t.pointGeometry(i,-i),"bottom-right":new t.pointGeometry(-i,-i),left:new t.pointGeometry(e,0),right:new t.pointGeometry(-e,0)}}if(e instanceof t.pointGeometry||Array.isArray(e)){const i=t.pointGeometry.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.pointGeometry.convert(e.center||[0,0]),top:t.pointGeometry.convert(e.top||[0,0]),"top-left":t.pointGeometry.convert(e["top-left"]||[0,0]),"top-right":t.pointGeometry.convert(e["top-right"]||[0,0]),bottom:t.pointGeometry.convert(e.bottom||[0,0]),"bottom-left":t.pointGeometry.convert(e["bottom-left"]||[0,0]),"bottom-right":t.pointGeometry.convert(e["bottom-right"]||[0,0]),left:t.pointGeometry.convert(e.left||[0,0]),right:t.pointGeometry.convert(e.right||[0,0])}}return wr(new t.pointGeometry(0,0))}const Sr={supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends er{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},sr,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new on(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new rr,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},or,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this._requestManager=new s(e.transformRequest),"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),"undefined"!=typeof window&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Qn(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new sn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ir({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new nr,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.Event("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,n){return null==n&&this.style.terrain&&(n=this.transform.getElevation(i,this.style.terrain)),super.calculateCameraOptionsFromTo(t,e,i,n)}resize(e){const i=this._containerDimensions(),n=i[0],r=i[1];this._resizeCanvas(n,r,this.getPixelRatio()),this.transform.resize(n/t.exported.dynamicScale,r/t.exported.dynamicScale),this.painter.resize(n,r,this.getPixelRatio());const o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),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(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.style.terrain)}unproject(e){return this.transform.pointLocation(t.pointGeometry.convert(e),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}setScale(e){t.exported.dynamicScale=e,this.setPixelRatio(window.devicePixelRatio*e),this.resize()}getScale(){return t.exported.dynamicScale}setDetailLevel(e){const i=this.getDetailLevel();t.exported.detailLevel=Math.round(t.clamp(e,-3,3)),this.setZoom(this.getZoom()+t.exported.detailLevel-i)}getDetailLevel(){return t.exported.detailLevel}getVisibleLayers(){return this.painter.visibleLayers}_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let n=!1;const r=r=>{const o=this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[];o.length?n||(n=!0,i.call(this,new mn(t,this,r.originalEvent,{features:o}))):n=!1};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;const r=r=>{(this.getLayer(e)?this.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?n=!0:n&&(n=!1,i.call(this,new mn(t,this,r.originalEvent)))},o=e=>{n&&(n=!1,i.call(this,new mn(t,this,e.originalEvent)))};return{layer:e,listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=t=>{const n=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,i.call(this,t),delete t.features)};return{layer:e,listener:i,delegates:{[t]:n}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const n=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(n);for(const t in n.delegates)this.on(t,n.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const n=this._createDelegatedListener(t,e,i);for(const t in n.delegates)this.once(t,n.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(n=>{const r=this._delegatedListeners[t];for(let t=0;t<r.length;t++){const n=r[t];if(n.layer===e&&n.listener===i){for(const t in n.delegates)this.off(t,n.delegates[t]);return r.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;if(void 0!==i||void 0===e||e instanceof t.pointGeometry||Array.isArray(e)||(i=e,e=void 0),i=i||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.pointGeometry||"number"==typeof e[0])n=[t.pointGeometry.convert(e)];else{const i=t.pointGeometry.convert(e[0]),r=t.pointGeometry.convert(e[1]);n=[i,new t.pointGeometry(r.x,i.y),r,new t.pointGeometry(i.x,r.y),i]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return!1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,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){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new ne(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ne(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,t.ResourceType.Style);t.getJSON(n,((e,n)=>{e?this.fire(new t.ErrorEvent(e)):n&&this._updateDiff(n,i)}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return!!this.style&&this.style.loaded()}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)))}setTerrain(t){return this.style.setTerrain(t),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}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}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:c,data:u}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},u),pixelRatio:n,stretchX:o,stretchY:s,content:a,sdf:r,version:0})}else{if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(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:l,height:c,data:u}=i,h=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(u)),pixelRatio:n,stretchX:o,stretchY:s,content:a,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,e)}}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:o,height:s,data:a}=r;if(void 0===o||void 0===s)return this.fire(new t.ErrorEvent(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!==n.data.width||s!==n.data.height)return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));n.data.replace(a,l),this.style.updateImage(e,n)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(e,i){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),i)}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)}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,n={}){return this.style.setPaintProperty(t,e,i,n),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,n={}){return this.style.setLayoutProperty(t,e,i,n),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}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}getLineBreaks(e,i,n,r,o,s){const a=this.style.glyphManager,l={},c=new Set;for(let t=0;t<e.length;t++)c.add(e.charCodeAt(t));l[i]=Array.from(c);let u={};a.getGlyphs(l,((t,e)=>{t||(u=e)}));const h=t.calculateBreakLines(e,i,n,r,o,s,u,{}),d=[];return h.forEach((t=>{d.push(t.text)})),d}_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","mapboxgl-map");const e=this._canvasContainer=o.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=o.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const i=this._containerDimensions();this._resizeCanvas(i[0],i[1],this.getPixelRatio());const n=this._controlContainer=o.create("div","maplibregl-control-container mapboxgl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=o.create("div",`maplibregl-ctrl-${t} mapboxgl-ctrl-${t}`,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const t=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=o.create("div","maplibregl-cooperative-gesture-screen",t);let e="Control",i="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(i="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",e="Meta"),this._cooperativeGesturesScreen.innerHTML=`\n <div class="maplibregl-desktop-message">${i}</div>\n <div class="maplibregl-mobile-message">${"boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>\n `,document.addEventListener("keydown",(t=>{t.key===e&&(this._metaPress=!0)})),document.addEventListener("keyup",(t=>{t.key===e&&(this._metaPress=!1)})),this._canvasContainer.addEventListener("wheel",(t=>{this._onCooperativeGesture(t,this._metaPress,1)}),!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(e,i,n){this._canvas.width=n*e/t.exported.dynamicScale,this._canvas.height=n*i/t.exported.dynamicScale,this._canvas.style.width=`${e}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const i=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",i)||this._canvas.getContext("experimental-webgl",i);n?(this.painter=new tn(n,this.transform),t.exported$1.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(t,e,i){return!e&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style?(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(e){let i,n=0;const r=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(i=r.createQueryEXT(),r.beginQueryEXT(r.TIME_ELAPSED_EXT,i),n=t.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=t.exported.now();this.style.zoomHistory.update(e,i);const n=new t.EvaluationParameters(e,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=n.crossFadingFactor();1===r&&r===this._crossFadingFactor||(o=!0,this._crossFadingFactor=r),this.style.update(n)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const e=t.exported.now()-n;r.endQueryEXT(r.TIME_ELAPSED_EXT,i),setTimeout((()=>{const n=r.getQueryObjectEXT(i,r.QUERY_RESULT_EXT)/1e6;r.deleteQueryEXT(i),this.fire(new t.Event("gpu-timing-frame",{cpuTime:e,gpuTime:n}))}),50)}if(this.listens("gpu-timing-layer")){const e=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(e);this.fire(new t.Event("gpu-timing-layer",{layerTimes:i}))}),50)}const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),o.remove(this._canvasContainer),o.remove(this._controlContainer),this._cooperativeGestures&&o.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e)})))}_onWindowOnline(){this._update()}_onWindowResize(t){this._trackResize&&this.resize({originalEvent:t})._update()}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()}_setCacheLimits(e,i){t.setCacheLimits(e,i)}get version(){return"2.4.0-mc.4"}},NavigationControl:class{constructor(e){this.options=t.extend({},ar,e),this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_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())}_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}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 lr(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}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},pr,e),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(t){var e;return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,void 0!==fr?e(fr):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((t=>{fr="denied"!==t.state,e(fr)})):(fr=!!window.navigator.geolocation,e(fr)),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,mr=0,gr=!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","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),o=t.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),o,{geolocateSource:!0})}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),i=this._map.unproject([1,t]),n=e.distanceTo(i),r=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-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===e.code&&gr)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(e){if(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=o.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new dr(this._dotElement),this._circleElement=o.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new dr({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new t.Event("trackuserlocationend")))}))}trigger(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mr--,gr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mr++,mr>1?(t={maximumAge:6e5,timeout:0},gr=!0):(t=this.options.positionOptions,gr=!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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ir,LogoControl:nr,ScaleControl:class{constructor(e){this.options=t.extend({},yr,e),t.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){_r(this._map,this._container,this.options)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-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}setUnit(t){this.options.unit=t,_r(this._map,this._container,this.options)}},FullscreenControl:class{constructor(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){o.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);o.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_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}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?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._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(e){this.options=e,t.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(t){return this._map=t,this._container=o.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=o.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),o.create("span","maplibregl-ctrl-icon mapboxgl-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}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(xr),e),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this}isOpen(){return!!this._map}remove(){return 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),delete this._map),this.fire(new t.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-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 n;for(i.innerHTML=t;n=i.firstChild,n;)e.appendChild(n);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.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 mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=o.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(t){this._update(t.point)}_onMouseMove(t){this._update(t.point)}_onDrag(t){this._update(t.point)}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=o.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=cr(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let i=this.options.anchor;const n=wr(this.options.offset);if(!i){const t=this._container.offsetWidth,r=this._container.offsetHeight;let o;o=e.y+n.bottom.y<r?["top"]:e.y>this._map.transform.height-r?["bottom"]:[],e.x<t/2?o.push("left"):e.x>this._map.transform.width-t/2&&o.push("right"),i=0===o.length?"bottom":o.join("-")}const r=e.mult(this._map.getScale()).add(n[i]);o.setTransform(this._container,`${ur[i]} translate(${r.x}px,${r.y}px)`),hr(this._container,i,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(br);t&&t.focus()}_onClose(){this.remove()}},Marker:dr,Style:ne,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.pointGeometry,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:C,GeoJSONSource:T,ImageSource:I,RasterDEMTileSource:k,RasterTileSource:S,VectorTileSource:w,VideoSource:M,prewarm:function(){dt().acquire(lt)},clearPrewarmedResources:function(){const t=ht;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(lt),ht=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()"))},get version(){return"2.4.0-mc.4"},get workerCount(){return ct.workerCount},set workerCount(t){ct.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage(e){t.clearTileCache(e)},workerUrl:"",addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return tr.extend(Sr,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),Sr})),i}()},2176:function(t,e,i){"use strict";function n(){return!("undefined"!=typeof __SENTRY_BROWSER_BUNDLE__&&__SENTRY_BROWSER_BUNDLE__)&&"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}function r(t,e){return t.require(e)}i.d(e,{l$:function(){return r},KV:function(){return n}}),t=i.hmd(t)},1170:function(t,e,i){"use strict";i.d(e,{ph:function(){return u},yW:function(){return c}});var n=i(2176),r=i(1235);t=i.hmd(t);const o=(0,r.Rf)(),s={nowSeconds:()=>Date.now()/1e3};const a=(0,n.KV)()?function(){try{return(0,n.l$)(t,"perf_hooks").performance}catch(t){return}}():function(){const{performance:t}=o;if(!t||!t.now)return;return{now:()=>t.now(),timeOrigin:Date.now()-t.now()}}(),l=void 0===a?s:{nowSeconds:()=>(a.timeOrigin+a.now())/1e3},c=s.nowSeconds.bind(s),u=l.nowSeconds.bind(l);let h;(()=>{const{performance:t}=o;if(!t||!t.now)return void(h="none");const e=36e5,i=t.now(),n=Date.now(),r=t.timeOrigin?Math.abs(t.timeOrigin+i-n):e,s=r<e,a=t.timing&&t.timing.navigationStart,l="number"==typeof a?Math.abs(a+i-n):e;s||l<e?r<=l?(h="timeOrigin",t.timeOrigin):h="navigationStart":h="dateNow"})()},1235:function(t,e,i){"use strict";function n(t){return t&&t.Math==Math?t:void 0}i.d(e,{Rf:function(){return o},YO:function(){return s},n2:function(){return r}});const r="object"==typeof globalThis&&n(globalThis)||"object"==typeof window&&n(window)||"object"==typeof self&&n(self)||"object"==typeof global&&n(global)||function(){return this}()||{};function o(){return r}function s(t,e,i){const n=i||r,o=n.__SENTRY__=n.__SENTRY__||{};return o[t]||(o[t]=e())}},1924:function(t,e,i){"use strict";var n=i(210),r=i(5559),o=r(n("String.prototype.indexOf"));t.exports=function(t,e){var i=n(t,!!e);return"function"==typeof i&&o(t,".prototype.")>-1?r(i):i}},5559:function(t,e,i){"use strict";var n=i(8612),r=i(210),o=r("%Function.prototype.apply%"),s=r("%Function.prototype.call%"),a=r("%Reflect.apply%",!0)||n.call(s,o),l=r("%Object.getOwnPropertyDescriptor%",!0),c=r("%Object.defineProperty%",!0),u=r("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=a(n,s,arguments);l&&c&&(l(e,"length").configurable&&c(e,"length",{value:1+u(0,t.length-(arguments.length-1))}));return e};var h=function(){return a(n,o,arguments)};c?c(t.exports,"apply",{value:h}):t.exports.apply=h},7551:function(t){(function(){"use strict";var e=function(t,e){return e=e||"",t.replace(/(^|-)/g,"$1\\u"+e).replace(/,/g,"\\u"+e)},i=e("20-26,28-2F,3A-40,5B-60,7B-7E,A0-BF,D7,F7","00"),n="a-z"+e("DF-F6,F8-FF","00"),r="A-Z"+e("C0-D6,D8-DE","00"),o=function(t,e,o,s){return t=t||i,e=e||n,o=o||r,s=s||"A|An|And|As|At|But|By|En|For|If|In|Of|On|Or|The|To|Vs?\\.?|Via",{capitalize:new RegExp("(^|["+t+"])(["+e+"])","g"),pascal:new RegExp("(^|["+t+"])+(["+e+o+"])","g"),fill:new RegExp("["+t+"]+(.|$)","g"),sentence:new RegExp('(^\\s*|[\\?\\!\\.]+"?\\s+"?|,\\s+")(['+e+"])","g"),improper:new RegExp("\\b("+s+")\\b","g"),relax:new RegExp("([^"+o+"])(["+o+"]*)(["+o+"])(?=[^"+o+"]|$)","g"),upper:new RegExp("^[^"+e+"]+$"),hole:/[^\s]\s[^\s]/,apostrophe:/'/g,room:new RegExp("["+t+"]")}},s=o(),a={re:s,unicodes:e,regexps:o,types:[],up:String.prototype.toUpperCase,low:String.prototype.toLowerCase,cap:function(t){return a.up.call(t.charAt(0))+t.slice(1)},decap:function(t){return a.low.call(t.charAt(0))+t.slice(1)},deapostrophe:function(t){return t.replace(s.apostrophe,"")},fill:function(t,e,i){return null!=e&&(t=t.replace(s.fill,(function(t,i){return i?e+i:""}))),i&&(t=a.deapostrophe(t)),t},prep:function(t,e,i,n){if(t=null==t?"":t+"",!n&&s.upper.test(t)&&(t=a.low.call(t)),!e&&!s.hole.test(t)){var r=a.fill(t," ");s.hole.test(r)&&(t=r)}return i||s.room.test(t)||(t=t.replace(s.relax,a.relax)),t},relax:function(t,e,i,n){return e+" "+(i?i+" ":"")+n}},l={_:a,of:function(t){for(var e=0,i=a.types.length;e<i;e++)if(l[a.types[e]].apply(l,arguments)===t)return a.types[e]},flip:function(t){return t.replace(/\w/g,(function(t){return(t==a.up.call(t)?a.low:a.up).call(t)}))},random:function(t){return t.replace(/\w/g,(function(t){return(Math.round(Math.random())?a.up:a.low).call(t)}))},type:function(t,e){l[t]=e,a.types.push(t)}},c={lower:function(t,e,i){return a.fill(a.low.call(a.prep(t,e)),e,i)},snake:function(t){return l.lower(t,"_",!0)},constant:function(t){return l.upper(t,"_",!0)},camel:function(t){return a.decap(l.pascal(t))},kebab:function(t){return l.lower(t,"-",!0)},upper:function(t,e,i){return a.fill(a.up.call(a.prep(t,e,!1,!0)),e,i)},capital:function(t,e,i){return a.fill(a.prep(t).replace(s.capitalize,(function(t,e,i){return e+a.up.call(i)})),e,i)},header:function(t){return l.capital(t,"-",!0)},pascal:function(t){return a.fill(a.prep(t,!1,!0).replace(s.pascal,(function(t,e,i){return a.up.call(i)})),"",!0)},title:function(t){return l.capital(t).replace(s.improper,(function(t,e,i,n){return i>0&&i<n.lastIndexOf(" ")?a.low.call(t):t}))},sentence:function(t,e,i){return t=l.lower(t).replace(s.sentence,(function(t,e,i){return e+a.up.call(i)})),e&&e.forEach((function(e){t=t.replace(new RegExp("\\b"+l.lower(e)+"\\b","g"),a.cap)})),i&&i.forEach((function(e){t=t.replace(new RegExp("(\\b"+l.lower(e)+"\\. +)(\\w)"),(function(t,e,i){return e+a.low.call(i)}))})),t}};for(var u in c.squish=c.pascal,l.default=l,c)l.type(u,c[u]);var h="function"==typeof h?h:function(){};h(t.exports?t.exports=l:this.Case=l)}).call(this)},7187:function(t){"use strict";var e,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};e=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var r=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(i,n){function r(i){t.removeListener(e,o),n(i)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),i([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,i){"function"==typeof t.on&&m(t,"error",e,i)}(t,r,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,i,n){var r,o,s,c;if(a(i),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),o=t._events),s=o[e]),void 0===s)s=o[e]=i,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=l(t))>0&&s.length>r&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,c=u,console&&console.warn&&console.warn(c)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,e,i){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},r=u.bind(n);return r.listener=i,n.wrapFn=r,r}function d(t,e,i){var n=t._events;if(void 0===n)return[];var r=n[e];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}(r):f(r,r.length)}function p(t){var e=this._events;if(void 0!==e){var i=e[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t[n];return i}function m(t,e,i,n){if("function"==typeof t.on)n.once?t.once(e,i):t.on(e,i);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){n.once&&t.removeEventListener(e,r),i(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||r(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[t];if(void 0===l)return!1;if("function"==typeof l)n(l,this,e);else{var c=l.length,u=f(l,c);for(i=0;i<c;++i)n(u[i],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return a(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var i,n,r,o,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(i=n[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===e||i[o].listener===e){s=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(i,r),1===i.length&&(n[t]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var r,o=Object.keys(i);for(n=0;n<o.length;++n)"removeListener"!==(r=o[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return d(this,t,!0)},o.prototype.rawListeners=function(t){return d(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},7648:function(t){"use strict";var e=Array.prototype.slice,i=Object.prototype.toString;t.exports=function(t){var n=this;if("function"!=typeof n||"[object Function]"!==i.call(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);for(var r,o=e.call(arguments,1),s=Math.max(0,n.length-o.length),a=[],l=0;l<s;l++)a.push("$"+l);if(r=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof r){var i=n.apply(this,o.concat(e.call(arguments)));return Object(i)===i?i:this}return n.apply(t,o.concat(e.call(arguments)))})),n.prototype){var c=function(){};c.prototype=n.prototype,r.prototype=new c,c.prototype=null}return r}},8612:function(t,e,i){"use strict";var n=i(7648);t.exports=Function.prototype.bind||n},210:function(t,e,i){"use strict";var n,r=SyntaxError,o=Function,s=TypeError,a=function(t){try{return o('"use strict"; return ('+t+").constructor;")()}catch(t){}},l=Object.getOwnPropertyDescriptor;if(l)try{l({},"")}catch(t){l=null}var c=function(){throw new s},u=l?function(){try{return c}catch(t){try{return l(arguments,"callee").get}catch(t){return c}}}():c,h=i(1405)(),d=i(8185)(),p=Object.getPrototypeOf||(d?function(t){return t.__proto__}:null),f={},m="undefined"!=typeof Uint8Array&&p?p(Uint8Array):n,g={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":h&&p?p([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&p?p(p([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h&&p?p((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h&&p?p((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&p?p(""[Symbol.iterator]()):n,"%Symbol%":h?Symbol:n,"%SyntaxError%":r,"%ThrowTypeError%":u,"%TypedArray%":m,"%TypeError%":s,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(p)try{null.error}catch(t){var y=p(p(t));g["%Error.prototype%"]=y}var _=function t(e){var i;if("%AsyncFunction%"===e)i=a("async function () {}");else if("%GeneratorFunction%"===e)i=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)i=a("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(i=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&p&&(i=p(r.prototype))}return g[e]=i,i},v={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},x=i(8612),b=i(7642),w=x.call(Function.call,Array.prototype.concat),S=x.call(Function.apply,Array.prototype.splice),E=x.call(Function.call,String.prototype.replace),k=x.call(Function.call,String.prototype.slice),T=x.call(Function.call,RegExp.prototype.exec),A=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,I=/\\(\\)?/g,M=function(t,e){var i,n=t;if(b(v,n)&&(n="%"+(i=v[n])[0]+"%"),b(g,n)){var o=g[n];if(o===f&&(o=_(n)),void 0===o&&!e)throw new s("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:o}}throw new r("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new s('"allowMissing" argument must be a boolean');if(null===T(/^%?[^%]*%?$/,t))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=function(t){var e=k(t,0,1),i=k(t,-1);if("%"===e&&"%"!==i)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===i&&"%"!==e)throw new r("invalid intrinsic syntax, expected opening `%`");var n=[];return E(t,A,(function(t,e,i,r){n[n.length]=i?E(r,I,"$1"):e||t})),n}(t),n=i.length>0?i[0]:"",o=M("%"+n+"%",e),a=o.name,c=o.value,u=!1,h=o.alias;h&&(n=h[0],S(i,w([0,1],h)));for(var d=1,p=!0;d<i.length;d+=1){var f=i[d],m=k(f,0,1),y=k(f,-1);if(('"'===m||"'"===m||"`"===m||'"'===y||"'"===y||"`"===y)&&m!==y)throw new r("property names with quotes must have matching quotes");if("constructor"!==f&&p||(u=!0),b(g,a="%"+(n+="."+f)+"%"))c=g[a];else if(null!=c){if(!(f in c)){if(!e)throw new s("base intrinsic for "+t+" exists, but the property is not available.");return}if(l&&d+1>=i.length){var _=l(c,f);c=(p=!!_)&&"get"in _&&!("originalValue"in _.get)?_.get:c[f]}else p=b(c,f),c=c[f];p&&!u&&(g[a]=c)}}return c}},8185:function(t){"use strict";var e={foo:{}},i=Object;t.exports=function(){return{__proto__:e}.foo===e.foo&&!({__proto__:null}instanceof i)}},1405:function(t,e,i){"use strict";var n="undefined"!=typeof Symbol&&Symbol,r=i(5419);t.exports=function(){return"function"==typeof n&&("function"==typeof Symbol&&("symbol"==typeof n("foo")&&("symbol"==typeof Symbol("bar")&&r())))}},5419:function(t){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),i=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(t,e);if(42!==r.value||!0!==r.enumerable)return!1}return!0}},7642:function(t,e,i){"use strict";var n=i(8612);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},631:function(t,e,i){var n="function"==typeof Map&&Map.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=n&&r&&"function"==typeof r.get?r.get:null,s=n&&Map.prototype.forEach,a="function"==typeof Set&&Set.prototype,l=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=a&&l&&"function"==typeof l.get?l.get:null,u=a&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,f=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,y=String.prototype.match,_=String.prototype.slice,v=String.prototype.replace,x=String.prototype.toUpperCase,b=String.prototype.toLowerCase,w=RegExp.prototype.test,S=Array.prototype.concat,E=Array.prototype.join,k=Array.prototype.slice,T=Math.floor,A="function"==typeof BigInt?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,C="function"==typeof Symbol&&"object"==typeof Symbol.iterator,z="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===C||"symbol")?Symbol.toStringTag:null,P=Object.prototype.propertyIsEnumerable,L=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function D(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||w.call(/e/,e))return e;var i=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var n=t<0?-T(-t):T(t);if(n!==t){var r=String(n),o=_.call(e,r.length+1);return v.call(r,i,"$&_")+"."+v.call(v.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(e,i,"$&_")}var R=i(4654),O=R.custom,F=U(O)?O:null;function B(t,e,i){var n="double"===(i.quoteStyle||e)?'"':"'";return n+t+n}function j(t){return v.call(String(t),/"/g,""")}function $(t){return!("[object Array]"!==Z(t)||z&&"object"==typeof t&&z in t)}function N(t){return!("[object RegExp]"!==Z(t)||z&&"object"==typeof t&&z in t)}function U(t){if(C)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!M)return!1;try{return M.call(t),!0}catch(t){}return!1}t.exports=function t(e,i,n,r){var a=i||{};if(q(a,"quoteStyle")&&"single"!==a.quoteStyle&&"double"!==a.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(q(a,"maxStringLength")&&("number"==typeof a.maxStringLength?a.maxStringLength<0&&a.maxStringLength!==1/0:null!==a.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var l=!q(a,"customInspect")||a.customInspect;if("boolean"!=typeof l&&"symbol"!==l)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(q(a,"indent")&&null!==a.indent&&"\t"!==a.indent&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(q(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=a.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return H(e,a);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var x=String(e);return m?D(e,x):x}if("bigint"==typeof e){var w=String(e)+"n";return m?D(e,w):w}var T=void 0===a.depth?5:a.depth;if(void 0===n&&(n=0),n>=T&&T>0&&"object"==typeof e)return $(e)?"[Array]":"[Object]";var I=function(t,e){var i;if("\t"===t.indent)i="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;i=E.call(Array(t.indent+1)," ")}return{base:i,prev:E.call(Array(e+1),i)}}(a,n);if(void 0===r)r=[];else if(G(r,e)>=0)return"[Circular]";function O(e,i,o){if(i&&(r=k.call(r)).push(i),o){var s={depth:a.depth};return q(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),t(e,s,n+1,r)}return t(e,a,n+1,r)}if("function"==typeof e&&!N(e)){var V=function(t){if(t.name)return t.name;var e=y.call(g.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),W=Q(e,O);return"[Function"+(V?": "+V:" (anonymous)")+"]"+(W.length>0?" { "+E.call(W,", ")+" }":"")}if(U(e)){var tt=C?v.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):M.call(e);return"object"!=typeof e||C?tt:X(tt)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var et="<"+b.call(String(e.nodeName)),it=e.attributes||[],nt=0;nt<it.length;nt++)et+=" "+it[nt].name+"="+B(j(it[nt].value),"double",a);return et+=">",e.childNodes&&e.childNodes.length&&(et+="..."),et+="</"+b.call(String(e.nodeName))+">"}if($(e)){if(0===e.length)return"[]";var rt=Q(e,O);return I&&!function(t){for(var e=0;e<t.length;e++)if(G(t[e],"\n")>=0)return!1;return!0}(rt)?"["+Y(rt,I)+"]":"[ "+E.call(rt,", ")+" ]"}if(function(t){return!("[object Error]"!==Z(t)||z&&"object"==typeof t&&z in t)}(e)){var ot=Q(e,O);return"cause"in Error.prototype||!("cause"in e)||P.call(e,"cause")?0===ot.length?"["+String(e)+"]":"{ ["+String(e)+"] "+E.call(ot,", ")+" }":"{ ["+String(e)+"] "+E.call(S.call("[cause]: "+O(e.cause),ot),", ")+" }"}if("object"==typeof e&&l){if(F&&"function"==typeof e[F]&&R)return R(e,{depth:T-n});if("symbol"!==l&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var st=[];return s&&s.call(e,(function(t,i){st.push(O(i,e,!0)+" => "+O(t,e))})),K("Map",o.call(e),st,I)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var at=[];return u&&u.call(e,(function(t){at.push(O(t,e))})),K("Set",c.call(e),at,I)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t,h);try{d.call(t,d)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return J("WeakMap");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{d.call(t,d);try{h.call(t,h)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return J("WeakSet");if(function(t){if(!p||!t||"object"!=typeof t)return!1;try{return p.call(t),!0}catch(t){}return!1}(e))return J("WeakRef");if(function(t){return!("[object Number]"!==Z(t)||z&&"object"==typeof t&&z in t)}(e))return X(O(Number(e)));if(function(t){if(!t||"object"!=typeof t||!A)return!1;try{return A.call(t),!0}catch(t){}return!1}(e))return X(O(A.call(e)));if(function(t){return!("[object Boolean]"!==Z(t)||z&&"object"==typeof t&&z in t)}(e))return X(f.call(e));if(function(t){return!("[object String]"!==Z(t)||z&&"object"==typeof t&&z in t)}(e))return X(O(String(e)));if(!function(t){return!("[object Date]"!==Z(t)||z&&"object"==typeof t&&z in t)}(e)&&!N(e)){var lt=Q(e,O),ct=L?L(e)===Object.prototype:e instanceof Object||e.constructor===Object,ut=e instanceof Object?"":"null prototype",ht=!ct&&z&&Object(e)===e&&z in e?_.call(Z(e),8,-1):ut?"Object":"",dt=(ct||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ht||ut?"["+E.call(S.call([],ht||[],ut||[]),": ")+"] ":"");return 0===lt.length?dt+"{}":I?dt+"{"+Y(lt,I)+"}":dt+"{ "+E.call(lt,", ")+" }"}return String(e)};var V=Object.prototype.hasOwnProperty||function(t){return t in this};function q(t,e){return V.call(t,e)}function Z(t){return m.call(t)}function G(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i;return-1}function H(t,e){if(t.length>e.maxStringLength){var i=t.length-e.maxStringLength,n="... "+i+" more character"+(i>1?"s":"");return H(_.call(t,0,e.maxStringLength),e)+n}return B(v.call(v.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,W),"single",e)}function W(t){var e=t.charCodeAt(0),i={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return i?"\\"+i:"\\x"+(e<16?"0":"")+x.call(e.toString(16))}function X(t){return"Object("+t+")"}function J(t){return t+" { ? }"}function K(t,e,i,n){return t+" ("+e+") {"+(n?Y(i,n):E.call(i,", "))+"}"}function Y(t,e){if(0===t.length)return"";var i="\n"+e.prev+e.base;return i+E.call(t,","+i)+"\n"+e.prev}function Q(t,e){var i=$(t),n=[];if(i){n.length=t.length;for(var r=0;r<t.length;r++)n[r]=q(t,r)?e(t[r],t):""}var o,s="function"==typeof I?I(t):[];if(C){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var l in t)q(t,l)&&(i&&String(Number(l))===l&&l<t.length||C&&o["$"+l]instanceof Symbol||(w.call(/[^\w$]/,l)?n.push(e(l,t)+": "+e(t[l],t)):n.push(l+": "+e(t[l],t))));if("function"==typeof I)for(var c=0;c<s.length;c++)P.call(t,s[c])&&n.push("["+e(s[c])+"]: "+e(t[s[c]],t));return n}},5798:function(t){"use strict";var e=String.prototype.replace,i=/%20/g,n="RFC1738",r="RFC3986";t.exports={default:r,formatters:{RFC1738:function(t){return e.call(t,i,"+")},RFC3986:function(t){return String(t)}},RFC1738:n,RFC3986:r}},129:function(t,e,i){"use strict";var n=i(8261),r=i(5235),o=i(5798);t.exports={formats:o,parse:r,stringify:n}},5235:function(t,e,i){"use strict";var n=i(2769),r=Object.prototype.hasOwnProperty,o=Array.isArray,s={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:n.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},a=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},l=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},c=function(t,e,i,n){if(t){var o=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,s=/(\[[^[\]]*])/g,a=i.depth>0&&/(\[[^[\]]*])/.exec(o),c=a?o.slice(0,a.index):o,u=[];if(c){if(!i.plainObjects&&r.call(Object.prototype,c)&&!i.allowPrototypes)return;u.push(c)}for(var h=0;i.depth>0&&null!==(a=s.exec(o))&&h<i.depth;){if(h+=1,!i.plainObjects&&r.call(Object.prototype,a[1].slice(1,-1))&&!i.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+o.slice(a.index)+"]"),function(t,e,i,n){for(var r=n?e:l(e,i),o=t.length-1;o>=0;--o){var s,a=t[o];if("[]"===a&&i.parseArrays)s=[].concat(r);else{s=i.plainObjects?Object.create(null):{};var c="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,u=parseInt(c,10);i.parseArrays||""!==c?!isNaN(u)&&a!==c&&String(u)===c&&u>=0&&i.parseArrays&&u<=i.arrayLimit?(s=[])[u]=r:"__proto__"!==c&&(s[c]=r):s={0:r}}r=s}return r}(u,e,i,n)}};t.exports=function(t,e){var i=function(t){if(!t)return s;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?s.charset:t.charset;return{allowDots:void 0===t.allowDots?s.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:s.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:s.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:s.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:s.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:s.comma,decoder:"function"==typeof t.decoder?t.decoder:s.decoder,delimiter:"string"==typeof t.delimiter||n.isRegExp(t.delimiter)?t.delimiter:s.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:s.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:s.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:s.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:s.strictNullHandling}}(e);if(""===t||null==t)return i.plainObjects?Object.create(null):{};for(var u="string"==typeof t?function(t,e){var i,c={__proto__:null},u=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,h=e.parameterLimit===1/0?void 0:e.parameterLimit,d=u.split(e.delimiter,h),p=-1,f=e.charset;if(e.charsetSentinel)for(i=0;i<d.length;++i)0===d[i].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[i]?f="utf-8":"utf8=%26%2310003%3B"===d[i]&&(f="iso-8859-1"),p=i,i=d.length);for(i=0;i<d.length;++i)if(i!==p){var m,g,y=d[i],_=y.indexOf("]="),v=-1===_?y.indexOf("="):_+1;-1===v?(m=e.decoder(y,s.decoder,f,"key"),g=e.strictNullHandling?null:""):(m=e.decoder(y.slice(0,v),s.decoder,f,"key"),g=n.maybeMap(l(y.slice(v+1),e),(function(t){return e.decoder(t,s.decoder,f,"value")}))),g&&e.interpretNumericEntities&&"iso-8859-1"===f&&(g=a(g)),y.indexOf("[]=")>-1&&(g=o(g)?[g]:g),r.call(c,m)?c[m]=n.combine(c[m],g):c[m]=g}return c}(t,i):t,h=i.plainObjects?Object.create(null):{},d=Object.keys(u),p=0;p<d.length;++p){var f=d[p],m=c(f,u[f],i,"string"==typeof t);h=n.merge(h,m,i)}return!0===i.allowSparse?h:n.compact(h)}},8261:function(t,e,i){"use strict";var n=i(7478),r=i(2769),o=i(5798),s=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},l=Array.isArray,c=Array.prototype.push,u=function(t,e){c.apply(t,l(e)?e:[e])},h=Date.prototype.toISOString,d=o.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,format:d,formatter:o.formatters[d],indices:!1,serializeDate:function(t){return h.call(t)},skipNulls:!1,strictNullHandling:!1},f={},m=function t(e,i,o,s,a,c,h,d,m,g,y,_,v,x,b,w){for(var S,E=e,k=w,T=0,A=!1;void 0!==(k=k.get(f))&&!A;){var I=k.get(e);if(T+=1,void 0!==I){if(I===T)throw new RangeError("Cyclic object value");A=!0}void 0===k.get(f)&&(T=0)}if("function"==typeof d?E=d(i,E):E instanceof Date?E=y(E):"comma"===o&&l(E)&&(E=r.maybeMap(E,(function(t){return t instanceof Date?y(t):t}))),null===E){if(a)return h&&!x?h(i,p.encoder,b,"key",_):i;E=""}if("string"==typeof(S=E)||"number"==typeof S||"boolean"==typeof S||"symbol"==typeof S||"bigint"==typeof S||r.isBuffer(E))return h?[v(x?i:h(i,p.encoder,b,"key",_))+"="+v(h(E,p.encoder,b,"value",_))]:[v(i)+"="+v(String(E))];var M,C=[];if(void 0===E)return C;if("comma"===o&&l(E))x&&h&&(E=r.maybeMap(E,h)),M=[{value:E.length>0?E.join(",")||null:void 0}];else if(l(d))M=d;else{var z=Object.keys(E);M=m?z.sort(m):z}for(var P=s&&l(E)&&1===E.length?i+"[]":i,L=0;L<M.length;++L){var D=M[L],R="object"==typeof D&&void 0!==D.value?D.value:E[D];if(!c||null!==R){var O=l(E)?"function"==typeof o?o(P,D):P:P+(g?"."+D:"["+D+"]");w.set(e,T);var F=n();F.set(f,w),u(C,t(R,O,o,s,a,c,"comma"===o&&x&&l(E)?null:h,d,m,g,y,_,v,x,b,F))}}return C};t.exports=function(t,e){var i,r=t,c=function(t){if(!t)return p;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||p.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=o.default;if(void 0!==t.format){if(!s.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");i=t.format}var n=o.formatters[i],r=p.filter;return("function"==typeof t.filter||l(t.filter))&&(r=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:p.addQueryPrefix,allowDots:void 0===t.allowDots?p.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:p.charsetSentinel,delimiter:void 0===t.delimiter?p.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:p.encode,encoder:"function"==typeof t.encoder?t.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:p.encodeValuesOnly,filter:r,format:i,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:p.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:p.strictNullHandling}}(e);"function"==typeof c.filter?r=(0,c.filter)("",r):l(c.filter)&&(i=c.filter);var h,d=[];if("object"!=typeof r||null===r)return"";h=e&&e.arrayFormat in a?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var f=a[h];if(e&&"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var g="comma"===f&&e&&e.commaRoundTrip;i||(i=Object.keys(r)),c.sort&&i.sort(c.sort);for(var y=n(),_=0;_<i.length;++_){var v=i[_];c.skipNulls&&null===r[v]||u(d,m(r[v],v,f,g,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,y))}var x=d.join(c.delimiter),b=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?b+="utf8=%26%2310003%3B&":b+="utf8=%E2%9C%93&"),x.length>0?b+x:""}},2769:function(t,e,i){"use strict";var n=i(5798),r=Object.prototype.hasOwnProperty,o=Array.isArray,s=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(i[n]=t[n]);return i};t.exports={arrayToObject:a,assign:function(t,e){return Object.keys(e).reduce((function(t,i){return t[i]=e[i],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],i=[],n=0;n<e.length;++n)for(var r=e[n],s=r.obj[r.prop],a=Object.keys(s),l=0;l<a.length;++l){var c=a[l],u=s[c];"object"==typeof u&&null!==u&&-1===i.indexOf(u)&&(e.push({obj:s,prop:c}),i.push(u))}return function(t){for(;t.length>1;){var e=t.pop(),i=e.obj[e.prop];if(o(i)){for(var n=[],r=0;r<i.length;++r)void 0!==i[r]&&n.push(i[r]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,i){var n=t.replace(/\+/g," ");if("iso-8859-1"===i)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},encode:function(t,e,i,r,o){if(0===t.length)return t;var a=t;if("symbol"==typeof t?a=Symbol.prototype.toString.call(t):"string"!=typeof t&&(a=String(t)),"iso-8859-1"===i)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var l="",c=0;c<a.length;++c){var u=a.charCodeAt(c);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===n.RFC1738&&(40===u||41===u)?l+=a.charAt(c):u<128?l+=s[u]:u<2048?l+=s[192|u>>6]+s[128|63&u]:u<55296||u>=57344?l+=s[224|u>>12]+s[128|u>>6&63]+s[128|63&u]:(c+=1,u=65536+((1023&u)<<10|1023&a.charCodeAt(c)),l+=s[240|u>>18]+s[128|u>>12&63]+s[128|u>>6&63]+s[128|63&u])}return l},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(o(t)){for(var i=[],n=0;n<t.length;n+=1)i.push(e(t[n]));return i}return e(t)},merge:function t(e,i,n){if(!i)return e;if("object"!=typeof i){if(o(e))e.push(i);else{if(!e||"object"!=typeof e)return[e,i];(n&&(n.plainObjects||n.allowPrototypes)||!r.call(Object.prototype,i))&&(e[i]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(i);var s=e;return o(e)&&!o(i)&&(s=a(e,n)),o(e)&&o(i)?(i.forEach((function(i,o){if(r.call(e,o)){var s=e[o];s&&"object"==typeof s&&i&&"object"==typeof i?e[o]=t(s,i,n):e.push(i)}else e[o]=i})),e):Object.keys(i).reduce((function(e,o){var s=i[o];return r.call(e,o)?e[o]=t(e[o],s,n):e[o]=s,e}),s)}}},4551:function(t,e){"use strict";e.Z='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">\n <path fill="#000" d="M16 12.5L11.3 8l4.6-4.5L13 0 8 4.8 3 0 0 3.6l4.6 4.5L0 12.5 3.1 16 8 11.3l4.9 4.7 3.1-3.5z"/>\n</svg>\n'},757:function(t,e){"use strict";e.Z='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">\n <path d="M20 6.7l-3.6-3.5-6.5 6.5-6.3-6.4L0 6.9l6.3 6.4 3.6 3.5 3.6-3.5z"/>\n</svg>\n'},7478:function(t,e,i){"use strict";var n=i(210),r=i(1924),o=i(631),s=n("%TypeError%"),a=n("%WeakMap%",!0),l=n("%Map%",!0),c=r("WeakMap.prototype.get",!0),u=r("WeakMap.prototype.set",!0),h=r("WeakMap.prototype.has",!0),d=r("Map.prototype.get",!0),p=r("Map.prototype.set",!0),f=r("Map.prototype.has",!0),m=function(t,e){for(var i,n=t;null!==(i=n.next);n=i)if(i.key===e)return n.next=i.next,i.next=t.next,t.next=i,i};t.exports=function(){var t,e,i,n={assert:function(t){if(!n.has(t))throw new s("Side channel does not contain "+o(t))},get:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(t)return c(t,n)}else if(l){if(e)return d(e,n)}else if(i)return function(t,e){var i=m(t,e);return i&&i.value}(i,n)},has:function(n){if(a&&n&&("object"==typeof n||"function"==typeof n)){if(t)return h(t,n)}else if(l){if(e)return f(e,n)}else if(i)return function(t,e){return!!m(t,e)}(i,n);return!1},set:function(n,r){a&&n&&("object"==typeof n||"function"==typeof n)?(t||(t=new a),u(t,n,r)):l?(e||(e=new l),p(e,n,r)):(i||(i={key:{},next:null}),function(t,e,i){var n=m(t,e);n?n.value=i:t.next={key:e,next:t.next,value:i}}(i,n,r))}};return n}},2582:function(t,e){var i,n,r;n=[],void 0===(r="function"==typeof(i=function(){function t(t,e){for(var i in t)t.hasOwnProperty(i)&&e(i,t[i])}function e(){var i={},n="en",r=/{{\s*(\w+)\s*}}/g,o={en:{pluralizeTo:"count",getVariationIndex:function(t){return 1===t?0:1}}};function s(t,e,r){var o=(r=r||{}).locale||n,c=r.registry||i,u=c[o]&&c[o][t];return void 0===u?s.whenUndefined(t,o):Array.isArray(u)?a(t,u,e,o,r.pluralizeTo):l(u,e)}function a(t,e,i,n,r){var s=o[n],a=Object.keys(i),c=1===a.length?a[0]:r||s.pluralizeTo,u=parseFloat(i[c]);if(isNaN(u))throw new Error('Tranlation pluralization missing parameters on key "'+t+'"');return l(e[s.getVariationIndex(u)],i)}function l(t,e){return e?t.replace(r,(function(t,i){return e.hasOwnProperty(i)?e[i]:t})):t}return s.add=function(e,r,o){return i[r=r||n]=i[r]||{},t(e,(function(t,e){var n=o?o+"."+t:t,a=typeof e;Array.isArray(e)||"string"===a||"number"===a?i[r][n]=e:s.add(e,r,n)})),this},s.setLocale=function(t){return n=t,this},s.getLocale=function(){return n},s.interpolateWith=function(t){return r=t,this},s.setPluralizationRule=function(t,e,i){return o[t]={pluralizeTo:i&&i.pluralizeTo||"count",getVariationIndex:e},this},s.whenUndefined=function(t,e){return t},s.clear=function(){return i={},this},s.createRegistry=function(){return e()},s}return e()})?i.apply(e,n):i)||(t.exports=r)},9809:function(t,e,i){"use strict";i.d(e,{Z:function(){return F}});var n=i(1823),r=i(1042),o=i(1235);function s(){const t=o.n2,e=t.crypto||t.msCrypto;if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");const i=e&&e.getRandomValues?()=>e.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&i())>>t/4).toString(16)))}var a=i(1170);const l=["debug","info","warn","error","log","assert","trace"];function c(t){if(!("console"in o.n2))return t();const e=o.n2.console,i={};l.forEach((t=>{const n=e[t]&&e[t].__sentry_original__;t in e&&n&&(i[t]=e[t],e[t]=n)}));try{return t()}finally{Object.keys(i).forEach((t=>{e[t]=i[t]}))}}function u(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?l.forEach((i=>{e[i]=(...e)=>{t&&c((()=>{o.n2.console[i](`Sentry Logger [${i}]:`,...e)}))}})):l.forEach((t=>{e[t]=()=>{}})),e}let h;h="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?(0,o.YO)("logger",u):u();const d="production",p=Object.prototype.toString;function f(t,e){return p.call(t)===`[object ${e}]`}function m(t){return f(t,"Object")}function g(t){return Boolean(t&&t.then&&"function"==typeof t.then)}var y;!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(y||(y={}));class _{__init(){this._state=y.PENDING}__init2(){this._handlers=[]}constructor(t){_.prototype.__init.call(this),_.prototype.__init2.call(this),_.prototype.__init3.call(this),_.prototype.__init4.call(this),_.prototype.__init5.call(this),_.prototype.__init6.call(this);try{t(this._resolve,this._reject)}catch(t){this._reject(t)}}then(t,e){return new _(((i,n)=>{this._handlers.push([!1,e=>{if(t)try{i(t(e))}catch(t){n(t)}else i(e)},t=>{if(e)try{i(e(t))}catch(t){n(t)}else n(t)}]),this._executeHandlers()}))}catch(t){return this.then((t=>t),t)}finally(t){return new _(((e,i)=>{let n,r;return this.then((e=>{r=!1,n=e,t&&t()}),(e=>{r=!0,n=e,t&&t()})).then((()=>{r?i(n):e(n)}))}))}__init3(){this._resolve=t=>{this._setResult(y.RESOLVED,t)}}__init4(){this._reject=t=>{this._setResult(y.REJECTED,t)}}__init5(){this._setResult=(t,e)=>{this._state===y.PENDING&&(g(e)?e.then(this._resolve,this._reject):(this._state=t,this._value=e,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state===y.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach((t=>{t[0]||(this._state===y.RESOLVED&&t[1](this._value),this._state===y.REJECTED&&t[2](this._value),t[0]=!0)}))}}}function v(t){return x(t,new Map)}function x(t,e){if(m(t)){const i=e.get(t);if(void 0!==i)return i;const n={};e.set(t,n);for(const i of Object.keys(t))void 0!==t[i]&&(n[i]=x(t[i],e));return n}if(Array.isArray(t)){const i=e.get(t);if(void 0!==i)return i;const n=[];return e.set(t,n),t.forEach((t=>{n.push(x(t,e))})),n}return t}function b(t){const e=(0,a.ph)(),i={sid:s(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return v({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(i)};return t&&w(i,t),i}function w(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||(0,a.ph)(),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:s()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}class S{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(t){const e=new S;return t&&(e._breadcrumbs=[...t._breadcrumbs],e._tags={...t._tags},e._extra={...t._extra},e._contexts={...t._contexts},e._user=t._user,e._level=t._level,e._span=t._span,e._session=t._session,e._transactionName=t._transactionName,e._fingerprint=t._fingerprint,e._eventProcessors=[...t._eventProcessors],e._requestSession=t._requestSession,e._attachments=[...t._attachments],e._sdkProcessingMetadata={...t._sdkProcessingMetadata}),e}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{},this._session&&w(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this.getSpan();return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;if("function"==typeof t){const e=t(this);return e instanceof S?e:this}return t instanceof S?(this._tags={...this._tags,...t._tags},this._extra={...this._extra,...t._extra},this._contexts={...this._contexts,...t._contexts},t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession)):m(t)&&(this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this}addBreadcrumb(t,e){const i="number"==typeof e?e:100;if(i<=0)return this;const n={timestamp:(0,a.yW)(),...t};return this._breadcrumbs=[...this._breadcrumbs,n].slice(-i),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(t,e={}){if(this._extra&&Object.keys(this._extra).length&&(t.extra={...this._extra,...t.extra}),this._tags&&Object.keys(this._tags).length&&(t.tags={...this._tags,...t.tags}),this._user&&Object.keys(this._user).length&&(t.user={...this._user,...t.user}),this._contexts&&Object.keys(this._contexts).length&&(t.contexts={...this._contexts,...t.contexts}),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts={trace:this._span.getTraceContext(),...t.contexts};const e=this._span.transaction;if(e){t.sdkProcessingMetadata={dynamicSamplingContext:e.getDynamicSamplingContext(),...t.sdkProcessingMetadata};const i=e.name;i&&(t.tags={transaction:i,...t.tags})}}return this._applyFingerprint(t),t.breadcrumbs=[...t.breadcrumbs||[],...this._breadcrumbs],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...E(),...this._eventProcessors],t,e)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}_notifyEventProcessors(t,e,i,n=0){return new _(((r,o)=>{const s=t[n];if(null===e||"function"!=typeof s)r(e);else{const a=s({...e},i);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&s.id&&null===a&&h.log(`Event processor "${s.id}" dropped event`),g(a)?a.then((e=>this._notifyEventProcessors(t,e,i,n+1).then(r))).then(null,o):this._notifyEventProcessors(t,a,i,n+1).then(r).then(null,o)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}_applyFingerprint(t){var e;t.fingerprint=t.fingerprint?(e=t.fingerprint,Array.isArray(e)?e:[e]):[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}function E(){return(0,o.YO)("globalEventProcessors",(()=>[]))}const k=4,T=100;class A{constructor(t,e=new S,i=k){this._version=i,this._stack=[{scope:e}],t&&this.bindClient(t)}isOlderThan(t){return this._version<t}bindClient(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=S.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(t){const e=this.pushScope();try{t(e)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,e){const i=this._lastEventId=e&&e.event_id?e.event_id:s(),n=new Error("Sentry syntheticException");return this._withClient(((r,o)=>{r.captureException(t,{originalException:t,syntheticException:n,...e,event_id:i},o)})),i}captureMessage(t,e,i){const n=this._lastEventId=i&&i.event_id?i.event_id:s(),r=new Error(t);return this._withClient(((o,s)=>{o.captureMessage(t,e,{originalException:t,syntheticException:r,...i,event_id:n},s)})),n}captureEvent(t,e){const i=e&&e.event_id?e.event_id:s();return t.type||(this._lastEventId=i),this._withClient(((n,r)=>{n.captureEvent(t,{...e,event_id:i},r)})),i}lastEventId(){return this._lastEventId}addBreadcrumb(t,e){const{scope:i,client:n}=this.getStackTop();if(!n)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:o=T}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const s={timestamp:(0,a.yW)(),...t},l=r?c((()=>r(s,e))):s;null!==l&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),i.addBreadcrumb(l,o))}setUser(t){this.getScope().setUser(t)}setTags(t){this.getScope().setTags(t)}setExtras(t){this.getScope().setExtras(t)}setTag(t,e){this.getScope().setTag(t,e)}setExtra(t,e){this.getScope().setExtra(t,e)}setContext(t,e){this.getScope().setContext(t,e)}configureScope(t){const{scope:e,client:i}=this.getStackTop();i&&t(e)}run(t){const e=M(this);try{t(this)}finally{M(e)}}getIntegration(t){const e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch(e){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&h.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,e){const i=this._callExtensionMethod("startTransaction",t,e);return"undefined"!=typeof __SENTRY_DEBUG__&&!__SENTRY_DEBUG__||i||console.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"),i}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const t=this.getStackTop().scope,e=t.getSession();e&&function(t,e){let i={};e?i={status:e}:"ok"===t.status&&(i={status:"exited"}),w(t,i)}(e),this._sendSessionUpdate(),t.setSession()}startSession(t){const{scope:e,client:i}=this.getStackTop(),{release:n,environment:r=d}=i&&i.getOptions()||{},{userAgent:s}=o.n2.navigator||{},a=b({release:n,environment:r,user:e.getUser(),...s&&{userAgent:s},...t}),l=e.getSession&&e.getSession();return l&&"ok"===l.status&&w(l,{status:"exited"}),this.endSession(),e.setSession(a),a}shouldSendDefaultPii(){const t=this.getClient(),e=t&&t.getOptions();return Boolean(e&&e.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:e}=this.getStackTop(),i=t.getSession();i&&e&&e.captureSession&&e.captureSession(i)}_withClient(t){const{scope:e,client:i}=this.getStackTop();i&&t(i,e)}_callExtensionMethod(t,...e){const i=I().__SENTRY__;if(i&&i.extensions&&"function"==typeof i.extensions[t])return i.extensions[t].apply(this,e);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&h.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function I(){return o.n2.__SENTRY__=o.n2.__SENTRY__||{extensions:{},hub:void 0},o.n2}function M(t){const e=I(),i=L(e);return D(e,t),i}function C(){const t=I();if(t.__SENTRY__&&t.__SENTRY__.acs){const e=t.__SENTRY__.acs.getCurrentHub();if(e)return e}return z(t)}function z(t=I()){return P(t)&&!L(t).isOlderThan(k)||D(t,new A),L(t)}function P(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function L(t){return(0,o.YO)("hub",(()=>new A),t)}function D(t,e){if(!t)return!1;return(t.__SENTRY__=t.__SENTRY__||{}).hub=e,!0}function R(t,e){return C().captureException(t,{captureContext:e})}i(3645);function O(t,e=null){var i;return e?(console.error({err:t,extras:e}),i=i=>{i.setExtras(e),R(t)},C().withScope(i)):(console.error(t),R(t)),t}var F=class{cache;fontCache;constructor(t=void 0){this.cache=new Map,this.fontCache=t}exists(t){return this.cache.has(this.getKey(t))}async getImage(t){const e=this.getKey(t);if(this.cache.has(e))return this.cache.get(e);const i=this.generateImage(t).catch((e=>O(e,{svg:t})));return this.cache.set(e,i),this.cache.set(e,await i),this.cache.get(e)}getKey(t){return(0,n.yU)(t)}async generateImage(t){const e=(new DOMParser).parseFromString(t,"image/svg+xml").firstElementChild,i=this._getFonts(e),n=document.createElement("defs"),o=document.createElement("style");o.innerText=await this._generateFontFaces(i),n.append(o),e?.prepend(n);const s=this._getSize(e),a=s.width&&s.width*window.devicePixelRatio,l=s.height&&s.height*window.devicePixelRatio,c=e?.outerHTML;if(!r.G6&&(r.vU||c?.length&&c?.length<2e6))try{return await this._generateImageFast(e?.outerHTML,a,l)}catch(t){}return this._generateImageSafe(c,a,l)}_getSize(t){return{width:t?.width?.baseVal?.value,height:t?.height?.baseVal?.value}}_getFonts(t){const e={};for(const n of t.querySelectorAll("[mol_font]")){const t=n.getAttribute("mol_font");e[t]||(e[t]={});for(const r of n.getAttributeNames())r.startsWith("font-")&&"font-size"!==r&&(e[t][r]=(i=n.getAttribute(r),Number.isFinite(Number(i))?Number(i):i))}var i;return e}async _generateFontFaces(t){const e=Object.entries(t).map((([t,e])=>this.fontCache.get(t,e)));return(await Promise.allSettled(e)).filter((t=>"fulfilled"===t.status)).map((t=>t.value)).join("\n")}_generateImageFast(t,e,i){const n=new Image;return Number.isFinite(e)&&Number.isFinite(i)&&(n.width=e,n.height=i),n.decoding="sync",n.fetchpriority="high",n.loading="eager",new Promise(((e,i)=>{n.onload=()=>e(n),n.onerror=()=>i(new Error("Failed to quickly generate image from svg")),n.src=`data:image/svg+xml;base64,${btoa(t)}`}))}async _generateImageSafe(t,e,i){let n,o=r.G6;if("string"==typeof t){const e=new Blob([t],{type:"image/svg+xml"});o&&=t.includes("mol_font"),n=URL.createObjectURL(e)}else{if(!(t instanceof Blob))throw new TypeError("Expected svg to be of type string or Blob");n=URL.createObjectURL(t)}const s=new Image;s.decoding="sync",s.fetchpriority="high",s.loading="eager",Number.isFinite(e)&&Number.isFinite(i)&&(s.width=e,s.height=i);const a=t=>new Promise(((e,i)=>{s.onload=()=>e(),s.onerror=()=>i(new Error("Failed to safely generate image from svg")),s.src=t}));try{o&&(await a(n),await a("data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")),await a(n)}finally{URL.revokeObjectURL(n)}return s}}},9436:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(7187);class r extends n.EventEmitter{static get identifier(){return""}loader;meta;map;options;constructor(t,e,...i){super(),this.loader=t,this.meta=e,this.map=t.map,this.options=i}init(){}}},805:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(9436);class r extends n.default{url2021Prod;url2019Prod;url2021Staging;url2019Staging;data;data2019;regionId;is2019Open;bound;static get identifier(){return"ca_elections_2021"}async init(){this.url2021Prod=this.options[0],this.url2019Prod=this.options[1],this.url2021Staging=this.options[2],this.url2019Staging=this.options[3],this.bound=this.options[4],this.is2019Open=!1,await this._loadData(),setInterval((()=>this._loadData()),1e4);const t=["Federal","Federal Names"];for(const e of t)this.map.on("click",e,(t=>this._onMapClick(t)));this.map.fitBounds(this.bound),this.map.touchZoomRotate.disableRotation(),this.map.touchPitch.disable()}deselectRegion(){this.regionId=void 0,this.emit("update")}enable2019(){void 0!==this.data2019&&(this.is2019Open=!0,this._setFeatureStates(),this.emit("update"))}disable2019(){void 0!==this.data&&(this.is2019Open=!1,this._setFeatureStates(),this.emit("update"))}toggle2019(){void 0!==this.data&&void 0!==this.data2019&&(this.is2019Open=!this.is2019Open,this._setFeatureStates(),this.emit("update"))}async _loadData(){let t;try{t=await Promise.all([fetch(this.url2021Prod).then((t=>this._processResponse(t))),fetch(this.url2019Prod).then((t=>this._processResponse(t)))])}catch(e){console.warn("Failed to load data from production. Trying staging...");try{t=await Promise.all([fetch(this.url2021Staging).then((t=>this._processResponse(t))),fetch(this.url2019Staging).then((t=>this._processResponse(t)))])}catch(t){return void console.error("Failed to load data from staging.")}}this.data=t[0],this.data2019=t[1],this._setFeatureStates(),this.emit("update")}_setFeatureStates(){const t=this.is2019Open?this.data2019:this.data;for(const e of t)this.map.setFeatureState({id:e.polygon_id,source:"canada_elex",sourceLayer:"fedpoly"},{color:e.color,textColor:e.text_color})}_onMapClick(t){const e=t.features?.[0]?.properties,i=e?.id,n=e?.lng_min,r=e?.lng_max,o=e?.lat_min,s=e?.lat_max;if(void 0!==i){if(this.regionId=String(i),void 0!==n&&void 0!==r&&void 0!==o&&void 0!==s){const t=[[n,o],[r,s]];this.map.fitBounds(t,{padding:{left:1e3,top:100,right:100,bottom:100},maxZoom:12})}this.emit("update")}}_processResponse(t){if(t.ok)return t.json();throw new Error("Failed to load")}}},1547:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return S}});var n=i(614),r=i(1002),o=i(9436),s=i(1042);function a(t){return null===t?NaN:+t}function l(t,e,i=a){if((n=t.length)&&!isNaN(e=+e)){if(e<=0||n<2)return+i(t[0],0,t);if(e>=1)return+i(t[n-1],n-1,t);var n,r=(n-1)*e,o=Math.floor(r),s=+i(t[o],o,t);return s+(+i(t[o+1],o+1,t)-s)*(r-o)}}function c(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function u(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function h(t){let e,i,n;function r(t,n,r=0,o=t.length){if(r<o){if(0!==e(n,n))return o;do{const e=r+o>>>1;i(t[e],n)<0?r=e+1:o=e}while(r<o)}return r}return 2!==t.length?(e=c,i=(e,i)=>c(t(e),i),n=(e,i)=>t(e)-i):(e=t===c||t===u?t:d,i=t,n=t),{left:r,center:function(t,e,i=0,o=t.length){const s=r(t,e,i,o-1);return s>i&&n(t[s-1],e)>-n(t[s],e)?s-1:s},right:function(t,n,r=0,o=t.length){if(r<o){if(0!==e(n,n))return o;do{const e=r+o>>>1;i(t[e],n)<=0?r=e+1:o=e}while(r<o)}return r}}}function d(){return 0}const p=h(c),f=p.right;p.left,h(a).center;var m=f;function g(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function y(){var t,e=[],i=[],n=[];function r(){var t=0,r=Math.max(1,i.length);for(n=new Array(r-1);++t<r;)n[t-1]=l(e,t/r);return o}function o(e){return null==e||isNaN(e=+e)?t:i[m(n,e)]}return o.invertExtent=function(t){var r=i.indexOf(t);return r<0?[NaN,NaN]:[r>0?n[r-1]:e[0],r<n.length?n[r]:e[e.length-1]]},o.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let i of t)null==i||isNaN(i=+i)||e.push(i);return e.sort(c),r()},o.range=function(t){return arguments.length?(i=Array.from(t),r()):i.slice()},o.unknown=function(e){return arguments.length?(t=e,o):t},o.quantiles=function(){return n.slice()},o.copy=function(){return y().domain(e).range(i).unknown(t)},g.apply(o,arguments)}var _=i(1823);const v={region:"regions",department:"departements",commune:"communes"},x={region:"regions_cent",department:"departements_cent",commune:"communes_cent"},b={Regions:"region",Departements:"department",Communes:"commune"},w=["Regions","Departements","Communes"];class S extends o.default{url;data;url2017;url2022;data2017;data2022;datasets;is2017Open;isLegendOpen;selectedParty;selectedRound;boundOnMapClick;adminLevelVisibility;selectedSubdivisions;highlightedSubdivision;displayLinks;initialSelectedCandidate;forceGradientMap;initialCenter;initialZoom;initialBearing;initialPitch;initialHighlight;static get identifier(){return"fr_elections_2022"}constructor(t,e,...i){super(t,e,...i),this.boundOnMapClick=this._onMapClick.bind(this),this.map.on("click",this.boundOnMapClick);const{selectedSubdivisions:n,highlightedSubdivision:r,showRegions:o,showDepartments:s,showCommunes:a,displayLinks:l,selectedCandidate:c}=e;this.selectedRound=e.selectedRound??"1",this.url2022=`https://elections.mc-cdn.io/france2022T${this.selectedRound}.json`,this.url2017="https://elections.mc-cdn.io/france2017T1.json",this.initialSelectedCandidate=c,this.selectedParty=c,this.forceGradientMap=void 0!==c,this.selectedSubdivisions=n??[],this.highlightedSubdivision=r,this.displayLinks=l,this.adminLevelVisibility={region:o??!0,department:s??!0,commune:a??!0},this.is2017Open=!1,this.isLegendOpen=this.forceGradientMap,this._initHatchImage(),this._setFilters(),this._setZoomLimits(),this.initialCenter=this.map.getCenter(),this.initialZoom=this.map.getZoom(),this.initialBearing=this.map.getBearing(),this.initialPitch=this.map.getPitch(),this.initialHighlight=this.highlightedSubdivision}async init(){await this._loadData(),setInterval((()=>this._reloadData()),3e4)}destroy(){for(const t of w)this.map.off("click",t,this.boundOnMapClick)}reset(){if(void 0!==this.initialHighlight){const{type:t,code:e}=this.initialHighlight;this.highlightedSubdivision=this.data.subdivisions.find((i=>i.type===t&&i.code===e))}this._setFilters(),this.emit("update"),this.map.easeTo({center:this.initialCenter,zoom:this.initialZoom,bearing:this.initialBearing,pitch:this.initialPitch})}toggleRounds(){if(this.is2017Open=!this.is2017Open,this.data=this.is2017Open?this.data2017:this.data2022,void 0!==this.highlightedSubdivision){const{type:t,code:e}=this.highlightedSubdivision;this.highlightedSubdivision=this.data.subdivisions.find((i=>i.type===t&&i.code===e))}this.selectParty()}setSelectedSubdivisions(t){if(this.selectedSubdivisions=t,void 0!==this.highlightedSubdivision){const{type:t,code:e,departmentCode:i,regionCode:n}=this.highlightedSubdivision;if(this.hasSelection()){const r="region"===t&&!this.isSelected("region",e),o="department"===t&&!this.isSelected("department",e)&&!this.isSelected("region",n),s="commune"===t&&!this.isSelected("commune",e)&&!this.isSelected("department",i)&&!this.isSelected("region",n);(r||o||s)&&this._resetHighlight()}}this._setFilters(),this.emit("update")}setAdminLevelVisibility(t,e){if(this.adminLevelVisibility[t]=e,e||this.highlightedSubdivision?.type!==t||this._resetHighlight(),!this.isVisible("region")){const t=this.isVisible("department")?3:6;this.map.getZoom()<t&&this.map.zoomTo(t)}this._setFilters(),this.emit("update")}hasSelection(){return this.selectedSubdivisions.length>0}isSelected(t,e){return!!this.selectedSubdivisions.find((i=>i.type===t&&i.code===e))}isVisible(t){return this.adminLevelVisibility[t]}allVotesCounted(){if(this.is2017Open)return!0;for(const t of this.data.subdivisions)if(t.progress<1)return!1;return!0}candidateList(){const t=(0,s.d9)(this.data.candidates);for(let e=0;e<t.length;e++)t[e].originalOrder=String(e);if(this.highlightedSubdivision){for(let e=0;e<t.length;e++)t[e].votes=this.highlightedSubdivision.votes[e];t.sort(((t,e)=>e.votes-t.votes))}return t}selectParty(t=void 0){this.selectedParty=t,this._setFeatureStates(t),this.emit("update")}getMainSubdivision(){return this.data?.subdivisions?.find((t=>"country"===t.type))}_initHatchImage(){const t=2*window.devicePixelRatio,e=new Image(128*t,128*t);e.onload=()=>{this.map.addImage("hatch",e,{pixelRatio:t})},e.src="/images/hatch.svg"}async _loadData(){try{const t=await Promise.all([fetch(this._calcUrl2022()).then((t=>t.json())),fetch(this.url2017).then((t=>t.json()))]);if(this.data2022=t[0],this.data2017=t[1],this.data=this.is2017Open?this.data2017:this.data2022,void 0===this.highlightedSubdivision)this.highlightedSubdivision=this.getMainSubdivision();else{const{type:t,code:e}=this.highlightedSubdivision;this.highlightedSubdivision=this.data.subdivisions.find((i=>i.type===t&&i.code===e))}this._setFeatureStates(this.selectedParty),this.emit("update")}catch(t){console.error(t)}}async _reloadData(){if(this.data2022=await fetch(this._calcUrl2022()).then((t=>t.json())),this.data=this.is2017Open?this.data2017:this.data2022,void 0!==this.highlightedSubdivision){const{type:t,code:e}=this.highlightedSubdivision;this.highlightedSubdivision=this.data.subdivisions.find((i=>i.type===t&&i.code===e))}this._setFeatureStates(this.selectedParty),this.emit("update")}_setFeatureStates(t){void 0===t||!this.allVotesCounted()&&!this.forceGradientMap?this._setFeatureStatesGlobal():this._setFeatureStatesParty(t)}_setFeatureStatesGlobal(){for(const t of this.data.subdivisions){const{type:e,votes:i}=t;if(0===i.length)continue;const n=t.code,r=v[e],o=x[e];if(void 0!==n&&void 0!==r&&void 0!==o){const{color:e,hatch:i,textColor:s,textHalo:a}=this._calcFeatureStateGlobal(t);this.map.setFeatureState({id:n,sourceLayer:r,source:"france_elex"},{color:e,hatch:i}),this.map.setFeatureState({id:n,sourceLayer:o,source:"france_elex"},{color:s,textHalo:a})}}}_calcFeatureStateGlobal(t){const e=t.votes.indexOf(Math.max(...t.votes)),i=this.data.candidates[e].color,n=["#071868","#042FA0","#BC1A1A","#FF0000","#1C4385","#FB6969","#9A7D24","#E54343","#743F99"];return t.progress<.6?{color:"#cccccc",textHalo:"rgba(255, 255, 255, 1)",hatch:!1}:t.progress<1?{color:i,textColor:n.includes(i)?"#ffffff":"#000000",textHalo:n.includes(i)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)",hatch:!0}:{color:i,textColor:n.includes(i)?"#ffffff":"#000000",textHalo:n.includes(i)?"rgba(0, 0, 0, 1)":"rgba(255, 255, 255, 1)",hatch:!1}}_setFeatureStatesParty(t){const e=this.data.candidates[t].color,i=this.data.subdivisions.filter((t=>t.votes.length>0)).map((e=>e.votes[t]));let o=1/0,s=-1/0;for(const t of i)t<o&&(o=t),t>s&&(s=t);const a=y().domain(i).range((0,n.Z)((0,r.ZP)("#ffffff",s>o?e:"#ffffff"),7));for(const e of this.data.subdivisions){const{type:i,votes:n}=e;if(0===n.length)continue;const r=e.code,o=v[i],s=x[i];if(void 0!==r&&void 0!==o&&void 0!==s){const i=a(e.votes[t]),n="rgb(255, 255, 255)"===i?"#CCCCCC":"#FFFFFF",l=(0,_.ou)(i),c="#000000"===l?"rgba(255, 255, 255, 1)":"rgba(0, 0, 0, 1)";this.map.setFeatureState({id:r,sourceLayer:o,source:"france_elex"},{color:i,outline:n,hatch:!1}),this.map.setFeatureState({id:r,sourceLayer:s,source:"france_elex"},{color:l,textHalo:c})}}}_onMapClick(t){const e=this.map.queryRenderedFeatures(t.point,{layers:w});if(0===e.length)return this._resetHighlight(),void this.reset();const i=e[0];if(void 0===i)return;const n=i.properties?.code_insee,r=i.layer?.id,o=b[r];if(void 0===n||void 0===o||void 0===this.data)return;let s=this.data.subdivisions.find((t=>t.code===n&&t.type===o));if(void 0===s)return;if("region"===o){const t=this.data.subdivisions.filter((t=>"department"===t.type&&t.regionCode===n));1===t.length&&(s=t[0])}if(0===s.votes.length)return;const a=this.highlightedSubdivision?.type,l=s.type;this.highlightedSubdivision=s,this._setFilters(),this.emit("update"),this.closeLegendIfOverlaps(),this._easeToHighlight(i,a,l)}closeLegendIfOverlaps(){this.isLegendOpen&&this._popupOverlapsLegend()&&(this.isLegendOpen=!1,this.emit("update"))}closePopupIfOverlaps(){void 0!==this.highlightedSubdivision&&this._popupOverlapsLegend()&&(this.highlightedSubdivision=void 0,this.emit("update"))}_popupOverlapsLegend(){const t=this.map.getContainer().querySelector(".fr-elections-2022-popup-container")?.getBoundingClientRect(),e=this.map.getContainer().querySelector(".fr-elections-2022-legend-container")?.getBoundingClientRect();return void 0!==t&&void 0!==e&&(t.right>e.left&&t.left<e.right&&t.bottom>e.top&&t.top<e.bottom)}_easeToHighlight(t,e,i){const n=t.properties?.lng_min,r=t.properties?.lng_max,o=t.properties?.lat_min,s=t.properties?.lat_max;if(void 0!==n&&void 0!==r&&void 0!==o&&void 0!==s){const t=this.map.getBounds(),a=[n,o],l=[r,s],c=t.contains(a)&&t.contains(l),u="region"===i?3:6;if(e!==i||!c||this.map.getZoom()<u){const t=this.map.cameraForBounds([a,l],{maxZoom:10});t.zoom=Math.max(t.zoom,u),this.map.easeTo(t)}}}_resetHighlight(){this.highlightedSubdivision=this.getMainSubdivision()}_setFilters(){this._filterRegions(),this._filterDepartments(),this._filterCommunes(),this._filterFocusLayers()}_filterRegions(){if(this.isVisible("region"))if(0===this.selectedSubdivisions.length)this._setFilterToLayers("region",void 0);else{const t=this.selectedSubdivisions.filter((t=>"region"===t.type)).map((t=>["==",["get","code_insee"],t.code]));this._setFilterToLayers("region",t.length>0?["any",...t]:["boolean",!1])}else this._setFilterToLayers("region",["boolean",!1])}_filterDepartments(){if(this.isVisible("department"))if(this.isVisible("region")){const t=this.selectedSubdivisions.filter((t=>"department"===t.type)).map((t=>["==",["get","code_insee"],t.code]));if(void 0!==this.highlightedSubdivision){const{type:e,code:i,departmentCode:n,regionCode:r}=this.highlightedSubdivision;"region"===e?t.push(["==",["get","regionid"],i]):"department"===e?!this.hasSelection()||this.isSelected("region",r)?t.push(["==",["get","regionid"],r]):t.push(["==",["get","code_insee"],i]):"commune"===e&&(!this.hasSelection()||this.isSelected("region",r)?t.push(["==",["get","regionid"],r]):t.push(["==",["get","departementid"],n]))}this._setFilterToLayers("department",t.length>0?["any",...t]:["boolean",!1])}else{const t=this.selectedSubdivisions.filter((t=>"region"===t.type||"department"===t.type)).map((t=>["==",["get","region"===t.type?"regionid":"code_insee"],t.code]));this._setFilterToLayers("department",t.length>0?["any",...t]:void 0)}else this._setFilterToLayers("department",["boolean",!1])}_filterCommunes(){if(this.isVisible("commune"))if(this.isVisible("region")||this.isVisible("department")){const t=this.selectedSubdivisions.filter((t=>"commune"===t.type)).map((t=>["==",["get","code_insee"],t.code]));if(void 0!==this.highlightedSubdivision){const{type:e,code:i,departmentCode:n,regionCode:r}=this.highlightedSubdivision;"department"===e?t.push(["==",["get","departementid"],i]):"region"===e&&this.isVisible("region")&&!this.isVisible("department")?t.push(["==",["get","regionid"],i]):"commune"===e&&(!this.hasSelection()||this.isSelected("department",n)||this.isSelected("region",r)?this.isVisible("region")&&!this.isVisible("department")?t.push(["==",["get","regionid"],r]):t.push(["==",["get","departementid"],n]):t.push(["==",["get","code_insee"],i]))}this._setFilterToLayers("commune",t.length>0?["any",...t]:["boolean",!1])}else{const t=this.selectedSubdivisions.map((t=>["==",["get",{region:"regionid",department:"departementid",commune:"code_insee"}[t.type]],t.code]));this._setFilterToLayers("commune",t.length>0?["any",...t]:void 0)}else this._setFilterToLayers("commune",["boolean",!1])}_filterFocusLayers(){const t=this.highlightedSubdivision?.type,e=this.highlightedSubdivision?.code,i=["==",["get","code_insee"],e];this.map.setFilter("regions-focus","region"===t?i:["boolean",!1]),this.map.setFilter("departements-focus","department"===t?i:["boolean",!1]),this.map.setFilter("communes-focus","commune"===t?i:["boolean",!1])}_setFilterToLayers(t,e){const i={region:["Regions","Regions Names","regions-outline","regions-hatch"],department:["Departements","Departements Names","departements-outline","departements-hatch"],commune:["Communes","Communes Names","communes-outline","communes-hatch"]};for(const n of i[t])this.map.setFilter(n,e)}_setZoomLimits(){const t=this.loader.originalZoom,e=this.map.getZoom(),i=!this._isNullFilter(this.map.getFilter("Regions")),n=!this._isNullFilter(this.map.getFilter("Departements")),r=!this._isNullFilter(this.map.getFilter("Communes"));e<t&&(t>6&&r?this.map.setZoom(Math.max(6,e)):t>3&&n&&this.map.setZoom(Math.max(3,e))),i||n?this.map.setMinZoom(3):this.map.setMinZoom(6)}_isNullFilter(t){return Array.isArray(t)&&2===t.length&&"boolean"===t[0]&&!1===t[1]}_calcUrl2022(){return`${this.url2022}?v=${Math.floor(Date.now()/3e4)}`}}},8929:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(9436);class r extends n.default{url2022;url2018;data;data2018;regionId;is2018open;bound;static get identifier(){return"quebec_election_2022"}async init(){this.url2022=this.options[0],this.url2018=this.options[1],this.bound=this.options[4],this.is2018open=!1,await this._loadData(),setInterval((()=>this._loadData()),1e4);const t=["Federal","Federal Names"];for(const e of t)this.map.on("click",e,(t=>this._onMapClick(t)));this.map.fitBounds(this.bound),this.map.touchZoomRotate.disableRotation(),this.map.touchPitch.disable()}deselectRegion(){this.regionId=void 0,this.emit("update")}enable2018(){void 0!==this.data2018&&(this.is2018open=!0,this._setFeatureStates(),this.emit("update"))}disable2018(){void 0!==this.data&&(this.is2018open=!1,this._setFeatureStates(),this.emit("update"))}toggle2018(){void 0!==this.data&&void 0!==this.data2018&&(this.is2018open=!this.is2018open,this._setFeatureStates(),this.emit("update"))}async _loadData(){let t;try{t=await Promise.all([fetch(this.url2022).then((t=>this._processResponse(t))),fetch(this.url2018).then((t=>this._processResponse(t)))])}catch(t){return void console.warn("Failed to load data.")}this.data=t[0],this.data2018=t[1],this._setFeatureStates(),this.emit("update")}_setFeatureStates(){const t=this.is2018open?this.data2018:this.data;for(const e of t)this.map.setFeatureState({id:e.polygon_id,source:"canada_elex",sourceLayer:"districts_wgs"},{color:e.color,textColor:e.text_color})}_onMapClick(t){const e=t.features?.[0]?.properties,i=e?.id,n=e?.lng_min,r=e?.lng_max,o=e?.lat_min,s=e?.lat_max;if(void 0!==i){if(this.regionId=String(i),void 0!==n&&void 0!==r&&void 0!==o&&void 0!==s){const t=[[n,o],[r,s]];this.map.fitBounds(t,{padding:{left:1e3,top:100,right:100,bottom:100},maxZoom:12})}this.emit("update")}}_processResponse(t){if(t.ok)return t.json();throw new Error("Failed to load")}}},6763:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(9436),r=i(1042),o=i(1823);class s extends n.default{data;popup;static get identifier(){return"us_elections_2020"}async init(){const[t,e]=await(0,o.I0)([Promise.resolve().then(i.bind(i,7622)),Promise.resolve().then(i.bind(i,8331))]),n=this.map.getPitch(),s=this.map.getBearing(),a=this.map.getBounds().toArray(),l={bottom:150,top:10,left:10,right:10},c=this.meta.selectedStateFips;this.data=new t(this.map,r.tq,c,!0,...this.options),this.popup=new e(this.map,this.data),this.data.on("zoom",(t=>this.map.easeTo({zoom:4,center:t}))),this.data.on("fit-bounds",(t=>{const e={};t?e.padding=r.tq?l:50:(e.pitch=n,e.bearing=s),this.map.fitBounds(t??a,e)})),this.data.once("vote-data-loaded",(()=>this.data.reset())),this.data.enableEventListeners(),this.popup.enableEventListeners(),(0,r.PQ)((async()=>{try{await this.data.loadSettings(),await this.data.loadCandidateData(),await this.data.loadVoteData(),this.data.watchForSettingsUpdate()}catch(t){console.log(t)}}))}}},5574:function(t,e,i){"use strict";i.d(e,{T:function(){return o}});var n=i(1042),r=i(1823);class o{container;behavior;map;_fullscreenchange;constructor(){this.container=document.createElement("div"),this.container.classList.add("maplibregl-ctrl"),n.tq&&(0,r.zd)()&&this.hidesOnMobileIframe&&(document.addEventListener("fullscreenchange",this.toggleVisible.bind(this)),this.toggleVisible()),this._detectFullscreenEvent()}get hidesOnMobileIframe(){return!1}toggleVisible(){this.container.style.display="none"===this.container.style.display?"block":"none"}applyOffset(t,e=void 0,i=void 0,{x:n=0,y:r=0}={}){"arbitrary"===t&&n+r>0&&(e||this.container.classList.add("arbitrary-positioning"),this.container.style.left=`${n}px`,this.container.style.top=`${r}px`,this.container.offsetBottom=i)}_isFullscreen(){return(0,r.rm)()}_detectFullscreenEvent(){"onfullscreenchange"in window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in window.document&&(this._fullscreenchange="MSFullscreenChange")}_fromSvgString(t){return(new DOMParser).parseFromString(t,"image/svg+xml").firstElementChild}}},8856:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5574);class r extends n.T{canadaButtonTimeout;bounds={canada:[[-146.748239,38.816187],[-42.253743,67.746815]]};constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){this.map=t,this.container.classList.add("ca-elections-2021-controls-container"),this.container.innerHTML=this._buildHtml();const e=this.container.querySelector(".canada-button"),i=this.container.querySelector(".nineteen-button");return e.addEventListener("click",(()=>this._focusCanada())),i.addEventListener("click",(()=>this.behavior.toggle2019())),this.behavior.on("update",(()=>this._update2019Button())),this.container}_buildHtml(){return'\n <div class="ca-elections-2021-controls">\n <div class="canada-button"><svg width="100" height="107" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m47.897 106.824 1.195-22.683a2.475 2.475 0 0 0-.85-1.986 2.53 2.53 0 0 0-2.097-.59l-22.806 3.97 3.08-8.411a1.692 1.692 0 0 0-.532-1.919L.904 55.177l5.629-2.602c.38-.178.681-.487.848-.869.166-.382.185-.812.055-1.207L2.497 35.465l14.39 3.022c.39.08.796.025 1.15-.157.353-.182.631-.479.788-.841l2.788-6.492 11.23 11.932a1.741 1.741 0 0 0 2.04.344c.333-.168.601-.439.764-.771.164-.332.214-.708.144-1.07l-5.417-27.65 8.682 4.967a1.74 1.74 0 0 0 1.982-.165c.18-.15.329-.336.434-.545L50.287.902 59.1 18.04a1.711 1.711 0 0 0 1.053.874 1.743 1.743 0 0 0 1.363-.164L70.2 13.78l-5.416 27.65c-.07.363-.02.739.143 1.07.163.333.431.604.763.773a1.741 1.741 0 0 0 2.04-.345L78.96 30.997l2.788 6.492c.157.362.436.66.789.841.353.182.76.238 1.15.157l14.389-3.022-4.938 15.034c-.131.395-.112.825.055 1.207.166.382.467.691.847.87l5.629 2.601-24.983 20.028a1.691 1.691 0 0 0-.531 1.919l3.08 8.41-22.807-3.968a2.547 2.547 0 0 0-2.096.589 2.497 2.497 0 0 0-.85 1.986l1.194 22.683h-4.779z" fill="#000"/></svg>\n</div>\n <div class="nineteen-button">2019</div>\n </div>\n '}_focusCanada(){const t=this.container.querySelector(".canada-button");t.classList.add("active"),clearTimeout(this.canadaButtonTimeout),this.canadaButtonTimeout=setTimeout((()=>{t.classList.remove("active")}),1e3),this.map.fitBounds(this.bounds.canada)}_update2019Button(){const t=this.container.querySelector(".nineteen-button");this.behavior.is2019Open?t.classList.add("active"):t.classList.remove("active")}}},4645:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5574),r=i(757);class o extends n.T{bounds={ontario:[[-95.152587,41.681117],[-74.344482,56.857982]],ouestCanadien:[[-130.72359,48.168561],[-102.151974,59.58277]],torontoCentre:[[-79.639377,43.581012],[-79.115467,43.855449]],torontoRegions:[[-80.419318,43.095904],[-78.53984,44.361994]],vancouverMetro:[[-123.224973,49.198475],[-123.023271,49.3141]],montrealRmr:[[-73.974208,45.41002],[-73.47433,45.70474]],riveNordDeMtl:[[-75.384109,45.35701],[-72.786199,46.890723]],riveSudDeMtl:[[-74.754196,45.099492],[-72.736013,45.814948]],quebecRmr:[[-72.313142,46.162254],[-70.164323,47.481918]],pAtlantiques:[[-70.958935,42.775873],[-52.00821,54.157207]],canada:[[-133.446019,43.374209],[-57.175872,63.326639]],quebec:[[-86.274514,41.84624],[-47.668783,61.534648]]};constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){this.map=t,this.container.classList.add("ca-elections-2021-focus-buttons-container"),this.container.innerHTML=this._buildHtml();const e=this.container.querySelectorAll(".dropdown"),i=this.container.querySelectorAll(".focus-button");for(const t of e)t.addEventListener("click",(()=>this._toggleDropdown(t)));for(const t of i)t.addEventListener("click",(()=>this._focus(t.dataset.bound)));return this.container}_buildHtml(){return`\n <div class="ca-elections-2021-focus-buttons">\n <div class="dropdown" data-group="quebec">\n Québec\n <div class="arrow">${r.Z}</div>\n </div>\n <div class="focus-buttons" data-group="quebec">\n <div class="focus-button" data-bound="montrealRmr">Montréal RMR</div>\n <div class="focus-button" data-bound="riveNordDeMtl">Rive-Nord de MTL</div>\n <div class="focus-button" data-bound="riveSudDeMtl">Rive-Sud de MTL</div>\n <div class="focus-button" data-bound="quebecRmr">Québec RMR</div>\n </div>\n <div class="dropdown" data-group="provinces">\n Provinces\n <div class="arrow">${r.Z}</div>\n </div>\n <div class="focus-buttons" data-group="provinces">\n <div class="focus-button" data-bound="pAtlantiques">Provinces Atlantiques</div>\n <div class="focus-button" data-bound="ontario">Ontario</div>\n <div class="focus-button" data-bound="ouestCanadien">Ouest Canadien</div>\n <div class="focus-button" data-bound="quebec">Québec</div>\n </div>\n <div class="dropdown" data-group="canada">\n Canada\n <div class="arrow">${r.Z}</div>\n </div>\n <div class="focus-buttons" data-group="canada">\n <div class="focus-button" data-bound="ouestCanadien">Ouest Canadien</div>\n <div class="focus-button" data-bound="torontoCentre">Toronto Centre</div>\n <div class="focus-button" data-bound="torontoRegions">Toronto Régions</div>\n <div class="focus-button" data-bound="vancouverMetro">Vancouver Métro</div>\n </div>\n </div>\n `}_toggleDropdown(t){const e=t.dataset.group,i=!t.classList.contains("active"),n=this.container.querySelectorAll(".dropdown"),r=this.container.querySelectorAll(".focus-buttons");for(const t of n)i&&t.dataset.group===e?t.classList.add("active"):t.classList.remove("active");for(const t of r)i&&t.dataset.group===e?t.classList.add("active"):t.classList.remove("active")}_focus(t){const e=this.container.querySelectorAll(".focus-button");for(const i of e)i.dataset.bound===t?i.classList.add("active"):i.classList.remove("active");this.map.fitBounds(this.bounds[t])}}},6408:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(5574),r=i(1823),o=i(4551);class s extends n.T{constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.container.classList.add("ca-elections-2021-popup-container"),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){const t=this.behavior.data,e=this.behavior.data2019,i=this.behavior.regionId;if(void 0===t)return;const n=t.find((t=>t.polygon_id===i)),r=e.find((t=>t.polygon_id===i));this.container.innerHTML=this._buildHtml(n,r),this.container.querySelector(".ca-elections-2021-popup .close-button.close-2021")?.addEventListener("click",(()=>this.behavior.deselectRegion())),this.container.querySelector(".ca-elections-2021-popup .close-button.close-2019")?.addEventListener("click",(()=>this.behavior.disable2019())),this.container.querySelector(".year-switch-number")?.addEventListener("click",(()=>this.behavior.enable2019()))}_buildHtml(t,e){const i=this.behavior.is2019Open;let n=this._buildRegionHtml(t,e,i,!1);return i&&(n+=this._buildRegionHtml(t,e,i,!0)),n}_buildRegionHtml(t,e,i,n){const r=n?e:t,s=n?"2019":"2021";if(void 0===r)return"";const a=r.district_name,l=r.counted_polls,c=r.total_poll_number,u=l/c*100,h=r.leading_candidates.slice(0,4).map(((t,e)=>this._buildCandidateHtml(t,l,e))).join("");return`\n <div class="ca-elections-2021-popup">\n <div class="header">\n <div class="name">${a}</div>\n <div class="reporting-bar">\n <div class="reporting-indicator" style="left: ${u}%"></div>\n </div>\n <div class="reporting-label">${Math.round(u)}% des votes dépouillés</div>\n </div>\n <div class="close-button ${n?"close-2019":"close-2021"}">${o.Z}</div>\n <div class="year-label ${i?"":"hidden"}">${s}</div>\n <div class="results">${h}</div>\n </div>\n `}_buildCandidateHtml(t,e,i){const n=`${(0,r.Zd)(t.vote_percent,2)}%`.replace(".",","),o=0===i,s=t.party.logo,a=`style="background-color: ${t.party.color}"`;return`\n <div class="results-row ${o?"leading":""}" style="color: ${t.party.text_color}">\n <div class="highlighter" ${o?a:""}></div>\n <div class="results-column logo" ${a}>${s?`<img src="${s}" alt=""></img>`:""}</div>\n <div class="results-column candidate"><div>${t.incumbent?`${t.first_name} ${t.last_name}*`:`${t.first_name} ${t.last_name}`}</div></div>\n <div class="results-column percent"><div>${n}</div></div>\n </div>\n `}}},8487:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5574);class r extends n.T{constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.container.classList.add("fr-elections-2022-back"),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.container.querySelector(".back-button").addEventListener("click",(t=>{this.behavior.reset()}))}_buildHtml(){return'\n <div class="fr-elections-2022-back">\n <button class="back-button">\n <svg width="14" height="19" viewBox="0 0 14 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.29 19 14 15.602l-6.747-6.18L14 3.399 10.29 0 0 9.423 10.29 19Z" fill="#000"/></svg>\n\n </button>\n </div>\n '}}},3138:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5574);class r extends n.T{copyrightShowing;clickable;constructor(t){super(),this.behavior=t,this.copyrightShowing=!0,this.clickable=!1}onAdd(t){return this.map=t,this.container.classList.add("fr-elections-2022-copyright"),this._update(),this.behavior.on("update",(()=>this._update())),window.addEventListener("resize",(()=>this.checkWindowSize())),this.checkWindowSize(),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.container.querySelector(".copyright-button").addEventListener("click",(t=>{this.showCopyright()}))}_buildHtml(){return`\n <div class="fr-elections-2022-copyright">\n <div class='outer-wrapper'>\n <div class="copyright-wrapper">\n <div class="copyright-text" style="display: ${this.copyrightShowing?"flex":"none"}">\n <div class="inner-wrapper">\n © <a href="https://mapcreator.io" target="_blank">Mapcreator.io</a> | © <a href="https://www.openstreetmap.org/copyright/" target="_blank">OSM.org</a> | © <a href="https://ign.fr/" target="_blank">IGN 2022</a>\n </div>\n </div>\n <button class="copyright-button" style="cursor: ${this.clickable?"pointer":"default"}">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464zM255.1 176C255.1 176 255.1 176 255.1 176c21.06 0 40.92 8.312 55.83 23.38c9.375 9.344 24.53 9.5 33.97 .1562c9.406-9.344 9.469-24.53 .1562-33.97c-24-24.22-55.95-37.56-89.95-37.56c0 0 .0313 0 0 0c-33.97 0-65.95 13.34-89.95 37.56c-49.44 49.88-49.44 131 0 180.9c24 24.22 55.98 37.56 89.95 37.56c.0313 0 0 0 0 0c34 0 65.95-13.34 89.95-37.56c9.312-9.438 9.25-24.62-.1562-33.97c-9.438-9.312-24.59-9.219-33.97 .1562c-14.91 15.06-34.77 23.38-55.83 23.38c0 0 .0313 0 0 0c-21.09 0-40.95-8.312-55.89-23.38c-30.94-31.22-30.94-82.03 0-113.3C214.2 184.3 234 176 255.1 176z"/></svg>\n\n </button>\n </div>\n </div>\n </div>\n `}showCopyright(){this.clickable&&(this.copyrightShowing=!this.copyrightShowing,this._update())}checkWindowSize(){this.map.getContainer().clientWidth<267?(this.clickable||(this.copyrightShowing=!1),this.clickable=!0,this._update()):(this.copyrightShowing=!0,this.clickable=!1,this._update())}}},259:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return l}});var n=i(614),r=i(1002),o=i(5574),s=i(5704),a=i(4551);class l extends o.T{parties;truncate;constructor(t){super(),this.behavior=t,this.parties=[],this.truncate=!0}onAdd(t){return this.map=t,this.container.classList.add("fr-elections-2022-legend-container"),this.container.innerHTML=this._buildBase(),this._addClickHandlersBase(),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){if(void 0===this.behavior.data)return;const t=this.behavior.getMainSubdivision().votes;this.parties=this.behavior.candidateList().map(((e,i)=>({name:e.lastName,color:e.color,votes:t[i],originalIndex:i}))),void 0===this.behavior.selectedParty?(this.container.querySelector(".parties").innerHTML=this._buildHtmlList(),this._addClickHandlersList()):this.behavior.allVotesCounted()||this.behavior.forceGradientMap?(this.container.querySelector(".parties").innerHTML=this._buildHtmlPartyFinal(),this._addClickHandlersParty()):(this.container.querySelector(".parties").innerHTML=this._buildHtmlPartyInProgress(),this._addClickHandlersParty()),this.switchIcon(this.behavior.isLegendOpen)}_buildBase(){return`\n <div class="fr-elections-2022-legend-adornment">\n <div class="show-hide-wrapper" title="${s.Z.t("frElections2022.candidateList")}">\n <div class="show-hide list-icon"><svg width="18" height="17" viewBox="0 0 18 17" xmlns="http://www.w3.org/2000/svg"><path fill="#000" d="M0 0h3v3H0zm0 7h3v3H0zm6-7h12v3H6zm0 7h12v3H6zm0 7h12v3H6zm-6 0h3v3H0z"/></svg>\n</div>\n <div class="show-hide close-icon">${a.Z}</div>\n </div>\n <div class="parties"></div>\n </div>\n `}_buildHtmlList(){const t=(this.truncate?this.parties.slice(0,3):this.parties).map((t=>this._buildCandidateHtml(t))).join(""),e=this.truncate?s.Z.t("frElections2022.showMore"):s.Z.t("frElections2022.showLess");return`\n ${t}\n <div class="show-more-wrapper" ${this.parties.length<=3?'style="display: none"':""}>\n <div class="show-more">${e}</div>\n </div>\n `}_buildCandidateHtml(t){return`\n <div class="party-container clickable" data-index="${t.originalIndex}">\n <div class="color-square party-color" style="background-color: ${t.color}"></div>\n <div class="party-name"><div>${t.name}</div></div>\n </div>\n `}_buildHtmlPartyInProgress(){const t=this.behavior.data.candidates[this.behavior.selectedParty];return this.truncate=!0,`\n <div class="party-container">\n <div class="color-square party-color" style="background-color: ${t.color}"></div>\n <div class="party-name"><div>${t.lastName}</div></div>\n </div>\n <div class="party-container">\n <div class="color-square party-color" style="fill: ${t.color}"><svg width="32" height="31" viewBox="0 0 32 31" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M31.5 20.5234V9.78175L12.2329 31H22.2257L31.5 20.5234ZM23.5612 31H31.5V22.0321L23.5612 31ZM31.5 0V8.2942L10.8821 31H1.07268L28.9727 0H31.5ZM7.52732 0H0.5V7.80813L7.52732 0ZM0.5 9.30298V18.629L17.4094 0H8.87268L0.5 9.30298ZM18.7599 0H27.6273L0.5 30.1415V20.1168L18.7599 0Z" fill=""/>\n</svg>\n</div>\n <div class="party-name"><div>60-99%</div></div>\n </div>\n <div class="party-container">\n <div class="grey-square party-color"></div>\n <div class="party-name"><div><60%</div></div>\n </div>\n <div class="show-more-wrapper">\n <div class="show-more">${s.Z.t("frElections2022.showMore")}</div>\n </div>\n `}_buildHtmlPartyFinal(){const t=this.behavior.data.candidates[this.behavior.selectedParty];let e=1/0,i=-1/0;for(const t of this.behavior.data.subdivisions)if(t.votes.length>0){const n=t.votes[this.behavior.selectedParty];n<e&&(e=n),n>i&&(i=n)}0===i&&(i=100);const o=(0,n.Z)((0,r.ZP)("#ffffff",t.color),7);let a="";for(let t=1;t<o.length;t++)a+=`<div class="scale-square" style="background-color: ${o[t]}"></div>`;return`\n <div class="party-container">\n <div class="color-square party-color" style="background-color: ${t.color}"></div>\n <div class="party-name"><div>${t.lastName}</div></div>\n </div>\n <div class="scale">${a}</div>\n <div class="ticks"></div>\n <div class="tick-labels">\n <div class="tick-label">${Math.round(e)}%</div>\n <div class="tick-label">${Math.round(i)}%</div>\n </div>\n <div class="show-more-wrapper">\n <div class="show-more">${s.Z.t("frElections2022.showMore")}</div>\n </div>\n `}_addClickHandlersList(){for(const t of this.container.querySelectorAll(".party-container"))t.addEventListener("click",(e=>{this.behavior.selectParty(this.behavior.candidateList()[Number(t.dataset.index)].originalOrder),this.behavior.closePopupIfOverlaps()}));this.container.querySelector(".show-more").addEventListener("click",(t=>{this.truncate=!this.truncate,this._update(),this.behavior.closePopupIfOverlaps()}))}_addClickHandlersParty(){this.container.querySelector(".show-more").addEventListener("click",(t=>{this.behavior.selectParty(void 0),this.behavior.closePopupIfOverlaps()}))}_addClickHandlersBase(){this.container.querySelector(".close-icon").addEventListener("click",(t=>{this.behavior.isLegendOpen=!this.behavior.isLegendOpen,this.behavior.isLegendOpen?void 0===this.behavior.selectedParty&&this.behavior.selectParty(this.behavior.initialSelectedCandidate??this.behavior.candidateList()[0].originalOrder):setTimeout((()=>{this.behavior.selectParty(void 0)}),300),this._update(),this.behavior.closePopupIfOverlaps()}))}switchIcon(t){const e=this.container.querySelector(".close-icon"),i=this.container.querySelector(".parties");e.style.opacity=t?"1":"0",i.style.display=t?"block":"none"}}},6958:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return c}});var n=i(5574),r=i(1823),o=i(1042),s=i(5704),a=i(4551),l='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M0 0V18H17.4808V9H14.5673V15H2.91346V3H8.74038V0H0ZM10.6827 0V3H12.2268L9.18711 6.13L11.4596 8.62L14.5673 5.41V7H17.4808V0H10.6827Z" fill="black"/>\n</svg>\n';class c extends n.T{truncate;name;type;candidates;constructor(t){super(),this.behavior=t,this.truncate=!0}onAdd(t){return this.map=t,this.container.classList.add("fr-elections-2022-popup-container"),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){const t=this.behavior.data;if(void 0===t)return;const e=this.behavior.highlightedSubdivision,i=(0,o.d9)(t.candidates);if(void 0===e)return void(this.container.innerHTML="");const{name:n,votes:r,type:s}=e;this.name=n,this.type=s;for(let t=0;t<i.length;t++)i[t].votes=r[t]??0;i.sort(((t,e)=>e.votes-t.votes)),this.candidates=i,this.container.innerHTML=this._buildHtml(),this.addClickHandler()}_buildHtml(){const t=this.truncate?s.Z.t("frElections2022.showMore"):s.Z.t("frElections2022.showLess"),e=this.truncate?this.candidates.slice(0,3):this.candidates,i=("department"===this.type||"commune"===this.type)&&this.behavior.displayLinks&&(0,r.Ph)("hostname"),n=this.truncate&&i?"flex":"none",o=!this.truncate&&i?"flex":"none",c=this._buildLink(),u=e[0].color,h=this.candidates.length>3,d=e.map(((t,e)=>this._buildCandidateHtml(t,e))).join("");return`\n <a href="${c}" target="_blank">\n <div class="link-wrapper-truncated" style="display: ${n}">\n <div class="link-text">${s.Z.t("frElections2022.allResults")}</div>\n <div class="link-icon">${l}</div>\n </div>\n </a>\n <div class="fr-elections-2022-popup">\n <div class="fr-elec-outer-wrapper">\n <div class="fr-elec-container ${h?"":"no-button"}">\n <div class="close-button">${a.Z}</div>\n <div class="header">\n <div class="name">\n <div class="name-text">${this.name}</div>\n <a href="${c}" target="_blank">\n <div class="link-wrapper-extended" style="display: ${o}">\n <div class="link-text">${s.Z.t("frElections2022.allResults")}</div>\n <div class="link-icon">${l}</div>\n </div>\n </a>\n </div>\n <div class="results">\n <div class="blank" style="background-color: ${u}"></div>\n ${d}\n </div>\n </div>\n </div>\n <div class="show-box" style="display: ${h?"flex":"none"}">\n <div class="show-text">${t}</div>\n </div>\n </div>\n </div>\n `}_buildCandidateHtml(t,e){const i=`${(0,r.Zd)(t.votes,2)}%`.replace(".",","),n=0===e,o=t.color,s=t.party,a=n?`style="background-color: ${o}"`:"",l=`style="background-color: ${o}"`;return`\n <div class="row-container">\n <div class="results-row ${n?"leading":""}" style="color: ${n&&!["#fed602"].includes(o)?"#ffffff":"#000000"}">\n <div class="highlighter" ${a}></div>\n <div class="results-column party-color-box" ${l}></div>\n <div class="results-column candidate"><div>${t.firstName} ${t.lastName}</div></div>\n <div class="results-column party">\n <div class="inner" ${a}>${s}</div>\n </div>\n <div class="results-column percent">\n <div class="inner percent" ${a}>${i}</div>\n </div>\n </div>\n <div class="spacer">\n <div class="spacer-inner left"></div>\n <div class="spacer-inner right"></div>\n </div>\n </div>\n `}_buildLink(){const t=this.behavior.highlightedSubdivision,e=this.behavior.selectedRound,i=(0,r.Ph)("hostname");return"department"===t.type?`https://${i}/elections/resultats/election-presidentielle-2022-tour-${e}?departement=${t.code}`:"commune"===t.type?`https://${i}/elections/resultats/election-presidentielle-2022-tour-${e}?commune=${t.code}`:void 0}addClickHandler(){this.container.querySelector(".show-box").addEventListener("click",(t=>{this.truncate=!this.truncate,this._update(),this.behavior.closeLegendIfOverlaps()})),this.container.querySelector(".close-button").addEventListener("click",(t=>{this.behavior.highlightedSubdivision=void 0,this._update()}))}}},2261:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5574),r=i(5704);class o extends n.T{constructor(t){super(),this.behavior=t}onAdd(t){return this.map=t,this.container.classList.add("fr-elections-2022-selector-container"),this.behavior.on("update",(()=>this._update())),this._update(),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.container.querySelector(".round-selector").addEventListener("click",(t=>{this.behavior.toggleRounds()}))}_buildHtml(){const t=this.behavior.is2017Open?"2022":"2017";return`\n <div>\n <button class="round-selector">\n ${r.Z.t("frElections2022.tapFor",{interpolate:t})}\n </button>\n </div>\n `}}},5564:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5574);class r extends n.T{canadaButtonTimeout;bounds={canada:[[-146.748239,38.816187],[-42.253743,67.746815]]};constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.container.classList.add("quebec-election-2022-controls-container"),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.container.querySelector(".eighteen-button").addEventListener("click",(()=>this.behavior.toggle2018())),this.container.querySelector(".quebec-button").addEventListener("click",(()=>this.map.fitBounds(this.behavior.bound)))}_buildHtml(){return`\n <div class="quebec-election-2022-controls">\n <div class="quebec-button"><svg width="583.967" height="797.386" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 206.011 281.3" style="enable-background:new 0 0 206.010544 281.299988">\n <path d="M171.918 191.482c4.521-6.723 4.136-21.44-4.903-26.639-6.914-3.454-14.723-2.101-18.368.872-5.877 3.556-11.534 14.917-11.534 26.423l20.282-.028-.006 22.65-42.093-.023c.551 11.646 6.903 20.98 18.723 26.175-1.52 4.909-8.65 14.915-18.44 14.234-1.932 10.591-3.769 16.535-12.57 26.155-8.805-9.62-10.645-15.564-12.575-26.152-9.789.675-16.92-9.328-18.442-14.237 11.82-5.195 18.172-14.526 18.724-26.175l-42.097.023v-22.648l20.276.026c0-11.506-5.648-22.87-11.528-26.42-3.648-2.973-11.454-4.326-18.363-.872-9.044 5.196-9.432 19.916-4.911 26.636-42.707-7.932-38.47-49.174-23.922-64.147 11.758-12.096 24.577-13.987 34.46-10.172 22.464 8.053 37.572 34.89 38.307 74.975h11.747c0-36.44-6.34-48.058-22.861-93.825-8.321-21.63-3.32-48.37 11.552-72.992C88.704 16.497 95.36 8.533 103.011.001c7.64 8.532 14.296 16.496 19.624 25.32 14.875 24.622 19.874 51.366 11.561 72.992-16.532 45.767-22.87 57.382-22.87 93.825h11.745c.734-40.086 15.848-66.922 38.307-74.975 9.885-3.812 22.712-1.924 34.465 10.172 14.543 14.973 18.782 56.217-23.925 64.147z"/>\n</svg>\n</div>\n <div class="eighteen-button">${this.behavior.is2018open?"2018":"2022"}</div>\n </div>\n `}}},1158:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5574),r=i(757);class o extends n.T{bounds={montreal:[[-73.974208,45.41002],[-73.47433,45.70474]],riveNordDeMtl:[[-75.384109,45.35701],[-72.786199,46.890723]],riveSudDeMtl:[[-74.754196,45.099492],[-72.736013,45.814948]],quebec:[[-72.313142,46.162254],[-70.164323,47.481918]],estDuQuebec:[[-71.2847695051887,46.47081389158913],[-60.710046201742855,50.42149962729246]],outaouais:[[-78.05633990335873,45.44045896148728],[-74.58647701385236,47.637715603457366]]};constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){this.map=t,this.container.classList.add("quebec-election-2022-focus-buttons-container"),this.container.innerHTML=this._buildHtml();const e=this.container.querySelectorAll(".dropdown"),i=this.container.querySelectorAll(".focus-button");for(const t of e)t.addEventListener("click",(()=>this._toggleDropdown(t)));for(const t of i)t.addEventListener("click",(()=>this._focus(t.dataset.bound)));return this.container}_buildHtml(){return`\n <div class="quebec-election-2022-focus-buttons">\n <div class="dropdown" data-group="regions">\n Régions\n <div class="arrow">${r.Z}</div>\n </div>\n <div class="focus-buttons" data-group="regions">\n <div class="focus-button" data-bound="montreal">Montréal</div>\n <div class="focus-button" data-bound="riveNordDeMtl">Rive-Nord de MTL</div>\n <div class="focus-button" data-bound="riveSudDeMtl">Rive-Sud de MTL</div>\n <div class="focus-button" data-bound="quebec">Québec</div>\n <div class="focus-button" data-bound="estDuQuebec">Est du Québec</div>\n <div class="focus-button" data-bound="outaouais">Outaouais</div>\n </div>\n </div>\n `}_toggleDropdown(t){const e=t.dataset.group,i=!t.classList.contains("active"),n=this.container.querySelectorAll(".dropdown"),r=this.container.querySelectorAll(".focus-buttons");for(const t of n)i&&t.dataset.group===e?t.classList.add("active"):t.classList.remove("active");for(const t of r)i&&t.dataset.group===e?t.classList.add("active"):t.classList.remove("active")}_focus(t){const e=this.container.querySelectorAll(".focus-button");for(const i of e)i.dataset.bound===t?i.classList.add("active"):i.classList.remove("active");this.map.fitBounds(this.bounds[t])}}},5511:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(5574),r=i(1823),o=i(4551);class s extends n.T{constructor(t){super(),this.behavior=t}get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.container.classList.add("quebec-election-2022-popup-container"),this._update(),this.behavior.on("update",(()=>this._update())),this.container}_update(){const t=this.behavior.data,e=this.behavior.data2018,i=this.behavior.regionId;if(void 0===t)return;const n=t.find((t=>t.polygon_id===i)),r=e.find((t=>t.polygon_id===i));this.container.innerHTML=this._buildHtml(n,r),this.container.querySelector(".quebec-election-2022-popup .close-button.close-2022")?.addEventListener("click",(()=>this.behavior.deselectRegion())),this.container.querySelector(".quebec-election-2022-popup .close-button.close-2018")?.addEventListener("click",(()=>this.behavior.disable2018())),this.container.querySelector(".year-switch-number")?.addEventListener("click",(()=>this.behavior.enable2018()))}_buildHtml(t,e){const i=this.behavior.is2018open;let n=this._buildRegionHtml(t,e,i,!1);return i&&(n+=this._buildRegionHtml(t,e,i,!0)),n}_buildRegionHtml(t,e,i,n){const r=n?e:t,s=n?"2018":"2022";if(void 0===r)return"";const a=r.district_name,l=r.counted_polls,c=r.total_poll_number,u=l/c*100,h=r.leading_candidates.slice(0,4).map(((t,e)=>this._buildCandidateHtml(t,l,e))).join("");return`\n <div class="quebec-election-2022-popup">\n <div class="header">\n <div class="name">${a}</div>\n <div class="reporting-bar">\n <div class="reporting-indicator" style="left: ${u}%"></div>\n </div>\n <div class="reporting-label">${Math.round(u)}% des votes dépouillés</div>\n </div>\n <div class="close-button ${n?"close-2018":"close-2022"}">${o.Z}</div>\n <div class="year-label ${i?"":"hidden"}">${s}</div>\n <div class="results">${h}</div>\n </div>\n `}_buildCandidateHtml(t,e,i){const n=`${(0,r.Zd)(t.vote_percent,2)}%`.replace(".",","),o=0===i,s=t.party.logo,a=t.party.color;return`\n <div class="results-row ${o?"leading":""}" style="color: ${t.party.text_color}">\n <div class="highlighter" ${o?`style="background-color: ${a}"`:""}></div>\n <div class="results-column logo">${s?`<img src="${s}" alt=""></img>`:""}</div>\n <div class="results-column divider" ${`style="background-color: ${a}"`}></div>\n <div class="results-column candidate"><div>${`${t.first_name} ${t.last_name}`}${t.incumbent?"*":""}</div></div>\n <div class="results-column percent"><div>${n}</div></div>\n </div>\n `}}},5414:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(5574),r=i(4825),o=i(1042),s=i(4551);class a extends((0,r.Z)(n.T)){data;content;popup;constructor(t){super({}),this.data=t,this.content=document.createElement("div"),this.popup=this,this.data.on("click-county",this.onCountyClicked.bind(this)),this.data.on("vote-data-loaded",this.updatePopup.bind(this)),this.data.on("reset",this.onReset.bind(this)),this.data.on("enter-state",this.enterState.bind(this))}onAdd(t){this.map=t;const e=document.createElement("div");return e.classList.add("close"),e.innerHTML=s.Z,e.addEventListener("click",this.remove.bind(this)),this.container.classList.add("election-popup"),this.container.appendChild(e),this.container.appendChild(this.content),(0,o.PQ)((()=>{if(!this.container.parentElement)return;const t=Number(getComputedStyle(this.container.parentElement).zIndex)??0;this.container.parentElement.style.zIndex=String(t+1)})),this.container}enterState(t){const e=this.data.findState(t,"statefips");e&&this.showPopup(e,this.data.findFeatureState(e))}onCountyClicked({feature:t,featureState:e}){this.showPopup(t,e)}onReset(){this.data.selectedState||this.remove()}onRemove(){this.container.remove()}addTo(){return this.container.style.display="block",this}setHTML(t){return this.content.innerHTML=t,this}setLngLat(){return this}remove(){return this.container.style.display="none",this}getElement(){return this.container}}},9587:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5574),r=i(5704);class o extends n.T{data;dataStatus;dataCountdown;title;_interval;_updatesLive;constructor(t,e){super(),this.data=t,this._interval=null,this._updatesLive=!1,this.data.on("settings-loading",this.settingsLoading.bind(this)),this.data.on("settings-loaded",this.settingsLoaded.bind(this)),this.data.on("candidate-data-loading",this.candidateDataLoading.bind(this)),this.data.on("candidate-data-loaded",this.candidateDataLoaded.bind(this)),this.data.on("vote-data-loading",this.voteDataLoading.bind(this)),this.data.on("vote-data-loaded",this.voteDataLoaded.bind(this)),this.title=document.createElement("h1"),this.dataStatus=document.createElement("div"),this.dataCountdown=document.createElement("div"),this.setTitle(e)}get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.container.classList.add("reload-data"),this.container.appendChild(this.title),this.container.appendChild(this.dataStatus),this.container.appendChild(this.dataCountdown),this.container}setTitle(t){this.title.innerText=t,this.title.style.display=t?"inline":"none"}settingsLoading(){this.dataStatus.textContent=`${r.Z.t("usElectionsUpdater.loadingSettings")}...`}settingsLoaded({error:t,data:e}){t?this.dataStatus.textContent=r.Z.t("usElectionsUpdater.errorLoadingSettings"):e&&(this._updatesLive=e.updatesLive,this.watchForTimeChanges())}candidateDataLoading(){this.dataStatus.textContent=`${r.Z.t("usElectionsUpdater.loadingCandidates")}...`}candidateDataLoaded({error:t}){t&&(this.dataStatus.textContent=r.Z.t("usElectionsUpdater.errorLoadingCandidates"))}voteDataLoading(){this.dataStatus.textContent=`${r.Z.t("usElectionsUpdater.loadingResults")}...`}voteDataLoaded({error:t}){if(t)this.dataStatus.textContent=r.Z.t("usElectionsUpdater.errorLoadingResults");else{const t=new Date(this.data.fileDate),e={weekday:"long",year:"numeric",month:"long",day:"numeric"},i=r.Z.localeWithPreferredRegion.replace("_","-");this.dataStatus.textContent=r.Z.t("usElectionsUpdater.updatedOn",{interpolate:{date:t.toLocaleDateString(i,e),time:t.toLocaleTimeString(i)}})}}watchForTimeChanges(){clearInterval(this._interval),this._interval=null,this.voteDataLoaded({}),this._updatesLive?this._interval=setInterval((()=>this.updateCounterText()),100):this.resetCounterText()}updateCounterText(){const t=this.data?.settings.dataUpdateInterval-this.data?.dataUpdateOffset;this.dataCountdown.innerText=r.Z.t("usElectionsUpdater.checkingForData",{interpolate:this.toMinute(t||0)})}resetCounterText(){this.dataCountdown.innerText=""}toMinute(t){const e=parseInt(String(t/60),10),i=parseInt(String(t%60),10);return`${e<10?`0${e}`:`${e}`}:${i<10?`0${i}`:`${i}`}`}onRemove(){this.container?.remove(),this.data?.disableEventListeners(),clearInterval(this._interval)}}},4330:function(t,e){"use strict";const i=Object.freeze({METRIC:"metric",IMPERIAL:"imperial",METRIC_AND_IMPERIAL:"metric_and_imperial",NAUTICAL:"nautical"});e.Z=i},7622:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(7187),r=i(1042),o=i(1823);class s extends n.EventEmitter{map;colors;checkSettingsInterval;dataUpdateInterval;dataUpdateOffset;settingsDate;fileDate;settings;isMobile;hoverEffects;settingsUrl;initialState;selectedState;highlightedState;countyLayer;stateLayers;candidates;boundClickOnCounty;boundClickOnState;boundMouseMoveOnState;boundMouseMoveOnCounty;boundMouseLeaveCounty;boundOnMapZoom;constructor(t,e,i,n,o,s){super(),this.map=t,this.colors={dem:{lead:"#BBD4FF",won:"#1D4EFF"},rep:{lead:"#FFCAD4",won:"#CE1729"},other:{lead:"#CEFDE8",won:"#33CC83"},undefined:"#CCCCCC",...o},this.checkSettingsInterval=null,this.dataUpdateInterval=null,this.dataUpdateOffset=0,this.settingsDate=null,this.fileDate=null,this.settings={settingsUpdateInterval:30,dataUpdateInterval:30},this.isMobile=e,this.hoverEffects=n??!0,this.settingsUrl=s,this.initialState=i,this.selectedState=null,this.highlightedState=null,this.boundClickOnCounty=this.clickOnCounty.bind(this),this.boundClickOnState=this.clickOnState.bind(this),this.boundMouseMoveOnState=this.mouseMoveOnState.bind(this),this.boundMouseMoveOnCounty=this.mouseMoveOnCounty.bind(this),this.boundMouseLeaveCounty=this.mouseLeaveCounty.bind(this),this.boundOnMapZoom=(0,r.Ds)(this.onMapZoom.bind(this),50),this.countyLayer="county-fill",this.stateLayers=["state-fill","state-label","state-label-abbrev","state-label-code","state-label-icon","state-leadline-fill","state-leadline-code","state-leadline-abbrev"]}async loadSettings(){this.emit("settings-loading");try{const t=this.calculateIntervalTimestamp(this.settings.settingsUpdateInterval),e=await fetch(`${this.settingsUrl}?v=${t}`);this.settingsDate=e.headers.get("last-modified"),this.settings=(0,r.TS)(this.settings,await e.json()),(!this.settings.updatesLive&&this.dataUpdateInterval||this.settings.updatesLive&&!this.dataUpdateInterval)&&this.watchForDataUpdate(),this.watchForSettingsUpdate(),this.emit("settings-loaded",{data:this.settings})}catch(t){throw this.emit("settings-loaded",{error:t}),t}}async hasNewSettings(){const t=this.calculateIntervalTimestamp(this.settings.settingsUpdateInterval),e=(await fetch(`${this.settingsUrl}?v=${t}`,{method:"HEAD"})).headers.get("last-modified");return e&&e>this.settingsDate}async loadCandidateData(){this.emit("candidate-data-loading");try{this.candidates=await fetch(this.settings.dataUrls.candidates).then((t=>t.json())),this.emit("candidate-data-loaded",{data:this.candidates})}catch(t){throw console.log(t),this.emit("candidate-data-loaded",{error:t}),t}}async loadVoteData(){this.emit("vote-data-loading");try{const t=this.calculateIntervalTimestamp(this.settings.dataUpdateInterval),[e,i]=await Promise.all([fetch(`${this.settings.dataUrls.counties}?v=${t}`),fetch(`${this.settings.dataUrls.states}?v=${t}`)]);this.fileDate=e.headers.get("last-modified");let[n,o]=await Promise.all([e.json(),i.json()]);if(this.settings.dataUrls.consensusStates){const e=await fetch(`${this.settings.dataUrls.consensusStates}?v=${t}`);o=(0,r.TS)(o,await e.json())}this.initiateElection(o,"state_poly"),this.initiateElection(n,"county_poly"),this.emit("vote-data-loaded",{data:{counties:n,states:o}})}catch(t){throw this.emit("vote-data-loaded",{error:t}),t}}initiateElection(t,e){for(const i in t){if(!t.hasOwnProperty(i))continue;const n=t[i];let r={color:this.colors.undefined,result:void 0,incumbent:void 0};if(n.cand?.[0]){const t=n.cand[0].eVotes;n.cand=n.cand.map((t=>({...t,...this.candidates[t.cId]})));const e=n.cand?.[0]?.majorPtyId.toLowerCase(),i=this.colors[e]??this.colors.other;r={result:n,incumbent:this.candidates[n.P2016],color:t>0?i.won:i.lead},r.incumbent||console.error(`Couldn't find incumbent candidate ${n.P2016}`)}this.map.setFeatureState({id:i,source:"us-elections",sourceLayer:e},r)}}findFeatureState(t){return this.map.getFeatureState({source:t.source,id:t.id,sourceLayer:t.sourceLayer})??null}findState(t,e="name"){const i="us-elections",n="state_poly",r=this.map.querySourceFeatures(i,{sourceLayer:n,filter:["==",e,t]})[0]??null;return r&&(r.source=i,r.sourceLayer=n),r}calculateIntervalTimestamp(t){const e=1e3*(t??1);return new Date(Math.round(Date.now()/e)*e).getTime()/1e3}watchForSettingsUpdate(){clearInterval(this.checkSettingsInterval),this.checkSettingsInterval=setInterval((async()=>{await this.hasNewSettings()&&await this.loadSettings()}),1e3*this.settings.settingsUpdateInterval)}watchForDataUpdate(){clearInterval(this.dataUpdateInterval),this.dataUpdateInterval=null,this.dataUpdateOffset=0,this.settings.updatesLive&&(this.dataUpdateInterval=setInterval((async()=>{this.dataUpdateOffset++;this.settings.dataUpdateInterval-this.dataUpdateOffset<=0&&(await this.loadVoteData(),this.watchForDataUpdate())}),1e3))}async updateCountyView(){this.map.getZoom()<3?await this.leaveCountyView():await this.enterCountyView(this.selectedState)}async enterCountyView(t){if(!t)return this.leaveCountyView();t!==this.highlightedState&&(this.map.setFilter("state-boundary-focus",["all",["!has","leadline_box"],["==","statefips",t]]),this.map.setFilter("state-fill",["all",["!has","leadline_box"],["!=","statefips",t]]),this.map.setFilter("county-fill",["==","statefips",t]),await(0,o.V2)(this.map),this.highlightedState=t,this.emit("enter-state",t))}async leaveCountyView(){this.highlightedState&&(this.map.setFilter("state-boundary-focus",["all",["!has","leadline_box"],["==","statefips",""]]),this.map.setFilter("state-fill",["!has","leadline_box"]),this.map.setFilter("county-fill",!1),await(0,o.V2)(this.map),this.highlightedState=null,this.emit("leave-state"))}async selectState(t){this.selectedState=t,await this.updateCountyView()}destroy(){this.disableEventListeners(),clearInterval(this.checkSettingsInterval),clearInterval(this.dataUpdateInterval),this.checkSettingsInterval=null,this.dataUpdateInterval=null}enableEventListeners(){this.map.on("click",this.countyLayer,this.boundClickOnCounty),this.map.on("click",this.boundClickOnState),this.map.on("zoom",this.boundOnMapZoom),this.isMobile||(this.map.on("mousemove",this.boundMouseMoveOnState),this.hoverEffects&&(this.map.on("mousemove",this.countyLayer,this.boundMouseMoveOnCounty),this.map.on("mouseleave",this.countyLayer,this.boundMouseLeaveCounty)))}disableEventListeners(){this.map.off("click",this.countyLayer,this.boundClickOnCounty),this.map.off("click",this.boundClickOnState),this.map.off("zoom",this.boundOnMapZoom),this.isMobile||(this.map.off("mousemove",this.boundMouseMoveOnState),this.hoverEffects&&(this.map.off("mousemove",this.countyLayer,this.boundMouseMoveOnCounty),this.map.off("mouseleave",this.countyLayer,this.boundMouseLeaveCounty)))}async onMapZoom(){await this.updateCountyView()}async reset(){await this.selectState(this.initialState),this.emit("fit-bounds"),this.emit("reset")}async clickOnState(t){const e=this.map.queryRenderedFeatures(t.point);if(!e.length)return void await this.reset();if(this.isMobile&&this.map.getZoom()<=3)return void this.emit("zoom",this.map.unproject(t.point));const i=Object.values(e).find((t=>t.state?.hasOwnProperty("result")))??e[0];if(this.stateLayers.includes(i.layer.id)){let t=i;if(t.properties.lng_max||(t=this.findState(t.properties.name)),t){const e=t.properties.statefips;await this.selectState(e),this.fitState(e)}}}fitState(t){const e=this.findState(t,"statefips");if(!e)return;const i=[[e.properties.lng_max,e.properties.lat_min],[e.properties.lng_min,e.properties.lat_max]];this.emit("fit-bounds",i)}clickOnCounty(t){if(!this.highlightedState)return;const e=t.features[0];this.map.setFilter("county-boundary-focus",["==","id",e.properties.id]),this.emit("click-county",{feature:e,featureState:this.findFeatureState(e)})}mouseMoveOnState(t){const e=this.map.queryRenderedFeatures(t.point)[0];if(!e)return this.emit("hover-state");if(this.stateLayers.includes(e.layer.id)){let i=e;i.properties.lng_max||(i=this.findState(i.properties.name)),this.emit("hover-state",i?{point:t.point,feature:i,featureState:this.findFeatureState(i)}:void 0)}}mouseMoveOnCounty(t){if(!this.highlightedState)return;const e=t.features[0];this.map.setFilter("county-boundary-focus",["==","id",e.properties.id]),this.emit("hover-county",{point:t.point,feature:e,featureState:this.findFeatureState(e)})}mouseLeaveCounty(){this.map.getCanvas().style.cursor="",this.map.setFilter("county-boundary-focus",["==","id",""]),this.emit("hover-county")}}},8331:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(1527),r=i(5574),o=i(4825);class s extends((0,o.Z)(r.T)){map;data;popup;boundClickCounty;boundHoverState;boundHoverCounty;boundVoteDataLoaded;boundReset;constructor(t,e){super({}),this.map=t,this.data=e,this.boundClickCounty=this.onRemove.bind(this),this.boundHoverState=this.onStateHover.bind(this),this.boundHoverCounty=this.onCountyHover.bind(this),this.boundVoteDataLoaded=this.updatePopup.bind(this),this.boundReset=this.onRemove.bind(this),this.popup=new n.Popup({maxWidth:"300",offset:25,closeButton:!1})}onStateHover({point:t,feature:e,featureState:i}={}){this.showPopup(e,i,t)}onCountyHover({point:t,feature:e,featureState:i}={}){this.showPopup(e,i,t)}onRemove(){this.popup?.remove()}enableEventListeners(){this.data.on("click-county",this.boundClickCounty),this.data.on("hover-state",this.boundHoverState),this.data.on("hover-county",this.boundHoverCounty),this.data.on("vote-data-loaded",this.boundVoteDataLoaded),this.data.on("reset",this.boundReset)}disableEventListeners(){this.data.off("click-county",this.boundClickCounty),this.data.off("hover-state",this.boundHoverState),this.data.off("hover-county",this.boundHoverCounty),this.data.off("vote-data-loaded",this.boundVoteDataLoaded),this.data.off("reset",this.boundReset)}}},5704:function(t,e,i){"use strict";var n=i(2582);e.Z=new class{fallbackLocale;constructor(t,e=void 0){n.interpolateWith(/{\s*(\w+)\s*}/g);for(const[t,e]of Object.entries(this._loadLocaleMessages()))n.add(e,t);this.locale=t,this.fallbackLocale=e??t}get locale(){return n.getLocale()}set locale(t){n.setLocale(t)}get localeMaplibreCompat(){return this.locale.substr(0,2)}get localeWithPreferredRegion(){return navigator.languages.find((t=>t.startsWith(`${this.localeMaplibreCompat}-`)))?.replace("-","_")??this.locale}t(t,e={interpolate:void 0},i=this.locale){const r=n(t,e,{locale:i});return t===r?i===this.fallbackLocale?t:n(t,e,{locale:this.fallbackLocale}):r}_loadLocaleMessages(){const t=i(3821),e={};for(const i of t.keys()){const n=i.match(/\/([a-z_/]+)\/([a-z0-9-_]+)\./i);if(!n?.length)continue;const r=n[1].split("/");let o=e;for(const t of r)o.hasOwnProperty(t)||(o[t]={}),o=o[t];o[n[2]]=t(i)}return e}}("en_GB")},4386:function(t,e){"use strict";e.Z=t=>class extends t{constructor(t){super(t);const e=this.map.getContainer(),i=t.dimension?.width?.value,n=t.dimension?.height?.value,{width:r,height:o,wrapperId:s,margins:a}=t;if(this.screenPosition=this.originalScreenPosition=t.screenPosition??"top-left",this.elementOffset=t.elementOffset??{x:0,y:0},this.stackingOrder=t.stackingOrder,this.wrapperId=s,this.margins=a,"arbitrary"===this.originalScreenPosition&&!this.wrapperId&&void 0!==i&&void 0!==n){const t=e.clientWidth/i,s=e.clientHeight/n,a=r*(t-1),l=o*(s-1),c=this.elementOffset.x/(i-r),u=this.elementOffset.y/(n-o);this.elementOffset.x=this.elementOffset.x*t+a*c,this.elementOffset.y=this.elementOffset.y*s+l*u}"arbitrary"===this.screenPosition&&(this.screenPosition="top-left")}static fromFeature(t){const e=super.fromFeature?.(t)??{};let i=t.properties["mc-html-element-position"],n=t.properties["wrapper-id"];return"bottom_right"!==i&&t.id.startsWith("custom-adornment-basic-copyright")&&(i="bottom_right"),"bottom-right-wrapper"!==n&&t.id.startsWith("custom-adornment-basic-copyright")&&(n="bottom-right-wrapper"),i=i.replace(/([ _])/g,"-").replace("-vertical",""),e.screenPosition=i,e.elementOffset=t.properties["mc-html-element-offset"],e.wrapperId=n,e.stackingOrder=t.properties["stacking-order"],e.offsetBottom=t.properties["offset-bottom"],e.width=t.properties.width,e.height=t.properties.height,"bottom_right"!==i&&t.id.startsWith("custom-adornment-basic-copyright")&&(i="bottom_right"),i=i.replace(/([ _])/g,"-").replace("-vertical",""),e.screenPosition=i,e.elementOffset=t.properties["mc-html-element-offset"],e.stackingOrder=t.properties["stacking-order"],e.margins=t.properties.margins,e}}},4962:function(t,e){"use strict";e.Z=t=>class extends t{constructor(t){super(t),this.control=null}}},4825:function(t,e,i){"use strict";var n=i(5704);e.Z=t=>class extends t{constructor(t){super(t),this.popup=null,this.popupFeature=null}showPopup(t,e,i=void 0){this.popup&&(e?.result?(this.popup.setLngLat(i?this.map.unproject(i):[0,0]).setHTML(this.toHtml(t,e)).addTo(this.map),this.popupFeature=t):(this.popup.remove(),this.popupFeature=null))}updatePopup(){if(this.popupFeature){const t=this.data.findFeatureState(this.popupFeature);t&&this.popup.setHTML(this.toHtml(this.popupFeature,t))}}toHtml(t,e){const i=n.Z.locale.replace("_","-"),r=e.result.cand.reduce(((t,{eVotes:e})=>t+e),0)>0,o=e.incumbent?.majorPtyId?.toLowerCase(),s=this.data.colors[o]??this.data.colors.other;return['<div class="election-popup-inner">','<div class="header">',`<div class="title">${t.properties[`name:${n.Z.localeMaplibreCompat}`]??t.properties.name}</div>`,'<div class="previous-winner">',`<div class="indicator" style="background-color: ${s.won}"></div>`,`<span>2016: ${e.incumbent?.candLastName??n.Z.t("usElectionsFixedPopup.unknown")}</span>`,"</div>","</div>",'<div class="slider">',`<div style="left: ${e.result.pctExpVote??0}%;" class="slider-pin"></div>`,"</div>",'<div class="results">','<div class="row heading">',`<div class="column name">${n.Z.t("usElectionsFixedPopup.reporting",{interpolate:e.result.pctExpVote??0})}</div>`,`<div class="column party">${n.Z.t("usElectionsFixedPopup.party")}</div>`,`<div class="column votes">${n.Z.t("usElectionsFixedPopup.votes")}</div>`,'<div class="column percentage">%</div>',r?`<div class="column ev">${n.Z.t("usElectionsFixedPopup.ev")}*</div>`:"","</div>",e.result.cand.map(((t,o)=>{const s=t.majorPtyId?.toLowerCase(),a=this.data.colors[s]??this.data.colors.other,l=0===o?a.won:"inherit",c=Math.round(100*t.cVote/e.result.totVote*10)/10;return[`<div class="row" style="background-color: ${l}">`,'<div class="column name">',`<div class="indicator" style="background-color: ${a.won}"></div>`,t.candFullName||n.Z.t("usElectionsFixedPopup.unknown"),"</div>",`<div class="column party">${t.majorPtyAbbr||" / "}</div>`,`<div class="column votes">${t.cVote?.toLocaleString(i)||n.Z.t("usElectionsFixedPopup.unknown")}</div>`,`<div class="column percentage">${c}%</div>`,r?`<div class="column ev">${t.eVotes||" / "}</div>`:"","</div>"].join("")})).join(""),"</div>",r?`<div style="font-size: 9px;">* ${n.Z.t("usElectionsFixedPopup.electoralVotes")}</div>`:"","</div>"].join("")}}},5714:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return c}});var n=i(1999),r=t=>class extends t{constructor(t){super(t),this.svg=t.svg??"<svg></svg>"}get svg(){return this.element.outerHTML}set svg(t){const e=new DOMParser;this.element=e.parseFromString(t,"image/svg+xml").firstChild,this.element.style.display="block",this.element.classList.add("adornment-collision"),this.emit("svg")}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.svg=t.properties["mc-svg-string"],e}},o=i(4386),s=i(5574);class a extends s.T{element;stackingOrder;constructor(t){super(),this.element=t}onAdd(t){return this.map=t,this.container.appendChild(this.element),this.container.style.order=this.stackingOrder,this.container}onRemove(){this.container.remove(),this.map=null}replace(t){this.container.contains(this.element)?this.container.replaceChild(t,this.element):this.container.appendChild(t),this.element=t}}var l=i(4962);class c extends((0,o.Z)((0,l.Z)(r(n.default)))){constructor(t){super(t),this.wrapperId=t.wrapperId,this.stackingOrder=t.stackingOrder,this.offsetBottom=t.offsetBottom,this.on("ready",(()=>this._initControl())),this.on("svg",(()=>this.control?.replace(this.element)))}_initControl(){this.control?.onRemove(),this.control=new a(this.element),this.control.applyOffset(this.originalScreenPosition,Boolean(this.wrapperId),this.offsetBottom,this.elementOffset),this.loader.controlManager.add(this)}}},1999:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(7187);class r extends n.EventEmitter{map;loader;constructor(t){super(),this.map=t.map,this.loader=t.loader}static get featurePrefixes(){return[]}static get layerPrefixes(){return[]}static fromFeature(t){return{}}static fromSource(t){return{}}static fromLayer(t){return{}}}},5521:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,8856))]);this.behavior=this.loader.behaviorManager.findBehavior("ca_elections_2021"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-ca-elections-2021-controls"]}static get featurePrefixes(){return["custom-adornment-ca-elections-2021-controls"]}}},7125:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,4645))]);this.behavior=this.loader.behaviorManager.findBehavior("ca_elections_2021"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-ca-elections-2021-focus-buttons"]}static get featurePrefixes(){return["custom-adornment-ca-elections-2021-focus-buttons"]}}},648:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,6408))]);this.behavior=this.loader.behaviorManager.findBehavior("ca_elections_2021"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-ca-elections-2021-popup"]}static get featurePrefixes(){return["custom-adornment-ca-elections-2021-popup"]}}},746:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5714);class r extends n.default{constructor(t){super(t),this.interactive=t.interactive,this.importedFileLayer=t.importedFileLayer,this.deselected=[],window.requestAnimationFrame((()=>{this.enable(),this.emit("ready")}))}enable(){if(document.querySelectorAll(".d3-legend-interactive .legendCells .cell .label").length){if(this.interactive){const t=this.map.getSource(this.importedFileLayer),e=t._data.features,i=Array.from(document.querySelectorAll(".d3-legend-interactive .legendCells .cell .label"));for(const n of i){const r=n;r.style.cursor="pointer",r.addEventListener("click",(n=>{this.deselected.includes(n.target)?(this.deselected=this.deselected.filter((t=>t!==n.target)),r.style.textDecorationLine="none"):(this.deselected.push(n.target),r.style.textDecorationLine="line-through");const o=Array.from(i).filter((t=>!this.deselected.includes(t))).map((t=>t.textContent)),s=e.filter((t=>o.includes(t.properties.dataGroup))),a={...t._data,features:s};t.setData(a),this.map.getLayer(`${this.importedFileLayer}-collision-box`)&&this.map.setFilter(`${this.importedFileLayer}-collision-box`,["in",["get","dataGroup"],["literal",o]])}))}}}else window.requestAnimationFrame((()=>this.enable()))}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.interactive=t.properties.interactive,e.importedFileLayer=t.properties["imported-file-layer"],e}static get featurePrefixes(){return["custom-adornment-d3-legend"]}static get layerPrefixes(){return["custom-adornment-d3-legend"]}}},4375:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,8487))]);this.behavior=this.loader.behaviorManager.findBehavior("fr_elections_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fr-elections-2022-back"]}static get featurePrefixes(){return["custom-adornment-fr-elections-2022-back"]}}},932:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,3138))]);this.behavior=this.loader.behaviorManager.findBehavior("fr_elections_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fr-elections-2022-copyright"]}static get featurePrefixes(){return["custom-adornment-fr-elections-2022-copyright"]}}},3988:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,259))]);this.behavior=this.loader.behaviorManager.findBehavior("fr_elections_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fr-elections-2022-legend"]}static get featurePrefixes(){return["custom-adornment-fr-elections-2022-legend"]}}},6679:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,6958))]);this.behavior=this.loader.behaviorManager.findBehavior("fr_elections_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fr-elections-2022-popup"]}static get featurePrefixes(){return["custom-adornment-fr-elections-2022-popup"]}}},9297:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,2261))]);this.behavior=this.loader.behaviorManager.findBehavior("fr_elections_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fr-elections-2022-selector"]}static get featurePrefixes(){return["custom-adornment-fr-elections-2022-selector"]}}},1111:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5714),r=i(1042);class o extends n.default{constructor(t){super(t),(0,r.PQ)((()=>this.emit("ready"))),this.update()}update(){}static get featurePrefixes(){return["custom-adornment-marker"]}static get layerPrefixes(){return["custom-adornment-marker"]}}},4372:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,5564))]);this.behavior=this.loader.behaviorManager.findBehavior("quebec_election_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-quebec-election-2022-controls"]}static get featurePrefixes(){return["custom-adornment-quebec-election-2022-controls"]}}},8774:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,1158))]);this.behavior=this.loader.behaviorManager.findBehavior("quebec_election_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-quebec-election-2022-focus-buttons"]}static get featurePrefixes(){return["custom-adornment-quebec-election-2022-focus-buttons"]}}},8004:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4962),o=i(1823),s=i(4386);class a extends((0,s.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}async _init(){const[t]=await(0,o.I0)([Promise.resolve().then(i.bind(i,5511))]);this.behavior=this.loader.behaviorManager.findBehavior("quebec_election_2022"),this.control=new t(this.behavior),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-quebec-election-2022-popup"]}static get featurePrefixes(){return["custom-adornment-quebec-election-2022-popup"]}}},1194:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(5714),r=i(1042);class o extends n.default{constructor(t){super(t),(0,r.PQ)((()=>this.emit("ready"))),this.update()}update(){}static get featurePrefixes(){return["custom-adornment-choropleth-vertical-legend"]}static get layerPrefixes(){return["custom-adornment-choropleth-vertical-legend"]}}},6903:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(1823),o=i(4386),s=i(4962);class a extends((0,o.Z)((0,s.Z)(n.default))){constructor(t){super(t),this.behaviorManager=t.loader.behaviorManager,this._init()}async _init(){const[t]=await(0,r.I0)([Promise.resolve().then(i.bind(i,5414))]);this.data=this.behaviorManager.findBehavior("us_elections_2020")?.data,this.control=new t(this.data),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-us-elections-fixed-popup"]}static get featurePrefixes(){return["custom-adornment-us-elections-fixed-popup"]}}},6360:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(1823),o=i(4386),s=i(4962);class a extends((0,o.Z)((0,s.Z)(n.default))){constructor(t){super(t);const{title:e,loader:i}=t;this.title=e,this.behaviorManager=i.behaviorManager,this._init()}async _init(){const[t]=await(0,r.I0)([Promise.resolve().then(i.bind(i,9587))]);this.data=this.behaviorManager.findBehavior("us_elections_2020")?.data,this.control=new t(this.data,this.title),this.control.applyOffset(this.originalScreenPosition,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-us-elections-updater"]}static get featurePrefixes(){return["custom-adornment-us-elections-updater"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.title=t.properties["mc-us-elections-2020-updater-title"],e}}},413:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return a}});var n=i(1999),r=i(4386),o=i(4962),s=i(1527);class a extends((0,o.Z)((0,r.Z)(n.default))){constructor(t){super(t),this._init()}_init(){this.control=new s.AttributionControl;const{originalScreenPosition:t,elementOffset:{x:e,y:i}}=this;"arbitrary"===t&&e+i>0&&(this.control._container.classList.add("arbitrary-positioning"),this.control._container.style.left=`${e}px`,this.control._container.style.top=`${i}px`),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-basic-copyright"]}static get featurePrefixes(){return["custom-adornment-basic-copyright"]}}},1147:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return u}});var n=i(1999),r=i(4386),o=i(4962),s=i(5574),a=i(1823),l=i(1362);class c extends s.T{icon;initialScale;boundChangeIcon;stackingOrder;_container;constructor(t){super();const{icon:e,scale:i}=t;this.icon=e,this.initialScale=i??1,this.boundChangeIcon=this._changeIcon.bind(this),this._detectFullscreenEvent()}onAdd(t){return this.container.innerHTML=this._buildHtml(this.getIcon()),this.container.addEventListener("click",this._onClickFullscreen.bind(this)),this.container.style.order=this.stackingOrder,this._checkFullscreenSupport()?this.container.classList.add("fullscreen-button","adornment-collision"):this.container.classList.add("new-tab-button","adornment-collision"),this._container=t.getContainer(),this._changeIcon(),window.document.addEventListener(this._fullscreenchange,this.boundChangeIcon),this.container}getIcon(){switch(this.icon){case"shrink":return'<svg xmlns="http://www.w3.org/2000/svg" width="29" viewBox="0 0 29 29" fill="none"><path fill="#343A40" fill-rule="evenodd" d="M0 6.416v5.5H11.97V0H6.498v6.416H0ZM17.031 16.97V29h5.472v-6.531H29v-5.5H17.03Z" clip-rule="evenodd"/></svg>\n';case"new-tab":return'<svg xmlns="http://www.w3.org/2000/svg" width="23" viewbox="0 0 23 23" fill="none"><path fill="#343A40" fill-rule="evenodd" d="m17.001 17.025-5.117-.023V17l-5.937-.027.023-5.165h.003l.026-5.833 4.026.018.023-5-9-.04-.046 10.09H.974l-.05 10.881 10.148.046V22l10.88.049.039-8.5-4.974-.023-.016 3.5Z" clip-rule="evenodd"/><path fill="#343A40" d="m21.936 1.047-.04 9-8.997-9.04 9.037.04Z" class="arrow"/><path fill="#343A40" d="m16.547 3.023 3.52 3.552-6.538 6.478-3.52-3.551z" class="arrow"/></svg>\n';case"close-tab":return'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" class="close-new-tab-button" viewBox="0 0 32 32"><g fill="#000"><path d="M25.597.848.848 25.597l6.155 6.155L31.752 7.003 25.597.848Z"/><path d="M7.387 1.361 1.232 7.517l24.749 24.748 6.155-6.155L7.387 1.361Z"/></g></svg>\n';default:return'<svg xmlns="http://www.w3.org/2000/svg" width="30" fill="none" viewBox="-5 -5 30 30"><path fill="#343A40" fill-rule="evenodd" d="M10.88 5V0H0v10.833h4.974V5h5.907ZM20 20V9.063h-4.974V15H9.119v5H20Z" clip-rule="evenodd"/></svg>\n'}}_buildHtml(t){const e=this._isFullscreen()?this.initialScale:.7*this.initialScale,i=this._checkFullscreenSupport()?"fullscreen-button":"new-tab-button",n=t,r=e*(this._checkFullscreenSupport()?30:23),o=this._fromSvgString(n);o?.setAttribute("width",String(r));const s=o?.outerHTML;return`\n <div class="web-map-adornment ${i}" style="${`width: ${50*e}px; height: ${50*e}px`}">\n ${s}\n </div>\n `}onRemove(){this.container.remove(),window.document.removeEventListener(this._fullscreenchange,this.boundChangeIcon)}_checkFullscreenSupport(){return Boolean(window.document.fullscreenEnabled||window.document.mozFullScreenEnabled||window.document.msFullscreenEnabled||window.document.webkitFullscreenEnabled)}_changeIcon(){null!==(0,a.Ph)("close-tab")?this.icon="close-tab":this._checkFullscreenSupport()?this._isFullscreen()?this.icon="shrink":this.icon="default":this.icon="new-tab",this.container.innerHTML=this._buildHtml(this.getIcon()),(0,l.lk)()}_onClickFullscreen(){null!==(0,a.Ph)("close-tab")?this._closeTab():this._checkFullscreenSupport()?this._isFullscreen()?this._exitFullscreen():this._enterFullscreen():this._openNewTab()}_enterFullscreen(){this._checkFullscreenSupport()?(this.container.classList.remove("fullscreen-button"),this.container.classList.add("shrink-button")):(this.container.classList.remove("new-tab-button"),this.container.classList.add("close-new-tab-button")),this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}_exitFullscreen(){this._checkFullscreenSupport()?(this.container.classList.remove("shrink-button"),this.container.classList.add("fullscreen-button")):(this.container.classList.remove("close-new-tab-button"),this.container.classList.add("new-tab-button")),window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen()}_openNewTab(){let t=document.location.href;t+=t.includes("?")?"&":"?",t+="close-tab",window.open(t,"_blank")}_closeTab(){window.close()}}class u extends((0,r.Z)((0,o.Z)(n.default))){constructor(t){super(t);const{icon:e,scale:i}=t;this.options=t,this.icon=e,this.scale=i,this._init()}_init(){this.control=new c({icon:this.icon,scale:this.scale}),this.control.applyOffset(this.originalScreenPosition,Boolean(this.options.wrapperId),this.options.offsetBottom,this.options.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-fullscreen-button"]}static get featurePrefixes(){return["custom-adornment-fullscreen-button"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.icon=t.properties["mc-fullscreen-button-icon"],e.scale=t.properties.scale,e}}},503:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return u}});var n=i(1999),r=i(4386),o=i(4962),s=i(5574);class a extends s.T{wrapperId;onClick;initialScale;locating;stackingOrder;constructor(t,e,i,n){super(),this.map=t,this.wrapperId=e,this.onClick=i,this.initialScale=n??1,this.locating=!1}onAdd(){return this.container.classList.add("geolocation-button","adornment-collision"),this.container.style.order=this.stackingOrder,this.container.addEventListener("click",(()=>{this.locating||(this.onClick(),this.toggleIcon(),this.locating=!0)})),window.document.addEventListener(this._fullscreenchange,(()=>this._update())),this._update(),this.container}toggleIcon(){this.container.querySelector(".geolocation-icon").classList.toggle("active"),this.container.querySelector(".locating-icon").classList.toggle("active")}_update(){this.container.innerHTML=this._buildHtml()}_buildHtml(){const t=this._isFullscreen()?this.initialScale:.7*this.initialScale,e=24*t,i=this._fromSvgString('<svg width="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="8" stroke="#343A40" stroke-width="4"/><path fill="#343A40" d="M11 0h2v9h-2zM0 13v-2h9v2zm11 2h2v9h-2zm4-2v-2h9v2z"/></svg>\n');i?.setAttribute("width",String(e));const n=this._fromSvgString('<svg width="34" viewBox="5 5 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)" fill="#343A40"><path d="M15.016 22.656a5.797 5.797 0 0 1-1.016-.46c-2.858-1.65-3.846-5.338-2.196-8.196 1.65-2.858 5.338-3.846 8.196-2.196 2.858 1.65 3.846 5.338 2.196 8.196-.2.346-.434.673-.694.962l2.933 2.72A10.1 10.1 0 0 0 25.66 22c2.75-4.763 1.103-10.91-3.66-13.66S11.09 7.237 8.34 12 7.237 22.91 12 25.66a9.61 9.61 0 0 0 1.635.748l1.381-3.752Z"/><path d="m11.01 17.183-3.999.06a10.051 10.051 0 0 0 6.427 9.097l1.484-3.714a6.025 6.025 0 0 1-3.913-5.443Zm13.284 5.183 1-1.732-2.598-1.5-1 1.732 2.598 1.5Zm-3.428-10.062 1.5-2.598-1.732-1-1.5 2.598 1.732 1Zm-9.562 2.562 1-1.732-2.598-1.5-1 1.732 2.598 1.5Z"/><path d="m13.366 25.294 1.5-2.598-1.732-1-1.5 2.598 1.732 1Z"/></g><defs><clipPath id="a"><path fill="#fff" d="m33.393 12.607-12 20.784-20.785-12 12-20.784z"/></clipPath></defs></svg>\n');n?.setAttribute("width",String(e));const r=i?.outerHTML,o=n?.outerHTML;return`\n <div class="web-map-adornment geolocation-button" style="${`width: ${50*t}px; height: ${50*t}px`}">\n <div class="location-icon geolocation-icon active">${r}</div>\n <div class="location-icon locating-icon">${o}</div>\n </div>\n `}onRemove(){this.container?.remove()}}var l=i(5704),c=i(9809);class u extends((0,r.Z)((0,o.Z)(n.default))){constructor(t){super(t);const{wrapperId:e,offsetBottom:i,scale:n}=t;this.imageCache=new c.Z,this.wrapperId=e,this.offsetBottom=i,this.scale=n,this._layersAndSourcesReady=!1,this._init()}onClick(){this._layersAndSourcesReady||(this._initLayersAndSources(),this._layersAndSourcesReady=!0);const t=t=>{const{longitude:e,latitude:i,accuracy:n}=t.coords;this.map.easeTo({center:[e,i],zoom:19,duration:1e3}),this.map.getSource("location-circle").setData(this.createCircle(e,i,n/2)),this.addLocationDot(e,i)},e=t=>{console.log(t)};navigator.geolocation?navigator.geolocation.getCurrentPosition(t,e,{maximumAge:6e4}):this.showNotification(),this.map.once("moveend",(()=>{this.control.locating=!1,this.control.toggleIcon()}))}_initLayersAndSources(){this.map.addSource("location-circle",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addSource("location-dot",{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:[]},properties:{}}}),this.map.addLayer({id:"location-circle",type:"fill",source:"location-circle",layout:{},paint:{"fill-color":"#349CF2","fill-opacity":.15,"fill-outline-color":"#005196"}},"mc-before-names"),this.map.addLayer({id:"location-dot",type:"symbol",source:"location-dot",layout:{"icon-padding":0},paint:{"icon-opacity":1},metadata:{"mc-name":"location dot","mc-skip-load":!0}},"mc-before-names"),this.loadLocationDot()}showNotification(){const t=document.querySelector(".map"),e=document.createElement("div");e.classList.add("location-notification"),e.textContent=`${l.Z.t("geoLocation.geolocationNotAvailable")}`,t?.appendChild(e),setTimeout((()=>{t?.removeChild(e)}),3e3)}addLocationDot(t,e){this.map.getSource("location-dot").setData({type:"Feature",geometry:{type:"Point",coordinates:[t,e]},properties:{}})}async loadLocationDot(){const t=2*window.devicePixelRatio,e=await this.imageCache.getImage('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#a)"><circle cx="16" cy="16" r="10" fill="#349CF2"/><circle cx="16" cy="16" r="9" stroke="#fff" stroke-width="2"/></g><defs><filter id="a" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="4"/><feGaussianBlur stdDeviation="2"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_15_3175"/><feBlend in="SourceGraphic" in2="effect1_dropShadow_15_3175" result="shape"/></filter></defs></svg>\n',t);this.map.addImage("location-dot",e,{pixelRatio:t}),this.map.setLayoutProperty("location-dot","icon-image","location-dot")}createCircle(t,e,i){const n=i/1e3,r=[],o=n/(111.32*Math.cos(e*Math.PI/180)),s=n/110.574;let a,l,c;for(let i=0;i<64;i++)a=i/64*(2*Math.PI),l=o*Math.cos(a),c=s*Math.sin(a),r.push([t+l,e+c]);return r.push(r[0]),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Polygon",coordinates:[r]}}]}}_init(){this.control=new a(this.map,this.wrapperId,this.onClick.bind(this),this.scale),this.control.applyOffset(this.originalScreenPosition,Boolean(this.wrapperId),this.offsetBottom,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-geolocation-button"]}static get featurePrefixes(){return["custom-adornment-geolocation-button"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.wrapperId=t.properties["wrapper-id"],e.offsetBottom=t.properties["offset-bottom"],e.scale=t.properties.scale,e}}},3067:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return Me}});var n=i(1042),r=i(5714),o=1e-6,s=1e-12,a=Math.PI,l=a/2,c=a/4,u=2*a,h=180/a,d=a/180,p=Math.abs,f=Math.atan,m=Math.atan2,g=Math.cos,y=(Math.ceil,Math.exp),_=(Math.floor,Math.hypot,Math.log),v=(Math.pow,Math.sin),x=Math.sign||function(t){return t>0?1:t<0?-1:0},b=Math.sqrt,w=Math.tan;function S(t){return t>1?l:t<-1?-l:Math.asin(t)}function E(){}function k(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:E,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function T(t,e){return p(t[0]-e[0])<o&&p(t[1]-e[1])<o}function A(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function I(t,e,i,n,r){var s,a,l=[],c=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(T(n,a)){if(!n[2]&&!a[2]){for(r.lineStart(),s=0;s<e;++s)r.point((n=t[s])[0],n[1]);return void r.lineEnd()}a[0]+=2*o}l.push(i=new A(n,t,null,!0)),c.push(i.o=new A(n,null,i,!1)),l.push(i=new A(a,t,null,!1)),c.push(i.o=new A(a,null,i,!0))}})),l.length){for(c.sort(e),M(l),M(c),s=0,a=c.length;s<a;++s)c[s].e=i=!i;for(var u,h,d=l[0];;){for(var p=d,f=!0;p.v;)if((p=p.n)===d)return;u=p.z,r.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(s=0,a=u.length;s<a;++s)r.point((h=u[s])[0],h[1]);else n(p.x,p.n.x,1,r);p=p.n}else{if(f)for(u=p.p.z,s=u.length-1;s>=0;--s)r.point((h=u[s])[0],h[1]);else n(p.x,p.p.x,-1,r);p=p.p}u=(p=p.o).z,f=!f}while(!p.v);r.lineEnd()}}}function M(t){if(e=t.length){for(var e,i,n=0,r=t[0];++n<e;)r.n=i=t[n],i.p=r,r=i;r.n=i=t[0],i.p=r}}class C{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let i=0;for(let n=0;n<this._n&&n<32;n++){const r=e[n],o=t+r,s=Math.abs(t)<Math.abs(r)?t-(o-r):r-(o-t);s&&(e[i++]=s),t=o}return e[i]=t,this._n=i+1,this}valueOf(){const t=this._partials;let e,i,n,r=this._n,o=0;if(r>0){for(o=t[--r];r>0&&(e=o,i=t[--r],o=e+i,n=i-(o-e),!n););r>0&&(n<0&&t[r-1]<0||n>0&&t[r-1]>0)&&(i=2*n,e=o+i,i==e-o&&(o=e))}return o}}function z(t){return[m(t[1],t[0]),S(t[2])]}function P(t){var e=t[0],i=t[1],n=g(i);return[n*g(e),n*v(e),v(i)]}function L(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function D(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function R(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function O(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function F(t){var e=b(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function B(t){return p(t[0])<=a?t[0]:x(t[0])*((p(t[0])+a)%u-a)}function j(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function $(t,e,i,n){return function(r){var h,d,p,f=e(r),y=k(),_=e(y),x=!1,b={point:w,lineStart:T,lineEnd:A,polygonStart:function(){b.point=M,b.lineStart=z,b.lineEnd=L,d=[],h=[]},polygonEnd:function(){b.point=w,b.lineStart=T,b.lineEnd=A,d=j(d);var t=function(t,e){var i=B(e),n=e[1],r=v(n),h=[v(i),-g(i),0],d=0,p=0,f=new C;1===r?n=l+o:-1===r&&(n=-l-o);for(var y=0,_=t.length;y<_;++y)if(b=(x=t[y]).length)for(var x,b,w=x[b-1],E=B(w),k=w[1]/2+c,T=v(k),A=g(k),I=0;I<b;++I,E=z,T=R,A=O,w=M){var M=x[I],z=B(M),L=M[1]/2+c,R=v(L),O=g(L),j=z-E,$=j>=0?1:-1,N=$*j,U=N>a,V=T*R;if(f.add(m(V*$*v(N),A*O+V*g(N))),d+=U?j+$*u:j,U^E>=i^z>=i){var q=D(P(w),P(M));F(q);var Z=D(h,q);F(Z);var G=(U^j>=0?-1:1)*S(Z[2]);(n>G||n===G&&(q[0]||q[1]))&&(p+=U^j>=0?1:-1)}}return(d<-o||d<o&&f<-s)^1&p}(h,n);d.length?(x||(r.polygonStart(),x=!0),I(d,U,t,i,r)):t&&(x||(r.polygonStart(),x=!0),r.lineStart(),i(null,null,1,r),r.lineEnd()),x&&(r.polygonEnd(),x=!1),d=h=null},sphere:function(){r.polygonStart(),r.lineStart(),i(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function w(e,i){t(e,i)&&r.point(e,i)}function E(t,e){f.point(t,e)}function T(){b.point=E,f.lineStart()}function A(){b.point=w,f.lineEnd()}function M(t,e){p.push([t,e]),_.point(t,e)}function z(){_.lineStart(),p=[]}function L(){M(p[0][0],p[0][1]),_.lineEnd();var t,e,i,n,o=_.clean(),s=y.result(),a=s.length;if(p.pop(),h.push(p),p=null,a)if(1&o){if((e=(i=s[0]).length-1)>0){for(x||(r.polygonStart(),x=!0),r.lineStart(),t=0;t<e;++t)r.point((n=i[t])[0],n[1]);r.lineEnd()}}else a>1&&2&o&&s.push(s.pop().concat(s.shift())),d.push(s.filter(N))}return b}}function N(t){return t.length>1}function U(t,e){return((t=t.x)[0]<0?t[1]-l-o:l-t[1])-((e=e.x)[0]<0?e[1]-l-o:l-e[1])}var V=$((function(){return!0}),(function(t){var e,i=NaN,n=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(s,c){var u=s>0?a:-a,h=p(s-i);p(h-a)<o?(t.point(i,n=(n+c)/2>0?l:-l),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(u,n),t.point(s,n),e=0):r!==u&&h>=a&&(p(i-r)<o&&(i-=r*o),p(s-u)<o&&(s-=u*o),n=function(t,e,i,n){var r,s,a=v(t-i);return p(a)>o?f((v(e)*(s=g(n))*v(i)-v(n)*(r=g(e))*v(t))/(r*s*a)):(e+n)/2}(i,n,s,c),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(u,n),e=0),t.point(i=s,n=c),r=u},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var r;if(null==t)r=i*l,n.point(-a,r),n.point(0,r),n.point(a,r),n.point(a,0),n.point(a,-r),n.point(0,-r),n.point(-a,-r),n.point(-a,0),n.point(-a,r);else if(p(t[0]-e[0])>o){var s=t[0]<e[0]?a:-a;r=i*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}),[-a,-l]);function q(t,e,i,n,r,o){if(i){var s=g(e),a=v(e),l=n*i;null==r?(r=e+n*u,o=e-l/2):(r=Z(s,r),o=Z(s,o),(n>0?r<o:r>o)&&(r+=n*u));for(var c,h=r;n>0?h>o:h<o;h-=l)c=z([s,-a*g(h),-a*v(h)]),t.point(c[0],c[1])}}function Z(t,e){(e=P(e))[0]-=t,F(e);var i,n=(i=-e[1])>1?0:i<-1?a:Math.acos(i);return((-e[2]<0?-n:n)+u-o)%u}var G=1e9,H=-G;function W(t,e,i,n){function r(r,o){return t<=r&&r<=i&&e<=o&&o<=n}function s(r,o,s,l){var u=0,h=0;if(null==r||(u=a(r,s))!==(h=a(o,s))||c(r,o)<0^s>0)do{l.point(0===u||3===u?t:i,u>1?n:e)}while((u=(u+s+4)%4)!==h);else l.point(o[0],o[1])}function a(n,r){return p(n[0]-t)<o?r>0?0:3:p(n[0]-i)<o?r>0?2:1:p(n[1]-e)<o?r>0?1:0:r>0?3:2}function l(t,e){return c(t.x,e.x)}function c(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(o){var a,c,u,h,d,p,f,m,g,y,_,v=o,x=k(),b={point:w,lineStart:function(){b.point=S,c&&c.push(u=[]);y=!0,g=!1,f=m=NaN},lineEnd:function(){a&&(S(h,d),p&&g&&x.rejoin(),a.push(x.result()));b.point=w,g&&v.lineEnd()},polygonStart:function(){v=x,a=[],c=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,r=c.length;i<r;++i)for(var o,s,a=c[i],l=1,u=a.length,h=a[0],d=h[0],p=h[1];l<u;++l)o=d,s=p,d=(h=a[l])[0],p=h[1],s<=n?p>n&&(d-o)*(n-s)>(p-s)*(t-o)&&++e:p<=n&&(d-o)*(n-s)<(p-s)*(t-o)&&--e;return e}(),i=_&&e,r=(a=j(a)).length;(i||r)&&(o.polygonStart(),i&&(o.lineStart(),s(null,null,1,o),o.lineEnd()),r&&I(a,l,e,s,o),o.polygonEnd());v=o,a=c=u=null}};function w(t,e){r(t,e)&&v.point(t,e)}function S(o,s){var a=r(o,s);if(c&&u.push([o,s]),y)h=o,d=s,p=a,y=!1,a&&(v.lineStart(),v.point(o,s));else if(a&&g)v.point(o,s);else{var l=[f=Math.max(H,Math.min(G,f)),m=Math.max(H,Math.min(G,m))],x=[o=Math.max(H,Math.min(G,o)),s=Math.max(H,Math.min(G,s))];!function(t,e,i,n,r,o){var s,a=t[0],l=t[1],c=0,u=1,h=e[0]-a,d=e[1]-l;if(s=i-a,h||!(s>0)){if(s/=h,h<0){if(s<c)return;s<u&&(u=s)}else if(h>0){if(s>u)return;s>c&&(c=s)}if(s=r-a,h||!(s<0)){if(s/=h,h<0){if(s>u)return;s>c&&(c=s)}else if(h>0){if(s<c)return;s<u&&(u=s)}if(s=n-l,d||!(s>0)){if(s/=d,d<0){if(s<c)return;s<u&&(u=s)}else if(d>0){if(s>u)return;s>c&&(c=s)}if(s=o-l,d||!(s<0)){if(s/=d,d<0){if(s>u)return;s>c&&(c=s)}else if(d>0){if(s<c)return;s<u&&(u=s)}return c>0&&(t[0]=a+c*h,t[1]=l+c*d),u<1&&(e[0]=a+u*h,e[1]=l+u*d),!0}}}}}(l,x,t,e,i,n)?a&&(v.lineStart(),v.point(o,s),_=!1):(g||(v.lineStart(),v.point(l[0],l[1])),v.point(x[0],x[1]),a||v.lineEnd(),_=!1)}f=o,m=s,g=a}return b}}function X(t,e){function i(i,n){return i=t(i,n),e(i[0],i[1])}return t.invert&&e.invert&&(i.invert=function(i,n){return(i=e.invert(i,n))&&t.invert(i[0],i[1])}),i}var J=t=>t;function K(t,e){return p(t)>a&&(t-=Math.round(t/u)*u),[t,e]}function Y(t,e,i){return(t%=u)?e||i?X(tt(t),et(e,i)):tt(t):e||i?et(e,i):K}function Q(t){return function(e,i){return p(e+=t)>a&&(e-=Math.round(e/u)*u),[e,i]}}function tt(t){var e=Q(t);return e.invert=Q(-t),e}function et(t,e){var i=g(t),n=v(t),r=g(e),o=v(e);function s(t,e){var s=g(e),a=g(t)*s,l=v(t)*s,c=v(e),u=c*i+a*n;return[m(l*r-u*o,a*i-c*n),S(u*r+l*o)]}return s.invert=function(t,e){var s=g(e),a=g(t)*s,l=v(t)*s,c=v(e),u=c*r-l*o;return[m(l*r+c*o,a*i+u*n),S(u*i-a*n)]},s}function it(t){return function(e){var i=new nt;for(var n in t)i[n]=t[n];return i.stream=e,i}}function nt(){}function rt(t,e){t&&st.hasOwnProperty(t.type)&&st[t.type](t,e)}K.invert=K,nt.prototype={constructor:nt,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ot={Feature:function(t,e){rt(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,r=i.length;++n<r;)rt(i[n].geometry,e)}},st={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)t=i[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){at(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)at(i[n],e,0)},Polygon:function(t,e){lt(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,r=i.length;++n<r;)lt(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,r=i.length;++n<r;)rt(i[n],e)}};function at(t,e,i){var n,r=-1,o=t.length-i;for(e.lineStart();++r<o;)n=t[r],e.point(n[0],n[1],n[2]);e.lineEnd()}function lt(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)at(t[i],e,1);e.polygonEnd()}function ct(t,e){t&&ot.hasOwnProperty(t.type)?ot[t.type](t,e):rt(t,e)}var ut=1/0,ht=ut,dt=-ut,pt=dt,ft={point:function(t,e){t<ut&&(ut=t);t>dt&&(dt=t);e<ht&&(ht=e);e>pt&&(pt=e)},lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E,result:function(){var t=[[ut,ht],[dt,pt]];return dt=pt=-(ht=ut=1/0),t}};var mt=ft;function gt(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),ct(i,t.stream(mt)),e(mt.result()),null!=n&&t.clipExtent(n),t}function yt(t,e,i){return gt(t,(function(i){var n=e[1][0]-e[0][0],r=e[1][1]-e[0][1],o=Math.min(n/(i[1][0]-i[0][0]),r/(i[1][1]-i[0][1])),s=+e[0][0]+(n-o*(i[1][0]+i[0][0]))/2,a=+e[0][1]+(r-o*(i[1][1]+i[0][1]))/2;t.scale(150*o).translate([s,a])}),i)}var _t=16,vt=g(30*d);function xt(t,e){return+e?function(t,e){function i(n,r,s,a,l,c,u,h,d,f,g,y,_,v){var x=u-n,w=h-r,E=x*x+w*w;if(E>4*e&&_--){var k=a+f,T=l+g,A=c+y,I=b(k*k+T*T+A*A),M=S(A/=I),C=p(p(A)-1)<o||p(s-d)<o?(s+d)/2:m(T,k),z=t(C,M),P=z[0],L=z[1],D=P-n,R=L-r,O=w*D-x*R;(O*O/E>e||p((x*D+w*R)/E-.5)>.3||a*f+l*g+c*y<vt)&&(i(n,r,s,a,l,c,P,L,C,k/=I,T/=I,A,_,v),v.point(P,L),i(P,L,C,k,T,A,u,h,d,f,g,y,_,v))}}return function(e){var n,r,o,s,a,l,c,u,h,d,p,f,m={point:g,lineStart:y,lineEnd:v,polygonStart:function(){e.polygonStart(),m.lineStart=x},polygonEnd:function(){e.polygonEnd(),m.lineStart=y}};function g(i,n){i=t(i,n),e.point(i[0],i[1])}function y(){u=NaN,m.point=_,e.lineStart()}function _(n,r){var o=P([n,r]),s=t(n,r);i(u,h,c,d,p,f,u=s[0],h=s[1],c=n,d=o[0],p=o[1],f=o[2],_t,e),e.point(u,h)}function v(){m.point=g,e.lineEnd()}function x(){y(),m.point=b,m.lineEnd=w}function b(t,e){_(n=t,e),r=u,o=h,s=d,a=p,l=f,m.point=_}function w(){i(u,h,c,d,p,f,r,o,n,s,a,l,_t,e),m.lineEnd=v,v()}return m}}(t,e):function(t){return it({point:function(e,i){e=t(e,i),this.stream.point(e[0],e[1])}})}(t)}var bt,wt=it({point:function(t,e){this.stream.point(t*d,e*d)}});function St(t,e,i,n,r,o){if(!o)return function(t,e,i,n,r){function o(o,s){return[e+t*(o*=n),i-t*(s*=r)]}return o.invert=function(o,s){return[(o-e)/t*n,(i-s)/t*r]},o}(t,e,i,n,r);var s=g(o),a=v(o),l=s*t,c=a*t,u=s/t,h=a/t,d=(a*i-s*e)/t,p=(a*e+s*i)/t;function f(t,o){return[l*(t*=n)-c*(o*=r)+e,i-c*t-l*o]}return f.invert=function(t,e){return[n*(u*t-h*e+d),r*(p-h*t-u*e)]},f}function Et(t){return function(t){var e,i,n,r,s,l,c,u,f,m,y=150,_=480,v=250,x=0,w=0,S=0,E=0,k=0,A=0,I=1,M=1,C=null,F=V,B=null,j=J,N=.5;function U(t){return u(t[0]*d,t[1]*d)}function Z(t){return(t=u.invert(t[0],t[1]))&&[t[0]*h,t[1]*h]}function G(){var t=St(y,0,0,I,M,A).apply(null,e(x,w)),n=St(y,_-t[0],v-t[1],I,M,A);return i=Y(S,E,k),c=X(e,n),u=X(i,c),l=xt(c,N),H()}function H(){return f=m=null,U}return U.stream=function(t){return f&&m===t?f:f=wt(function(t){return it({point:function(e,i){var n=t(e,i);return this.stream.point(n[0],n[1])}})}(i)(F(l(j(m=t)))))},U.preclip=function(t){return arguments.length?(F=t,C=void 0,H()):F},U.postclip=function(t){return arguments.length?(j=t,B=n=r=s=null,H()):j},U.clipAngle=function(t){return arguments.length?(F=+t?function(t){var e=g(t),i=6*d,n=e>0,r=p(e)>o;function s(t,i){return g(t)*g(i)>e}function l(t,i,n){var r=[1,0,0],s=D(P(t),P(i)),l=L(s,s),c=s[0],u=l-c*c;if(!u)return!n&&t;var h=e*l/u,d=-e*c/u,f=D(r,s),m=O(r,h);R(m,O(s,d));var g=f,y=L(m,g),_=L(g,g),v=y*y-_*(L(m,m)-1);if(!(v<0)){var x=b(v),w=O(g,(-y-x)/_);if(R(w,m),w=z(w),!n)return w;var S,E=t[0],k=i[0],T=t[1],A=i[1];k<E&&(S=E,E=k,k=S);var I=k-E,M=p(I-a)<o;if(!M&&A<T&&(S=T,T=A,A=S),M||I<o?M?T+A>0^w[1]<(p(w[0]-E)<o?T:A):T<=w[1]&&w[1]<=A:I>a^(E<=w[0]&&w[0]<=k)){var C=O(g,(-y+x)/_);return R(C,m),[w,z(C)]}}}function c(e,i){var r=n?t:a-t,o=0;return e<-r?o|=1:e>r&&(o|=2),i<-r?o|=4:i>r&&(o|=8),o}return $(s,(function(t){var e,i,o,u,h;return{lineStart:function(){u=o=!1,h=1},point:function(d,p){var f,m=[d,p],g=s(d,p),y=n?g?0:c(d,p):g?c(d+(d<0?a:-a),p):0;if(!e&&(u=o=g)&&t.lineStart(),g!==o&&(!(f=l(e,m))||T(e,f)||T(m,f))&&(m[2]=1),g!==o)h=0,g?(t.lineStart(),f=l(m,e),t.point(f[0],f[1])):(f=l(e,m),t.point(f[0],f[1],2),t.lineEnd()),e=f;else if(r&&e&&n^g){var _;y&i||!(_=l(m,e,!0))||(h=0,n?(t.lineStart(),t.point(_[0][0],_[0][1]),t.point(_[1][0],_[1][1]),t.lineEnd()):(t.point(_[1][0],_[1][1]),t.lineEnd(),t.lineStart(),t.point(_[0][0],_[0][1],3)))}!g||e&&T(e,m)||t.point(m[0],m[1]),e=m,o=g,i=y},lineEnd:function(){o&&t.lineEnd(),e=null},clean:function(){return h|(u&&o)<<1}}}),(function(e,n,r,o){q(o,t,i,r,e,n)}),n?[0,-t]:[-a,t-a])}(C=t*d):(C=null,V),H()):C*h},U.clipExtent=function(t){return arguments.length?(j=null==t?(B=n=r=s=null,J):W(B=+t[0][0],n=+t[0][1],r=+t[1][0],s=+t[1][1]),H()):null==B?null:[[B,n],[r,s]]},U.scale=function(t){return arguments.length?(y=+t,G()):y},U.translate=function(t){return arguments.length?(_=+t[0],v=+t[1],G()):[_,v]},U.center=function(t){return arguments.length?(x=t[0]%360*d,w=t[1]%360*d,G()):[x*h,w*h]},U.rotate=function(t){return arguments.length?(S=t[0]%360*d,E=t[1]%360*d,k=t.length>2?t[2]%360*d:0,G()):[S*h,E*h,k*h]},U.angle=function(t){return arguments.length?(A=t%360*d,G()):A*h},U.reflectX=function(t){return arguments.length?(I=t?-1:1,G()):I<0},U.reflectY=function(t){return arguments.length?(M=t?-1:1,G()):M<0},U.precision=function(t){return arguments.length?(l=xt(c,N=t*t),H()):b(N)},U.fitExtent=function(t,e){return yt(U,t,e)},U.fitSize=function(t,e){return function(t,e,i){return yt(t,[[0,0],e],i)}(U,t,e)},U.fitWidth=function(t,e){return function(t,e,i){return gt(t,(function(i){var n=+e,r=n/(i[1][0]-i[0][0]),o=(n-r*(i[1][0]+i[0][0]))/2,s=-r*i[0][1];t.scale(150*r).translate([o,s])}),i)}(U,t,e)},U.fitHeight=function(t,e){return function(t,e,i){return gt(t,(function(i){var n=+e,r=n/(i[1][1]-i[0][1]),o=-r*i[0][0],s=(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([o,s])}),i)}(U,t,e)},function(){return e=t.apply(this,arguments),U.invert=e.invert&&Z,G()}}((function(){return t}))()}function kt(t,e){return[g(e)*v(t),v(e)]}function Tt(){return Et(kt).scale(249.5).clipAngle(90+o)}function At(t,e){return[t,_(w((l+e)/2))]}function It(){return function(t){var e,i,n,r=Et(t),o=r.center,s=r.scale,l=r.translate,c=r.clipExtent,u=null;function p(){var o=a*s(),l=r(function(t){function e(e){return(e=t(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e}return t=Y(t[0]*d,t[1]*d,t.length>2?t[2]*d:0),e.invert=function(e){return(e=t.invert(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e},e}(r.rotate()).invert([0,0]));return c(null==u?[[l[0]-o,l[1]-o],[l[0]+o,l[1]+o]]:t===At?[[Math.max(l[0]-o,u),e],[Math.min(l[0]+o,i),n]]:[[u,Math.max(l[1]-o,e)],[i,Math.min(l[1]+o,n)]])}return r.scale=function(t){return arguments.length?(s(t),p()):s()},r.translate=function(t){return arguments.length?(l(t),p()):l()},r.center=function(t){return arguments.length?(o(t),p()):o()},r.clipExtent=function(t){return arguments.length?(null==t?u=e=i=n=null:(u=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),p()):null==u?null:[[u,e],[i,n]]},p()}(At).scale(961/u)}kt.invert=(bt=S,function(t,e){var i=b(t*t+e*e),n=bt(i),r=v(n),o=g(n);return[m(t*r,i*o),S(i&&e*r/i)]}),At.invert=function(t,e){return[t,2*f(y(e))-l]};var Mt,Ct,zt,Pt,Lt=new C,Dt=new C,Rt={point:E,lineStart:E,lineEnd:E,polygonStart:function(){Rt.lineStart=Ot,Rt.lineEnd=jt},polygonEnd:function(){Rt.lineStart=Rt.lineEnd=Rt.point=E,Lt.add(p(Dt)),Dt=new C},result:function(){var t=Lt/2;return Lt=new C,t}};function Ot(){Rt.point=Ft}function Ft(t,e){Rt.point=Bt,Mt=zt=t,Ct=Pt=e}function Bt(t,e){Dt.add(Pt*t-zt*e),zt=t,Pt=e}function jt(){Bt(Mt,Ct)}var $t,Nt,Ut,Vt,qt=Rt,Zt=0,Gt=0,Ht=0,Wt=0,Xt=0,Jt=0,Kt=0,Yt=0,Qt=0,te={point:ee,lineStart:ie,lineEnd:oe,polygonStart:function(){te.lineStart=se,te.lineEnd=ae},polygonEnd:function(){te.point=ee,te.lineStart=ie,te.lineEnd=oe},result:function(){var t=Qt?[Kt/Qt,Yt/Qt]:Jt?[Wt/Jt,Xt/Jt]:Ht?[Zt/Ht,Gt/Ht]:[NaN,NaN];return Zt=Gt=Ht=Wt=Xt=Jt=Kt=Yt=Qt=0,t}};function ee(t,e){Zt+=t,Gt+=e,++Ht}function ie(){te.point=ne}function ne(t,e){te.point=re,ee(Ut=t,Vt=e)}function re(t,e){var i=t-Ut,n=e-Vt,r=b(i*i+n*n);Wt+=r*(Ut+t)/2,Xt+=r*(Vt+e)/2,Jt+=r,ee(Ut=t,Vt=e)}function oe(){te.point=ee}function se(){te.point=le}function ae(){ce($t,Nt)}function le(t,e){te.point=ce,ee($t=Ut=t,Nt=Vt=e)}function ce(t,e){var i=t-Ut,n=e-Vt,r=b(i*i+n*n);Wt+=r*(Ut+t)/2,Xt+=r*(Vt+e)/2,Jt+=r,Kt+=(r=Vt*t-Ut*e)*(Ut+t),Yt+=r*(Vt+e),Qt+=3*r,ee(Ut=t,Vt=e)}var ue=te;function he(t){this._context=t}he.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,u)}},result:E};var de,pe,fe,me,ge,ye=new C,_e={point:E,lineStart:function(){_e.point=ve},lineEnd:function(){de&&xe(pe,fe),_e.point=E},polygonStart:function(){de=!0},polygonEnd:function(){de=null},result:function(){var t=+ye;return ye=new C,t}};function ve(t,e){_e.point=xe,pe=me=t,fe=ge=e}function xe(t,e){me-=t,ge-=e,ye.add(b(me*me+ge*ge)),me=t,ge=e}var be=_e;let we,Se,Ee,ke;class Te{constructor(t){this._append=null==t?Ae:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Ae;if(e!==we){const t=10**e;we=e,Se=function(e){let i=1;this._+=e[0];for(const n=e.length;i<n;++i)this._+=Math.round(arguments[i]*t)/t+e[i]}}return Se}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Ee||this._append!==Se){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Ee=t,Se=this._append,ke=this._,this._=e}this._+=ke}}result(){const t=this._;return this._="",t.length?t:null}}function Ae(t){let e=1;this._+=t[0];for(const i=t.length;e<i;++e)this._+=arguments[e]+t[e]}function Ie(t,e){let i,n,r=3,o=4.5;function s(t){return t&&("function"==typeof o&&n.pointRadius(+o.apply(this,arguments)),ct(t,i(n))),n.result()}return s.area=function(t){return ct(t,i(qt)),qt.result()},s.measure=function(t){return ct(t,i(be)),be.result()},s.bounds=function(t){return ct(t,i(mt)),mt.result()},s.centroid=function(t){return ct(t,i(ue)),ue.result()},s.projection=function(e){return arguments.length?(i=null==e?(t=null,J):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new Te(r)):new he(e=t),"function"!=typeof o&&n.pointRadius(o),s):e},s.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(n.pointRadius(+t),+t),s):o},s.digits=function(t){if(!arguments.length)return r;if(null==t)r=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);r=e}return null===e&&(n=new Te(r)),s},s.projection(t).digits(r).context(e)}class Me extends r.default{constructor(t){super(t);const{projectionName:e,projectionTranslation:i,projectionScale:r,projectionRotation:o}=t;if(void 0===e||void 0===i||void 0===r||void 0===o)return;const s="Orthographic"===e,a=s?Tt():It();a.scale(r).translate(i).rotate(o),s&&a.clipAngle(90),this.projection=a,(0,n.PQ)((()=>{this.emit("ready"),this._updateViewportIndicator(),this.map.on("move",(()=>this._updateViewportIndicator()))}))}_updateViewportIndicator(){if(!this.control)return void console.warn("Tried updating inset map before initialising control");const t=this.control.element.querySelector(".insetmap-highlightDot"),e=this.control.element.querySelector(".insetmap-highlightBackground"),i=this.control.element.querySelector(".insetmap-highlight");if(!t||!e||!i)return;const n=this._calcFrame(),r=this.map.getBounds(),o=Math.abs(r.getEast()-r.getWest()),s=Math.abs(r.getNorth()-r.getSouth()),{frameWidth:a,frameHeight:l}=this._calcFrameSize(n);t.setAttribute("display","none"),e.setAttribute("display","none"),i.setAttribute("display","none"),a<10||l<10?this._showViewportDot(t):o<180&&s<180&&this._showViewportFrame(e,i,n)}_calcFrame(){const t=this.map.getContainer(),e=t.clientWidth,i=t.clientHeight,n=[],r=[],o=[],s=[];for(let t=0;t<8;t++)n.push([e*t/8,0]),r.push([e,i*t/8]),o.push([e*(8-t)/8,i]),s.push([0,i*(8-t)/8]);const a=n.concat(r).concat(o).concat(s);return a.push(a[0]),a.map((t=>{const{lng:e,lat:i}=this.map.unproject(t);return[e,i]}))}_showViewportDot(t){const{lng:e,lat:i}=this.map.getCenter();if(!!!Ie(this.projection)({type:"Point",coordinates:[e,i]}))return;const[n,r]=this.projection([e,i]);t.setAttribute("cx",n),t.setAttribute("cy",r),t.setAttribute("display",null)}_showViewportFrame(t,e,i){const n=Ie(this.projection)({type:"LineString",coordinates:i});n&&(t.setAttribute("d",n),e.setAttribute("d",n),t.setAttribute("display",null),e.setAttribute("display",null))}_calcFrameSize(t){const e=t.map((t=>this.projection(t)));let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const t of e)t[0]<i&&(i=t[0]),t[1]<n&&(n=t[1]),t[0]>r&&(r=t[0]),t[1]>o&&(o=t[1]);return{frameWidth:r-i,frameHeight:o-n}}static get featurePrefixes(){return["custom-adornment-d3-insetmap"]}static get layerPrefixes(){return["custom-adornment-d3-insetmap"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.projectionName=t.properties["mc-insetmap-projection-name"],e.projectionTranslation=t.properties["mc-insetmap-projection-translation"],e.projectionScale=t.properties["mc-insetmap-projection-scale"],e.projectionRotation=t.properties["mc-insetmap-projection-rotation"],e}}},5083:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(5714),r=t=>class extends t{constructor(t){super(t),this.map.on("rotate",this._rotationCallback.bind(this)),this.map.on("rotateend",this._rotationCallback.bind(this))}_rotationCallback(){const t=this.map.getBearing()%360;this.emit("rotate",t)}},o=i(1042);class s extends(r(n.default)){constructor(t){super(t),this.on("rotate",(()=>this.update())),(0,o.PQ)((()=>this.emit("ready"))),this.update()}update(){throw new Error("unimplemented")}}},7514:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return r}});var n=i(5083);class r extends n.default{constructor(t){super(t),this._scale=t.scale??1,this.update()}update(){const t=this._scale,e=this.map.getBearing()%180;this.svg=`<svg xmlns="http://www.w3.org/2000/svg" width="${12.79*t}" height="${12.89*t}" viewBox="0 0 ${6.79*t} ${6.89*t}">\n <g transform="rotate(${-e}, ${3.395*t}, ${3.445*t}) scale(${t})">\n <polygon points="0 6.08 3.39 0 6.79 6.08 3.39 3.88 0 6.08"/>\n <path d="M4.13,6.89H3.75l-.59-1h0v1H2.78V5.26h.37l.6,1h0v-1h.38Z"/>\n </g>\n </svg>`}static get featurePrefixes(){return["custom-adornment-basic-north-arrow"]}static get layerPrefixes(){return["custom-adornment-basic-north-arrow"]}static fromFeature(t){return{scale:t.properties.scale}}}},637:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return l}});var n=i(1999),r=i(4962),o=i(4386),s=i(5574);class a extends s.T{initialScale;stackingOrder;_hideTile;_pitch;_rotation;constructor(t){super(),this._hideTile=t.hideTile,this.initialScale=t.scale}onAdd(t){return this.map=t,this.container.classList.add("adornment-collision"),this.container.style.order=this.stackingOrder,this.container.addEventListener("click",(()=>{this.map.easeTo({bearing:0,pitch:0,duration:500})})),this.map.on("rotate",(()=>{this._setBearing()})),this.map.on("pitch",(()=>{this._setPitch()})),window.document.addEventListener(this._fullscreenchange,(()=>this._update())),this._setPitch(),this._setBearing(),this._update(),this.container}_update(){const t=this._isFullscreen()?this.initialScale:.7*this.initialScale;this.container.style.width=this._hideTile?20*t+"px":50*t+"px",this.container.style.height=this._hideTile?20*t+"px":50*t+"px",this.container.innerHTML=this._buildHtml(t)}_buildHtml(t){const e=this._hideTile?"background-color: rgba(0, 0, 0, 0); box-shadow: none":"",i=20*t;return`\n <div class="web-map-adornment ${this._hideTile?"north-arrow-transparent":"north-arrow"}" style="${e}">\n <div style="transform: rotateX(${this._pitch}deg)">\n <div style="transform: rotate(${-this._rotation}deg)">\n <svg width="${i}" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 20L10 0L20 20L10 12.7711L0 20Z" fill="#343A40"/>\n </svg>\n </div>\n </div>\n </div>\n `}_setBearing(){this._rotation=this.map.getBearing(),this._update()}_setPitch(){this._pitch=this.map.getPitch(),this._update()}}class l extends((0,o.Z)((0,r.Z)(n.default))){constructor(t){super(t),this.options=t,this._init()}_init(){this.control=new a(this.options),this.control.applyOffset(this.originalScreenPosition,Boolean(this.options.wrapperId),this.options.offsetBottom,this.options.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-north-arrow"]}static get featurePrefixes(){return["custom-adornment-north-arrow"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.hideTile=t.properties["hide-tile"],e.scale=t.properties.scale,e}}},9655:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return l}});var n=i(1999),r=i(4386),o=i(4962),s=i(5574);class a extends s.T{icon;wrapperId;onClick;initialScale;stackingOrder;constructor(t,e,i,n){super(),this.icon=t,this.wrapperId=e,this.onClick=i,this.initialScale=n??1}onAdd(){return this.container.classList.add("reset-button","adornment-collision"),this.container.style.order=this.stackingOrder,this.container.addEventListener("click",this.onClick),window.document.addEventListener(this._fullscreenchange,(()=>this._update())),this._update(),this.container}_update(){this.container.innerHTML=this._buildHtml(this._icon)}_buildHtml(t){const e=this._isFullscreen()?this.initialScale:.7*this.initialScale,i=t,n=e*("usa"===this.icon?40:30),r=this._fromSvgString(i);r?.setAttribute("width",String(n));const o=r?.outerHTML;return`\n <div class="web-map-adornment reset-button" style="${`width: ${50*e}px; height: ${50*e}px`}">\n ${o}\n </div>\n `}get _icon(){return"usa"===this.icon?'<svg xmlns="http://www.w3.org/2000/svg" width="40" height="24" viewBox="0 0 24 14.61">\n <path d="M4.73 13.28l-.06-.07-.12-.08v-.06l-.08.05h-.16l-.37-1.89-.17-.06h-.73L3 11.1l-.07-.1-.06.05v-.07l-.04.02-.11.1h-.09.05l-.15.07-.17.24h-.27v.09H2l.08.09H2v.09l.17.18h-.13l-.22.14v.06h.08-.02l-.15.06v.06h.1-.07v.12H2v-.05.06l.1-.07v.05l-.11.09v.08H2v.05l-.06.07v.09h.1-.39.05-.13l.11.1h.05v-.07h.05l.1.14H2V13.13h.13l.06.1v-.1.05l.11-.05v.08h-.06V13.33h-.06v.05l.11.62-.09.05h-.06l-.14.1-.18.13h-.19.25v-.06H2l.16-.07H2.31l.2-.11v-.07l.16-.13h.08l.09-.09h-.08v-.1h.06v.1l-.08.08h.08v-.06h.09v-.13.11l.06-.09v.06-.12.06l.09.05H3.4l.09-.08h.05v.05-.05.09h.14l.23.13-.07-.06v-.06l-.19-.13h.11l.1-.09v.05-.06.1h.11v.06h.08v-.05.07h.09l-.07-.13v.06l.12.23v-.08l-.05-.07.07.06v.06H5l.09.09v-.06h.11v.1l-.14-.11H5v.08h.18v-.09h-.09v-.07.13-.06.05H5.24v-.1h.22v-.12.06-.06H5.4l.08.09-.08-.07-.05-.05H5l-.08-.06zm-1.16-.13zM2.26 12H2.2zm-.14 2.2zm1-.95zm.09-.06v-.08.07H3.2zm.36 0zm.54.06h.13zm.17 0zm.59.27zm.14.08H5zm0 .1zm.28.16zm-.45-.36zM.49 14.57l.11.04-.06-.03-.05-.01zM2.17 14.35l.04-.04v-.03l-.04.07zM5.81 12.9v.06l.02-.02.06-.04.02-.05-.03-.01-.07.06zM2.33 9.18l.03.1.05.02-.06-.13-.02.01zM1.35 12.45l-.01.06h.07l.08.12.04-.03h.05l-.06-.04-.05-.08-.09-.02-.03-.01zM2.4 8.93l.03.09.07.02-.01-.05-.09-.06zM6.2 12.73l.03-.02.04-.11-.02-.07-.13-.01-.12.12.1.08.05.02-.11.09.1.07.07.03.05-.03.04-.1-.03-.06-.07-.01zM2.12 14.27l-.02.03.04-.01v-.03l-.02.01z"/>\n <path d="M5.1 13.72l-.01.03.03.01.01-.04H5.1zM1.89 8.44l-.01.05.03.02h.12l-.05-.02-.09-.05zM1.72 8.43l.02.07.06.01.03-.02-.03-.04-.08-.02zM1.93 8.95l.05.01-.01-.03-.05-.02.01.04z"/>\n <path d="M23.9 1.85h.1v-.11h-.05l-.06-.15h-.05l-.07-.05V1.37h-.18v-.1l-.2-.63-.24-.12-.22.15h-.05V.58h-.07l-.16.5v.09l-.05.16v.6h-.05l.05.16v.07h-.09v.18l-.7.18-.81.18-.11.09-.19.27v.06l-.17.2h.05v.05l.07.15-.1.06-.08.11-.09.06h-.49l-.35.25v.17h.08v.1l-.08.12-.2.2-.15.11-.19.16-.2.14-.08.09-.12.07h-.19l.11-.06h-.05L18.2 5h-.23l.08-.18v-.23.07-.23l-.15-.47-.06-.08h-.08l-.13.11v.05h-.07v.05V4l-.11-.06v-.16l.07-.06V3.6l.06-.07v-.24l-.07-.11h.05l.17-.18-.28-.12-.05-.06h-.16.07l-.07-.1h-.08.22l-.07-.09h-.07l-.06-.11h-.25v-.3l-.2.08h-.19l-.17.15h-.26L16 2.29h-.22l-.08.09V2.15v.09l.06-.12L16 2h.09-.24l-.08.09h-.1l-.08.09-.08.09h-.12l-.18.13h-.07l-.14.09h-.17l-.07.06.05-.16h-.05l-.08.06-.14.06-.16.05.42-.53.45-.25H15l.09-.06H15v-.07h-.22l-.06-.07-.21.11-.17-.14h-.13v-.1l-.21.04h-.13l-.11.06h-.05l-.28-.1v-.33h-.07v.24h-.06v-.15H13v.1h-.52v.11h-.21v-.19l-1.09-.05L10 1v.23h-.09L7.63 1 5.34.52v.07L5.2.56V.51L3 0h-.07v.12H2.9l.1.17h-.11V.47H3v.1-.13h.06V.38l-.23.03h-.14L2.44.3 2.2.11V.94h.05v.23-.03L2 1.31H2.23l.07.09h-.07v-.05h-.06l-.11-.06L2 1.7l-.39 1-.1.13h-.08l-.16.26v.14l-.06.26v.43l-.1.22-.08.13-.03.12v.14l.12.33V5L1 5.08v.26l.11.25.06.07.05.17v-.07.13l.03.11.05.06.08.11v-.05.32l.06.15v.09l-.08.08v.13l.07.12.09.31.13.18v.2l.07.08-.07.3.06.07h.06v.07l.06.07.2.06.2.08v.14l.12.09h.09V8.78h.09l.09.13v.69h.12v.17l1 .12 1.52.91.94.14.8.06v-.07h.22v-.18l.61.08.12.19.27.3.26.25.09.26V12l.09.17.12.1.19.16.34.21h.09l.1-.1.1-.23.06-.06h.53l.09.1.17.23.15.32v.1l.25.35.12.1v.28l.11.17.06.18.13.06v.1l.42.2h.24l.23.11h.07l-.11-.24V13.84h-.1v-.08l.09.06.08-.2-.07-.09h.13v-.12h-.05.11v-.13h.05l.13-.06h-.06l.15-.22.06.07h.18l-.11.08L13 13l.28-.19.06-.06.12-.12-.06-.17h.06v.12h.13l-.12.09.33-.17h.1v-.07l.06-.1h.11l.25.09h.28v-.06l.11-.08h.07l.08.11h.09v.07H15.07 15h.26l.08-.08h.1l.09.1h.05v-.15h.09v.07h.09l.09.06v.11l.06-.06.06-.11.03-.07h-.17l-.08-.06h.14v-.12h-.05l-.06.08h-.06l.09-.09h.11l.06.06.05.13v.1-.1l.09-.09h.22v-.05h.12l.08.08-.13.05h.22l.1-.12v-.21H17v.07l-.1.06.25-.06.19-.07h.07-.15l.34.1h.07v.06l.16.12v-.05.08l.28-.07.11-.09h.08v-.09h.12l.19.07.22.24.29.19.07.08v.6l.05.06h.06v-.06h.07l-.09.2.17.23.12.1v-.05h.08v.18l-.05-.07.06.1h.06l.05.16.06.08.19.06.16.23h.1-.09.31l-.05.12.09-.12h.06l.06-.07v-.18l.05-.16v-.44l-.07-.25.07-.35-.19-.32.2.35-.4-.64-.08-.21.05.06v.14-.11.2l.1.15-.1-.21v-.13L20 11.7l-.1-.19-.18-.51h-.06v-.22l.05-.05v-.06h.07v-.05l.06-.07-.05-.1.08.08v.1H20l.06-.06-.06-.35h.06v-.08h-.08.12l.17-.11h.06l.07-.07v-.1l.12-.09v-.11.08-.12l.07-.14.1-.11.31-.06v-.18.15-.25l.14-.2V8.7l.06.06.06-.08h.17l.08-.07V8.49H21.36v-.14l-.16-.07H21.42l.11-.22v-.24l-.05-.12-.06.06v.06-.12l-.23.07h.13v-.12l.16.06-.08-.14h.08v.07l.17.23-.12-.18-.05-.08h.06l-.07-.17v.08l.16.28-.12-.21-.05-.11h.16l-.1-.14h-.22l-.11-.11h-.15.18l.1.07h.06v-.31l.07-.07v-.21.08h.09l-.07.18v.16V6.98l.07-.06V6.46h-.23V6.3h.21-.06v-.08h-.09v-.83.12-.35h-.1v-.08h-.05v-.23V5l.06-.1v.11l.64-.01h.16v.08l.08-.08.47-.35h-.07l-.15.12v-.05l.07-.12-.11.13-.17.06v-.08l.19-.1.6-.09-.11-.27V4.2v.07l.15-.17.05.09h.1l.18-.19h.08l-.06-.1h-.17.06l.06.08H22.9v-.06h.08-.07v-.06L23 3.6v-.06l.06-.1h.05v-.16l-.06-.1L23 3v-.26.06-.07l.06-.08v-.27.14h.12v-.2h.05l.06.06v-.16h.07l.09-.11H24V2h-.06zm-8.07.27zm6.74 1.93h.2zm.09-.43zm-2.88 9.83zM2.86.61h-.05zM16.38 3l-.05.07.13-.07v-.12l.16-.11h.15l.15.08v-.06h.05v.13H17v.28-.05.07h-.05l-.1.14h-.07l-.08.11-.05.11v.16L16.5 4l.05.15v.1l.15.33v.21l-.05.21-.07.18v.05-.11L16.44 5l-.05-.12v-.16l.07-.26v-.15l.07-.12V4l.06-.24h-.08l-.07.12-.06.06.06-.22.1-.09-.06-.06v-.11h-.1v-.18h-.05l.11-.3zM2.45 1.64zm.19-.72zm-.25.57zm18.68 5.17H21h.09l.05.06zm-6.43-.41zm1.53-3.1v.08-.08zM2.84.91L2.75 1h-.07.06V.94zm14 10.73v.05zm4.45-4.78l.15.09h.05V7h-.07zm.22 0l-.15-.07h-.14l-.07-.05.05.06h.21l-.05-.1-.13-.09.07.09h.14v-.1h.07v.08h.09zM3 .4zm-.11.28V.8.72zm-.06 0l-.15.1.07-.11.07-.06zm-.66.49zM12 13.76v-.06zm1.35-1.33zM15.5 12h-.09l.07-.11.13.05h.08zm4.24 1.52zm1.64-5.06h-.06.07zm0-1.36l-.07-.1.13.07zM22 4.82zm.77-.64h.05zm.51-.29l.08.06h-.05zm-.16.11zM4.96 13.68l-.04.02.05.06.01.07.02-.01v-.11l-.04-.03zM5.07 13.93l.02.03.02-.06-.04.03zM5.2 14.01l-.09-.06.12.09-.01-.04-.02.01zM1.09 13.04l.04.04-.06-.07.02.03zM4.75 13.57l.08.02-.02-.05-.04.01.03-.02v-.04l-.05-.01-.02.04-.02-.05-.04.04-.02-.02-.01.05.09.09h.02v-.06z"/>\n <path d="M4.83 13.61l-.06-.02-.02.06.02.06.02-.06.04.03-.01.04.06.02.04.08-.02-.1-.07-.11zM7.47 13.47l.04.09.07-.01.02-.03-.04-.04-.09-.01zM1.51 14.43v-.03h-.02l.02.03zM4.54 13.38l.01-.01h-.01v.01zM1.68 8.39l-.04.01.06.02-.02-.03zM14.81 2.47l-.04.02.04.01v-.03zM14.75 2.58l.04-.05-.07.05h.03zM15.97 11.94l-.01-.01.02-.05-.08.06.06.01-.03.02.06.01v-.02l.01-.05-.03.03zM15.38 1.9l.12-.08.04-.06.06-.02.01-.02.11-.08.04-.08-.22.14-.02.06-.22.12-.01.06.09-.02V1.9zM20.08 14.59l.03-.01v-.05l-.03.06zM2.83.22L2.8.27l.03.02V.22zM20.37 14.47l.06-.03-.11.04.05-.01zM20.21 14.54l.02-.01-.05-.05.03.06zM2.78.24L2.74.17l-.01.05.05.04V.24zM19.67 13.61l.06-.01-.09-.04.03.05zM18.09 12.01l.07-.06-.1.06h.03zM21.94 5.57l.01-.04-.04.13.03-.09zM16.81 3.03l-.02-.06-.02.09.02.01.02-.04zM23.57 2.33l-.02.11.04.01v-.04l.04-.02-.06-.06zM23.46 2.53l.02-.02-.03-.02.01.04zM16.3 3.26v-.03l-.03-.01v.05l.03-.01zM23.05 4.3l.03.02.1-.06-.06-.03-.07.07zM23.37 4.23l-.07.05.11-.02-.04-.07v.04zM16.16 12.16l.01-.03-.03.06.02-.03zM17.47 2.74l-.06.03.12.02.03-.05-.08-.04-.01.04zM18.04 12.02l.02-.01-.08.02.06-.01zM14.72 12.28l.01-.01-.06-.04-.06.02.08.04-.03.01.11.06.01-.04-.06-.04zM.34 14.54h.01-.01z"/>\n <path d="M8.02 13.55l.1-.01.07-.07-.17-.12-.12.01-.06-.07-.04.01-.02.05.04.08.08.01.01.03-.03-.02-.11.01-.06-.06H7.7l-.03-.03h-.06l.04-.04-.26-.03-.03-.01-.02.07.23.03.01-.01.04.08h.04l.04.06.07.01.04.11.16-.02.06-.06-.01-.01zM2.83.21l.05.04-.01-.02-.03-.06V.16l.02.02.03-.01-.04-.04-.05.03.03.03v.02zM2.9.26l.03.02V.22L2.9.26zM16.69 3.4l-.03-.01v.05l.04-.01-.01-.03zM22.84 4.71l-.16.11.02-.04.08-.12-.13.13-.42.13-.02.06-.03-.01-.07.06-.04.1.01.03.06-.05.04.01-.04.04.3-.13.52-.36-.08.05-.04-.01zM19.55 4.19l.02.04.03-.03-.05-.01zM21.99 5.22l.02-.01.04-.08-.05.03-.01.06zM21.9 5.7l.01-.04-.03.15.02-.11zM17.38 2.33h-.02l-.02.03.05.06-.01-.09zM17.64 2.59l-.07-.04v.04l-.06.03.11.02.02-.05zM16.95 2.89l-.02-.06-.02.09.02.01.02-.04zM23.43 4.13l-.06.02.11-.01-.05-.04v.03zM8.72 14.1l-.01-.08-.07-.07-.37-.18-.03.07.02.05-.14-.07-.04.06.04.08-.12.16.08.2.01.18.11.05.05-.02v.01l.12.07.06-.03.02-.06.13-.1.14-.04.15-.13-.11-.14-.04-.01zM7.77 13.21l-.29-.04-.02-.01-.03.08.25.04.09-.07zM5.85 12.66l-.03-.01-.07.07-.01.07.03-.03.06-.04.02-.06zM7.13 13.14l.1-.03-.05-.09h-.04l-.1-.16-.09.07-.09.01.07.13-.01.02h-.09l.09.15h.07l-.03-.03h.03l.09.06.09-.02-.05-.09h-.03l-.06-.09.1.07zM2.63 9.22l-.01-.04-.1-.07.04.09.07.02zM1.75 8.57l.05.02-.01-.04-.04.02zM1.85 8.67l.06.01.04-.03-.04-.03-.08-.02.02.07zM2.1 8.66l-.09-.05-.01.05.03.02h.12l-.05-.02zM2.04 9.13l.05.01-.01-.03-.04-.02v.04zM2.46 9.36l.03.11.05.02-.06-.14-.02.01zM1.49 14.44v.07h-.34l-.06.07.11-.05-.05.05.12-.06h.26zm-.06 0zM.51 14.56l.12.05-.06-.03-.06-.02zM1.54 12.38l-.1-.02-.03-.03-.01.08h.08l.08.12.04-.03h.06l-.07-.05-.05-.07zM.06 14.48L0 14.44v.01-.01l.01.06.04-.02h.01zM.69 14.58l-.01-.01-.02.02.02.01.02-.01h.03l-.01-.03-.03.02zM.13 14.48l-.08.02h.01-.01l.06.02.02-.04zM.19 14.51v-.03l-.01.02-.01-.01-.05.06.07-.01H.18.2l-.01-.03zM1.14 12.96l-.02-.03.06.08-.04-.05zM.5 14.55l.02-.04H.47v.01H.46v.01H.35l.04.01H.35l.06.02h.07l.01-.01H.5zM5.1 13.39l-.05.01-.04-.03.12.25.05-.08-.08-.13.07.07-.07-.09zM4.78 13.29v-.01.01zM5.57 13.86l.01.05.04.02-.01-.04-.04-.03z"/>\n <path d="M5.61 13.85l.01-.06-.07-.08-.03.04.03.14.02-.06.04.02zM5.36 13.65l.01-.01-.04-.03v.04h.03zM1.58 14.42v-.03l-.02.01.02.02z"/>\n <path d="M5.46 13.61l-.09-.08v-.02l-.19-.2-.21-.12-.05-.07-.03-.02-.08.06v.1l-.03.03.09.03-.01-.06.04.02-.02.02.04.08h.09l-.09-.17v-.05l.11.18.07.03.02-.07.01.09.04.04.06-.03-.03.02.06.04H5.2l.05.09h.07l.11.1.08.02-.03.02.01.13.02.01v-.08l.07-.07.08.14-.02.04.04.06.04-.01.02-.12-.06-.15-.22-.03zM2.32 14.3v-.03l-.05.07.05-.04zM2.22 14.25l-.01.03h.04l-.01-.04-.02.01zM3.12 13.65l.01.02-.06.04h-.05l-.04-.01.01.02-.07.04.05.02.07-.06.02.02.01-.03.05.02.07-.05.02.01.01-.02-.05-.01-.05-.01zM3.02 13.95l-.02.04.02-.04zM3.12 13.77v.05H3V13.97v-.07l-.06.05v.1h.24V14zm-.12.17zM21.89 6.75l.02-.08-.04.08h.02zM12.24 13.66l-.04.16.01-.03.15-.3-.12.17zM13.37 12.73l.14-.11-.16.12.02-.01zM12.51 13.3l.19-.13-.18.11-.01.02zM12.2 13.84l-.01.22.1.4.01-.02-.09-.37-.01-.23zM12.39 13.44l.08-.11v-.02l-.08.13zM21.89 8l-.05-.16v.26h-.05.06V8l-.05-.21zm0 .1zM16.15 12.09l-.03.06.02-.03.01-.03zM20.71 14.31l.09-.13.04-.14-.04.05-.09.22zM20.49 14.49l.06-.04-.11.05.05-.01zM20.32 14.56l.02-.01-.05-.05.03.06zM20.19 14.61l.04-.01-.01-.06-.03.07z"/>\n</svg>\n':'<svg xmlns="http://www.w3.org/2000/svg" width="30" fill="none" viewBox="-4 -2 30 30"><g id="reset-button-animated"><path d="M3.99724 5.29014C5.81631 3.53623 8.296 2.5 11 2.5C16.7761 2.5 21.5 7.22386 21.5 13C21.5 18.7761 16.7761 23.5 11 23.5C6.13443 23.5 2.07112 20.0837 0.891647 15.6279L0.725426 15H1.375H4H4.35547L4.47225 15.3357C5.40587 18.0199 7.9734 20 11 20C14.8489 20 18 16.8489 18 13C18 9.15114 14.8489 6 11 6C9.20714 6 7.69983 6.6669 6.46753 7.76042L10.1036 11.3964L10.9571 12.25H9.75H1H0.5V11.75V3V1.79289L1.35355 2.64645L3.99724 5.29014Z" fill="#343A40" stroke="#343A40"/></g></svg>\n\n'}onRemove(){this.container?.remove()}}class l extends((0,r.Z)((0,o.Z)(n.default))){constructor(t){super(t);const{icon:e,wrapperId:i,offsetBottom:n,scale:r}=t;this.icon=e,this.wrapperId=i,this.offsetBottom=n,this.center=this.map.getCenter(),this.pitch=this.map.getPitch(),this.bearing=this.map.getBearing(),this.zoom=this.map.getZoom(),this.scale=r,this.data=t.loader.behaviorManager.findBehavior("us_elections_2020")?.data,this._init()}onClick(){if("defaultIcon"===this.icon){const t=document.getElementById("reset-button-animated");t&&(t.classList.remove("reset-button-animation"),t.getBBox(),t.classList.add("reset-button-animation"))}this.data?this.data.reset():this.map.easeTo({center:this.center,zoom:this.zoom,pitch:this.pitch,bearing:this.bearing})}_init(){this.control=new a(this.icon,this.wrapperId,this.onClick.bind(this),this.scale),this.control.applyOffset(this.originalScreenPosition,Boolean(this.wrapperId),this.offsetBottom,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-reset-button"]}static get featurePrefixes(){return["custom-adornment-reset-button"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.icon=t.properties["mc-reset-button-icon"],e.wrapperId=t.properties["wrapper-id"],e.offsetBottom=t.properties["offset-bottom"],e.scale=t.properties.scale,e}}},1966:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return u}});var n=i(4330);const r=Object.freeze({KM:"kilometer",MI:"mile",NM:"nauticalMile",FT:"foot",M:"meter"});var o=r;const s=Object.freeze({get[r.KM](){return"km"},get[r.MI](){return"mi"},get[r.NM](){return"nm"},get[r.FT](){return"ft"},get[r.M](){return"m"}});function a(t,e,i){if(e===i)return t;const n={[o.KM]:1,[o.MI]:1.609,[o.NM]:1.852,[o.M]:.001,[o.FT]:3048e-7};return t*n[e]/n[i]}var l=i(5714),c=i(1042);class u extends l.default{scale={};significantNumbers=[10,5,3,2,1];longestPossibleLabel="40000 km";constructor(t){super(t);const{unit:e,maxWidth:i,fontFamily:n,fontSize:r}=t;if(void 0===e||void 0===i||void 0===n||void 0===r)return;this.unit=e,this.maxWidth=i,this.fontFamily=n,this.fontSize=r;const o="string"==typeof this.fontSize?this.fontSize:`${this.fontSize}px`;this.ctx=document.createElement("canvas").getContext("2d"),this.ctx.font=`${o} ${this.fontFamily}`,this.map.on("move",(()=>this.update())),(0,c.PQ)((()=>{this.emit("ready"),this.update()}))}update(){const t=this.map.project(this.map.getCenter()),e=(0,c.YE)(this.map.getCenter(),this.map.unproject([t.x+this.maxWidth,t.y]));for(const t of[o.KM,o.M,o.MI,o.FT,o.NM]){const i=a(e,o.M,t),n=s[t],r=this.getRoundNum(i)||0,l=r<1?`${(0,c.z5)(r).join("/")} ${n}`:`${r} ${n}`;this.scale[t]={value:i,unit:n,maxMeters:e,distance:r,ratio:r/i,humanized:l}}this.svg=this.render()}render(){throw new Error("Not implemented")}getRoundNum(t){const e=10**Math.floor(Math.log10(t)),i=t/e;for(const t of this.significantNumbers)if(i>=t)return t*e;return this.getDecimalRoundNum(i)*e}getDecimalRoundNum(t){const e=10**Math.ceil(-Math.log(t)/Math.LN10);return Math.round(t*e)/e}getScale(t=this.unit){return t===n.Z.IMPERIAL?this.scale[o.FT].value>5280?this.scale[o.MI]:this.scale[o.FT]:t===n.Z.METRIC?this.scale[o.M].value>1e3?this.scale[o.KM]:this.scale[o.M]:t===n.Z.NAUTICAL?this.scale[o.NM]:void 0}measureText(t){return Math.ceil(this.ctx.measureText(t).width)}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.maxWidth=t.properties["mc-max-width"],e.unit=t.properties["mc-unit"],e.fontFamily=t.properties["mc-font-family"],e.fontSize=t.properties["mc-font-size"],e}}},6328:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(1966),r=i(1042);class o extends n.default{color;constructor(t){super(t),this.color=t.color}render(){const t=this.getScale(),e=Math.round(this.maxWidth*t.ratio),i=t.humanized.toUpperCase(),n=(0,r.f)(this.color),o=Math.max(this.maxWidth,this.measureText(this.longestPossibleLabel)),s=parseInt(this.fontSize,10);return`\n <svg\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n version="1.1"\n width="${o}"\n height="${s}"\n viewBox="0 0 ${o} ${s}"\n style="display: block; visibility: ${this.element.style.visibility}"\n >\n <g>\n <line\n x1="0"\n y1="0"\n x2="${e}"\n y2="0"\n stroke="${n.color}"\n stroke-width="5"\n stroke-opacity="${n.opacity}"\n />\n <text\n y="${this.fontSize}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n fill="${n.color}"\n fill-opacity="${n.opacity}"\n >${i}</text>\n </g>\n </svg>\n `}static get featurePrefixes(){return["custom-adornment-maps4news-line-scalebar"]}static get layerPrefixes(){return["custom-adornment-maps4news-line-scalebar"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.color=t.properties["mc-color"],e}}},5238:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return s}});var n=i(1042),r=i(1966),o=i(4330);class s extends r.default{color;constructor(t){super(t),this.color=t.color}render(){return this.unit===o.Z.METRIC_AND_IMPERIAL?this.renderDoubleUnit():this.renderSingleUnit()}renderDoubleUnit(){const t=this.getScale(o.Z.METRIC),e=this.getScale(o.Z.IMPERIAL),i=Math.round(this.maxWidth*t.ratio),r=Math.round(this.maxWidth*e.ratio),s=Math.max(i,r),a=this.fontSize+2+5,l=(0,n.f)(this.color),c=this.maxWidth+this.measureText(this.longestPossibleLabel),u=2*this.fontSize+14;return`\n <svg\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n version="1.1"\n width="${c}"\n height="${u}"\n viewBox="0 0 ${c} ${u}"\n style="display: block; visibility: ${this.element.style.visibility}"\n >\n <g>\n <line\n x1="0"\n y1="${a-.5}"\n x2="${s}"\n y2="${a-.5}"\n stroke="${l.color}"\n stroke-width="1"\n stroke-opacity="${l.opacity}"\n />\n <line\n x1="0.5"\n y1="${a-5}"\n x2="0.5"\n y2="${a+5}"\n stroke="${l.color}"\n stroke-width="1"\n stroke-opacity="${l.opacity}"\n />\n <line\n x1="${r-.5}"\n y1="${a-5}"\n x2="${r-.5}"\n y2="${a}"\n stroke="${l.color}"\n stroke-width="1"\n stroke-opacity="${l.opacity}"\n />\n <line\n x1="${i-.5}"\n y1="${a}"\n x2="${i-.5}"\n y2="${a+5}"\n stroke="${l.color}"\n stroke-width="1"\n stroke-opacity="${l.opacity}"\n />\n <text\n x="0"\n y="${a+7+this.fontSize}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n font-weight="bold"\n fill="${l.color}"\n fill-opacity="${l.opacity}"\n text-anchor="start"\n >0</text>\n <text\n x="${r-2}"\n y="${a-7}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n font-weight="bold"\n fill="${l.color}"\n fill-opacity="${l.opacity}"\n text-anchor="start"\n >${e.humanized}</text>\n <text\n x="${i-2}"\n y="${a+7+this.fontSize}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n font-weight="bold"\n fill="${l.color}"\n fill-opacity="${l.opacity}"\n text-anchor="start"\n >${t.humanized}</text>\n </g>\n </svg>\n `}renderSingleUnit(){const t=this.getScale(),e=Math.round(this.maxWidth*t.ratio),i=t.humanized,r=(0,n.f)(this.color),o=this.maxWidth+this.measureText("10000 km"),s=12+this.fontSize;return`\n <svg\n xmlns="http://www.w3.org/2000/svg"\n xmlns:xlink="http://www.w3.org/1999/xlink"\n version="1.1"\n width="${o}"\n height="${s}"\n viewBox="0 0 ${o} ${s}"\n style="display: block"\n >\n <g>\n <line\n x1="0"\n y1="4.5"\n x2="${e}"\n y2="4.5"\n stroke="${r.color}"\n stroke-width="1"\n stroke-opacity="${r.opacity}"\n />\n <line\n x1="0.5"\n y1="0"\n x2="0.5"\n y2="10"\n stroke="${r.color}"\n stroke-width="1"\n stroke-opacity="${r.opacity}"\n />\n <line\n x1="${e-.5}"\n y1="0"\n x2="${e-.5}"\n y2="10"\n stroke="${r.color}"\n stroke-width="1"\n stroke-opacity="${r.opacity}"\n />\n <text\n x="0"\n y="${this.fontSize+12}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n fill="${r.color}"\n fill-opacity="${r.opacity}"\n font-weight="bold"\n text-anchor="start"\n >0</text>\n <text\n x="${e-2}"\n y="${this.fontSize+12}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n fill="${r.color}"\n fill-opacity="${r.opacity}"\n font-weight="bold"\n text-anchor="start"\n >${i}</text>\n </g>\n </svg>\n `}static get featurePrefixes(){return["custom-adornment-modern-scalebar"]}static get layerPrefixes(){return["custom-adornment-modern-scalebar"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.color=t.properties["mc-color"],e}}},3728:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return o}});var n=i(1966),r=i(1042);class o extends n.default{color;backgroundColor;constructor(t){super(t),this.color=t.color,this.backgroundColor=t.backgroundColor}render(){const t=this.getScale(),e=t.humanized,i=(0,r.f)(this.color),n=(0,r.f)(this.backgroundColor),o=Math.max(Math.round(this.maxWidth*t.ratio),this.measureText(e)+6),s=parseInt(this.fontSize,10),a=Math.max(Math.round(this.maxWidth),this.measureText(this.longestPossibleLabel)+6);return`\n <svg\n xmlns="http://www.w3.org/2000/svg"\n version="1.1"\n width="${a}"\n height="${s}"\n viewBox="0 0 ${a} ${s}"\n style="display: block; visibility: ${this.element.style.visibility}"\n >\n <g>\n <rect\n width="${o}"\n height="${s}"\n fill="${n.color}"\n fill-opacity="${n.opacity}"\n />\n <line\n x1="1"\n y1="0"\n x2="1"\n y2="${s}"\n stroke-width="2"\n stroke="${i.color}"\n stroke-opacity="${i.opacity}"\n />\n <line\n x1="${o-1}"\n y1="0"\n x2="${o-1}"\n y2="${s}"\n stroke-width="2"\n stroke="${i.color}"\n stroke-opacity="${i.opacity}"\n />\n <text\n x="3"\n y="${this.fontSize}"\n font-size="${this.fontSize}"\n font-family="${this.fontFamily}"\n fill="${i.color}"\n fill-opacity="${i.opacity}"\n >\n <tspan dy="-2px">${e}</tspan>\n </text>\n </g>\n </svg>\n `}static get featurePrefixes(){return["custom-adornment-simple-style-scalebar"]}static get layerPrefixes(){return["custom-adornment-simple-style-scalebar"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.color=t.properties["mc-color"],e.backgroundColor=t.properties["mc-background-color"],e}}},3900:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return f}});var n=i(1999),r=i(4386),o=i(4962),s=i(5574),a=i(5704),l=i(1823),c=i(7551);Object.freeze({"administrative-region":"World-country-name","city-town-village":"Placename-bigcity",recreation:"Landusename-park",airport:"Poi-airport",restaurant:"Poi-restaurant","railway-station":"Poi-railway","sea-name-world":"Watername-ocean"});const u=Object.freeze({Country:"World-country-name",Continent:"World-continent-name",City:"Placename-bigcity",Park:"Landusename-park",Plain:"Landusename-park","Parks and Outdoors":"Landusename-park",Airport:"Poi-airport",POI:"Poi-restaurant","Continental Food":"Poi-restaurant",Snacks:"Poi-restaurant","Bar or Pub":"Poi-restaurant","Fast Food":"Poi-restaurant","Train Station":"Poi-railway",Ocean:"Watername-ocean"});Object.freeze({"World-country-name":"administrative-region","World-continent-name":"administrative-region","Placename-bigcity":"city-town-village","Landusename-park":"recreation","Poi-airport":"airport","Poi-restaurant":"restaurant","Poi-railway":"railway-station"}),Object.freeze({Country:"World-country-name",Continent:"World-continent-name",City:"Placename-bigcity","Capital City":"Placename-capital","Parks and Outdoors":"Landusename-park",Airport:"Poi-airport",Restaurant:"Poi-restaurant","Train Station":"Poi-railway",Ocean:"Watername-ocean"});class h{get host(){return"https://utility.arcgis.com/usrsvcs/appservices/eJhxE4Wd1m94t6Lq/rest/services/World/GeocodeServer"}getLocationAtCenter(t="",e={lat:0,lng:0}){return async i=>{const n=await this._callArcGIS("findAddressCandidates",{maxLocations:10,SingleLine:t,location:`${e.lng},${e.lat}`},i);return this._mapResults(n.candidates)}}async getLocationInBounds(t="",e=[[-90,-180],[90,180]]){(0,l.pX)(e[0])||(e[0]=[-90,-180]),(0,l.pX)(e[1])||(e[1]=[90,180]);const i=await this._callArcGIS("findAddressCandidates",{maxLocations:10,SingleLine:t,searchExtent:`${e[0][1]},${e[0][0]},${e[1][1]},${e[1][0]}`});return this._mapResults(i.candidates)}getLocationForAddress(t){return this.getLocationInBounds(t)}getLocationForAddresses(t){const e={records:[]};for(let i=0;i<t.length;i++)e.records.push({attributes:{OBJECTID:i,SingleLine:t[i][1]}});const i=new FormData;return i.append("f","json"),i.append("addresses",JSON.stringify(e)),i.append("langCode","en"),async t=>{const e=await fetch(`${this.host}/geocodeAddresses`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:i,signal:t});return(await e.json()).locations.sort(((t,e)=>t.attributes.ResultID-e.attributes.ResultID)).map((t=>({lng:t.location.x,lat:t.location.y})))}}async _callArcGIS(t,e,i=void 0){const n={f:"json",langCode:a.Z.localeMaplibreCompat,outFields:"type,city,region,country"},r=await fetch(`${this.host}/${t}?${new URLSearchParams({...n,...e})}`);return await r.json()}_filterSubTitle(t){return[t.attributes.type,t.attributes.city,t.attributes.region,t.attributes.country].filter(Boolean)}_mapResults(t){return t.map((t=>({id:(0,c.kebab)(`${t.address}_${t.attributes.type}_${this._filterSubTitle(t).join("_").replace(" ","_")}`),title:t.address,labelTitle:t.address.split(",")[0],category:u[t.attributes.type],position:{lng:t.location.x,lat:t.location.y},bbox:t.extent?[{lng:t.extent.xmin,lat:t.extent.ymin},{lng:t.extent.xmax,lat:t.extent.ymax}]:null,subtitle:this._filterSubTitle(t).join(", ")})))}}const d=265;class p extends s.T{wrapperId;initialScale;loader;dimension;suggestions;geocoder;stackingOrder;searchBar;_closedButtonClicked;constructor(t,e,i,n,r){super(),this.map=t,this.wrapperId=e,this.initialScale=i??1,this.loader=n,this.dimension=r,this.suggestions=[],this.geocoder=new h}onAdd(){return this.container.classList.add("adornment-collision"),this.container.style.order=this.stackingOrder,this.container.style.zIndex=1,this.container.addEventListener("click",this._onClickSearch.bind(this)),this.map.getCanvas().addEventListener("click",this._onClickOutside.bind(this)),window.document.addEventListener(this._fullscreenchange,(()=>this._update())),this._update(),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.searchBar&&(this.container.querySelector(".search-bar-clear-button").addEventListener("click",(t=>{const e=this.container.querySelector("#searchBarInput");e.value?(e.value="",this.suggestions=[],this.container.querySelector(".search-suggestions").innerHTML=[]):(this._closedButtonClicked=!0,this.hideSearchBar())})),this.container.querySelector("#searchBarInput").addEventListener("input",(async t=>{const e=t.target.value.toLowerCase();e.length<2||(this.suggestions=await this.geocoder.getLocationInBounds(e),this._renderSuggs())})))}hideSearchBar(){this.searchBar&&(this.searchBar=null,this.checkAdornments(),this._update())}checkAdornments(){const t=Array.from(document.querySelectorAll(".web-map-adornment")).filter((t=>!(t.classList.contains("search-bar")||t.classList.contains("search-button"))));let e,i=0,n=0;if(this.searchBar&&(e=this.container.querySelector(".search-button").getBoundingClientRect(),i=this._getScale()*d,e)){const r=e.width+i;n=Math.max(0,e.left+r-window.innerWidth);let o=r;if(t.forEach((t=>{const{top:i,bottom:n,width:r}=t.getBoundingClientRect();(e.top<=i||e.bottom>=n)&&(o+=r+5)})),o+10<=window.innerWidth)return;for(const r of t){const t=r.getBoundingClientRect(),o=this.searchBar&&!(e.right+i<=t.left-5||e.left-n>=t.right+5||e.bottom<=t.top-5||e.top>=t.bottom+5);r.parentNode.style.display=o?"none":"flex"}}}_getScale(){return this._isFullscreen()?this.initialScale:.7*this.initialScale}_buildHtml(){const t=this._getScale(),e=20*t,i=this._fromSvgString('<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m20 16.768-4.444-4.445a9.194 9.194 0 0 0 1.01-4.04 8.283 8.283 0 1 0-8.283 8.283 8.365 8.365 0 0 0 3.838-1.01L16.566 20 20 16.768ZM4.848 8.485A3.414 3.414 0 0 1 8.283 5.05a3.434 3.434 0 1 1-3.435 3.434Z" fill="#343A40"/></svg>\n');i?.setAttribute("width",String(e)),i?.setAttribute("height",String(e));const n=i?.outerHTML;return`\n <div class="search-wrapper">\n <div class="web-map-adornment search-button" style="${`width: ${50*t}px; height: ${50*t}px; ${this.searchBar?"border-top-right-radius: 0px; border-bottom-right-radius: 0px;":""}`}">\n ${n}\n </div>\n ${this.searchBar?this._buildSearchBarHtml():""}\n </div>\n `}_buildSearchBarHtml(){const t=this._getScale(),e=12*t,i=this._fromSvgString('<svg\n width="33"\n height="33"\n viewBox="0 0 33 33"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n>\n <path\n d="M25.5967 0.84795L0.847954 25.5967L7.00304 31.7518L31.7518 7.00303L25.5967 0.84795Z"\n fill="black"\n />\n <path\n d="M7.38735 1.36138L1.2322 7.51653L25.9809 32.2653L32.1361 26.1101L7.38735 1.36138Z"\n fill="black"\n />\n</svg>\n');i?.setAttribute("width",String(e));const n=i?.outerHTML,r=`min-width: ${50*t}px; min-height: ${50*t}px;`;return`\n <div class="search-bar-wrapper">\n <div class="web-map-adornment search-bar" style="${`width: ${t*d}px; height: ${50*t}px; border-radius: 0px;`}">\n <input type="text" id="searchBarInput" class="search-bar-input" style="${`\n padding: ${11*t}px ${10*t}px;\n font-size: ${15*t}px;\n letter-spacing: ${.113*t}px;`}" placeholder="${a.Z.t("search.flyTo")}" />\n <div class="search-bar-clear-button" style="${r}">\n ${n}\n </div>\n </div>\n <div class="search-suggestions" style="width: ${t*d}px;"/>\n </div>\n `}_renderSuggs(){const t=this._isFullscreen()?this.initialScale:.7*this.initialScale,e=`\n min-width: ${t*d}px;\n min-height: ${40*t}px;\n max-height: ${40*t}px;\n padding: ${11*t}px ${10*t}px;\n font-size: ${15*t}px;\n letter-spacing: ${.113*t}px;`,i=this.container.querySelector(".search-suggestions");i.innerHTML="";const{top:n,bottom:r}=this.container.getBoundingClientRect();n>window.innerHeight-r&&(i.style.top=-this.suggestions.length*t*40+"px");for(const t of this.suggestions){const n=document.createElement("div");n.setAttribute("style",e),n.className="search-sugg",n.innerHTML=`<span>${t.labelTitle}</span><span style="color: grey; margin-left: 3px; overflow: hidden; text-overflow: ellipsis;">${t.subtitle}</span>`,n.addEventListener("click",(e=>{t.bbox?this.map.fitBounds(t.bbox):this.map.easeTo({center:t.position,zoom:16},{linear:!0}),this.suggestions=[],this._renderSuggs()})),i.appendChild(n)}}_onClickOutside(){this.hideSearchBar()}_onClickSearch(){this._closedButtonClicked?this._closedButtonClicked=!1:this.searchBar||(this.searchBar=!0,this.checkAdornments(),this._update())}onRemove(){this.container?.remove()}}class f extends((0,r.Z)((0,o.Z)(n.default))){constructor(t){super(t);const{wrapperId:e,offsetBottom:i,scale:n,loader:r,dimension:o}=t;this.wrapperId=e,this.offsetBottom=i,this.scale=n,this.loader=r,this.dimension=o,this._init()}_init(){this.control=new p(this.map,this.wrapperId,this.scale,this.loader,this.dimension),this.control.applyOffset(this.originalScreenPosition,Boolean(this.wrapperId),this.offsetBottom,this.elementOffset),this.loader.controlManager.add(this),this.emit("ready")}static get layerPrefixes(){return["custom-adornment-search-button"]}static get featurePrefixes(){return["custom-adornment-search-button"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.wrapperId=t.properties["wrapper-id"],e.offsetBottom=t.properties["offset-bottom"],e.scale=t.properties.scale,e}}},5097:function(t,e,i){"use strict";i.r(e),i.d(e,{default:function(){return c}});var n=i(1999),r=i(4962),o=i(4386),s=i(5574);class a extends s.T{orientation;initialScale;zoomedToMax;zoomedToMin;stackingOrder;constructor(t){super(),this.orientation=t.orientation,this.initialScale=t.scale??1,this.zoomedToMax=!1,this.zoomedToMin=!1}onAdd(t){return this.map=t,this.container.style.order=this.stackingOrder,this.container.classList.add("zoom-buttons","adornment-collision"),this.map.on("zoomend",(()=>{this.map.getZoom()>=this.map.getMaxZoom()&&(this.zoomedToMax=!0,this._update()),this.map.getZoom()<=this.map.getMinZoom()&&(this.zoomedToMin=!0,this._update())})),window.document.addEventListener(this._fullscreenchange,(()=>this._update())),this._update(),this.container}_update(){this.container.innerHTML=this._buildHtml(),this.container.querySelector(".zoom-in-button").addEventListener("click",(t=>{this.map.zoomIn(),this.zoomedToMin=!1,this._update()})),this.container.querySelector(".zoom-out-button").addEventListener("click",(t=>{this.map.zoomOut(),this.zoomedToMax=!1,this._update()}))}_buildHtml(){const t=this._isFullscreen()?this.initialScale:.7*this.initialScale,e="horizontal"===this.orientation?"zoom-horizontal":"zoom-vertical",i=!0===this.zoomedToMax?"greyed":"",n=!0===this.zoomedToMin?"greyed":"",r=5*t+"px",o=`width: ${50*t}px; height: ${50*t}px`,s=20*t,a=this._fromSvgString('<svg xmlns="http://www.w3.org/2000/svg" width="20" viewbox="0 0 20 20" fill="none"><path fill="#343A40" d="M7.5 0h5v20h-5z"/><path fill="#343A40" d="M20 7.5v5H0v-5z"/></svg>\n');a?.setAttribute("width",String(s));const l=a?.outerHTML,c=this._fromSvgString('<svg xmlns="http://www.w3.org/2000/svg" width="20" viewbox="0 0 20 5" fill="none"><path fill="#343A40" d="M20 0v5H0V0z"/></svg>\n');c?.setAttribute("width",String(s));const u=c?.outerHTML;return`\n <div class="web-map-adornment zoom-buttons ${e}" style="border-radius: ${r}">\n <div class="zoom-button zoom-in-button ${i}" style="${o}">\n ${l}\n </div>\n <div class="zoom-button zoom-out-button ${n}" style="${o}">\n ${u}\n </div>\n </div>\n `}}var l=i(1042);class c extends((0,o.Z)((0,r.Z)(n.default))){constructor(t){super(t),this.options=t,this._init()}_init(){l.tq||(this.control=new a(this.options),this.control.applyOffset(this.originalScreenPosition,Boolean(this.options.wrapperId),this.options.offsetBottom,this.options.elementOffset),this.loader.controlManager.add(this),this.emit("ready"))}static get layerPrefixes(){return["custom-adornment-zoom-buttons"]}static get featurePrefixes(){return["custom-adornment-zoom-buttons"]}static fromFeature(t){const e=super.fromFeature?.(t)??{};return e.orientation=t.properties.orientation,e.scale=t.properties.scale,e}}},1362:function(t,e,i){"use strict";function n(){const t=Array.from(document.querySelectorAll(".vertical-adornment")),e=document.createElement("div");e.classList.add("vertical-wrapper","top-left");const i=document.createElement("div");i.classList.add("vertical-wrapper","top-right");const n=document.createElement("div");n.classList.add("vertical-wrapper","bottom-left");const o=document.createElement("div");o.classList.add("vertical-wrapper","bottom-right"),document.querySelector(".maplibregl-ctrl-top-left")?.appendChild(e),document.querySelector(".maplibregl-ctrl-top-right")?.appendChild(i),document.querySelector(".maplibregl-ctrl-bottom-left")?.appendChild(n),document.querySelector(".maplibregl-ctrl-bottom-right")?.appendChild(o),r();for(const r of t){const t=r.classList;r.style.position="static",t.contains("vertical-top-left")?e.appendChild(r):t.contains("vertical-top-right")?i.appendChild(r):t.contains("vertical-bottom-left")?n.appendChild(r):t.contains("vertical-bottom-right")&&o.appendChild(r)}}function r(){null!==document.querySelector(".vertical-wrapper.top-left")&&(document.querySelector(".vertical-wrapper.top-left").style.top=`${document.querySelector(".maplibregl-ctrl-top-left")?.clientHeight}px`,document.querySelector(".vertical-wrapper.top-right").style.top=`${document.querySelector(".maplibregl-ctrl-top-right")?.clientHeight}px`,document.querySelector(".vertical-wrapper.bottom-left").style.bottom=`${document.querySelector(".maplibregl-ctrl-bottom-left")?.clientHeight}px`,document.querySelector(".vertical-wrapper.bottom-right").style.bottom=`${document.querySelector(".maplibregl-ctrl-bottom-right")?.clientHeight}px`)}function o(){const t=document.querySelector(".maplibregl-ctrl-bottom-right"),e=Array.from(t.childNodes).filter((t=>!t.classList.contains("maplibregl-ctrl-attrib")));if(e.length){const i=document.createElement("div");t.appendChild(i),t.style.flexDirection="column-reverse",i.setAttribute("style","display:flex;flex-direction:row-reverse;align-items:flex-end");for(const t of e)i.appendChild(t)}}i.d(e,{dg:function(){return o},lk:function(){return r},zb:function(){return n}})},3645:function(t,e,i){"use strict";var n=i(1823);e.Z={id:(0,n.Ph)("id"),accessToken:(0,n.Ph)("access-token")||document.querySelector("meta[name=mc-access-token]")?.getAttribute("content"),debug:"true"===(0,n.Ph)("debug")||n.D0,productionJob:"true"===(0,n.Ph)("debug")||!n.HM,get objectUrl(){return this.id?this.accessToken?this.productionJob?`https://cdn.mapcreator.io/jobs/${this.id}.json`:`https://cdn.bleeding.mapcreator.io/jobs/${this.id}.json`:`https://dynamic.maps4news.com/${this.id}/map.json`:location.href.replace(/(\/|\/[^/]+\.[^/.]+)?$/,"/map.json")}}},1823:function(t,e,i){"use strict";function n(t,e=void 0){return e||(e=window.location.href),new URL(e).searchParams.get(t)}function r(t,e){const i=10**e;return Math.round(t*i)/i}function o(t){return[[t.bottomLeft.lon,t.bottomLeft.lat],[t.topRight.lon,t.topRight.lat]]}i.d(e,{A4:function(){return d},D0:function(){return c},HM:function(){return l},I0:function(){return p},Ph:function(){return n},V2:function(){return h},Zd:function(){return r},_m:function(){return v},jj:function(){return m},ou:function(){return g},pX:function(){return _},q_:function(){return f},rm:function(){return y},vU:function(){return o},yU:function(){return a},zd:function(){return u}});const s=2166136261;function a(t){let e=t.split("").map((t=>t.charCodeAt(0))).reduce(((t,e)=>(t^=e)+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)),s);return e^=e<<3,e+=e>>5,e^=e<<4,e+=e>>17,e^=e<<25,e+=e>>6,`0000000${(e>>>0).toString(16)}`.substr(-8)}const l=!1,c=!1;function u(){try{return window.self!==window.top}catch(t){return!0}}function h(t){return t.isStyleLoaded()?Promise.resolve():new Promise((e=>{if(t.isStyleLoaded())e();else{const i=()=>{t.isStyleLoaded()&&(t.off("data",i),e())};t.on("data",i)}}))}function d(t){const e=t.keys().map((e=>[e.match(/(\w+)\./)[1],t(e).default]));return Object.fromEntries(e)}async function p(t){return(await Promise.all(t)).map((t=>t.default))}function f(t){return(new DOMParser).parseFromString(t,"image/svg+xml")}function m(t){return[...new Set(t)]}function g(t){const e=t.slice(t.indexOf("(")+1,t.indexOf(")")).split(",");return(299*e[0]+587*e[1]+114*e[2])/1e3>=128?"#000000":"#FFFFFF"}function y(){return Boolean(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.msFullscreenElement||window.document.webkitFullscreenElement)}function _(t){const e=[[-90,-180],[90,180]],i=t[0]>=e[0][0]&&t[0]<=e[1][0],n=t[1]>=e[0][1]&&t[1]<=e[1][1];return i&&n}function v(t){t&&(t.id=t.properties.id??t.id??t.layer.id)}},2511:function(t,e,i){var n;t=i.nmd(t),function(r){e&&e.nodeType,t&&t.nodeType;var o="object"==typeof global&&global;o.global!==o&&o.window!==o&&o.self;var s,a=2147483647,l=36,c=1,u=26,h=38,d=700,p=72,f=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=l-c,b=Math.floor,w=String.fromCharCode;function S(t){throw new RangeError(v[t])}function E(t,e){for(var i=t.length,n=[];i--;)n[i]=e(t[i]);return n}function k(t,e){var i=t.split("@"),n="";return i.length>1&&(n=i[0]+"@",t=i[1]),n+E((t=t.replace(_,".")).split("."),e).join(".")}function T(t){for(var e,i,n=[],r=0,o=t.length;r<o;)(e=t.charCodeAt(r++))>=55296&&e<=56319&&r<o?56320==(64512&(i=t.charCodeAt(r++)))?n.push(((1023&e)<<10)+(1023&i)+65536):(n.push(e),r--):n.push(e);return n}function A(t){return E(t,(function(t){var e="";return t>65535&&(e+=w((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=w(t)})).join("")}function I(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function M(t,e,i){var n=0;for(t=i?b(t/d):t>>1,t+=b(t/e);t>x*u>>1;n+=l)t=b(t/x);return b(n+(x+1)*t/(t+h))}function C(t){var e,i,n,r,o,s,h,d,g,y,_,v=[],x=t.length,w=0,E=f,k=p;for((i=t.lastIndexOf(m))<0&&(i=0),n=0;n<i;++n)t.charCodeAt(n)>=128&&S("not-basic"),v.push(t.charCodeAt(n));for(r=i>0?i+1:0;r<x;){for(o=w,s=1,h=l;r>=x&&S("invalid-input"),((d=(_=t.charCodeAt(r++))-48<10?_-22:_-65<26?_-65:_-97<26?_-97:l)>=l||d>b((a-w)/s))&&S("overflow"),w+=d*s,!(d<(g=h<=k?c:h>=k+u?u:h-k));h+=l)s>b(a/(y=l-g))&&S("overflow"),s*=y;k=M(w-o,e=v.length+1,0==o),b(w/e)>a-E&&S("overflow"),E+=b(w/e),w%=e,v.splice(w++,0,E)}return A(v)}function z(t){var e,i,n,r,o,s,h,d,g,y,_,v,x,E,k,A=[];for(v=(t=T(t)).length,e=f,i=0,o=p,s=0;s<v;++s)(_=t[s])<128&&A.push(w(_));for(n=r=A.length,r&&A.push(m);n<v;){for(h=a,s=0;s<v;++s)(_=t[s])>=e&&_<h&&(h=_);for(h-e>b((a-i)/(x=n+1))&&S("overflow"),i+=(h-e)*x,e=h,s=0;s<v;++s)if((_=t[s])<e&&++i>a&&S("overflow"),_==e){for(d=i,g=l;!(d<(y=g<=o?c:g>=o+u?u:g-o));g+=l)k=d-y,E=l-y,A.push(w(I(y+k%E,0))),d=b(k/E);A.push(w(I(d,0))),o=M(i,x,n==r),i=0,++n}++i,++e}return A.join("")}s={version:"1.4.1",ucs2:{decode:T,encode:A},decode:C,encode:z,toASCII:function(t){return k(t,(function(t){return y.test(t)?"xn--"+z(t):t}))},toUnicode:function(t){return k(t,(function(t){return g.test(t)?C(t.slice(4).toLowerCase()):t}))}},void 0===(n=function(){return s}.call(e,i,e,t))||(t.exports=n)}()},8575:function(t,e,i){"use strict";var n=i(2511);function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var o=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),u=["%","/","?",";","#"].concat(c),h=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=i(129);function _(t,e,i){if(t&&"object"==typeof t&&t instanceof r)return t;var n=new r;return n.parse(t,e,i),n}r.prototype.parse=function(t,e,i){if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),s=-1!==r&&r<t.indexOf("#")?"?":"#",l=t.split(s);l[0]=l[0].replace(/\\/g,"/");var _=t=l.join(s);if(_=_.trim(),!i&&1===t.split("#").length){var v=a.exec(_);if(v)return this.path=_,this.href=_,this.pathname=v[1],v[2]?(this.search=v[2],this.query=e?y.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var x=o.exec(_);if(x){var b=(x=x[0]).toLowerCase();this.protocol=b,_=_.substr(x.length)}if(i||x||_.match(/^\/\/[^@/]+@[^@/]+/)){var w="//"===_.substr(0,2);!w||x&&m[x]||(_=_.substr(2),this.slashes=!0)}if(!m[x]&&(w||x&&!g[x])){for(var S,E,k=-1,T=0;T<h.length;T++){-1!==(A=_.indexOf(h[T]))&&(-1===k||A<k)&&(k=A)}-1!==(E=-1===k?_.lastIndexOf("@"):_.lastIndexOf("@",k))&&(S=_.slice(0,E),_=_.slice(E+1),this.auth=decodeURIComponent(S)),k=-1;for(T=0;T<u.length;T++){var A;-1!==(A=_.indexOf(u[T]))&&(-1===k||A<k)&&(k=A)}-1===k&&(k=_.length),this.host=_.slice(0,k),_=_.slice(k),this.parseHost(),this.hostname=this.hostname||"";var I="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!I)for(var M=this.hostname.split(/\./),C=(T=0,M.length);T<C;T++){var z=M[T];if(z&&!z.match(d)){for(var P="",L=0,D=z.length;L<D;L++)z.charCodeAt(L)>127?P+="x":P+=z[L];if(!P.match(d)){var R=M.slice(0,T),O=M.slice(T+1),F=z.match(p);F&&(R.push(F[1]),O.unshift(F[2])),O.length&&(_="/"+O.join(".")+_),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var B=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+B,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!f[b])for(T=0,C=c.length;T<C;T++){var $=c[T];if(-1!==_.indexOf($)){var N=encodeURIComponent($);N===$&&(N=escape($)),_=_.split($).join(N)}}var U=_.indexOf("#");-1!==U&&(this.hash=_.substr(U),_=_.slice(0,U));var V=_.indexOf("?");if(-1!==V?(this.search=_.substr(V),this.query=_.substr(V+1),e&&(this.query=y.parse(this.query)),_=_.slice(0,V)):e&&(this.search="",this.query={}),_&&(this.pathname=_),g[b]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){B=this.pathname||"";var q=this.search||"";this.path=B+q}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",i=this.pathname||"",n=this.hash||"",r=!1,o="";this.host?r=t+this.host:this.hostname&&(r=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(r+=":"+this.port)),this.query&&"object"==typeof this.query&&Object.keys(this.query).length&&(o=y.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var s=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||g[e])&&!1!==r?(r="//"+(r||""),i&&"/"!==i.charAt(0)&&(i="/"+i)):r||(r=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),e+r+(i=i.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+n},r.prototype.resolve=function(t){return this.resolveObject(_(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if("string"==typeof t){var e=new r;e.parse(t,!1,!0),t=e}for(var i=new r,n=Object.keys(this),o=0;o<n.length;o++){var s=n[o];i[s]=this[s]}if(i.hash=t.hash,""===t.href)return i.href=i.format(),i;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),l=0;l<a.length;l++){var c=a[l];"protocol"!==c&&(i[c]=t[c])}return g[i.protocol]&&i.hostname&&!i.pathname&&(i.pathname="/",i.path=i.pathname),i.href=i.format(),i}if(t.protocol&&t.protocol!==i.protocol){if(!g[t.protocol]){for(var u=Object.keys(t),h=0;h<u.length;h++){var d=u[h];i[d]=t[d]}return i.href=i.format(),i}if(i.protocol=t.protocol,t.host||m[t.protocol])i.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),i.pathname=p.join("/")}if(i.search=t.search,i.query=t.query,i.host=t.host||"",i.auth=t.auth,i.hostname=t.hostname||t.host,i.port=t.port,i.pathname||i.search){var f=i.pathname||"",y=i.search||"";i.path=f+y}return i.slashes=i.slashes||t.slashes,i.href=i.format(),i}var _=i.pathname&&"/"===i.pathname.charAt(0),v=t.host||t.pathname&&"/"===t.pathname.charAt(0),x=v||_||i.host&&t.pathname,b=x,w=i.pathname&&i.pathname.split("/")||[],S=(p=t.pathname&&t.pathname.split("/")||[],i.protocol&&!g[i.protocol]);if(S&&(i.hostname="",i.port=null,i.host&&(""===w[0]?w[0]=i.host:w.unshift(i.host)),i.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),x=x&&(""===p[0]||""===w[0])),v)i.host=t.host||""===t.host?t.host:i.host,i.hostname=t.hostname||""===t.hostname?t.hostname:i.hostname,i.search=t.search,i.query=t.query,w=p;else if(p.length)w||(w=[]),w.pop(),w=w.concat(p),i.search=t.search,i.query=t.query;else if(null!=t.search){if(S)i.host=w.shift(),i.hostname=i.host,(I=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=I.shift(),i.hostname=I.shift(),i.host=i.hostname);return i.search=t.search,i.query=t.query,null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!w.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var E=w.slice(-1)[0],k=(i.host||t.host||w.length>1)&&("."===E||".."===E)||""===E,T=0,A=w.length;A>=0;A--)"."===(E=w[A])?w.splice(A,1):".."===E?(w.splice(A,1),T++):T&&(w.splice(A,1),T--);if(!x&&!b)for(;T--;T)w.unshift("..");!x||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),k&&"/"!==w.join("/").substr(-1)&&w.push("");var I,M=""===w[0]||w[0]&&"/"===w[0].charAt(0);S&&(i.hostname=M?"":w.length?w.shift():"",i.host=i.hostname,(I=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@"))&&(i.auth=I.shift(),i.hostname=I.shift(),i.host=i.hostname));return(x=x||i.host&&w.length)&&!M&&w.unshift(""),w.length>0?i.pathname=w.join("/"):(i.pathname=null,i.path=null),null===i.pathname&&null===i.search||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=t.auth||i.auth,i.slashes=i.slashes||t.slashes,i.href=i.format(),i},r.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)},e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){return"string"==typeof t&&(t=_(t)),t instanceof r?t.format():r.prototype.format.call(t)},e.Url=r},1388:function(t,e,i){var n={"./AbstractBehavior.ts":9436,"./CaElections2021.ts":805,"./FrElections2022.ts":1547,"./QuebecElection2022.ts":8929,"./UsElections2020.ts":6763};function r(t){var e=o(t);return i(e)}function o(t){if(!i.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}r.keys=function(){return Object.keys(n)},r.resolve=o,t.exports=r,r.id=1388},3821:function(t,e,i){var n={"./da_DK/frElections2022.json":2488,"./da_DK/fullscreen.json":8680,"./da_DK/usElectionsFixedPopup.json":4420,"./da_DK/usElectionsUpdater.json":5587,"./de_DE/frElections2022.json":4154,"./de_DE/fullscreen.json":4422,"./de_DE/usElectionsFixedPopup.json":3918,"./de_DE/usElectionsUpdater.json":9596,"./en_GB/frElections2022.json":3234,"./en_GB/fullscreen.json":2230,"./en_GB/geoLocation.json":9766,"./en_GB/search.json":9052,"./en_GB/usElectionsFixedPopup.json":6791,"./en_GB/usElectionsUpdater.json":8352,"./es_ES/frElections2022.json":358,"./es_ES/fullscreen.json":4074,"./es_ES/usElectionsFixedPopup.json":851,"./es_ES/usElectionsUpdater.json":4529,"./fr_FR/frElections2022.json":4568,"./fr_FR/fullscreen.json":458,"./fr_FR/usElectionsFixedPopup.json":2008,"./fr_FR/usElectionsUpdater.json":8105,"./it_IT/frElections2022.json":3181,"./it_IT/fullscreen.json":51,"./it_IT/usElectionsFixedPopup.json":4367,"./it_IT/usElectionsUpdater.json":5983,"./nl_NL/frElections2022.json":9745,"./nl_NL/fullscreen.json":2279,"./nl_NL/usElectionsFixedPopup.json":9733,"./nl_NL/usElectionsUpdater.json":7661};function r(t){var e=o(t);return i(e)}function o(t){if(!i.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}r.keys=function(){return Object.keys(n)},r.resolve=o,t.exports=r,r.id=3821},2168:function(t,e,i){var n={"./AbstractAdornment.ts":5714,"./AbstractModel.ts":1999,"./adornments/CaElections2021/CaElections2021Controls.ts":5521,"./adornments/CaElections2021/CaElections2021FocusButtons.ts":7125,"./adornments/CaElections2021/CaElections2021Popup.ts":648,"./adornments/D3Legend.ts":746,"./adornments/FrElections2022/FrElections2022Back.ts":4375,"./adornments/FrElections2022/FrElections2022Copyright.ts":932,"./adornments/FrElections2022/FrElections2022Legend.ts":3988,"./adornments/FrElections2022/FrElections2022Popup.ts":6679,"./adornments/FrElections2022/FrElections2022Selector.ts":9297,"./adornments/MarkerAdornment.ts":1111,"./adornments/QuebecElection2022/QuebecElection2022Controls.ts":4372,"./adornments/QuebecElection2022/QuebecElection2022FocusButtons.ts":8774,"./adornments/QuebecElection2022/QuebecElection2022Popup.ts":8004,"./adornments/StaticAdornment.ts":1194,"./adornments/UsElections2020/UsElections2020FixedPopup.ts":6903,"./adornments/UsElections2020/UsElections2020Updater.ts":6360,"./adornments/copyright/Copyright.ts":413,"./adornments/fullscreenButton/FullscreenButton.ts":1147,"./adornments/geolocationButton/GeolocationButton.ts":503,"./adornments/insetMap/InsetMap.ts":3067,"./adornments/northArrow/AbstractNorthArrow.ts":5083,"./adornments/northArrow/BasicNorthArrow.ts":7514,"./adornments/northArrow/northArrow.ts":637,"./adornments/resetButton/ResetButton.ts":9655,"./adornments/scale/AbstractScalebar.ts":1966,"./adornments/scale/LineScalebar.ts":6328,"./adornments/scale/ModernScalebar.ts":5238,"./adornments/scale/SimpleScalebar.ts":3728,"./adornments/search/Search.ts":3900,"./adornments/zoomButtons/ZoomButtons.ts":5097};function r(t){var e=o(t);return i(e)}function o(t){if(!i.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}r.keys=function(){return Object.keys(n)},r.resolve=o,t.exports=r,r.id=2168},4654:function(){},498:function(t,e,i){!function(t,e){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=i(e),r={$version:8,$root:{version:{required:!0,type:"enum",values:[8],doc:"Style specification version number. Must be 8.",example:8},name:{type:"string",doc:"A human-readable name for the style.",example:"Bright"},metadata:{type:"*",doc:"Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},center:{type:"array",value:"number",doc:"Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:[-73.9749,40.7736]},zoom:{type:"number",doc:"Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:12.5},bearing:{type:"number",default:0,period:360,units:"degrees",doc:'Default bearing, in degrees. The bearing is the compass direction that is "up"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).',example:29},pitch:{type:"number",default:0,units:"degrees",doc:"Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",example:50},light:{type:"light",doc:"The global light source.",example:{anchor:"viewport",color:"white",intensity:.4}},terrain:{type:"terrain",doc:"The terrain configuration.",example:{source:"raster-dem-source",exaggeration:.5,elevationOffset:100}},sources:{required:!0,type:"sources",doc:"Data source specifications.",example:{"maplibre-demotiles":{type:"vector",url:"https://demotiles.maplibre.org/tiles/tiles.json"}}},sprite:{type:"string",doc:"A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the `background-pattern`, `fill-pattern`, `line-pattern`, `fill-extrusion-pattern`, or `icon-image` properties. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).",example:"mapbox://sprites/mapbox/bright-v8"},glyphs:{type:"string",doc:"A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the `text-field` layout property. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).",example:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},transition:{type:"transition",doc:"A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's `transition` property.",example:{duration:300,delay:0}},layers:{required:!0,type:"array",value:"layer",doc:"Layers will be drawn in the order of this array.",example:[{id:"water",source:"mapbox-streets","source-layer":"water",type:"fill",paint:{"fill-color":"#00ffff"}}]}},sources:{"*":{type:"source",doc:"Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For image and video sources, a URL must be provided. For GeoJSON sources, a URL or inline GeoJSON must be provided."}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{doc:"A vector tile source."}},doc:"The type of the source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:` and `https:`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129],doc:"An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre GL."},scheme:{type:"enum",values:{xyz:{doc:"Slippy map tilenames scheme."},tms:{doc:"OSGeo spec scheme."}},default:"xyz",doc:"Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed."},minzoom:{type:"number",default:0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number",default:22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},attribution:{type:"string",doc:"Contains an attribution to be displayed when the map is shown to a user."},promoteId:{type:"promoteId",doc:"A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`. If specified as a string for a vector tile source, the same property is used across all its source layers."},volatile:{type:"boolean",default:!1,doc:"A setting to determine whether a source's tiles are cached locally.","sdk-support":{"basic functionality":{android:"9.3.0",ios:"5.10.0"}}},"*":{type:"*",doc:"Other keys to configure the data source."}},source_raster:{type:{required:!0,type:"enum",values:{raster:{doc:"A raster tile source."}},doc:"The type of the source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:` and `https:`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129],doc:"An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre GL."},minzoom:{type:"number",default:0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number",default:22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number",default:512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},scheme:{type:"enum",values:{xyz:{doc:"Slippy map tilenames scheme."},tms:{doc:"OSGeo spec scheme."}},default:"xyz",doc:"Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed."},attribution:{type:"string",doc:"Contains an attribution to be displayed when the map is shown to a user."},volatile:{type:"boolean",default:!1,doc:"A setting to determine whether a source's tiles are cached locally.","sdk-support":{"basic functionality":{android:"9.3.0",ios:"5.10.0"}}},"*":{type:"*",doc:"Other keys to configure the data source."}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{doc:"A RGB-encoded raster DEM source"}},doc:"The type of the source."},url:{type:"string",doc:"A URL to a TileJSON resource. Supported protocols are `http:` and `https:`."},tiles:{type:"array",value:"string",doc:"An array of one or more tile source URLs, as in the TileJSON spec."},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129],doc:"An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre GL."},minzoom:{type:"number",default:0,doc:"Minimum zoom level for which tiles are available, as in the TileJSON spec."},maxzoom:{type:"number",default:22,doc:"Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels."},tileSize:{type:"number",default:512,units:"pixels",doc:"The minimum visual size to display tiles for this layer. Only configurable for raster layers."},attribution:{type:"string",doc:"Contains an attribution to be displayed when the map is shown to a user."},encoding:{type:"enum",values:{terrarium:{doc:"Terrarium format PNG tiles. See https://aws.amazon.com/es/public-datasets/terrain/ for more info."},mapbox:{doc:"Mapbox Terrain RGB tiles. See https://www.mapbox.com/help/access-elevation-data/#mapbox-terrain-rgb for more info."}},default:"mapbox",doc:"The encoding used by this source. Mapbox Terrain RGB is used by default"},volatile:{type:"boolean",default:!1,doc:"A setting to determine whether a source's tiles are cached locally.","sdk-support":{"basic functionality":{android:"9.3.0",ios:"5.10.0"}}},"*":{type:"*",doc:"Other keys to configure the data source."}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{doc:"A GeoJSON data source."}},doc:"The data type of the GeoJSON source."},data:{type:"*",doc:"A URL to a GeoJSON file, or inline GeoJSON."},maxzoom:{type:"number",default:18,doc:"Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels)."},attribution:{type:"string",doc:"Contains an attribution to be displayed when the map is shown to a user."},buffer:{type:"number",default:128,maximum:512,minimum:0,doc:"Size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance."},filter:{type:"*",doc:"An expression for filtering features prior to processing them for rendering."},tolerance:{type:"number",default:.375,doc:"Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance)."},cluster:{type:"boolean",default:!1,doc:"If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new `Point` features in the source with additional properties:\n * `cluster` Is `true` if the point is a cluster \n * `cluster_id` A unqiue id for the cluster to be used in conjunction with the [cluster inspection methods](https://www.mapbox.com/mapbox-gl-js/api/#geojsonsource#getclusterexpansionzoom)\n * `point_count` Number of original points grouped into this cluster\n * `point_count_abbreviated` An abbreviated point count"},clusterRadius:{type:"number",default:50,minimum:0,doc:"Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile."},clusterMaxZoom:{type:"number",doc:"Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15."},clusterMinPoints:{type:"number",doc:"Minimum number of points necessary to form a cluster if clustering is enabled. Defaults to `2`."},clusterProperties:{type:"*",doc:'An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form `{"property_name": [operator, map_expression]}`. `operator` is any expression function that accepts at least 2 operands (e.g. `"+"` or `"max"`) — it accumulates the property value from clusters/points the cluster contains; `map_expression` produces the value of a single point.\n\nExample: `{"sum": ["+", ["get", "scalerank"]]}`.\n\nFor more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `["accumulated"]` value, e.g.:\n`{"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}`'},lineMetrics:{type:"boolean",default:!1,doc:"Whether to calculate line distance metrics. This is required for line layers that specify `line-gradient` values."},generateId:{type:"boolean",default:!1,doc:"Whether to generate ids for the geojson features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values."},promoteId:{type:"promoteId",doc:"A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`."}},source_video:{type:{required:!0,type:"enum",values:{video:{doc:"A video data source."}},doc:"The data type of the video source."},urls:{required:!0,type:"array",value:"string",doc:"URLs to video content in order of preferred format."},coordinates:{required:!0,doc:"Corners of video specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},source_image:{type:{required:!0,type:"enum",values:{image:{doc:"An image data source."}},doc:"The data type of the image source."},url:{required:!0,type:"string",doc:"URL that points to an image."},coordinates:{required:!0,doc:"Corners of image specified in longitude, latitude pairs.",type:"array",length:4,value:{type:"array",length:2,value:"number",doc:"A single longitude, latitude pair."}}},layer:{id:{type:"string",doc:"Unique layer name.",required:!0},type:{type:"enum",values:{fill:{doc:"A filled polygon with an optional stroked border.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}},line:{doc:"A stroked line.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}},symbol:{doc:"An icon or a text label.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}},circle:{doc:"A filled circle.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}},heatmap:{doc:"A heatmap.","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"fill-extrusion":{doc:"An extruded (3D) polygon.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}}},raster:{doc:"Raster map textures such as satellite imagery.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}},hillshade:{doc:"Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB and Mapzen Terrarium tiles.","sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},background:{doc:"The background color or pattern of the map.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}}}},doc:"Rendering type of this layer.",required:!0},metadata:{type:"*",doc:"Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'."},source:{type:"string",doc:"Name of a source description to be used for this layer. Required for all layer types except `background`."},"source-layer":{type:"string",doc:"Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources."},minzoom:{type:"number",minimum:0,maximum:24,doc:"The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden."},maxzoom:{type:"number",minimum:0,maximum:24,doc:"The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden."},filter:{type:"filter",doc:"A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `feature-state` expression is not supported in filter expressions."},layout:{type:"layout",doc:"Layout properties for the layer."},paint:{type:"paint",doc:"Default paint properties for this layer."}},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:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",doc:"Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.","sdk-support":{"basic functionality":{js:"1.2.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"},"data-driven styling":{js:"1.2.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",doc:"Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.","sdk-support":{"basic functionality":{js:"1.2.0",android:"9.2.0",ios:"5.9.0",macos:"0.16.0"},"data-driven styling":{js:"1.2.0",android:"9.2.0",ios:"5.9.0",macos:"0.16.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},"property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},"property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{doc:"A cap with a squared-off end which is drawn to the exact endpoint of the line."},round:{doc:"A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line."},square:{doc:"A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width."}},default:"butt",doc:"The display of line endings.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{doc:"A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width."},round:{doc:"A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line."},miter:{doc:"A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet."}},default:"miter",doc:"The display of lines when joining.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.40.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,doc:"Used to automatically convert miter joins to bevel joins for sharp angles.",requires:[{"line-join":"miter"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,doc:"Used to automatically convert round joins to miter joins for shallow angles.",requires:[{"line-join":"round"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",doc:"Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.","sdk-support":{"basic functionality":{js:"1.2.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"},"data-driven styling":{js:"1.2.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{doc:"The label is placed at the point where the geometry is located."},line:{doc:"The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries."},"line-center":{doc:"The label is placed at the center of the line of the geometry. Can only be used on `LineString` and `Polygon` geometries. Note that a single feature in a vector tile may contain multiple line geometries."}},default:"point",doc:"Label placement relative to its geometry.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"`line-center` value":{js:"0.47.0",android:"6.4.0",ios:"4.3.0",macos:"0.10.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",doc:"Distance between two symbol anchors.",requires:[{"symbol-placement":"line"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,doc:"If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",doc:"Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `icon-allow-overlap` or `text-allow-overlap` is `false`, features with a lower sort key will have priority during placement. When `icon-allow-overlap` or `text-allow-overlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key.","sdk-support":{"basic functionality":{js:"0.53.0",android:"7.4.0",ios:"4.11.0",macos:"0.14.0"},"data-driven styling":{js:"0.53.0",android:"7.4.0",ios:"4.11.0",macos:"0.14.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{doc:"Sorts symbols by `symbol-sort-key` if set. Otherwise, sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`."},"viewport-y":{doc:"Sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`."},source:{doc:"Sorts symbols by `symbol-sort-key` if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data."}},default:"auto",doc:"Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbol-sort-key`.","sdk-support":{"basic functionality":{js:"0.49.0",android:"6.6.0",ios:"4.5.0",macos:"0.12.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,doc:"If true, the icon will be visible even if it collides with other previously drawn symbols.",requires:["icon-image",{"!":"icon-overlap"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{doc:"The icon will be hidden if it collides with any other previously drawn symbol."},always:{doc:"The icon will be visible even if it collides with any other previously drawn symbol."},cooperative:{doc:"If the icon collides with another previously drawn symbol, the overlap mode for that symbol is checked. If the previous symbol was placed using `never` overlap mode, the new icon is hidden. If the previous symbol was placed using `always` or `cooperative` overlap mode, the new icon is visible."}},doc:"Allows for control over whether to show an icon when it overlaps other symbols on the map. If `icon-overlap` is not set, `icon-allow-overlap` is used instead.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"2.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,doc:"If true, other symbols can be visible even if they collide with the icon.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,doc:"If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.",requires:["icon-image","text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{doc:"When `symbol-placement` is set to `point`, aligns icons east-west. When `symbol-placement` is set to `line` or `line-center`, aligns icon x-axes with the line."},viewport:{doc:"Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`."},auto:{doc:"When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line` or `line-center`, this is equivalent to `map`."}},default:"auto",doc:"In combination with `symbol-placement`, determines the rotation behavior of icons.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"`auto` value":{js:"0.25.0",android:"4.2.0",ios:"3.4.0",macos:"0.3.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",doc:"Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by `icon-size`. 1 is the original size; 3 triples the size of the image.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.35.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{doc:"The icon is displayed at its intrinsic aspect ratio."},width:{doc:"The icon is scaled in the x-dimension to fit the width of the text."},height:{doc:"The icon is scaled in the y-dimension to fit the height of the text."},both:{doc:"The icon is scaled in both x- and y-dimensions."}},default:"none",doc:"Scales the icon to fit around the associated text.",requires:["icon-image","text-field"],"sdk-support":{"basic functionality":{js:"0.21.0",android:"4.2.0",ios:"3.4.0",macos:"0.2.1"},"stretchable icons":{js:"1.6.0",android:"9.2.0",ios:"5.8.0",macos:"0.15.0"}},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",doc:"Size of the additional area added to dimensions determined by `icon-text-fit`, in clockwise order: top, right, bottom, left.",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"sdk-support":{"basic functionality":{js:"0.21.0",android:"4.2.0",ios:"3.4.0",macos:"0.2.1"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",doc:"Name of image in sprite to use for drawing an image background.",tokens:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.35.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",doc:"Rotates the icon clockwise.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.21.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",doc:"Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a one-element array - padding applied to all sides.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"2.2.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,doc:"If true, the icon may be flipped to prevent it from being rendered upside-down.",requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],doc:"Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of `icon-size` to obtain the final offset in pixels. When combined with `icon-rotate` the offset will be as if the rotated direction was up.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{doc:"The center of the icon is placed closest to the anchor."},left:{doc:"The left side of the icon is placed closest to the anchor."},right:{doc:"The right side of the icon is placed closest to the anchor."},top:{doc:"The top of the icon is placed closest to the anchor."},bottom:{doc:"The bottom of the icon is placed closest to the anchor."},"top-left":{doc:"The top left corner of the icon is placed closest to the anchor."},"top-right":{doc:"The top right corner of the icon is placed closest to the anchor."},"bottom-left":{doc:"The bottom left corner of the icon is placed closest to the anchor."},"bottom-right":{doc:"The bottom right corner of the icon is placed closest to the anchor."}},default:"center",doc:"Part of the icon placed closest to the anchor.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.40.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"},"data-driven styling":{js:"0.40.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{doc:"The icon is aligned to the plane of the map."},viewport:{doc:"The icon is aligned to the plane of the viewport."},auto:{doc:"Automatically matches the value of `icon-rotation-alignment`."}},default:"auto",doc:"Orientation of icon when map is pitched.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.39.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{doc:"The text is aligned to the plane of the map."},viewport:{doc:"The text is aligned to the plane of the viewport."},auto:{doc:"Automatically matches the value of `text-rotation-alignment`."}},default:"auto",doc:"Orientation of text when map is pitched.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.21.0",android:"4.2.0",ios:"3.4.0",macos:"0.2.1"},"`auto` value":{js:"0.25.0",android:"4.2.0",ios:"3.4.0",macos:"0.3.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{doc:"When `symbol-placement` is set to `point`, aligns text east-west. When `symbol-placement` is set to `line` or `line-center`, aligns text x-axes with the line."},viewport:{doc:"Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`."},"viewport-glyph":{doc:"When `symbol-placement` is set to `point`, aligns text to the x-axis of the viewport. When `symbol-placement` is set to `line` or `line-center`, aligns glyphs to the x-axis of the viewport and places them along the line."},auto:{doc:"When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line` or `line-center`, this is equivalent to `map`."}},default:"auto",doc:"In combination with `symbol-placement`, determines the rotation behavior of the individual glyphs forming the text.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"`auto` value":{js:"0.25.0",android:"4.2.0",ios:"3.4.0",macos:"0.3.0"},"`viewport-glyph` value":{js:"2.1.8"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,doc:"Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.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"],doc:"Font stack to use for displaying text.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",doc:"Font size.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.35.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",doc:"The maximum line width for text wrapping.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.40.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",doc:"Text leading value for multi-line text.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",doc:"Text tracking amount.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.40.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{doc:"The text is aligned towards the anchor position."},left:{doc:"The text is aligned to the left."},center:{doc:"The text is centered."},right:{doc:"The text is aligned to the right."}},default:"center",doc:"Text justification options.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.39.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"},auto:{js:"0.54.0",android:"7.4.0",ios:"4.10.0",macos:"0.14.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,doc:"Radial offset of text, in the direction of the symbol's anchor. Useful in combination with `text-variable-anchor`, which defaults to using the two-dimensional `text-offset` if present.","sdk-support":{"basic functionality":{js:"0.54.0",android:"7.4.0",ios:"4.10.0",macos:"0.14.0"},"data-driven styling":{js:"0.54.0",android:"7.4.0",ios:"4.10.0",macos:"0.14.0"}},requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{doc:"The center of the text is placed closest to the anchor."},left:{doc:"The left side of the text is placed closest to the anchor."},right:{doc:"The right side of the text is placed closest to the anchor."},top:{doc:"The top of the text is placed closest to the anchor."},bottom:{doc:"The bottom of the text is placed closest to the anchor."},"top-left":{doc:"The top left corner of the text is placed closest to the anchor."},"top-right":{doc:"The top right corner of the text is placed closest to the anchor."},"bottom-left":{doc:"The bottom left corner of the text is placed closest to the anchor."},"bottom-right":{doc:"The bottom right corner of the text is placed closest to the anchor."}},requires:["text-field",{"symbol-placement":["point"]}],doc:"To increase the chance of placing high-priority labels on the map, you can provide an array of `text-anchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the `text-radial-offset` or the two-dimensional `text-offset`.","sdk-support":{"basic functionality":{js:"0.54.0",android:"7.4.0",ios:"4.10.0",macos:"0.14.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{doc:"The center of the text is placed closest to the anchor."},left:{doc:"The left side of the text is placed closest to the anchor."},right:{doc:"The right side of the text is placed closest to the anchor."},top:{doc:"The top of the text is placed closest to the anchor."},bottom:{doc:"The bottom of the text is placed closest to the anchor."},"top-left":{doc:"The top left corner of the text is placed closest to the anchor."},"top-right":{doc:"The top right corner of the text is placed closest to the anchor."},"bottom-left":{doc:"The bottom left corner of the text is placed closest to the anchor."},"bottom-right":{doc:"The bottom right corner of the text is placed closest to the anchor."}},default:"center",doc:"Part of the text placed closest to the anchor.",requires:["text-field",{"!":"text-variable-anchor"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.39.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",doc:"Maximum angle change between adjacent characters.",requires:["text-field",{"symbol-placement":["line","line-center"]}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{doc:"If a text's language supports horizontal writing mode, symbols with point placement would be laid out horizontally."},vertical:{doc:"If a text's language supports vertical writing mode, symbols with point placement would be laid out vertically."}},doc:"The property allows control over a symbol's orientation. Note that the property values act as a hint, so that a symbol whose language doesn’t support the provided orientation will be laid out in its natural orientation. Example: English point symbol will be rendered horizontally even if array value contains single 'vertical' enum value. The order of elements in an array define priority order for the placement of an orientation variant.",requires:["text-field",{"symbol-placement":["point"]}],"sdk-support":{"basic functionality":{js:"1.3.0",android:"8.3.0",ios:"5.3.0",macos:"0.15.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",doc:"Rotates the text clockwise.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.35.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",doc:"Size of the additional area around the text bounding box used for detecting symbol collisions.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,doc:"If true, the text may be flipped vertically to prevent it from being rendered upside-down.",requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{doc:"The text is not altered."},uppercase:{doc:"Forces all letters to be displayed in uppercase."},lowercase:{doc:"Forces all letters to be displayed in lowercase."}},default:"none",doc:"Specifies how to capitalize text, similar to the CSS `text-transform` property.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",doc:"Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. If used with text-variable-anchor, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position.",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.35.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,doc:"If true, the text will be visible even if it collides with other previously drawn symbols.",requires:["text-field",{"!":"text-overlap"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{doc:"The text will be hidden if it collides with any other previously drawn symbol."},always:{doc:"The text will be visible even if it collides with any other previously drawn symbol."},cooperative:{doc:"If the text collides with another previously drawn symbol, the overlap mode for that symbol is checked. If the previous symbol was placed using `never` overlap mode, the new text is hidden. If the previous symbol was placed using `always` or `cooperative` overlap mode, the new text is visible."}},doc:"Allows for control over whether to show symbol text when it overlaps other symbols on the map. If `text-overlap` is not set, `text-allow-overlap` is used instead",requires:["text-field"],"sdk-support":{"basic functionality":{js:"2.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,doc:"If true, other symbols can be visible even if they collide with the text.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,doc:"If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.",requires:["text-field","icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},"property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{doc:"The layer is shown."},none:{doc:"The layer is not shown."}},default:"visible",doc:"Whether this layer is displayed.","sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},"property-type":"constant"}},filter:{type:"array",value:"*",doc:"A filter selects specific features from a layer."},filter_operator:{type:"enum",values:{"==":{doc:'`["==", key, value]` equality: `feature[key] = value`'},"!=":{doc:'`["!=", key, value]` inequality: `feature[key] ≠ value`'},">":{doc:'`[">", key, value]` greater than: `feature[key] > value`'},">=":{doc:'`[">=", key, value]` greater than or equal: `feature[key] ≥ value`'},"<":{doc:'`["<", key, value]` less than: `feature[key] < value`'},"<=":{doc:'`["<=", key, value]` less than or equal: `feature[key] ≤ value`'},in:{doc:'`["in", key, v0, ..., vn]` set inclusion: `feature[key] ∈ {v0, ..., vn}`'},"!in":{doc:'`["!in", key, v0, ..., vn]` set exclusion: `feature[key] ∉ {v0, ..., vn}`'},all:{doc:'`["all", f0, ..., fn]` logical `AND`: `f0 ∧ ... ∧ fn`'},any:{doc:'`["any", f0, ..., fn]` logical `OR`: `f0 ∨ ... ∨ fn`'},none:{doc:'`["none", f0, ..., fn]` logical `NOR`: `¬f0 ∧ ... ∧ ¬fn`'},has:{doc:'`["has", key]` `feature[key]` exists'},"!has":{doc:'`["!has", key]` `feature[key]` does not exist'},within:{doc:'`["within", object]` feature geometry is within object geometry'}},doc:"The filter operator."},geometry_type:{type:"enum",values:{Point:{doc:"Filter to point geometries."},LineString:{doc:"Filter to line geometries."},Polygon:{doc:"Filter to polygon geometries."}},doc:"The geometry type for the filter to select."},function:{expression:{type:"expression",doc:"An expression."},stops:{type:"array",doc:"An array of stops.",value:"function_stop"},base:{type:"number",default:1,minimum:0,doc:"The exponential base of the interpolation curve. It controls the rate at which the result increases. Higher values make the result increase more towards the high end of the range. With `1` the stops are interpolated linearly."},property:{type:"string",doc:"The name of a feature property to use as the function input.",default:"$zoom"},type:{type:"enum",values:{identity:{doc:"Return the input value as the output value."},exponential:{doc:"Generate an output by interpolating between stops just less than and just greater than the function input."},interval:{doc:"Return the output value of the stop just less than the function input."},categorical:{doc:"Return the output value of the stop equal to the function input."}},doc:"The interpolation strategy to use in function evaluation.",default:"exponential"},colorSpace:{type:"enum",values:{rgb:{doc:"Use the RGB color space to interpolate color values"},lab:{doc:"Use the LAB color space to interpolate color values."},hcl:{doc:"Use the HCL color space to interpolate color values, interpolating the Hue, Chroma, and Luminance channels individually."}},doc:"The color space in which colors interpolated. Interpolating colors in perceptual color spaces like LAB and HCL tend to produce color ramps that look more consistent and produce colors that can be differentiated more easily than those interpolated in RGB space.",default:"rgb"},default:{type:"*",required:!1,doc:"A value to serve as a fallback function result when a value isn't otherwise available. It is used in the following circumstances:\n* In categorical functions, when the feature value does not match any of the stop domain values.\n* In property and zoom-and-property functions, when a feature does not contain a value for the specified property.\n* In identity functions, when the feature value is not valid for the style property (for example, if the function is being used for a `circle-color` property but the feature property value is not a string or not a valid color).\n* In interval or exponential property and zoom-and-property functions, when the feature value is not numeric.\nIf no default is provided, the style property's default is used in these circumstances."}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2,doc:"Zoom level and value pair."},expression:{type:"array",value:"*",minimum:1,doc:"An expression defines a function that can be used for data-driven style properties or feature filters."},expression_name:{doc:"",type:"enum",values:{let:{doc:'Binds expressions to named variables, which can then be referenced in the result expression using ["var", "variable_name"].',group:"Variable binding","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},var:{doc:'References variable bound using "let".',group:"Variable binding","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},literal:{doc:"Provides a literal array or object value.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},array:{doc:"Asserts that the input is an array (optionally with a specific item type and length). If, when the input expression is evaluated, it is not of the asserted type, then this assertion will cause the whole expression to be aborted.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},at:{doc:"Retrieves an item from an array.",group:"Lookup","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},in:{doc:"Determines whether an item exists in an array or a substring exists in a string.",group:"Lookup","sdk-support":{"basic functionality":{js:"1.6.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"}}},"index-of":{doc:"Returns the first position at which an item can be found in an array or a substring can be found in a string, or `-1` if the input cannot be found. Accepts an optional index from where to begin the search.",group:"Lookup","sdk-support":{"basic functionality":{js:"1.10.0"}}},slice:{doc:"Returns an item from an array or a substring from a string from a specified start index, or between a start index and an end index if set. The return value is inclusive of the start index but not of the end index.",group:"Lookup","sdk-support":{"basic functionality":{js:"1.10.0"}}},case:{doc:"Selects the first output whose corresponding test condition evaluates to true, or the fallback value otherwise.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},match:{doc:'Selects the output whose label value matches the input value, or the fallback value if no match is found. The input can be any expression (e.g. `["get", "building_type"]`). Each label must be either:\n - a single literal value; or\n - an array of literal values, whose values must be all strings or all numbers (e.g. `[100, 101]` or `["c", "b"]`). The input matches if any of the values in the array matches, similar to the `"in"` operator.\nEach label must be unique. If the input type does not match the type of the labels, the result will be the fallback value.',group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},coalesce:{doc:"Evaluates each expression in turn until the first non-null value is obtained, and returns that value.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},step:{doc:'Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of input and output values ("stops"). The `input` may be any numeric expression (e.g., `["get", "population"]`). Stop inputs must be numeric literals in strictly ascending order. Returns the output value of the stop just less than the input, or the first output if the input is less than the first stop.',group:"Ramps, scales, curves","sdk-support":{"basic functionality":{js:"0.42.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},interpolate:{doc:'Produces continuous, smooth results by interpolating between pairs of input and output values ("stops"). The `input` may be any numeric expression (e.g., `["get", "population"]`). Stop inputs must be numeric literals in strictly ascending order. The output type must be `number`, `array<number>`, or `color`.\n\nInterpolation types:\n- `["linear"]`: Interpolates linearly between the pair of stops just less than and just greater than the input.\n- `["exponential", base]`: Interpolates exponentially between the stops just less than and just greater than the input. `base` controls the rate at which the output increases: higher values make the output increase more towards the high end of the range. With values close to 1 the output increases linearly.\n- `["cubic-bezier", x1, y1, x2, y2]`: Interpolates using the cubic bezier curve defined by the given control points.',group:"Ramps, scales, curves","sdk-support":{"basic functionality":{js:"0.42.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"interpolate-hcl":{doc:'Produces continuous, smooth results by interpolating between pairs of input and output values ("stops"). Works like `interpolate`, but the output type must be `color`, and the interpolation is performed in the Hue-Chroma-Luminance color space.',group:"Ramps, scales, curves","sdk-support":{"basic functionality":{js:"0.49.0"}}},"interpolate-lab":{doc:'Produces continuous, smooth results by interpolating between pairs of input and output values ("stops"). Works like `interpolate`, but the output type must be `color`, and the interpolation is performed in the CIELAB color space.',group:"Ramps, scales, curves","sdk-support":{"basic functionality":{js:"0.49.0"}}},ln2:{doc:"Returns mathematical constant ln(2).",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},pi:{doc:"Returns the mathematical constant pi.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},e:{doc:"Returns the mathematical constant e.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},typeof:{doc:"Returns a string describing the type of the given value.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},string:{doc:"Asserts that the input value is a string. If multiple values are provided, each one is evaluated in order until a string is obtained. If none of the inputs are strings, the expression is an error.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},number:{doc:"Asserts that the input value is a number. If multiple values are provided, each one is evaluated in order until a number is obtained. If none of the inputs are numbers, the expression is an error.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},boolean:{doc:"Asserts that the input value is a boolean. If multiple values are provided, each one is evaluated in order until a boolean is obtained. If none of the inputs are booleans, the expression is an error.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},object:{doc:"Asserts that the input value is an object. If multiple values are provided, each one is evaluated in order until an object is obtained. If none of the inputs are objects, the expression is an error.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},collator:{doc:"Returns a `collator` for use in locale-dependent comparison operations. The `case-sensitive` and `diacritic-sensitive` options default to `false`. The `locale` argument specifies the IETF language tag of the locale to use. If none is provided, the default locale is used. If the requested locale is not available, the `collator` will use a system-defined fallback locale. Use `resolved-locale` to test the results of locale fallback behavior.",group:"Types","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},format:{doc:'Returns a `formatted` string for displaying mixed-format text in the `text-field` property. The input may contain a string literal or expression, including an [`\'image\'`](#types-image) expression. Strings may be followed by a style override object that supports the following properties:\n- `"text-font"`: Overrides the font stack specified by the root layout property.\n- `"text-color"`: Overrides the color specified by the root paint property.\n- `"font-scale"`: Applies a scaling factor on `text-size` as specified by the root layout property.',group:"Types","sdk-support":{"basic functionality":{js:"0.48.0",android:"6.7.0",ios:"4.6.0",macos:"0.12.0"},"text-font":{js:"0.48.0",android:"6.7.0",ios:"4.6.0",macos:"0.12.0"},"font-scale":{js:"0.48.0",android:"6.7.0",ios:"4.6.0",macos:"0.12.0"},"text-color":{js:"1.3.0",android:"7.3.0",ios:"4.10.0",macos:"0.14.0"},image:{js:"1.6.0",android:"8.6.0",ios:"5.7.0",macos:"0.15.0"}}},image:{doc:"Returns an `image` type for use in `icon-image`, `*-pattern` entries and as a section in the `format` expression. If set, the `image` argument will check that the requested image exists in the style and will return either the resolved image name or `null`, depending on whether or not the image is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the `image` argument.",group:"Types","sdk-support":{"basic functionality":{js:"1.4.0",android:"8.6.0",ios:"5.7.0",macos:"0.15.0"}}},"number-format":{doc:"Converts the input number into a string representation using the providing formatting rules. If set, the `locale` argument specifies the locale to use, as a BCP 47 language tag. If set, the `currency` argument specifies an ISO 4217 code to use for currency-style formatting. If set, the `min-fraction-digits` and `max-fraction-digits` arguments specify the minimum and maximum number of fractional digits to include.",group:"Types","sdk-support":{"basic functionality":{js:"0.54.0"}}},"to-string":{doc:'Converts the input value to a string. If the input is `null`, the result is `""`. If the input is a boolean, the result is `"true"` or `"false"`. If the input is a number, it is converted to a string as specified by the ["NumberToString" algorithm](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type) of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form `"rgba(r,g,b,a)"`, where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the [`JSON.stringify`](https://tc39.github.io/ecma262/#sec-json.stringify) function of the ECMAScript Language Specification.',group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"to-number":{doc:'Converts the input value to a number, if possible. If the input is `null` or `false`, the result is 0. If the input is `true`, the result is 1. If the input is a string, it is converted to a number as specified by the ["ToNumber Applied to the String Type" algorithm](https://tc39.github.io/ecma262/#sec-tonumber-applied-to-the-string-type) of the ECMAScript Language Specification. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.',group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"to-boolean":{doc:"Converts the input value to a boolean. The result is `false` when then input is an empty string, 0, `false`, `null`, or `NaN`; otherwise it is `true`.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"to-rgba":{doc:"Returns a four-element array containing the input color's red, green, blue, and alpha components, in that order.",group:"Color","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"to-color":{doc:"Converts the input value to a color. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.",group:"Types","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},rgb:{doc:"Creates a color value from red, green, and blue components, which must range between 0 and 255, and an alpha component of 1. If any component is out of range, the expression is an error.",group:"Color","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},rgba:{doc:"Creates a color value from red, green, blue components, which must range between 0 and 255, and an alpha component which must range between 0 and 1. If any component is out of range, the expression is an error.",group:"Color","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},get:{doc:"Retrieves a property value from the current feature's properties, or from another object if a second argument is provided. Returns null if the requested property is missing.",group:"Lookup","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},has:{doc:"Tests for the presence of an property value in the current feature's properties, or from another object if a second argument is provided.",group:"Lookup","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},length:{doc:"Gets the length of an array or string.",group:"Lookup","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},properties:{doc:'Gets the feature properties object. Note that in some cases, it may be more efficient to use ["get", "property_name"] directly.',group:"Feature data","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"feature-state":{doc:"Retrieves a property value from the current feature's state. Returns null if the requested property is not present on the feature's state. A feature's state is not part of the GeoJSON or vector tile data, and must be set programmatically on each feature. When `source.promoteId` is not provided, features are identified by their `id` attribute, which must be an integer or a string that can be cast to an integer. When `source.promoteId` is provided, features are identified by their `promoteId` property, which may be a number, string, or any primitive data type. Note that [\"feature-state\"] can only be used with paint properties that support data-driven styling.",group:"Feature data","sdk-support":{"basic functionality":{js:"0.46.0"}}},"geometry-type":{doc:"Gets the feature's geometry type: `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`.",group:"Feature data","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},id:{doc:"Gets the feature's id, if it has one.",group:"Feature data","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},zoom:{doc:'Gets the current zoom level. Note that in style layout and paint properties, ["zoom"] may only appear as the input to a top-level "step" or "interpolate" expression.',group:"Zoom","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"heatmap-density":{doc:"Gets the kernel density estimation of a pixel in a heatmap layer, which is a relative measure of how many data points are crowded around a particular pixel. Can only be used in the `heatmap-color` property.",group:"Heatmap","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"line-progress":{doc:"Gets the progress along a gradient line. Can only be used in the `line-gradient` property.",group:"Feature data","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.5.0",ios:"4.6.0",macos:"0.12.0"}}},accumulated:{doc:"Gets the value of a cluster property accumulated so far. Can only be used in the `clusterProperties` option of a clustered GeoJSON source.",group:"Feature data","sdk-support":{"basic functionality":{js:"0.53.0"}}},"+":{doc:"Returns the sum of the inputs.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"*":{doc:"Returns the product of the inputs.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"-":{doc:"For two inputs, returns the result of subtracting the second input from the first. For a single input, returns the result of subtracting it from 0.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"/":{doc:"Returns the result of floating point division of the first input by the second.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"%":{doc:"Returns the remainder after integer division of the first input by the second.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"^":{doc:"Returns the result of raising the first input to the power specified by the second.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},sqrt:{doc:"Returns the square root of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.42.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},log10:{doc:"Returns the base-ten logarithm of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},ln:{doc:"Returns the natural logarithm of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},log2:{doc:"Returns the base-two logarithm of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},sin:{doc:"Returns the sine of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},cos:{doc:"Returns the cosine of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},tan:{doc:"Returns the tangent of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},asin:{doc:"Returns the arcsine of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},acos:{doc:"Returns the arccosine of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},atan:{doc:"Returns the arctangent of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},min:{doc:"Returns the minimum value of the inputs.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},max:{doc:"Returns the maximum value of the inputs.",group:"Math","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},round:{doc:'Rounds the input to the nearest integer. Halfway values are rounded away from zero. For example, `["round", -1.5]` evaluates to -2.',group:"Math","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},abs:{doc:"Returns the absolute value of the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},ceil:{doc:"Returns the smallest integer that is greater than or equal to the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},floor:{doc:"Returns the largest integer that is less than or equal to the input.",group:"Math","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},distance:{doc:"Returns the shortest distance in meters between the evaluated feature and the input geometry. The input value can be a valid GeoJSON of type `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`, `Feature`, or `FeatureCollection`. Distance values returned may vary in precision due to loss in precision from encoding geometries, particularly below zoom level 13.",group:"Math","sdk-support":{"basic functionality":{android:"9.2.0",ios:"5.9.0",macos:"0.16.0"}}},"==":{doc:"Returns `true` if the input values are equal, `false` otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},"!=":{doc:"Returns `true` if the input values are not equal, `false` otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},">":{doc:"Returns `true` if the first input is strictly greater than the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},"<":{doc:"Returns `true` if the first input is strictly less than the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},">=":{doc:"Returns `true` if the first input is greater than or equal to the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},"<=":{doc:"Returns `true` if the first input is less than or equal to the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},collator:{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}},all:{doc:"Returns `true` if all the inputs are `true`, `false` otherwise. The inputs are evaluated in order, and evaluation is short-circuiting: once an input expression evaluates to `false`, the result is `false` and no further input expressions are evaluated.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},any:{doc:"Returns `true` if any of the inputs are `true`, `false` otherwise. The inputs are evaluated in order, and evaluation is short-circuiting: once an input expression evaluates to `true`, the result is `true` and no further input expressions are evaluated.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"!":{doc:"Logical negation. Returns `true` if the input is `false`, and `false` if the input is `true`.",group:"Decision","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},within:{doc:"Returns `true` if the evaluated feature is fully contained inside a boundary of the input geometry, `false` otherwise. The input value can be a valid GeoJSON of type `Polygon`, `MultiPolygon`, `Feature`, or `FeatureCollection`. Supported features for evaluation:\n- `Point`: Returns `false` if a point is on the boundary or falls outside the boundary.\n- `LineString`: Returns `false` if any part of a line falls outside the boundary, the line intersects the boundary, or a line's endpoint is on the boundary.",group:"Decision","sdk-support":{"basic functionality":{js:"1.9.0",android:"9.1.0",ios:"5.8.0",macos:"0.15.0"}}},"is-supported-script":{doc:"Returns `true` if the input string is expected to render legibly. Returns `false` if the input string contains sections that cannot be rendered without potential loss of meaning (e.g. Indic scripts that require complex text shaping, or right-to-left scripts if the the `mapbox-gl-rtl-text` plugin is not in use in MapLibre GL JS).",group:"String","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.6.0"}}},upcase:{doc:"Returns the input string converted to uppercase. Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.",group:"String","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},downcase:{doc:"Returns the input string converted to lowercase. Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.",group:"String","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},concat:{doc:"Returns a `string` consisting of the concatenation of the inputs. Each input is converted to a string as if by `to-string`.",group:"String","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}}},"resolved-locale":{doc:"Returns the IETF language tag of the locale being used by the provided `collator`. This can be used to determine the default system locale, or to determine if a requested locale was successfully loaded.",group:"String","sdk-support":{"basic functionality":{js:"0.45.0",android:"6.5.0",ios:"4.2.0",macos:"0.9.0"}}}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{doc:"The position of the light source is aligned to the rotation of the map."},viewport:{doc:"The position of the light source is aligned to the rotation of the viewport."}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]},doc:"Whether extruded geometries are lit relative to the map or viewport.",example:"map","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},doc:"Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below).",example:[1.5,90,80],"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0,doc:"Color tint for lighting extruded geometries.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}}},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,doc:"Intensity of lighting (on a scale from 0 to 1). Higher numbers will present as more extreme contrast.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}}}},terrain:{source:{type:"string",doc:"The source for the terrain data.",required:!0,"sdk-support":{"basic functionality":{js:"2.2.0"}}},exaggeration:{type:"number",minimum:0,doc:"The exaggeration of the terrain - how high it will look.",default:1,"sdk-support":{"basic functionality":{js:"2.2.0"}}},elevationOffset:{type:"number",doc:"The elevation offset.",default:450,"sdk-support":{"basic functionality":{js:"2.2.0"}}}},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,doc:"Whether or not the fill should be antialiased.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,doc:"The opacity of the entire fill layer. In contrast to the `fill-color`, this value will also affect the 1px stroke around the fill, if the stroke is used.",transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.21.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",doc:"The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.",transition:!0,requires:[{"!":"fill-pattern"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.19.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",doc:"The outline color of the fill. Matches the value of `fill-color` if unspecified.",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.19.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.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",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{doc:"The fill is translated relative to the map."},viewport:{doc:"The fill is translated relative to the viewport."}},doc:"Controls the frame of reference for `fill-translate`.",default:"map",requires:["fill-translate"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,doc:"Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.49.0",android:"6.5.0",macos:"0.11.0",ios:"4.4.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,doc:"The opacity of the entire fill extrusion layer. This is rendered on a per-layer, not per-feature, basis, and data-driven styling is not available.",transition:!0,"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",doc:"The base color of the extruded fill. The extrusion's surfaces will be shaded differently based on this color in combination with the root `light` settings. If this color is specified as `rgba` with an alpha component, the alpha component will be ignored; use `fill-extrusion-opacity` to set layer opacity.",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"},"data-driven styling":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},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",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{doc:"The fill extrusion is translated relative to the map."},viewport:{doc:"The fill extrusion is translated relative to the viewport."}},doc:"Controls the frame of reference for `fill-extrusion-translate`.",default:"map",requires:["fill-extrusion-translate"],"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,doc:"Name of image in sprite to use for drawing images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.","sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"},"data-driven styling":{js:"0.49.0",android:"6.5.0",macos:"0.11.0",ios:"4.4.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",doc:"The height with which to extrude this layer.",transition:!0,"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"},"data-driven styling":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",doc:"The height with which to extrude the base of this layer. Must be less than or equal to `fill-extrusion-height`.",transition:!0,requires:["fill-extrusion-height"],"sdk-support":{"basic functionality":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"},"data-driven styling":{js:"0.27.0",android:"5.1.0",ios:"3.6.0",macos:"0.5.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,doc:"Whether to apply a vertical gradient to the sides of a fill-extrusion layer. If true, sides will be shaded slightly darker farther down.",transition:!1,"sdk-support":{"basic functionality":{js:"0.50.0",ios:"4.7.0",macos:"0.13.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",doc:"The opacity at which the line will be drawn.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",doc:"The color with which the line will be drawn.",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.23.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{doc:"The line is translated relative to the map."},viewport:{doc:"The line is translated relative to the viewport."}},doc:"Controls the frame of reference for `line-translate`.",default:"map",requires:["line-translate"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",doc:"Stroke thickness.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.39.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,doc:"Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.",transition:!0,units:"pixels","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,doc:"The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.",transition:!0,units:"pixels","sdk-support":{"basic functionality":{js:"0.12.1",android:"3.0.0",ios:"3.1.0",macos:"0.1.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",doc:"Blur applied to the line, in pixels.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",doc:"Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,doc:"Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.49.0",android:"6.5.0",macos:"0.11.0",ios:"4.4.0"}},expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",doc:'Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify `"lineMetrics": true`.',transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],"sdk-support":{"basic functionality":{js:"0.45.0",android:"6.5.0",ios:"4.4.0",macos:"0.11.0"},"data-driven styling":{}},expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",doc:"Circle radius.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.18.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",doc:"The fill color of the circle.",transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.18.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,doc:"Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.",transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.20.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",doc:"The opacity at which the circle will be drawn.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.20.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.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",doc:"The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{doc:"The circle is translated relative to the map."},viewport:{doc:"The circle is translated relative to the viewport."}},doc:"Controls the frame of reference for `circle-translate`.",default:"map",requires:["circle-translate"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{doc:"Circles are scaled according to their apparent distance to the camera."},viewport:{doc:"Circles are not scaled."}},default:"map",doc:"Controls the scaling behavior of the circle when the map is pitched.","sdk-support":{"basic functionality":{js:"0.21.0",android:"4.2.0",ios:"3.4.0",macos:"0.2.1"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{doc:"The circle is aligned to the plane of the map."},viewport:{doc:"The circle is aligned to the plane of the viewport."}},default:"viewport",doc:"Orientation of circle when map is pitched.","sdk-support":{"basic functionality":{js:"0.39.0",android:"5.2.0",ios:"3.7.0",macos:"0.6.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",doc:"The width of the circle's stroke. Strokes are placed outside of the `circle-radius`.","sdk-support":{"basic functionality":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",doc:"The stroke color of the circle.",transition:!0,"sdk-support":{"basic functionality":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",doc:"The opacity of the circle's stroke.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"},"data-driven styling":{js:"0.29.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.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",doc:"Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed.","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},"data-driven styling":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,doc:"A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering.","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},"data-driven styling":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,doc:"Similar to `heatmap-weight` but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level.","sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.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"],doc:'Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmap-density"]` as input.',transition:!1,"sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"},"data-driven styling":{}},expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",doc:"The global opacity at which the heatmap layer will be drawn.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.41.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{doc:"The opacity at which the icon will be drawn.",type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,doc:"The color of the icon. This can only be used with sdf icons.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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,doc:"The color of the icon's halo. Icon halos can only be used with SDF icons.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"Distance of halo to the icon outline.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"Fade out the halo towards the outside.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["icon-image"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{doc:"Icons are translated relative to the map."},viewport:{doc:"Icons are translated relative to the viewport."}},doc:"Controls the frame of reference for `icon-translate`.",default:"map",requires:["icon-image","icon-translate"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",doc:"The opacity at which the text will be drawn.",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",doc:"The color with which the text will be drawn.",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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,doc:"The color of the text's halo, which helps it stand out from backgrounds.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"The halo's fadeout distance towards the outside.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{js:"0.33.0",android:"5.0.0",ios:"3.5.0",macos:"0.4.0"}},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",doc:"Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.",requires:["text-field"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{doc:"The text is translated relative to the map."},viewport:{doc:"The text is translated relative to the viewport."}},doc:"Controls the frame of reference for `text-translate`.",default:"map",requires:["text-field","text-translate"],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",doc:"The opacity at which the image will be drawn.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",doc:"Rotates hues around the color wheel.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",doc:"Increase or reduce the brightness of the image. The value is the minimum brightness.",default:0,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",doc:"Increase or reduce the brightness of the image. The value is the maximum brightness.",default:1,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",doc:"Increase or reduce the saturation of the image.",default:0,minimum:-1,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",doc:"Increase or reduce the contrast of the image.",default:0,minimum:-1,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",doc:"The resampling/interpolation method to use for overscaling, also known as texture magnification filter",values:{linear:{doc:"(Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscaled"},nearest:{doc:"Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled"}},default:"linear","sdk-support":{"basic functionality":{js:"0.47.0",android:"6.3.0",ios:"4.2.0",macos:"0.9.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",doc:"Fade duration when a new tile is added.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,doc:"The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshade-illumination-anchor` is set to `viewport` and due north if `hillshade-illumination-anchor` is set to `map`.",transition:!1,"sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{doc:"The hillshade illumination is relative to the north direction."},viewport:{doc:"The hillshade illumination is relative to the top of the viewport."}},default:"viewport",doc:"Direction of light source when map is rotated.","sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",doc:"Intensity of the hillshade",default:.5,minimum:0,maximum:1,transition:!0,"sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",doc:"The shading color of areas that face away from the light source.",transition:!0,"sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",doc:"The shading color of areas that faces towards the light source.",transition:!0,"sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",doc:"The shading color used to accentuate rugged terrain like sharp cliffs and gorges.",transition:!0,"sdk-support":{"basic functionality":{js:"0.43.0",android:"6.0.0",ios:"4.0.0",macos:"0.7.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",doc:"The color with which the background will be drawn.",transition:!0,requires:[{"!":"background-pattern"}],"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,doc:"Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.","sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"},"data-driven styling":{}},expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,doc:"The opacity at which the background will be drawn.",transition:!0,"sdk-support":{"basic functionality":{js:"0.10.0",android:"2.0.1",ios:"2.0.0",macos:"0.1.0"}},expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds",doc:"Time allotted for transitions to complete."},delay:{type:"number",default:0,minimum:0,units:"milliseconds",doc:"Length of time before a transition begins."}},"property-type":{"data-driven":{type:"property-type",doc:"Property is interpolable and can be represented using a property expression."},"cross-faded":{type:"property-type",doc:"Property is non-interpolable; rather, its values will be cross-faded to smoothly transition between integer zooms."},"cross-faded-data-driven":{type:"property-type",doc:"Property is non-interpolable; rather, its values will be cross-faded to smoothly transition between integer zooms. It can be represented using a property expression."},"color-ramp":{type:"property-type",doc:"Property should be specified using a color ramp from which the output color can be sampled based on a property calculation."},"data-constant":{type:"property-type",doc:"Property is interpolable but cannot be represented using a property expression."},constant:{type:"property-type",doc:"Property is constant across all zoom levels and property values."}},promoteId:{"*":{type:"string",doc:"A name of a feature property to use as ID for feature state."}}};const o=/("(?:[^\\"]|\\.)*")|[:,]/g;function s(t,e={}){const i=JSON.stringify([1],void 0,void 0===e.indent?2:e.indent).slice(2,-3),n=""===i?1/0:void 0===e.maxLength?80:e.maxLength;let{replacer:r}=e;return function t(e,s,a){e&&"function"==typeof e.toJSON&&(e=e.toJSON());const l=JSON.stringify(e,r);if(void 0===l)return l;const c=n-s.length-a;if(l.length<=c){const t=l.replace(o,((t,e)=>e||`${t} `));if(t.length<=c)return t}if(null!=r&&(e=JSON.parse(l),r=void 0),"object"==typeof e&&null!==e){const n=s+i,r=[];let o,a,l=0;if(Array.isArray(e)){o="[",a="]";const{length:i}=e;for(;l<i;l++)r.push(t(e[l],n,l===i-1?0:1)||"null")}else{o="{",a="}";const i=Object.keys(e),{length:s}=i;for(;l<s;l++){const o=i[l],a=`${JSON.stringify(o)}: `,c=t(e[o],n,a.length+(l===s-1?0:1));void 0!==c&&r.push(a+c)}}if(r.length>0)return[o,i+r.join(`,\n${n}`),a].join(`\n${s}`)}return l}(t,"",0)}function a(t,e){const i={};for(const n in e)void 0!==t[n]&&(i[n]=t[n]);for(const e in t)void 0===i[e]&&(i[e]=t[e]);return i}function l(t,e=2){return(t=a(t,r.$root)).layers&&(t.layers=t.layers.map((t=>a(t,r.layer)))),s(t,{indent:e})}function c(t){for(let e=0;e<r.layout.length;e++)for(const i in r[r.layout[e]])if(i===t)return r[r.layout[e]][i];for(let e=0;e<r.paint.length;e++)for(const i in r[r.paint[e]])if(i===t)return r[r.paint[e]][i];return null}function u(t,e){for(const i in t.sources)e(t.sources[i])}function h(t,e){for(const i of t.layers)e(i)}function d(t,e,i){function n(t,e){const n=t[e];n&&Object.keys(n).forEach((r=>{i({path:[t.id,e,r],key:r,value:n[r],reference:c(r),set(t){n[r]=t}})}))}h(t,(t=>{e.paint&&n(t,"paint"),e.layout&&n(t,"layout")}))}function p(t,e){for(const i in t)0===i.indexOf("layout")&&e(t[i],i)}function f(t,e){for(const i in t)0===i.indexOf("paint")&&e(t[i],i)}function m(t,e){return"string"==typeof e&&"@"===e[0]?m(t,t.constants[e]):e}function g(t){return Array.isArray(t.stops)}function y(t,e,i){t[i]=t[e],delete t[e]}function _(t){function e(t){const e=n.default.parse(t),i=e.pathname.split("/");if("mapbox:"!==e.protocol)return t;if("fontstack"===e.hostname)return r("/{fontstack}/{range}.pbf"===decodeURI(e.pathname)),"mapbox://fonts/mapbox/{fontstack}/{range}.pbf";if("fonts"===e.hostname)return r("v1"===i[1]),r("{fontstack}"===decodeURI(i[3])),r("{range}.pbf"===decodeURI(i[4])),`mapbox://fonts/${i[2]}/{fontstack}/{range}.pbf`;function r(e){if(!e)throw new Error(`Invalid font url: "${t}"`)}r(!1)}function i(t){function e(t){return t.split(",").map((t=>t.trim()))}if(Array.isArray(t))return t;if("string"==typeof t)return e(t);if("object"==typeof t)return t.stops.forEach((t=>{t[1]=e(t[1])})),t;throw new Error("unexpected font value")}t.version=8,u(t,(t=>{"video"===t.type&&void 0!==t.url&&y(t,"url","urls"),"video"===t.type&&t.coordinates.forEach((t=>t.reverse()))})),h(t,(t=>{p(t,(t=>{void 0!==t["symbol-min-distance"]&&y(t,"symbol-min-distance","symbol-spacing")})),f(t,(t=>{void 0!==t["background-image"]&&y(t,"background-image","background-pattern"),void 0!==t["line-image"]&&y(t,"line-image","line-pattern"),void 0!==t["fill-image"]&&y(t,"fill-image","fill-pattern")}))})),d(t,{paint:!0,layout:!0},(e=>{const i=m(t,e.value);g(i)&&i.stops.forEach((e=>{e[1]=m(t,e[1])})),e.set(i)})),delete t.constants,h(t,(t=>{p(t,(t=>{delete t["text-max-size"],delete t["icon-max-size"]})),f(t,(e=>{e["text-size"]&&(t.layout||(t.layout={}),t.layout["text-size"]=e["text-size"],delete e["text-size"]),e["icon-size"]&&(t.layout||(t.layout={}),t.layout["icon-size"]=e["icon-size"],delete e["icon-size"])}))})),t.glyphs&&(t.glyphs=e(t.glyphs)),h(t,(t=>{p(t,(t=>{t["text-font"]&&(t["text-font"]=i(t["text-font"]))}))}));let r=0;for(let e=t.layers.length-1;e>=0;e--)if("symbol"!==t.layers[e].type){r=e+1;break}const o=t.layers.splice(r);return o.reverse(),t.layers=t.layers.concat(o),t}function v(t,...e){for(const i of e)for(const e in i)t[e]=i[e];return t}class x extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class b{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,i]of e)this.bindings[t]=i}concat(t){return new b(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 w={kind:"null"},S={kind:"number"},E={kind:"string"},k={kind:"boolean"},T={kind:"color"},A={kind:"object"},I={kind:"value"},M={kind:"error"},C={kind:"collator"},z={kind:"formatted"},P={kind:"padding"},L={kind:"resolvedImage"};function D(t,e){return{kind:"array",itemType:t,N:e}}function R(t){if("array"===t.kind){const e=R(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const O=[w,S,E,k,T,z,A,D(I),P,L];function F(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!F(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 O)if(!F(t,e))return null}return`Expected ${R(t)} but found ${R(e)} instead.`}function B(t,e){return e.some((e=>e.kind===t.kind))}function j(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))}var $,N={},U={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function V(t){return(t=Math.round(t))<0?0:t>255?255:t}function q(t){return t<0?0:t>1?1:t}function Z(t){return"%"===t[t.length-1]?V(parseFloat(t)/100*255):V(parseInt(t))}function G(t){return"%"===t[t.length-1]?q(parseFloat(t)/100):q(parseFloat(t))}function H(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function W(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in U)return U[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),s=i.substr(n+1,r-(n+1)).split(","),a=1;switch(o){case"rgba":if(4!==s.length)return null;a=G(s.pop());case"rgb":return 3!==s.length?null:[Z(s[0]),Z(s[1]),Z(s[2]),a];case"hsla":if(4!==s.length)return null;a=G(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,c=G(s[1]),u=G(s[2]),h=u<=.5?u*(c+1):u+c-u*c,d=2*u-h;return[V(255*H(d,h,l+1/3)),V(255*H(d,h,l)),V(255*H(d,h,l-1/3)),a];default:return null}}return null}try{$=N.parseCSSColor=W}catch(t){}class X{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof X)return t;if("string"!=typeof t)return;const e=$(t);return e?new X(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}}X.black=new X(0,0,0,1),X.white=new X(1,1,1,1),X.transparent=new X(0,0,0,0),X.red=new X(1,0,0,1);class J{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 K{constructor(t,e,i,n,r){this.text=t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Y{constructor(t){this.sections=t}static fromString(t){return new Y([new K(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 Y?t:Y.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Q{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Q)return t;if("number"==typeof t)return new Q([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 Q(t)}}toString(){return JSON.stringify(this.values)}}class tt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new tt({name:t,available:!1}):null}}function et(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function it(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof X)return!0;if(t instanceof J)return!0;if(t instanceof Y)return!0;if(t instanceof Q)return!0;if(t instanceof tt)return!0;if(Array.isArray(t)){for(const e of t)if(!it(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!it(t[e]))return!1;return!0}return!1}function nt(t){if(null===t)return w;if("string"==typeof t)return E;if("boolean"==typeof t)return k;if("number"==typeof t)return S;if(t instanceof X)return T;if(t instanceof J)return C;if(t instanceof Y)return z;if(t instanceof Q)return P;if(t instanceof tt)return L;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=nt(e);if(i){if(i===t)continue;i=I;break}i=t}return D(i||I,e)}return A}function rt(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof X||t instanceof Y||t instanceof Q||t instanceof tt?t.toString():JSON.stringify(t)}class ot{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(!it(t[1]))return e.error("invalid value");const i=t[1];let n=nt(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new ot(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class st{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const at={string:E,number:S,boolean:k,object:A};class lt{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,n=1;const r=t[0];if("array"===r){let r,o;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in at)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=at[i],n++}else r=I;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);o=t[2],n++}i=D(r,o)}else{if(!at[r])throw new Error(`Types doesn't contain name = ${r}`);i=at[r]}const o=[];for(;n<t.length;n++){const i=e.parse(t[n],n,I);if(!i)return null;o.push(i)}return new lt(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){const i=this.args[e].evaluate(t);if(!F(this.type,nt(i)))return i;if(e===this.args.length-1)throw new st(`Expected value to be of type ${R(this.type)}, but found ${R(nt(i))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ct={"to-boolean":k,"to-color":T,"to-number":S,"to-string":E};class ut{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(!ct[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 n=ct[i],r=[];for(let i=1;i<t.length;i++){const n=e.parse(t[i],i,I);if(!n)return null;r.push(n)}return new ut(n,r)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,i;for(const n of this.args){if(e=n.evaluate(t),i=null,e instanceof X)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.`:et(e[0],e[1],e[2],e[3]),!i))return new X(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new st(i||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("padding"===this.type.kind){let e;for(const i of this.args){e=i.evaluate(t);const n=Q.parse(e);if(n)return n}throw new st(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new st(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Y.fromString(rt(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?tt.fromString(rt(this.args[0].evaluate(t))):rt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ht=["Unknown","Point","LineString","Polygon"];class dt{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?ht[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]=X.parse(t)),e}}class pt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}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],n=pt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,o]of s){a=new Zt(e.registry,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e<t.length;e++){const i=t[e],r=Array.isArray(n)?n[e-1]:n.type,o=a.parse(i,1+s.length,r);if(!o){l=!0;break}s.push(o)}if(!l)if(Array.isArray(n)&&n.length!==s.length)a.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,i=s[t];a.concat(t+1).checkSubtype(e,i.type)}if(0===a.errors.length)return new pt(i,r,o,s)}}if(1===s.length)e.errors.push(...a.errors);else{const i=(s.length?s:o).map((([t])=>ft(t))).join(" | "),n=[];for(let i=1;i<t.length;i++){const r=e.parse(t[i],1+n.length);if(!r)return null;n.push(R(r.type))}e.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){pt.definitions=e;for(const i in e)t[i]=pt}}function ft(t){return Array.isArray(t)?`(${t.map(R).join(", ")})`:`(${R(t.type)}...)`}class mt{constructor(t,e,i){this.type=C,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 n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,k);if(!n)return null;const r=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,k);if(!r)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,E),!o)?null:new mt(n,r,o)}evaluate(t){return new J(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}}const gt=8192;function yt(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 _t(t){return(180+t)/360}function vt(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function xt(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function bt(t,e){const i=_t(t[0]),n=vt(t[1]),r=Math.pow(2,e.z);return[Math.round(i*r*gt),Math.round(n*r*gt)]}function wt(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return n*s-o*r==0&&n*o<=0&&r*s<=0}function St(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function Et(t,e){let i=!1;for(let n=0,r=e.length;n<r;n++){const r=e[n];for(let e=0,n=r.length;e<n-1;e++){if(wt(t,r[e],r[e+1]))return!1;St(t,r[e],r[e+1])&&(i=!i)}}return i}function kt(t,e){for(let i=0;i<e.length;i++)if(Et(t,e[i]))return!0;return!1}function Tt(t,e){return t[0]*e[1]-t[1]*e[0]}function At(t,e,i,n){const r=t[0]-i[0],o=t[1]-i[1],s=e[0]-i[0],a=e[1]-i[1],l=n[0]-i[0],c=n[1]-i[1],u=r*c-l*o,h=s*c-l*a;return u>0&&h<0||u<0&&h>0}function It(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]];return 0!==Tt([n[0]-i[0],n[1]-i[1]],r)&&!(!At(t,e,i,n)||!At(i,n,t,e))}function Mt(t,e,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(It(t,e,n[i],n[i+1]))return!0;return!1}function Ct(t,e){for(let i=0;i<t.length;++i)if(!Et(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Mt(t[i],t[i+1],e))return!1;return!0}function zt(t,e){for(let i=0;i<e.length;i++)if(Ct(t,e[i]))return!0;return!1}function Pt(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=[];for(let n=0;n<t[r].length;n++){const s=bt(t[r][n],i);yt(e,s),o.push(s)}n.push(o)}return n}function Lt(t,e,i){const n=[];for(let r=0;r<t.length;r++){const o=Pt(t[r],e,i);n.push(o)}return n}function Dt(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}yt(e,t)}function Rt(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Ot(t,e,i,n){const r=Math.pow(2,n.z)*gt,o=[n.x*gt,n.y*gt],s=[];for(const n of t)for(const t of n){const n=[t.x+o[0],t.y+o[1]];Dt(n,e,i,r),s.push(n)}return s}function Ft(t,e,i,n){const r=Math.pow(2,n.z)*gt,o=[n.x*gt,n.y*gt],s=[];for(const i of t){const t=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];yt(e,i),t.push(i)}s.push(t)}if(e[2]-e[0]<=r/2){Rt(e);for(const t of s)for(const n of t)Dt(n,e,i,r)}return s}function Bt(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=Pt(e.coordinates,n,r),s=Ot(t.geometry(),i,n,r);if(!xt(i,n))return!1;for(const t of s)if(!Et(t,o))return!1}if("MultiPolygon"===e.type){const o=Lt(e.coordinates,n,r),s=Ot(t.geometry(),i,n,r);if(!xt(i,n))return!1;for(const t of s)if(!kt(t,o))return!1}return!0}function jt(t,e){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=t.canonicalID();if("Polygon"===e.type){const o=Pt(e.coordinates,n,r),s=Ft(t.geometry(),i,n,r);if(!xt(i,n))return!1;for(const t of s)if(!Ct(t,o))return!1}if("MultiPolygon"===e.type){const o=Lt(e.coordinates,n,r),s=Ft(t.geometry(),i,n,r);if(!xt(i,n))return!1;for(const t of s)if(!zt(t,o))return!1}return!0}class $t{constructor(t,e){this.type=k,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(it(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const i=e.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new $t(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new $t(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new $t(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 Bt(t,this.geometries);if("LineString"===t.geometryType())return jt(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Nt(t){if(t instanceof pt){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 $t)return!1;let e=!0;return t.eachChild((t=>{e&&!Nt(t)&&(e=!1)})),e}function Ut(t){if(t instanceof pt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!Ut(t)&&(e=!1)})),e}function Vt(t,e){if(t instanceof pt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!Vt(t,e)&&(i=!1)})),i}class qt{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 qt(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 Zt{constructor(t,e=[],i,n=new b,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new lt(e,[t]):"coerce"===i?new ut(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 n=t[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind)if("padding"!==t.kind||"value"!==r.kind&&"number"!==r.kind&&"array"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof ot)&&"resolvedImage"!==n.type.kind&&Gt(n)){const t=new dt;try{n=new ot(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new Zt(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new x(i,t))}checkSubtype(t,e){const i=F(t,e);return i&&this.error(i),i}}function Gt(t){if(t instanceof qt)return Gt(t.boundExpression);if(t instanceof pt&&"error"===t.name)return!1;if(t instanceof mt)return!1;if(t instanceof $t)return!1;const e=t instanceof ut||t instanceof lt;let i=!0;return t.eachChild((t=>{i=e?i&&Gt(t):i&&t instanceof ot})),!!i&&Nt(t)&&Vt(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ht(t,e){const i=t.length-1;let n,r,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),n=t[a],r=t[a+1],n<=e){if(a===i||e<r)return a;o=a+1}else{if(!(n>e))throw new st("Input is not a number.");s=a-1}return 0}class Wt{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,S);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i<t.length;i+=2){const o=1===i?-1/0:t[i],s=t[i+1],a=i,l=i+1;if("number"!=typeof o)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(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=e.parse(s,l,r);if(!c)return null;r=r||c.type,n.push([o,c])}return new Wt(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;return n>=e[r-1]?i[r-1].evaluate(t):i[Ht(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}var Xt=Jt;function Jt(t,e,i,n){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*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}function Kt(t,e,i){return t*(1-i)+e*i}function Yt(t,e,i){return new X(Kt(t.r,e.r,i),Kt(t.g,e.g,i),Kt(t.b,e.b,i),Kt(t.a,e.a,i))}function Qt(t,e,i){return t.map(((t,n)=>Kt(t,e[n],i)))}function te(t,e,i){const n=t.values,r=e.values;return new Q([Kt(n[0],r[0],i),Kt(n[1],r[1],i),Kt(n[2],r[2],i),Kt(n[3],r[3],i)])}Jt.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,n=0;n<8;n++){var r=this.sampleCurveX(i)-t;if(Math.abs(r)<e)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var s=0,a=1;for(i=t,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-t)<e));n++)t>r?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var ee=Object.freeze({__proto__:null,number:Kt,color:Yt,array:Qt,padding:te});const ie=.95047,ne=1,re=1.08883,oe=4/29,se=6/29,ae=3*se*se,le=se*se*se,ce=Math.PI/180,ue=180/Math.PI;function he(t){return t>le?Math.pow(t,1/3):t/ae+oe}function de(t){return t>se?t*t*t:ae*(t-oe)}function pe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function fe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function me(t){const e=fe(t.r),i=fe(t.g),n=fe(t.b),r=he((.4124564*e+.3575761*i+.1804375*n)/ie),o=he((.2126729*e+.7151522*i+.072175*n)/ne);return{l:116*o-16,a:500*(r-o),b:200*(o-he((.0193339*e+.119192*i+.9503041*n)/re)),alpha:t.a}}function ge(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=ne*de(e),i=ie*de(i),n=re*de(n),new X(pe(3.2404542*i-1.5371385*e-.4985314*n),pe(-.969266*i+1.8760108*e+.041556*n),pe(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function ye(t,e,i){return{l:Kt(t.l,e.l,i),a:Kt(t.a,e.a,i),b:Kt(t.b,e.b,i),alpha:Kt(t.alpha,e.alpha,i)}}function _e(t){const{l:e,a:i,b:n}=me(t),r=Math.atan2(n,i)*ue;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}}function ve(t){const e=t.h*ce,i=t.c;return ge({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})}function xe(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}function be(t,e,i){return{h:xe(t.h,e.h,i),c:Kt(t.c,e.c,i),l:Kt(t.l,e.l,i),alpha:Kt(t.alpha,e.alpha,i)}}const we={forward:me,reverse:ge,interpolate:ye},Se={forward:_e,reverse:ve,interpolate:be};var Ee=Object.freeze({__proto__:null,lab:we,hcl:Se});class ke{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=Te(e,t.base,i,n);else if("linear"===t.name)r=Te(e,1,i,n);else if("cubic-bezier"===t.name){const o=t.controlPoints;r=new Xt(o[0],o[1],o[2],o[3]).solve(Te(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...o]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.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);n={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(r=e.parse(r,2,S),!r)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=T:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t<o.length;t+=2){const i=o[t],n=o[t+1],r=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 computed expressions) for the input values.',r);if(s.length&&s[s.length-1][0]>=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=e.parse(n,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"padding"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new ke(a,i,n,r,s):e.error(`Type ${R(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const o=Ht(e,n),s=e[o],a=e[o+1],l=ke.interpolationFactor(this.interpolation,n,s,a),c=i[o].evaluate(t),u=i[o+1].evaluate(t);return"interpolate"===this.operator?ee[this.type.kind.toLowerCase()](c,u,l):"interpolate-hcl"===this.operator?Se.reverse(Se.interpolate(Se.forward(c),Se.forward(u),l)):we.reverse(we.interpolate(we.forward(c),we.forward(u),l))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Te(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}class Ae{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 n=e.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const n of t.slice(1)){const t=e.parse(n,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,r.push(t)}if(!i)throw new Error("No output type");const o=n&&r.some((t=>F(n,t.type)));return new Ae(o?I:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(t),i&&i instanceof tt&&!i.available&&(e||(e=i.name),i=null,n===this.args.length&&(i=e)),null!==i)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ie{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 n=1;n<t.length-1;n+=2){const r=t[n];if("string"!=typeof r)return e.error(`Expected string, but found ${typeof r} instead.`,n);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=e.parse(t[n+1],n+1);if(!o)return null;i.push([r,o])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return n?new Ie(i,n):null}outputDefined(){return this.result.outputDefined()}}class Me{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,S),n=e.parse(t[2],2,D(e.expectedType||I));if(!i||!n)return null;const r=n.type;return new Me(r.itemType,i,n)}evaluate(t){const e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new st(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new st(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new st(`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 Ce{constructor(t,e){this.type=k,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,I),n=e.parse(t[2],2,I);return i&&n?B(i.type,[k,E,S,w,I])?new Ce(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!j(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${R(nt(e))} instead.`);if(!j(i,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${R(nt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ze{constructor(t,e,i){this.type=S,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,I),n=e.parse(t[2],2,I);if(!i||!n)return null;if(!B(i.type,[k,E,S,w,I]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${R(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,S);return r?new ze(i,n,r):null}return new ze(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!j(e,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${R(nt(e))} instead.`);if(!j(i,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${R(nt(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Pe{constructor(t,e,i,n,r,o){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}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,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},o=[];for(let s=2;s<t.length-1;s+=2){let a=t[s];const l=t[s+1];Array.isArray(a)||(a=[a]);const c=e.concat(s);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,nt(t)))return null}else i=nt(t);if(void 0!==r[String(t)])return c.error("Branch labels must be unique.");r[String(t)]=o.length}const u=e.parse(l,s,n);if(!u)return null;n=n||u.type,o.push(u)}const s=e.parse(t[1],1,I);if(!s)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==s.type.kind&&e.concat(1).checkSubtype(i,s.type)?null:new Pe(i,n,s,r,o,a):null}evaluate(t){const e=this.input.evaluate(t);return(nt(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 Le{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 n=[];for(let r=1;r<t.length-1;r+=2){const o=e.parse(t[r],r,k);if(!o)return null;const s=e.parse(t[r+1],r+1,i);if(!s)return null;n.push([o,s]),i=i||s.type}const r=e.parse(t[t.length-1],t.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new Le(i,n,r)}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 De{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}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,I),n=e.parse(t[2],2,S);if(!i||!n)return null;if(!B(i.type,[D(I),E,I]))return e.error(`Expected first argument to be of type array or string, but found ${R(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,S);return r?new De(i.type,i,n,r):null}return new De(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!j(e,["string","array"]))throw new st(`Expected first argument to be of type array or string, but found ${R(nt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Re(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 Oe(t,e,i){return e===i}function Fe(t,e,i){return e!==i}function Be(t,e,i){return e<i}function je(t,e,i){return e>i}function $e(t,e,i){return e<=i}function Ne(t,e,i){return e>=i}function Ue(t,e,i,n){return 0===n.compare(e,i)}function Ve(t,e,i,n){return!Ue(t,e,i,n)}function qe(t,e,i,n){return n.compare(e,i)<0}function Ze(t,e,i,n){return n.compare(e,i)>0}function Ge(t,e,i,n){return n.compare(e,i)<=0}function He(t,e,i,n){return n.compare(e,i)>=0}function We(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=k,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 o=e.parse(t[1],1,I);if(!o)return null;if(!Re(i,o.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${R(o.type)}'.`);let s=e.parse(t[2],2,I);if(!s)return null;if(!Re(i,s.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${R(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error(`Cannot compare types '${R(o.type)}' and '${R(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new lt(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new lt(o.type,[s])));let a=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,C),!a)return null}return new r(o,s,a)}evaluate(r){const o=this.lhs.evaluate(r),s=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=nt(o),i=nt(s);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new st(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=nt(o),i=nt(s);if("string"!==t.kind||"string"!==i.kind)return e(r,o,s)}return this.collator?i(r,o,s,this.collator.evaluate(r)):e(r,o,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}}}const Xe=We("==",Oe,Ue),Je=We("!=",Fe,Ve),Ke=We("<",Be,qe),Ye=We(">",je,Ze),Qe=We("<=",$e,Ge),ti=We(">=",Ne,He);class ei{constructor(t,e,i,n,r){this.type=E,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,S);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,E),!r))return null;let o=null;if(n.currency&&(o=e.parse(n.currency,1,E),!o))return null;let s=null;if(n["min-fraction-digits"]&&(s=e.parse(n["min-fraction-digits"],1,S),!s))return null;let a=null;return n["max-fraction-digits"]&&(a=e.parse(n["max-fraction-digits"],1,S),!a)?null:new ei(i,r,o,s,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 ii{constructor(t){this.type=z,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 n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const o=t[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let t=null;if(o["font-scale"]&&(t=e.parse(o["font-scale"],1,S),!t))return null;let i=null;if(o["text-font"]&&(i=e.parse(o["text-font"],1,D(E)),!i))return null;let s=null;if(o["text-color"]&&(s=e.parse(o["text-color"],1,T),!s))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=s}else{const o=e.parse(t[i],1,I);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new ii(n)}evaluate(t){const e=e=>{const i=e.content.evaluate(t);return nt(i)===L?new K("",i,null,null,null):new K(rt(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)};return new Y(this.sections.map(e))}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 ni{constructor(t){this.type=L,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,E);return i?new ni(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=tt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ri{constructor(t){this.type=S,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 ${R(i.type)} instead.`):new ri(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 st(`Expected value to be of type string or array, but found ${R(nt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const oi={"==":Xe,"!=":Je,">":Ye,"<":Ke,">=":ti,"<=":Qe,array:lt,at:Me,boolean:lt,case:Le,coalesce:Ae,collator:mt,format:ii,image:ni,in:Ce,"index-of":ze,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ri,let:Ie,literal:ot,match:Pe,number:lt,"number-format":ei,object:lt,slice:De,step:Wt,string:lt,"to-boolean":ut,"to-color":ut,"to-number":ut,"to-string":ut,var:qt,within:$t};function si(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const o=r?r.evaluate(t):1,s=et(e,i,n,o);if(s)throw new st(s);return new X(e/255*o,i/255*o,n/255*o,o)}function ai(t,e){return t in e}function li(t,e){const i=e[t];return void 0===i?null:i}function ci(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}function ui(t){return{type:t}}function hi(t){return{result:"success",value:t}}function di(t){return{result:"error",value:t}}function pi(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function fi(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function mi(t){return!!t.expression&&t.expression.interpolated}function gi(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function yi(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _i(t){return t}function vi(t,e){const i="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],r=n||void 0!==t.property,o=n||!r,s=t.type||(mi(e)?"exponential":"interval");if(i||"padding"===e.type){const n=i?X.parse:Q.parse;(t=v({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default?t.default=n(t.default):t.default=n(e.default)}if(t.colorSpace&&"rgb"!==t.colorSpace&&!Ee[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,l,c;if("exponential"===s)a=Si;else if("interval"===s)a=wi;else if("categorical"===s){a=bi,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];c=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Ei}if(n){const i={},n=[];for(let e=0;e<t.stops.length;e++){const r=t.stops[e],o=r[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:t.type,property:t.property,default:t.default,stops:[]},n.push(o)),i[o].stops.push([r[0].value,r[1]])}const r=[];for(const t of n)r.push([i[t].zoom,vi(i[t],e)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:ke.interpolationFactor.bind(void 0,o),zoomStops:r.map((t=>t[0])),evaluate({zoom:i},n){return Si({stops:r,base:t.base},e,i).evaluate(i,n)}}}if(o){const i="exponential"===s?{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,n){const r=n&&n.properties?n.properties[t.property]:void 0;return void 0===r?xi(t.default,e.default):a(t,e,r,l,c)}}}function xi(t,e,i){return void 0!==t?t:void 0!==e?e:void 0!==i?i:void 0}function bi(t,e,i,n,r){return xi(typeof i===r?n[i]:void 0,t.default,e.default)}function wi(t,e,i){if("number"!==gi(i))return xi(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const r=Ht(t.stops.map((t=>t[0])),i);return t.stops[r][1]}function Si(t,e,i){const n=void 0!==t.base?t.base:1;if("number"!==gi(i))return xi(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 o=Ht(t.stops.map((t=>t[0])),i),s=ki(i,n,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],l=t.stops[o+1][1];let c=ee[e.type]||_i;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Ee[t.colorSpace];c=(t,i)=>e.reverse(e.interpolate(e.forward(t),e.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...t){const e=a.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==i)return c(e,i,s)}}:c(a,l,s)}function Ei(t,e,i){switch(e.type){case"color":i=X.parse(i);break;case"formatted":i=Y.fromString(i.toString());break;case"resolvedImage":i=tt.fromString(i.toString());break;case"padding":i=Q.parse(i);break;default:gi(i)===e.type||"enum"===e.type&&e.values[i]||(i=void 0)}return xi(i,t.default,e.default)}function ki(t,e,i,n){const r=n-i,o=t-i;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}pt.register(oi,{error:[M,[E],(t,[e])=>{throw new st(e.evaluate(t))}],typeof:[E,[I],(t,[e])=>R(nt(e.evaluate(t)))],"to-rgba":[D(S,4),[T],(t,[e])=>e.evaluate(t).toArray()],rgb:[T,[S,S,S],si],rgba:[T,[S,S,S,S],si],has:{type:k,overloads:[[[E],(t,[e])=>ai(e.evaluate(t),t.properties())],[[E,A],(t,[e,i])=>ai(e.evaluate(t),i.evaluate(t))]]},get:{type:I,overloads:[[[E],(t,[e])=>li(e.evaluate(t),t.properties())],[[E,A],(t,[e,i])=>li(e.evaluate(t),i.evaluate(t))]]},"feature-state":[I,[E],(t,[e])=>li(e.evaluate(t),t.featureState||{})],properties:[A,[],t=>t.properties()],"geometry-type":[E,[],t=>t.geometryType()],id:[I,[],t=>t.id()],zoom:[S,[],t=>t.globals.zoom],"heatmap-density":[S,[],t=>t.globals.heatmapDensity||0],"line-progress":[S,[],t=>t.globals.lineProgress||0],accumulated:[I,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[S,ui(S),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[S,ui(S),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:S,overloads:[[[S,S],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[S],(t,[e])=>-e.evaluate(t)]]},"/":[S,[S,S],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[S,[S,S],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[S,[],()=>Math.LN2],pi:[S,[],()=>Math.PI],e:[S,[],()=>Math.E],"^":[S,[S,S],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[S,[S],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[S,[S],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[S,[S],(t,[e])=>Math.log(e.evaluate(t))],log2:[S,[S],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[S,[S],(t,[e])=>Math.sin(e.evaluate(t))],cos:[S,[S],(t,[e])=>Math.cos(e.evaluate(t))],tan:[S,[S],(t,[e])=>Math.tan(e.evaluate(t))],asin:[S,[S],(t,[e])=>Math.asin(e.evaluate(t))],acos:[S,[S],(t,[e])=>Math.acos(e.evaluate(t))],atan:[S,[S],(t,[e])=>Math.atan(e.evaluate(t))],min:[S,ui(S),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[S,ui(S),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[S,[S],(t,[e])=>Math.abs(e.evaluate(t))],round:[S,[S],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[S,[S],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[S,[S],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[k,[E,I],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[k,[I],(t,[e])=>t.id()===e.value],"filter-type-==":[k,[E],(t,[e])=>t.geometryType()===e.value],"filter-<":[k,[E,I],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[k,[I],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[k,[E,I],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[k,[I],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[k,[E,I],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[k,[I],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[k,[E,I],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[k,[I],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[k,[I],(t,[e])=>e.value in t.properties()],"filter-has-id":[k,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[k,[D(E)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[k,[D(I)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[k,[E,D(I)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[k,[E,D(I)],(t,[e,i])=>ci(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:k,overloads:[[[k,k],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[ui(k),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:k,overloads:[[[k,k],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[ui(k),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[k,[k],(t,[e])=>!e.evaluate(t)],"is-supported-script":[k,[E],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[E,[E],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[E,[E],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[E,ui(I),(t,e)=>e.map((e=>rt(e.evaluate(t)))).join("")],"resolved-locale":[E,[C],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Ti{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new dt,this._defaultValue=e?Oi(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||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 st(`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 Ai(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in oi}function Ii(t,e){const i=new Zt(oi,[],e?Ri(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?hi(new Ti(n,e)):di(i.errors)}class Mi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Ut(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}}class Ci{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Ut(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,o)}evaluate(t,e,i,n,r,o){return this._styleExpression.evaluate(t,e,i,n,r,o)}interpolationFactor(t,e,i){return this.interpolationType?ke.interpolationFactor(this.interpolationType,t,e,i):0}}function zi(t,e){const i=Ii(t,e);if("error"===i.result)return i;const n=i.value.expression,r=Nt(n);if(!r&&!pi(e))return di([new x("","data expressions not supported")]);const o=Vt(n,["zoom"]);if(!o&&!fi(e))return di([new x("","zoom expressions not supported")]);const s=Di(n);if(!s&&!o)return di([new x("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof x)return di([s]);if(s instanceof ke&&!mi(e))return di([new x("",'"interpolate" expressions cannot be used with this property')]);if(!s)return hi(new Mi(r?"constant":"source",i.value));const a=s instanceof ke?s.interpolation:void 0;return hi(new Ci(r?"camera":"composite",i.value,s.labels,a))}class Pi{constructor(t,e){this._parameters=t,this._specification=e,v(this,vi(this._parameters,this._specification))}static deserialize(t){return new Pi(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Li(t,e){if(yi(t))return new Pi(t,e);if(Ai(t)){const i=zi(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=X.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)||(i=Q.parse(t)),{kind:"constant",evaluate:()=>i}}}function Di(t){let e=null;if(t instanceof Ie)e=Di(t.result);else if(t instanceof Ae){for(const i of t.args)if(e=Di(i),e)break}else(t instanceof Wt||t instanceof ke)&&t.input instanceof pt&&"zoom"===t.input.name&&(e=t);return e instanceof x||t.eachChild((t=>{const i=Di(t);i instanceof x?e=i:!e&&i?e=new x("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new x("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Ri(t){const e={color:T,string:E,number:S,enum:E,boolean:k,formatted:z,padding:P,resolvedImage:L};return"array"===t.type?D(e[t.value]||I,t.length):e[t.type]}function Oi(t){return"color"===t.type&&yi(t.default)?new X(0,0,0,0):"color"===t.type?X.parse(t.default)||null:"padding"===t.type?Q.parse(t.default)||null:void 0===t.default?null:t.default}function Fi(t){return"object"==typeof t?["literal",t]:t}function Bi(t,e){let i=t.stops;if(!i)return ji(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,o=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],Xi(t[1])]:[t[0],Fi(t[1])])),n?Ni(t,e,i):o?Zi(t,e,i):qi(t,e,i)}function ji(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,Fi(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}function $i(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Ni(t,e,i){const n={},r={},o=[];for(let e=0;e<i.length;e++){const s=i[e],a=s[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},r[a]=[],o.push(a)),r[a].push([s[0].value,s[1]])}if("exponential"===Wi({},e)){const i=[$i(t),["linear"],["zoom"]];for(const t of o)Hi(i,t,qi(n[t],e,r[t]),!1);return i}{const t=["step",["zoom"]];for(const i of o)Hi(t,i,qi(n[i],e,r[i]),!0);return Gi(t),t}}function Ui(t,e){return void 0!==t?t:void 0!==e?e:void 0}function Vi(t,e){const i=Fi(Ui(t.default,e.default));return void 0===i&&"resolvedImage"===e.type?"":i}function qi(t,e,i){const n=Wi(t,e),r=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){const n=["case"];for(const t of i)n.push(["==",r,t[0]],t[1]);return n.push(Vi(t,e)),n}if("categorical"===n){const n=["match",r];for(const t of i)Hi(n,t[0],t[1],!1);return n.push(Vi(t,e)),n}if("interval"===n){const e=["step",["number",r]];for(const t of i)Hi(e,t[0],t[1],!0);return Gi(e),void 0===t.default?e:["case",["==",["typeof",r],"number"],e,Fi(t.default)]}if("exponential"===n){const e=void 0!==t.base?t.base:1,n=[$i(t),1===e?["linear"]:["exponential",e],["number",r]];for(const t of i)Hi(n,t[0],t[1],!1);return void 0===t.default?n:["case",["==",["typeof",r],"number"],n,Fi(t.default)]}throw new Error(`Unknown property function type ${n}`)}function Zi(t,e,i,n=["zoom"]){const r=Wi(t,e);let o,s=!1;if("interval"===r)o=["step",n],s=!0;else{if("exponential"!==r)throw new Error(`Unknown zoom function type "${r}"`);{const e=void 0!==t.base?t.base:1;o=[$i(t),1===e?["linear"]:["exponential",e],n]}}for(const t of i)Hi(o,t[0],t[1],s);return Gi(o),o}function Gi(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function Hi(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Wi(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function Xi(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const o=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,o.length>0&&e.push(o),e.push(["get",r[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}function Ji(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(!Ji(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}const Ki={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Yi(t){if(null==t)return{filter:()=>!0,needGeometry:!1};Ji(t)||(t=en(t));const e=Ii(t,Ki);if("error"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return{filter:(t,i,n)=>e.value.evaluate(t,i,{},n),needGeometry:tn(t)}}function Qi(t,e){return t<e?-1:t>e?1:0}function tn(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e<t.length;e++)if(tn(t[e]))return!0;return!1}function en(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?nn(t[1],t[2],"=="):"!="===e?an(nn(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?nn(t[1],t[2],e):"any"===e?rn(t.slice(1)):"all"===e?["all"].concat(t.slice(1).map(en)):"none"===e?["all"].concat(t.slice(1).map(en).map(an)):"in"===e?on(t[1],t.slice(2)):"!in"===e?an(on(t[1],t.slice(2))):"has"===e?sn(t[1]):"!has"===e?an(sn(t[1])):"within"!==e||t}function nn(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 rn(t){return["any"].concat(t.map(en))}function on(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(Qi)]]:["filter-in-small",t,["literal",e]]}}function sn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function an(t){return["!",t]}function ln(t,e={}){if(Ji(t))return t;if(!t)return!0;const i=t,n=i[0];if(t.length<=1)return"any"!==n;switch(n){case"==":case"!=":case"<":case">":case"<=":case">=":{const[,i,r]=t;return un(i,r,n,e)}case"any":{const[,...t]=i,e=t.map((t=>{const e={},i=ln(t,e),n=cn(e);return!0===n?i:["case",n,i,!1]}));return["any",...e]}case"all":{const[,...t]=i,n=t.map((t=>ln(t,e)));return n.length>1?["all",...n]:n[0]}case"none":{const[,...t]=i;return["!",ln(["any",...t],{})]}case"in":{const[,t,...e]=i;return hn(t,e)}case"!in":{const[,t,...e]=i;return hn(t,e,!0)}case"has":return dn(i[1]);case"!has":return["!",dn(i[1])];default:return!0}}function cn(t){const e=[];for(const i in t){const n="$id"===i?["id"]:["get",i];e.push(["==",["typeof",n],t[i]])}return 0===e.length||(1===e.length?e[0]:["all",...e])}function un(t,e,i,n){let r;if("$type"===t)return[i,["geometry-type"],e];if(r="$id"===t?["id"]:["get",t],n&&null!==e){const i=typeof e;n[t]=i}return"=="===i&&"$id"!==t&&null===e?["all",["has",t],["==",r,null]]:"!="===i&&"$id"!==t&&null===e?["any",["!",["has",t]],["!=",r,null]]:[i,r,e]}function hn(t,e,i=!1){if(0===e.length)return i;let n;n="$type"===t?["geometry-type"]:"$id"===t?["id"]:["get",t];let r=!0;const o=typeof e[0];for(const t of e)if(typeof t!==o){r=!1;break}if(r&&("string"===o||"number"===o)){const t=e.sort().filter(((t,i)=>0===i||e[i-1]!==t));return["match",n,t,!i,i]}return i?["all",...e.map((t=>["!=",n,t]))]:["any",...e.map((t=>["==",n,t]))]}function dn(t){return"$type"===t||("$id"===t?["!=",["id"],null]:["has",t])}function pn(t){const e=[];return h(t,(t=>{t.filter&&(t.filter=ln(t.filter))})),d(t,{paint:!0,layout:!0},(({path:t,value:i,reference:n,set:r})=>{Ai(i)||("object"!=typeof i||Array.isArray(i)?n.tokens&&"string"==typeof i&&r(Xi(i)):(r(Bi(i,n)),e.push(t.join("."))))})),t}function fn(t){let e=!1;if(7===t.version&&(t=_(t),e=!0),8===t.version&&(e=!!pn(t),e=!0),!e)throw new Error(`Cannot migrate from ${t.version}`);return t}function mn(t){const e=[],i=[],n=[];for(const n in t.sources){const r=t.sources[n];if("vector"!==r.type)continue;const o=/^mapbox:\/\/(.*)/.exec(r.url);o&&(e.push(n),i.push(o[1]))}if(e.length<2)return t;e.forEach((e=>{delete t.sources[e]}));const r=i.join(",");return t.sources[r]={type:"vector",url:`mapbox://${r}`},t.layers.forEach((t=>{if(e.indexOf(t.source)>=0&&(t.source=r,"source-layer"in t)){if(n.indexOf(t["source-layer"])>=0)throw new Error("Conflicting source layer names");n.push(t["source-layer"])}})),t}const gn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yn(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return gn.forEach((t=>{t in e&&(i[t]=e[t])})),i}function _n(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]=yn(t[i],e[t[i].ref]));return t}function vn(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(!vn(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(!vn(t[i],e[i]))return!1;return!0}return t===e}const xn={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function bn(t,e,i){i.push({command:xn.addSource,args:[t,e[t]]})}function wn(t,e,i){e.push({command:xn.removeSource,args:[t]}),i[t]=!0}function Sn(t,e,i,n){wn(t,i,n),bn(t,e,i)}function En(t,e,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!vn(t[i][n],e[i][n]))return!1;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!vn(t[i][n],e[i][n]))return!1;return!0}function kn(t,e,i,n){let r;for(r in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e,r)||wn(r,i,n));for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(t,r)?vn(t[r],e[r])||("geojson"===t[r].type&&"geojson"===e[r].type&&En(t,e,r)?i.push({command:xn.setGeoJSONSourceData,args:[r,e[r].data]}):Sn(r,e,i,n)):bn(r,e,i))}function Tn(t,e,i,n,r,o){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(vn(t[s],e[s])||i.push({command:o,args:[n,s,e[s],r]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(vn(t[s],e[s])||i.push({command:o,args:[n,s,e[s],r]}))}function An(t){return t.id}function In(t,e){return t[e.id]=e,t}function Mn(t,e,i){e=e||[];const n=(t=t||[]).map(An),r=e.map(An),o=t.reduce(In,{}),s=e.reduce(In,{}),a=n.slice(),l=Object.create(null);let c,u,h,d,p,f,m;for(c=0,u=0;c<n.length;c++)h=n[c],Object.prototype.hasOwnProperty.call(s,h)?u++:(i.push({command:xn.removeLayer,args:[h]}),a.splice(a.indexOf(h,u),1));for(c=0,u=0;c<r.length;c++)h=r[r.length-1-c],a[a.length-1-c]!==h&&(Object.prototype.hasOwnProperty.call(o,h)?(i.push({command:xn.removeLayer,args:[h]}),a.splice(a.lastIndexOf(h,a.length-u),1)):u++,f=a[a.length-c],i.push({command:xn.addLayer,args:[s[h],f]}),a.splice(a.length-c,0,h),l[h]=!0);for(c=0;c<r.length;c++)if(h=r[c],d=o[h],p=s[h],!l[h]&&!vn(d,p))if(vn(d.source,p.source)&&vn(d["source-layer"],p["source-layer"])&&vn(d.type,p.type)){for(m in Tn(d.layout,p.layout,i,h,null,xn.setLayoutProperty),Tn(d.paint,p.paint,i,h,null,xn.setPaintProperty),vn(d.filter,p.filter)||i.push({command:xn.setFilter,args:[h,p.filter]}),vn(d.minzoom,p.minzoom)&&vn(d.maxzoom,p.maxzoom)||i.push({command:xn.setLayerZoomRange,args:[h,p.minzoom,p.maxzoom]}),d)Object.prototype.hasOwnProperty.call(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?Tn(d[m],p[m],i,h,m.slice(6),xn.setPaintProperty):vn(d[m],p[m])||i.push({command:xn.setLayerProperty,args:[h,m,p[m]]}));for(m in p)Object.prototype.hasOwnProperty.call(p,m)&&!Object.prototype.hasOwnProperty.call(d,m)&&"layout"!==m&&"paint"!==m&&"filter"!==m&&"metadata"!==m&&"minzoom"!==m&&"maxzoom"!==m&&(0===m.indexOf("paint.")?Tn(d[m],p[m],i,h,m.slice(6),xn.setPaintProperty):vn(d[m],p[m])||i.push({command:xn.setLayerProperty,args:[h,m,p[m]]}))}else i.push({command:xn.removeLayer,args:[h]}),f=a[a.lastIndexOf(h)+1],i.push({command:xn.addLayer,args:[p,f]})}function Cn(t,e){if(!t)return[{command:xn.setStyle,args:[e]}];let i=[];try{if(!vn(t.version,e.version))return[{command:xn.setStyle,args:[e]}];vn(t.center,e.center)||i.push({command:xn.setCenter,args:[e.center]}),vn(t.zoom,e.zoom)||i.push({command:xn.setZoom,args:[e.zoom]}),vn(t.bearing,e.bearing)||i.push({command:xn.setBearing,args:[e.bearing]}),vn(t.pitch,e.pitch)||i.push({command:xn.setPitch,args:[e.pitch]}),vn(t.sprite,e.sprite)||i.push({command:xn.setSprite,args:[e.sprite]}),vn(t.glyphs,e.glyphs)||i.push({command:xn.setGlyphs,args:[e.glyphs]}),vn(t.transition,e.transition)||i.push({command:xn.setTransition,args:[e.transition]}),vn(t.light,e.light)||i.push({command:xn.setLight,args:[e.light]});const n={},r=[];kn(t.sources,e.sources,r,n);const o=[];t.layers&&t.layers.forEach((t=>{n[t.source]?i.push({command:xn.removeLayer,args:[t.id]}):o.push(t)})),i=i.concat(r),Mn(o,e.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:xn.setStyle,args:[e]}]}return i}class zn{constructor(t,e,i,n){this.message=(t?`${t}: `:"")+i,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}class Pn{constructor(t){this.error=t,this.message=t.message;const e=t.message.match(/line (\d+)/);this.line=e?parseInt(e[1],10):0}}function Ln(t){const e=t.key,i=t.value;return i?[new zn(e,i,"constants have been deprecated as of v8")]:[]}function Dn(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Rn(t){if(Array.isArray(t))return t.map(Rn);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Rn(t[i]);return e}return Dn(t)}function On(t){const e=t.key,i=t.value,n=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,s=t.styleSpec;let a=[];const l=gi(i);if("object"!==l)return[new zn(e,i,`object expected, ${l} found`)];for(const t in i){const l=t.split(".")[0],c=n[l]||n["*"];let u;if(r[l])u=r[l];else if(n[l])u=sr;else if(r["*"])u=r["*"];else{if(!n["*"]){a.push(new zn(e,i[t],`unknown property "${t}"`));continue}u=sr}a=a.concat(u({key:(e?`${e}.`:e)+t,value:i[t],valueSpec:c,style:o,styleSpec:s,object:i,objectKey:t},i))}for(const t in n)r[t]||n[t].required&&void 0===n[t].default&&void 0===i[t]&&a.push(new zn(e,i,`missing required property "${t}"`));return a}function Fn(t){const e=t.value,i=t.valueSpec,n=t.style,r=t.styleSpec,o=t.key,s=t.arrayElementValidator||sr;if("array"!==gi(e))return[new zn(o,e,`array expected, ${gi(e)} found`)];if(i.length&&e.length!==i.length)return[new zn(o,e,`array length ${i.length} expected, length ${e.length} found`)];if(i["min-length"]&&e.length<i["min-length"])return[new zn(o,e,`array length at least ${i["min-length"]} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};r.$version<7&&(a.function=i.function),"object"===gi(i.value)&&(a=i.value);let l=[];for(let t=0;t<e.length;t++)l=l.concat(s({array:e,arrayIndex:t,value:e[t],valueSpec:a,style:n,styleSpec:r,key:`${o}[${t}]`}));return l}function Bn(t){const e=t.key,i=t.value,n=t.valueSpec;let r=gi(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new zn(e,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new zn(e,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new zn(e,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function jn(t){const e=t.valueSpec,i=Dn(t.value.type);let n,r,o,s={};const a="categorical"!==i&&void 0===t.value.property,l=!a,c="array"===gi(t.value.stops)&&"array"===gi(t.value.stops[0])&&"object"===gi(t.value.stops[0][0]),u=On({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:h,default:f}});return"identity"===i&&a&&u.push(new zn(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||u.push(new zn(t.key,t.value,'missing required property "stops"')),"exponential"===i&&t.valueSpec.expression&&!mi(t.valueSpec)&&u.push(new zn(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!pi(t.valueSpec)?u.push(new zn(t.key,t.value,"property functions not supported")):a&&!fi(t.valueSpec)&&u.push(new zn(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==t.value.property||u.push(new zn(t.key,t.value,'"property" property is required')),u;function h(t){if("identity"===i)return[new zn(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const n=t.value;return e=e.concat(Fn({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:d})),"array"===gi(n)&&0===n.length&&e.push(new zn(t.key,n,"array must have at least one stop")),e}function d(t){let i=[];const n=t.value,a=t.key;if("array"!==gi(n))return[new zn(a,n,`array expected, ${gi(n)} found`)];if(2!==n.length)return[new zn(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==gi(n[0]))return[new zn(a,n,`object expected, ${gi(n[0])} found`)];if(void 0===n[0].zoom)return[new zn(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new zn(a,n,"object stop key must have value")];if(o&&o>Dn(n[0].zoom))return[new zn(a,n[0].zoom,"stop zoom values must appear in ascending order")];Dn(n[0].zoom)!==o&&(o=Dn(n[0].zoom),r=void 0,s={}),i=i.concat(On({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Bn,value:p}}))}else i=i.concat(p({key:`${a}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return Ai(Rn(n[1]))?i.concat([new zn(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(sr({key:`${a}[1]`,value:n[1],valueSpec:e,style:t.style,styleSpec:t.styleSpec}))}function p(t,o){const a=gi(t.value),l=Dn(t.value),c=null!==t.value?t.value:o;if(n){if(a!==n)return[new zn(t.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new zn(t.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return pi(e)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new zn(t.key,c,n)]}return"categorical"!==i||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&void 0!==r&&l<r?[new zn(t.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in s?[new zn(t.key,c,"stop domain values must be unique")]:(s[l]=!0,[])):[new zn(t.key,c,`integer expected, found ${l}`)]}function f(t){return sr({key:t.key,value:t.value,valueSpec:e,style:t.style,styleSpec:t.styleSpec})}}function $n(t){const e=("property"===t.expressionContext?zi:Ii)(Rn(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new zn(`${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 zn(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&&!Ut(i))return[new zn(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Ut(i))return[new zn(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Vt(i,["zoom","feature-state"]))return[new zn(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Nt(i))return[new zn(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Nn(t){const e=t.value,i=t.key,n=gi(e);return"boolean"!==n?[new zn(i,e,`boolean expected, ${n} found`)]:[]}function Un(t){const e=t.key,i=t.value,n=gi(i);return"string"!==n?[new zn(e,i,`color expected, ${n} found`)]:null===$(i)?[new zn(e,i,`color expected, "${i}" found`)]:[]}function Vn(t){const e=t.key,i=t.value,n=t.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Dn(i))&&r.push(new zn(e,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Dn(i))&&r.push(new zn(e,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function qn(t){return Ji(Rn(t.value))?$n(v({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zn(t)}function Zn(t){const e=t.value,i=t.key;if("array"!==gi(e))return[new zn(i,e,`array expected, ${gi(e)} found`)];const n=t.styleSpec;let r,o=[];if(e.length<1)return[new zn(i,e,"filter array must have at least 1 element")];switch(o=o.concat(Vn({key:`${i}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dn(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&"$type"===Dn(e[1])&&o.push(new zn(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":3!==e.length&&o.push(new zn(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(r=gi(e[1]),"string"!==r&&o.push(new zn(`${i}[1]`,e[1],`string expected, ${r} found`)));for(let s=2;s<e.length;s++)r=gi(e[s]),"$type"===Dn(e[1])?o=o.concat(Vn({key:`${i}[${s}]`,value:e[s],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&o.push(new zn(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<e.length;n++)o=o.concat(Zn({key:`${i}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":r=gi(e[1]),2!==e.length?o.push(new zn(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==r&&o.push(new zn(`${i}[1]`,e[1],`string expected, ${r} found`));break;case"within":r=gi(e[1]),2!==e.length?o.push(new zn(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):"object"!==r&&o.push(new zn(`${i}[1]`,e[1],`object expected, ${r} found`))}return o}function Gn(t,e){const i=t.key,n=t.style,r=t.styleSpec,o=t.value,s=t.objectKey,a=r[`${e}_${t.layerType}`];if(!a)return[];const l=s.match(/^(.*)-transition$/);if("paint"===e&&l&&a[l[1]]&&a[l[1]].transition)return sr({key:i,value:o,valueSpec:r.transition,style:n,styleSpec:r});const c=t.valueSpec||a[s];if(!c)return[new zn(i,o,`unknown property "${s}"`)];let u;if("string"===gi(o)&&pi(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new zn(i,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];const h=[];return"symbol"===t.layerType&&("text-field"===s&&n&&!n.glyphs&&h.push(new zn(i,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&yi(Rn(o))&&"identity"===Dn(o.type)&&h.push(new zn(i,o,'"text-font" does not support identity functions'))),h.concat(sr({key:t.key,value:o,valueSpec:c,style:n,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:s}))}function Hn(t){return Gn(t,"paint")}function Wn(t){return Gn(t,"layout")}function Xn(t){let e=[];const i=t.value,n=t.key,r=t.style,o=t.styleSpec;i.type||i.ref||e.push(new zn(n,i,'either "type" or "ref" is required'));let s=Dn(i.type);const a=Dn(i.ref);if(i.id){const o=Dn(i.id);for(let s=0;s<t.arrayIndex;s++){const t=r.layers[s];Dn(t.id)===o&&e.push(new zn(n,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 zn(n,i[t],`"${t}" is prohibited for ref layers`))})),r.layers.forEach((e=>{Dn(e.id)===a&&(t=e)})),t?t.ref?e.push(new zn(n,i.ref,"ref cannot reference another ref layer")):s=Dn(t.type):e.push(new zn(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==s)if(i.source){const t=r.sources&&r.sources[i.source],o=t&&Dn(t.type);t?"vector"===o&&"raster"===s?e.push(new zn(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==s?e.push(new zn(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?e.push(new zn(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&t.lineMetrics||e.push(new zn(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new zn(n,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new zn(n,i.source,`source "${i.source}" not found`))}else e.push(new zn(n,i,'missing required property "source"'));return e=e.concat(On({key:n,value:i,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*"(){return[]},type(){return sr({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:i,objectKey:"type"})},filter:qn,layout(t){return On({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*"(t){return Wn(v({layerType:s},t))}}})},paint(t){return On({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*"(t){return Hn(v({layerType:s},t))}}})}}})),e}function Jn(t){const e=t.value,i=t.key,n=gi(e);return"string"!==n?[new zn(i,e,`string expected, ${n} found`)]:[]}const Kn={promoteId:Qn};function Yn(t){const e=t.value,i=t.key,n=t.styleSpec,r=t.style;if(!e.type)return[new zn(i,e,'"type" is required')];const o=Dn(e.type);let s;switch(o){case"vector":case"raster":case"raster-dem":return s=On({key:i,value:e,valueSpec:n[`source_${o.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:Kn}),s;case"geojson":if(s=On({key:i,value:e,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:Kn}),e.cluster)for(const t in e.clusterProperties){const[n,r]=e.clusterProperties[t],o="string"==typeof n?[n,["accumulated"],["get",t]]:n;s.push(...$n({key:`${i}.${t}.map`,value:r,expressionContext:"cluster-map"})),s.push(...$n({key:`${i}.${t}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return On({key:i,value:e,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return On({key:i,value:e,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new zn(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Vn({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:n})}}function Qn({key:t,value:e}){if("string"===gi(e))return Jn({key:t,value:e});{const i=[];for(const n in e)i.push(...Jn({key:`${t}.${n}`,value:e[n]}));return i}}function tr(t){const e=t.value,i=t.styleSpec,n=i.light,r=t.style;let o=[];const s=gi(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new zn("light",e,`object expected, ${s} found`)]),o;for(const t in e){const s=t.match(/^(.*)-transition$/);o=s&&n[s[1]]&&n[s[1]].transition?o.concat(sr({key:t,value:e[t],valueSpec:i.transition,style:r,styleSpec:i})):n[t]?o.concat(sr({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i})):o.concat([new zn(t,e[t],`unknown property "${t}"`)])}return o}function er(t){const e=t.value,i=t.styleSpec,n=i.terrain,r=t.style;let o=[];const s=gi(e);if(void 0===e)return o;if("object"!==s)return o=o.concat([new zn("terrain",e,`object expected, ${s} found`)]),o;for(const t in e)o=n[t]?o.concat(sr({key:t,value:e[t],valueSpec:n[t],style:r,styleSpec:i})):o.concat([new zn(t,e[t],`unknown property "${t}"`)]);return o}function ir(t){return 0===Jn(t).length?[]:$n(t)}function nr(t){return 0===Jn(t).length?[]:$n(t)}function rr(t){const e=t.key,i=t.value;if("array"===gi(i)){if(i.length<1||i.length>4)return[new zn(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const t={type:"number"};let n=[];for(let r=0;r<i.length;r++)n=n.concat(sr({key:`${e}[${r}]`,value:i[r],valueSpec:t}));return n}return Bn({key:e,value:i,valueSpec:{}})}const or={"*"(){return[]},array:Fn,boolean:Nn,number:Bn,color:Un,constants:Ln,enum:Vn,filter:qn,function:jn,layer:Xn,object:On,source:Yn,light:tr,terrain:er,string:Jn,formatted:ir,resolvedImage:nr,padding:rr};function sr(t){const e=t.value,i=t.valueSpec,n=t.styleSpec;return i.expression&&yi(Dn(e))?jn(t):i.expression&&Ai(Rn(e))?$n(t):i.type&&or[i.type]?or[i.type](t):On(v({},t,{valueSpec:i.type?n[i.type]:i}))}function ar(t){const e=t.value,i=t.key,n=Jn(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new zn(i,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new zn(i,e,'"glyphs" url must include a "{range}" token'))),n}function lr(t,e=r){let i=[];return i=i.concat(sr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:ar,"*"(){return[]}}})),t.constants&&(i=i.concat(Ln({key:"constants",value:t.constants,style:t,styleSpec:e}))),cr(i)}function cr(t){return[].concat(t).sort(((t,e)=>t.line-e.line))}function ur(t){return function(...e){return cr(t.apply(this,e))}}function hr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}lr.source=ur(Yn),lr.light=ur(tr),lr.terrain=ur(er),lr.layer=ur(Xn),lr.filter=ur(qn),lr.paintProperty=ur(Hn),lr.layoutProperty=ur(Wn);var dr={};function pr(t){if(t instanceof String||"string"==typeof t||t instanceof Buffer)try{return dr.parse(t.toString())}catch(t){throw new Pn(t)}return t}function fr(t,e=mr){let i=t;try{i=pr(i)}catch(t){return[t]}return lr(i,e)}!function(t){var e=function(){var t=function(t,e,i,n){for(i=i||{},n=t.length;n--;i[t[n]]=e);return i},e=[1,12],i=[1,13],n=[1,9],r=[1,10],o=[1,11],s=[1,14],a=[1,15],l=[14,18,22,24],c=[18,22],u=[22,24],h={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(t,e,i,n,r,o,s){var a=o.length-1;switch(r){case 1:this.$=new String(t.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b")),this.$.__line__=this._$.first_line;break;case 2:this.$=new Number(t),this.$.__line__=this._$.first_line;break;case 3:this.$=null;break;case 4:this.$=new Boolean(!0),this.$.__line__=this._$.first_line;break;case 5:this.$=new Boolean(!1),this.$.__line__=this._$.first_line;break;case 6:return this.$=o[a-1];case 13:this.$={},Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 14:case 19:this.$=o[a-1],Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 15:this.$=[o[a-2],o[a]];break;case 16:this.$={},this.$[o[a][0]]=o[a][1];break;case 17:this.$=o[a-2],o[a-2][o[a][0]]=o[a][1];break;case 18:this.$=[],Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 20:this.$=[o[a]];break;case 21:this.$=o[a-2],o[a-2].push(o[a])}},table:[{3:5,4:e,5:6,6:i,7:3,8:n,9:4,10:r,11:o,12:1,13:2,15:7,16:8,17:s,23:a},{1:[3]},{14:[1,16]},t(l,[2,7]),t(l,[2,8]),t(l,[2,9]),t(l,[2,10]),t(l,[2,11]),t(l,[2,12]),t(l,[2,3]),t(l,[2,4]),t(l,[2,5]),t([14,18,21,22,24],[2,1]),t(l,[2,2]),{3:20,4:e,18:[1,17],19:18,20:19},{3:5,4:e,5:6,6:i,7:3,8:n,9:4,10:r,11:o,13:23,15:7,16:8,17:s,23:a,24:[1,21],25:22},{1:[2,6]},t(l,[2,13]),{18:[1,24],22:[1,25]},t(c,[2,16]),{21:[1,26]},t(l,[2,18]),{22:[1,28],24:[1,27]},t(u,[2,20]),t(l,[2,14]),{3:20,4:e,20:29},{3:5,4:e,5:6,6:i,7:3,8:n,9:4,10:r,11:o,13:30,15:7,16:8,17:s,23:a},t(l,[2,19]),{3:5,4:e,5:6,6:i,7:3,8:n,9:4,10:r,11:o,13:31,15:7,16:8,17:s,23:a},t(c,[2,17]),t(c,[2,15]),t(u,[2,21])],defaultActions:{16:[2,6]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){var e=this,i=[0],n=[null],r=[],o=this.table,s="",a=0,l=0,c=2,u=1,h=r.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(p.yy[f]=this.yy[f]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var m=d.yylloc;r.push(m);var g=d.options&&d.options.ranges;function y(){var t;return"number"!=typeof(t=d.lex()||u)&&(t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,v,x,b,w,S,E,k,T={};;){if(v=i[i.length-1],this.defaultActions[v]?x=this.defaultActions[v]:(null==_&&(_=y()),x=o[v]&&o[v][_]),void 0===x||!x.length||!x[0]){var A="";for(w in k=[],o[v])this.terminals_[w]&&w>c&&k.push("'"+this.terminals_[w]+"'");A=d.showPosition?"Parse error on line "+(a+1)+":\n"+d.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(a+1)+": Unexpected "+(_==u?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(A,{text:d.match,token:this.terminals_[_]||_,line:d.yylineno,loc:m,expected:k})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+_);switch(x[0]){case 1:i.push(_),n.push(d.yytext),r.push(d.yylloc),i.push(x[1]),_=null,l=d.yyleng,s=d.yytext,a=d.yylineno,m=d.yylloc;break;case 2:if(S=this.productions_[x[1]][1],T.$=n[n.length-S],T._$={first_line:r[r.length-(S||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(S||1)].first_column,last_column:r[r.length-1].last_column},g&&(T._$.range=[r[r.length-(S||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(T,[s,l,a,p.yy,x[1],n,r].concat(h))))return b;S&&(i=i.slice(0,-1*S*2),n=n.slice(0,-1*S),r=r.slice(0,-1*S)),i.push(this.productions_[x[1]][0]),n.push(T.$),r.push(T._$),E=o[i[i.length-2]][i[i.length-1]],i.push(E);break;case 3:return!0}}return!0}},d={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,n,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var o in r)this[o]=r[o];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,i,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;o<r.length;o++)if((i=this._input.match(this.rules[r[o]]))&&(!e||i[0].length>e[0].length)){if(e=i,n=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,r[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[n]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,i,n){switch(i){case 0:break;case 1:return 6;case 2:return e.yytext=e.yytext.substr(1,e.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};function p(){this.yy={}}return h.lexer=d,p.prototype=h,h.Parser=p,new p}();void 0!==hr&&(t.parser=e,t.Parser=e.Parser,t.parse=function(){return e.parse.apply(e,arguments)})}(dr);const mr=r,gr={StyleExpression:Ti,isExpression:Ai,isExpressionFilter:Ji,createExpression:Ii,createPropertyExpression:zi,normalizePropertyExpression:Li,ZoomConstantExpression:Mi,ZoomDependentExpression:Ci,StylePropertyFunction:Pi},yr={convertFunction:Bi,createFunction:vi,isFunction:yi},_r={eachSource:u,eachLayer:h,eachProperty:d};t.Color=X,t.Padding=Q,t.ParsingError=Pn,t.ValidationError=zn,t.composite=mn,t.convertFilter=ln,t.derefLayers=_n,t.diff=Cn,t.expression=gr,t.featureFilter=Yi,t.format=l,t.function=yr,t.latest=r,t.migrate=fn,t.v8=mr,t.validate=fr,t.visit=_r,Object.defineProperty(t,"__esModule",{value:!0})}(e,i(8575))},614:function(t,e,i){"use strict";function n(t,e){for(var i=new Array(e),n=0;n<e;++n)i[n]=t(n/(e-1));return i}i.d(e,{Z:function(){return n}})},1002:function(t,e,i){"use strict";function n(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function r(t,e){var i=Object.create(t.prototype);for(var n in e)i[n]=e[n];return i}function o(){}i.d(e,{ZP:function(){return U}});var s=.7,a=1/s,l="\\s*([+-]?\\d+)\\s*",c="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h=/^#([0-9a-f]{3,8})$/,d=new RegExp(`^rgb\\(${l},${l},${l}\\)$`),p=new RegExp(`^rgb\\(${u},${u},${u}\\)$`),f=new RegExp(`^rgba\\(${l},${l},${l},${c}\\)$`),m=new RegExp(`^rgba\\(${u},${u},${u},${c}\\)$`),g=new RegExp(`^hsl\\(${c},${u},${u}\\)$`),y=new RegExp(`^hsla\\(${c},${u},${u},${c}\\)$`),_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function v(){return this.rgb().formatHex()}function x(){return this.rgb().formatRgb()}function b(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=h.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?w(e):3===i?new k(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?S(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?S(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=d.exec(t))?new k(e[1],e[2],e[3],1):(e=p.exec(t))?new k(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=f.exec(t))?S(e[1],e[2],e[3],e[4]):(e=m.exec(t))?S(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=g.exec(t))?z(e[1],e[2]/100,e[3]/100,1):(e=y.exec(t))?z(e[1],e[2]/100,e[3]/100,e[4]):_.hasOwnProperty(t)?w(_[t]):"transparent"===t?new k(NaN,NaN,NaN,0):null}function w(t){return new k(t>>16&255,t>>8&255,255&t,1)}function S(t,e,i,n){return n<=0&&(t=e=i=NaN),new k(t,e,i,n)}function E(t,e,i,n){return 1===arguments.length?((r=t)instanceof o||(r=b(r)),r?new k((r=r.rgb()).r,r.g,r.b,r.opacity):new k):new k(t,e,i,null==n?1:n);var r}function k(t,e,i,n){this.r=+t,this.g=+e,this.b=+i,this.opacity=+n}function T(){return`#${C(this.r)}${C(this.g)}${C(this.b)}`}function A(){const t=I(this.opacity);return`${1===t?"rgb(":"rgba("}${M(this.r)}, ${M(this.g)}, ${M(this.b)}${1===t?")":`, ${t})`}`}function I(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function M(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function C(t){return((t=M(t))<16?"0":"")+t.toString(16)}function z(t,e,i,n){return n<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new L(t,e,i,n)}function P(t){if(t instanceof L)return new L(t.h,t.s,t.l,t.opacity);if(t instanceof o||(t=b(t)),!t)return new L;if(t instanceof L)return t;var e=(t=t.rgb()).r/255,i=t.g/255,n=t.b/255,r=Math.min(e,i,n),s=Math.max(e,i,n),a=NaN,l=s-r,c=(s+r)/2;return l?(a=e===s?(i-n)/l+6*(i<n):i===s?(n-e)/l+2:(e-i)/l+4,l/=c<.5?s+r:2-s-r,a*=60):l=c>0&&c<1?0:a,new L(a,l,c,t.opacity)}function L(t,e,i,n){this.h=+t,this.s=+e,this.l=+i,this.opacity=+n}function D(t){return(t=(t||0)%360)<0?t+360:t}function R(t){return Math.max(0,Math.min(1,t||0))}function O(t,e,i){return 255*(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)}function F(t,e,i,n,r){var o=t*t,s=o*t;return((1-3*t+3*o-s)*e+(4-6*o+3*s)*i+(1+3*t+3*o-3*s)*n+s*r)/6}n(o,b,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:v,formatHex:v,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return P(this).formatHsl()},formatRgb:x,toString:x}),n(k,E,r(o,{brighter(t){return t=null==t?a:Math.pow(a,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?s:Math.pow(s,t),new k(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new k(M(this.r),M(this.g),M(this.b),I(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:T,formatHex:T,formatHex8:function(){return`#${C(this.r)}${C(this.g)}${C(this.b)}${C(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:A,toString:A})),n(L,(function(t,e,i,n){return 1===arguments.length?P(t):new L(t,e,i,null==n?1:n)}),r(o,{brighter(t){return t=null==t?a:Math.pow(a,t),new L(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?s:Math.pow(s,t),new L(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,n=i+(i<.5?i:1-i)*e,r=2*i-n;return new k(O(t>=240?t-240:t+120,r,n),O(t,r,n),O(t<120?t+240:t-120,r,n),this.opacity)},clamp(){return new L(D(this.h),R(this.s),R(this.l),I(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=I(this.opacity);return`${1===t?"hsl(":"hsla("}${D(this.h)}, ${100*R(this.s)}%, ${100*R(this.l)}%${1===t?")":`, ${t})`}`}}));var B=t=>()=>t;function j(t,e){return function(i){return t+i*e}}function $(t){return 1==(t=+t)?N:function(e,i){return i-e?function(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(n){return Math.pow(t+n*e,i)}}(e,i,t):B(isNaN(e)?i:e)}}function N(t,e){var i=e-t;return i?j(t,i):B(isNaN(t)?e:t)}var U=function t(e){var i=$(e);function n(t,e){var n=i((t=E(t)).r,(e=E(e)).r),r=i(t.g,e.g),o=i(t.b,e.b),s=N(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=r(e),t.b=o(e),t.opacity=s(e),t+""}}return n.gamma=t,n}(1);function V(t){return function(e){var i,n,r=e.length,o=new Array(r),s=new Array(r),a=new Array(r);for(i=0;i<r;++i)n=E(e[i]),o[i]=n.r||0,s[i]=n.g||0,a[i]=n.b||0;return o=t(o),s=t(s),a=t(a),n.opacity=1,function(t){return n.r=o(t),n.g=s(t),n.b=a(t),n+""}}}V((function(t){var e=t.length-1;return function(i){var n=i<=0?i=0:i>=1?(i=1,e-1):Math.floor(i*e),r=t[n],o=t[n+1],s=n>0?t[n-1]:2*r-o,a=n<e-1?t[n+2]:2*o-r;return F((i-n/e)*e,s,r,o,a)}})),V((function(t){var e=t.length;return function(i){var n=Math.floor(((i%=1)<0?++i:i)*e),r=t[(n+e-1)%e],o=t[n%e],s=t[(n+1)%e],a=t[(n+2)%e];return F((i-n/e)*e,r,o,s,a)}}))},2488:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for {alternative}","allResults":"All results","candidateList":"Candidate list"}')},8680:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Gå tilbage","notice":"Brug to fingre til at navigere i kortet"}')},4420:function(t){"use strict";t.exports=JSON.parse('{"party":"Parti","votes":"Stemmer","reporting":"{percentage}% optalt","ev":"VM","electoralVotes":"Valgmænd","unknown":"Ukendt"}')},5587:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Henter indstillinger","errorLoadingSettings":"Fejl i indstillinger","loadCandidates":"Henter data om kandidat","errorLoadingCandidates":"Fejl i kandidatens data","loadingResults":"Henter resultat","errorLoadingResults":"Fejl i resultater","updatedOn":"Opdateret {date} kl. {time}","checkingForData":"Opdaterer resultat om: {time}"}')},4154:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for {alternative}","allResults":"All results","candidateList":"Candidate list"}')},4422:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Zurück","notice":"Verwenden Sie zwei Finger um die Karte zu bewegen"}')},3918:function(t){"use strict";t.exports=JSON.parse('{"party":"Partei","votes":"Stimmen","reporting":"Wahlbeteiligung {percentage}%","ev":"WL","electoralVotes":"Wahlleute","unknown":"Unbekannt"}')},9596:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Einstellungen werden geladen","errorLoadingSettings":"Fehler beim Laden der Einstellungen","loadCandidates":"Kandidat-Daten werden geladen","errorLoadingCandidates":"Fehler beim Laden der Kandidat-Daten","loadingResults":"Ergebnisse werden geladen","errorLoadingResults":"Fehler beim Laden der Ergebnisse","updatedOn":"Aktualisiert am {date} um {time}","checkingForData":"Neue Daten werden abgerufen in: {time}"}')},3234:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for { interpolate }","allResults":"All results","candidateList":"Candidate list"}')},2230:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Go back","notice":"Use two fingers to move the map"}')},9766:function(t){"use strict";t.exports=JSON.parse('{"geolocationNotAvailable":"Sorry, geolocation is not supported by your browser"}')},9052:function(t){"use strict";t.exports=JSON.parse('{"flyTo":"fly to..."}')},6791:function(t){"use strict";t.exports=JSON.parse('{"party":"Party","votes":"Votes","reporting":"{ interpolate }% Reporting","ev":"E.V.","electoralVotes":"Electoral Votes","unknown":"Unknown"}')},8352:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Loading settings","errorLoadingSettings":"Error loading settings","loadCandidates":"Loading candidate data","errorLoadingCandidates":"Error loading candidates","loadingResults":"Loading results","errorLoadingResults":"Error loading results","updatedOn":"Updated on { interpolate.date } at { interpolate.time }","checkingForData":"Checking for new data in: { interpolate }"}')},358:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for {alternative}","allResults":"All results","candidateList":"Candidate list"}')},4074:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Vuelve atrás","notice":"Usa dos dedos para mover el mapa"}')},851:function(t){"use strict";t.exports=JSON.parse('{"party":"Partido","votes":"Votos","reporting":"{percentage}% Informando","ev":"V.E.","electoralVotes":"Votos Electorales","unknown":"Desconocido"}')},4529:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Cargando configuración","errorLoadingSettings":"Error al cargar la configuración","loadCandidates":"Cargando los datos del candidato","errorLoadingCandidates":"Error al cargar los datos de los candidatos","loadingResults":"Cargando los resultados","errorLoadingResults":"Error al cargar los resultados","updatedOn":"Actualizado el {date} a las {time}","checkingForData":"Comprobando nuevos datos en {time}"}')},4568:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Voir plus","showLess":"Voir moins","tapFor":"Résutats de {alternative}","allResults":"Tous les résultats","candidateList":"Liste des candidats"}')},458:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Retour en arrière","notice":"Utilisez deux doigts pour déplacer la carte"}')},2008:function(t){"use strict";t.exports=JSON.parse('{"party":"Parti","votes":"Votes","reporting":"{percentage}% des votes dépouillés","ev":"C.E.","electoralVotes":"Collège électoral","unknown":"Inconnu"}')},8105:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Chargement des paramètres","errorLoadingSettings":"Erreur lors du chargement des paramètres","loadCandidates":"Chargement des données du candidat","errorLoadingCandidates":"Erreur de chargement des candidats","loadingResults":"Chargement des résultats","errorLoadingResults":"Erreur de chargement des résultats","updatedOn":"{date} à {time} ","checkingForData":"mise à jour dans : {time}"}')},3181:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for {alternative}","allResults":"All results","candidateList":"Candidate list"}')},51:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Indietro","notice":"Usa due dita per muovere la mappa"}')},4367:function(t){"use strict";t.exports=JSON.parse('{"party":"Partito","votes":"Voti","reporting":"{percentage}% Copertura","ev":"V.E.","electoralVotes":"Voti Elettorali","unknown":"Sconosciuto"}')},5983:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Caricamento impostazioni","errorLoadingSettings":"Errore caricamento impostazioni","loadCandidates":"Caricamento dati candidato","errorLoadingCandidates":"Errore caricamento dati candidato","loadingResults":"Caricamento risultati","errorLoadingResults":"Errore caricamento risultati","updatedOn":"Aggiornato il {date} alle {time}","checkingForData":"Controllo nuovi dati in: {time}"}')},9745:function(t){"use strict";t.exports=JSON.parse('{"showMore":"Show more","showLess":"Show less","tapFor":"Tap for {alternative}","allResults":"All results","candidateList":"Candidate list"}')},2279:function(t){"use strict";t.exports=JSON.parse('{"goBack":"Ga terug","notice":"Gebruik twee vingers om de kaart te bewegen"}')},9733:function(t){"use strict";t.exports=JSON.parse('{"party":"Partij","votes":"Stemmen","reporting":"{percentage}% Gerapporteerd","ev":"K.M.","electoralVotes":"Kiesmannen","unknown":"Onbekend"}')},7661:function(t){"use strict";t.exports=JSON.parse('{"loadingSettings":"Instellingen aan het laden","errorLoadingSettings":"Fout bij het laden van de instellingen","loadCandidates":"Kandidaat data aan het laden","errorLoadingCandidates":"Fout bij het laden van kandidaat data","loadingResults":"Resultaten aan het laden","errorLoadingResults":"Fout bij het laden van de resultaten","updatedOn":"Geüpdatet op {date} om {time}","checkingForData":"Controleren op nieuwe data over: {time}"}')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.loaded=!0,o.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.hmd=function(t){return(t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t};var n={};return function(){"use strict";i.r(n),i.d(n,{init:function(){return D}});var t=i(1823);class e{mapOptions;options;_favicon;constructor(t,e){this.mapOptions={...this.constructor.defaultMapOptions,...e},this.options={...this.constructor.defaultMapOptions,...t},this.options.libraryMode||(this.updateTitle(),this.updateFavicon())}static get defaultMapOptions(){return{container:document.getElementsByClassName("map")[0],attributionControl:!1}}static get defaultOptions(){return{noBounds:"true"===(0,t.Ph)("noBounds"),language:navigator.language||navigator.userLanguage}}updateTitle(){const t=document.querySelector("title");t.innerText=`${this.title} - ${t.innerText}`}updateFavicon(){this._favicon=document.createElement("link"),this._favicon.setAttribute("href",this.favicon),this._favicon.setAttribute("rel","shortcut icon"),this._favicon.parentElement!==document.head&&document.head.appendChild(this._favicon)}get favicon(){throw new Error("Unimplemented")}get title(){return"Unimplemented"}}var r=i(1042),o=i(1527);function s(t,e,i=[255,255,255,255]){const n={width:t,height:e,data:new Uint8Array(t*e*4)};for(let r=0;r<t*e*4;r+=4)for(let t=0;t<4;t++)n.data[r+t]=i[t];return n}var a=i(3645),l=i(9809),c=i(5574);class u{_active=!1;map;target;options;_instance;constructor(t,e,i={}){this.map=t,this.target=e,this.options=i,this.control.stackingOrder=this.target.stackingOrder}activate(){if(!this.active){if(this.target.wrapperId)this.addToWrapper(this.target.wrapperId);else if("arbitrary"===this.position)this.control instanceof c.T&&this.control.applyOffset(this.offset),this.map.addControl(this.control,"top-left");else if(this.position.includes("center")){const t=this.control.container.style;let e="top-left";t.position="absolute","top-center"===this.position?(t.top="0",t.transform="translateX(-50%)",t.marginLeft="0",e="top-left"):"bottom-center"===this.position?(t.bottom="0",t.transform="translateX(-50%)",t.marginLeft="0",e="bottom-left"):"center-left"===this.position?(t.left="0",t.transform="translateY(-50%)",t.marginTop="0",e="top-left"):"center-right"===this.position&&(t.right="0",t.transform="translateY(-50%)",t.marginTop="0",e="top-right"),this.map.addControl(this.control,e),this.map.on("resize",this.centerAdornment),this.centerAdornment()}else this.map.addControl(this.control,this.position);this._active=!0}}disable(){this.active&&(this.map.removeControl(this.control),this.map.off("resize",this.centerAdornment),this._active=!1)}centerAdornment=()=>{"top-center"!==this.position&&"bottom-center"!==this.position||(this.control.container.style.left=`${Math.round(this.map.getContainer().clientWidth/2)}px`),"center-left"!==this.position&&"center-right"!==this.position||(this.control.container.style.top=`${Math.round(this.map.getContainer().clientHeight/2)}px`)};addToWrapper(t){let e="";switch(t){case"top-right-wrapper":e="top-right";break;case"top-left-wrapper":e="top-left";break;case"bottom-left-wrapper":e="bottom-left";break;case"bottom-right-wrapper":e="bottom-right";break;case"top-left-wrapper-vertical":e="top-left",this.target.control.container.classList.add("vertical-adornment","vertical-top-left");break;case"top-right-wrapper-vertical":e="top-right",this.target.control.container.classList.add("vertical-adornment","vertical-top-right");break;case"bottom-left-wrapper-vertical":e="bottom-left",this.target.control.container.classList.add("vertical-adornment","vertical-bottom-left");break;case"bottom-right-wrapper-vertical":e="bottom-right",this.target.control.container.classList.add("vertical-adornment","vertical-bottom-right")}if(this.target.control.container&&(this.target.control.container.style.order=this.target.stackingOrder+1,this.target.margins))for(const t of Object.keys(this.target.margins))this.target.control.container.style[`margin-${t}`]=`${this.target.margins[t]}px`;this.map.addControl(this.control,e)}get active(){return this._active}get control(){let t=this._instance??this.target.control??this.target;return"function"==typeof t&&(t=this._instance=new t),t}get position(){return this.target.screenPosition??this.options.position??"top-left"}get offset(){return this.target.elementOffset??this.options.offset??{x:0,y:0}}}class h{_controls=new Set;_active=!1;map;constructor(t){this.map=t}add(t,e={}){if(this.has(t))return;const i=new u(this.map,t,e);this._controls.add(i),this.active&&i.activate()}remove(t){this._controls.delete(this._findControlFor(t))}has(t){return Boolean(this._findControlFor(t))}_findControlFor(t){for(const e of this._controls)if(e.target===t)return e}activate(){this._controls.forEach((t=>t.activate())),this._active=!0}disable(){this._controls.forEach((t=>t.disable())),this._active=!1}get active(){return this._active}}class d{map;control;constructor(t){this.map=t}static get watch(){return"click"}init(t,e){}destroy(){}show(t,e){}hide(t){}}class p extends c.T{content;_closed;_listener;get hidesOnMobileIframe(){return!0}onAdd(t){return this.map=t,this.content="<p>Hello World</p>",this.container.classList.add("sidebar-content"),this.container.style.left=this._closed="-122vw",this._listener=t=>{const{classList:e}=t.target;(e.contains("maplibregl-canvas")||e.contains("mc-sidebar-close-button"))&&this.close()},document.body.addEventListener("click",this._listener),this.container}setContent(t){this.content=t,this.buildElement()}show(){this.container.style.left="0"}close(){this.container.style.left=this._closed,this.checkAdornments()}buildElement(){const t=document.createElement("button");t.classList.add("mc-sidebar-close-button"),t.type="button",t.innerHTML="×";const e=document.createElement("div");e.classList.add("sidebar-inner"),e.appendChild(t),e.innerHTML+=this.content,this.container.innerHTML=e.outerHTML,this.checkAdornments(!0)}onRemove(){document.body.removeEventListener("click",this._listener),this.container.remove(),this.map=null}getDefaultPosition(){return"top-left"}checkAdornments(t=!1){const e=Array.from(document.querySelectorAll(".svgAdornment")),i=this.container.offsetWidth;for(const n of e)t&&i>n.getBoundingClientRect().x?n.style.visibility="hidden":n.style.visibility="visible"}}class f extends d{init(){this.control=new p,this.map.addControl(this.control)}destroy(){this.map.removeControl(this.control)}show(t,e){this.control.setContent(t),this.control.show()}hide(){this.control.close()}}var m=i(498);class g{static maybeLiteral={paint:[],layout:["text-font","text-variable-anchor","text-writing-mode"]};parsedExpression;constructor(t){this.parsedExpression=t}static parse(t,e=null){let i;if(t.stops&&(t=["step",["zoom"],["literal",t.stops[0][1]],...t.stops.map((([t,e])=>[t,["literal",e]])).flat(1)]),i=e?m.expression.createExpression(t,{type:e}):m.expression.createExpression(t),"success"===i?.result)return new g(i.value);throw i.value[0]}evaluate(t,e={zoom:14}){return this.parsedExpression.evaluate(e,t)}static evaluateForLayer(t,e,i={zoom:14}){const n={paint:{},layout:{}};for(const r in n)if("object"==typeof t[r])for(const o in t[r]){const s=t[r][o];if(s?.stops||Array.isArray(s)&&"string"==typeof s[0])try{n[r][o]=g.parse(s).evaluate(e,i)}catch(t){if(!t.message.startsWith("Unknown expression")||!this.maybeLiteral[r].includes(o))throw t;console.warn(`Evaluation fallback for "${r}.${o}", expression might be a literal`,s),n[r][o]=s}else n[r][o]=s}return n}}class y extends c.T{position;highlight;listenEvent;content;_closed;_listener;focusedMarker;featureId;get hidesOnMobileIframe(){return!1}setPosition(t){this.position=t??"bottomLeft"}setHighlight(t){this.highlight=t??!1}setListenEvent(t){this.listenEvent=t}onAdd(t){return this.map=t,this.content="<p>Hello World</p>",this.container.classList.add("fixed-popup-content"),this.container.classList.add("bottomRight"===this.position?"desktop-bottom-right":"desktop-bottom-left"),this.container.style.transform=this._closed="translateY(calc(100% + 10px))",this._listener=t=>{const{classList:e}=t.target;if(e.contains("mapboxgl-canvas")){this.map.queryRenderedFeatures([t.clientX,t.clientY]).find((t=>t.properties?.["mc-interactivity-template"]||t.layer.metadata?.["mc-interactivity-template"]))||this.close()}},document.body.addEventListener(this.listenEvent??"mousedown",this._listener),this.container}setContent(t,e=!1){this.content=t,this.buildElement(e)}getCenter(t){const e=t.map((t=>t[0])),i=t.map((t=>t[1]));return[(Math.min(...e)+Math.max(...e))/2,(Math.min(...i)+Math.max(...i))/2]}getFeatureCoordinates(t){let e;return"Point"===t?.geometry?.type?e=t.geometry.coordinates:"Polygon"===t?.geometry?.type?e=this.getCenter(t.geometry.coordinates[0]):"LineString"===t?.geometry?.type&&(e=this.getCenter(t.geometry.coordinates)),e}useNarrowScreen(){const t=document.getElementsByClassName("fixed-popup-content")[0]?.offsetWidth;return t>=window.innerWidth-20}shouldBePanned(t){const{x:e,y:i}=this.map.project(t),n=document.getElementsByClassName("fixed-popup-content")[0]?.offsetWidth;if(this.useNarrowScreen())return i>window.innerHeight/2-20;let r=!1;return r="bottomRight"===this.position?e>window.innerWidth-(n+20):e<n+20,r||i<20||i>window.innerHeight-20||e>window.innerWidth-20||e<20}panTo(t){const e=document.getElementsByClassName("fixed-popup-content")[0]?.offsetWidth;if(this.useNarrowScreen()){const e=window.innerHeight/2,i=10,n=window.innerHeight,r=e+2*i+(n-e-2*i)/2-n/2,{x:o,y:s}=this.map.project(t),a=-1,{lng:l,lat:c}=this.map.unproject({x:o,y:s-a*r});this.map.panTo({lng:l,lat:c})}else{const i=10,n=window.innerWidth,r=e+2*i+(n-e-2*i)/2-n/2,{x:o,y:s}=this.map.project(t),a="bottomRight"===this.position?-1:1,{lng:l,lat:c}=this.map.unproject({x:o-a*r,y:s});this.map.panTo({lng:l,lat:c})}}show({feature:e,coordinates:i}){if(this.container.style.transform="translateY(0)",i=this.getFeatureCoordinates(e)??i,this.shouldBePanned(i)&&"mousemove"!==this.listenEvent&&this.panTo(i),this.focusedMarker){const t=this.focusedMarker;this.map.setPaintProperty(t.feature.layer.id,"icon-opacity",1),this.map.once("sourcedata",(()=>{t.remove()}))}this.highlight&&"Point"===e?.geometry?.type?this.focusedMarker=function(e,i,n,r=1.2){const s=document.createElement("div");let a;s.classList.add("grow-marker"),(0,t._m)(e);let l=1;const c=n.getLayoutProperty(e.layer.id,"icon-size"),u=e.properties["mc-svg-string"],h={width:void 0,height:void 0};if(a=Array.isArray(c)?g.parse(c).evaluate(e)??1:c??1,u){const e=(0,t.q_)(u).firstChild;s.appendChild(e)}else{const t=e.layer.layout["icon-image"];if(!t)return;const i=n.painter.imageManager.images[t],r=i.data;l=i.pixelRatio,h.width=r.width,h.height=r.height;const o=document.createElement("canvas"),c=o.getContext("2d");c.canvas.width=r.width,c.canvas.height=r.height;const u=new ImageData(new Uint8ClampedArray(r.data),r.width,r.height);c.putImageData(u,0,0);const d=o.toDataURL("image/png"),p=document.createElement("img");p.src=d,p.width=Math.round(a/l*(h.width??1)),p.height=Math.round(a/l*(h.height??1)),h.width=p.width,h.height=p.height,s.appendChild(p)}const d=["case",e.layer.id!==e.id?["!=",["get","id"],e.id]:["!=",["get","mc-layer"],e.layer.id],1,0];n.setPaintProperty(e.layer.id,"icon-opacity",d);const p=JSON.parse(e.properties["icon-offset"]??"[0, 0]"),f=JSON.parse(e.properties["icon-offset-addition"]??"[0, 0]");s.style.width=`${h.width}px`,s.style.height=`${h.height}px`,s.style.display="flex";const m=new o.Marker({element:s,anchor:u?"top-left":"center"}).setLngLat(i).addTo(n),y=p[0]+f[0]??0,_=p[1]+f[1]??0,v=m.getElement().firstChild,x=e.properties["icon-rotate"]??0;return v.style.transform=`scale(${r}) rotate(${x}deg)`,v.style.transformOrigin=u?`${-y}px ${-_}px`:"center",m.setLngLat(i).setOffset([y,_]),m.feature=e,m}(e,i,this.map,1.3):this.focusedMarker=null,this.featureId=e.id}close(){if(this.container.style.transform=this._closed,this.focusedMarker){const t=this.focusedMarker;this.map.setPaintProperty(t.feature.layer.id,"icon-opacity",1),this.map.once("sourcedata",(()=>{t.remove()}))}this.featureId=null,this.checkAdornments(!1)}buildElement(t){const e=document.createElement("div");e.classList.add("fixed-popup-inner"),e.innerHTML+=this.content,this.container.innerHTML=e.outerHTML,this.checkAdornments(t)}onRemove(){document.body.removeEventListener("click",this._listener),this.container.remove(),this.map=null}getDefaultPosition(){return"bottomLeft"===this.position?"bottom-left":"bottom-right"}checkAdornments(t){const e=[...document.querySelectorAll(".svgAdornment"),...document.querySelectorAll(".adornment-collision")];let i=this.container.getBoundingClientRect().top;t&&this.container.style.transform===this._closed&&(i-=this.container.getBoundingClientRect().height+10);const n=this.container.getBoundingClientRect().right,r=this.container.getBoundingClientRect().left;for(const o of e){const{bottom:e,left:s,right:a}=o.getBoundingClientRect(),l=o.parentElement;t&&i<e+10&&("bottomLeft"===this.position?n>s-10:r<a+10)?(o.style.visibility="hidden",null!==l&&(l.style.pointerEvents="none")):(o.style.visibility="visible",null!==l&&(l.style.pointerEvents="auto"))}}}class _ extends d{init(t,e){this.control=new y,this.control.setPosition(t),this.control.setHighlight(e),this.map.addControl(this.control)}show(t,e){this.control.featureId!==e.feature.id&&(this.control.setContent(t,!0),this.control.show(e))}hide(t){this.control.close(t)}destroy(){this.map.removeControl(this.control)}}const v=Object.freeze({SIDEBAR:"sidebar",POPUP:"popup",NONE:"none",HOVER_POPUP:"hover",HOVER_SIDEBAR:"hoverSidebar"});var x=v;const b=Object.freeze({[v.POPUP]:_,[v.SIDEBAR]:f,[v.NONE]:class extends d{show(t,e){}},[v.HOVER_POPUP]:class extends _{static get watch(){return r.tq?"click":"mousemove"}init(t,e){this.control=new y,this.control.setPosition(t),this.control.setHighlight(e),this.control.setListenEvent(r.tq?"click":"mousemove"),this.map.addControl(this.control)}},[v.HOVER_SIDEBAR]:class extends f{static get watch(){return r.tq?"click":"mousemove"}}});class w{map;languages;publication;featureIds;layerIds;_promoteCache;_boundOnMapEvent;_isLoading;_type;_interactivity;_highlighted;_boundShowInteractivity;_pointed;popupPosition;highlightInteractivity;constructor(t,e,i=null,n=null,r=!1){this.map=t,this.featureIds=new Set,this.layerIds=new Set,this.languages=e,this.publication=i,this._promoteCache=new Map,this._boundOnMapEvent=this._onMapEvent.bind(this),this._boundShowInteractivity=this._showInteractivity.bind(this),this._isLoading=!1,this.popupPosition=n,this.highlightInteractivity=r,this.setType(x.NONE)}getType(){return this._type}setType(t){const e=Object.values(x);if(e.includes(t))return this._interactivity&&(this.map.off(this._interactivity.constructor.watch,this._boundOnMapEvent),this.map.off("mousemove",this._boundShowInteractivity),this._interactivity.destroy()),this._type=t,this._interactivity=new b[t](this.map),this.map.on(b[t].watch,this._boundOnMapEvent),this.map.on("mousemove",this._boundShowInteractivity),this._interactivity.init(this.popupPosition,this.highlightInteractivity);const i=`Expected type to be one of InteractivityType (${e.join(", ")})`;throw new TypeError(i)}async show(t,e){if(this._isLoading)return;if(e.feature.id===this._interactivity.control?.featureId)return void this._interactivity?.show(t,{feature:null,event:null,coordinates:this.map.getCenter(),...e});const i=document.createElement("div");i.innerHTML=t;const n=[];for(const t of i.querySelectorAll("img"))n.push(new Promise((e=>{t.onload=()=>e(),t.onerror=()=>{const i=t.getAttribute("placeholder");i?(t.src=i,t.setAttribute("style","object-fit:cover"),t.onerror=null):t.remove(),e()}})));this._isLoading=!0,this.map.getCanvas().style.cursor="progress",await Promise.all(n),this._isLoading=!1,this.map.getCanvas().style.cursor=this._pointed?"pointer":null,"<p></p>"!==(t=i.innerHTML).replace(/\s/g,"")&&this._interactivity?.show(t,{feature:null,event:null,coordinates:this.map.getCenter(),...e})}hide(){this._interactivity?.hide()}isInteractive(t){return Boolean(this._getTemplate(t))}_getEventFeature(t){return t.features?t.features[0]:t.point?this._checkForHatchLayer(t.point):t.lngLat?this._checkForHatchLayer(t.lngLat):void 0}_checkForHatchLayer(t){const e=this.map.queryRenderedFeatures(t),i=e[0]?.layer?.id.endsWith("hatching");return i?e[1]:e[0]}_showInteractivity(t){if(this._isLoading)return;const e=this._getEventFeature(t);if(!e||!this._getTemplate(e))return this.map.getCanvas().style.cursor=null,void(this._pointed=!1);this.map.getCanvas().style.cursor="pointer",this._pointed=!0}_onMapEvent(e){const i=this._getEventFeature(e);if(!i)return;(0,t._m)(i);if(!(this.featureIds.has(i.id)||this.layerIds.has(i.layer?.id)))return void(0,r.PQ)((()=>this.hide()));const n=this._getTemplate(i);if(n){const t="Point"===i.geometry?.type?i.geometry.coordinates:e.lngLat;(0,r.PQ)((()=>this.show(n,{feature:i,coordinates:t,event:e})))}else(0,r.PQ)((()=>this.hide()))}_getTemplate(t){const e=[];let i;this.publication&&(this.languages.forEach((t=>e.push(`:${this.publication}-${t}`))),e.push(`:${this.publication}`)),this.languages.forEach((t=>e.push(`:${t}`))),e.push("");for(let n=0;!i&&n<e.length;n++)i=this._getProperty(t,`mc-interactivity-template${e[n]}`);for(let n=0;!i&&n<e.length;n++)i=t.layer?.metadata?.[`mc-interactivity-template${e[n]}`];if(i)return i=this._fillTemplate(t,i),i}_fillTemplate(t,e,i="data-mention-id"){const n=(new DOMParser).parseFromString(e,"text/html").body;for(const e of n.querySelectorAll(`[${i}]`)){const n=this._getProperty(t,e.getAttribute(i));void 0!==n&&(e.innerText=n)}return n.innerHTML}highlight(t){this._highlighted&&this.map.setFeatureState(this._highlighted,{highlight:!1}),t?.id?(this._highlighted={source:t.source,id:t.id??t.properties?.id,sourceLayer:t.sourceLayer},this.map.setFeatureState(this._highlighted,{highlight:!0})):this._highlighted=null}_getProperty(t,e){return t.properties[e]??this._getVectorProperty(t,e)}_getVectorProperty(t,e){let i=this._promoteCache.get(t.source);void 0===i&&(i=this.map.getSource(t.source).serialize().promoteId||"id",this._promoteCache.set(t.source,i));try{const n=t.properties[i];return t.layer.metadata.properties[e][n]}catch(t){return}}}class S{loader;map;behaviors;availableBehaviors;constructor(e,n){this.loader=e,this.map=n,this.behaviors=[],this.availableBehaviors=Object.entries((0,t.A4)(i(1388))).filter((([t])=>!t.startsWith("Abstract"))).map((([,t])=>t))}async init(t){this._initBehaviors(this._findBehaviors(),t),await Promise.all(this.behaviors.map((t=>t.init())))}findBehavior(t){return this.behaviors.find((e=>e.constructor.identifier===t))}_initBehaviors(t,e={}){for(const i of t){const t=Array.isArray(i)?i:[String(i)],n=this._findBehaviorConstructor(t.shift());if(!n)continue;const r=new n(this.loader,e[n.identifier]??{},...t);this.behaviors.push(r)}}_findBehaviors(){return this.map.getStyle().metadata?.behaviors??[]}_findBehaviorConstructor(t){return this.availableBehaviors.find((e=>e.identifier===t))}}var E=i(5704);const k=Object.freeze({THREE:"ISO 639-2/B",API:"ISO 639-2/B",TWO:"ISO 639-1",MAPLIBRE_COMPAT:"ISO 639-1",ENDONYM:"name",NAME:"name",LOCALE:"locale",i18n:"locale"});var T=k;const A=Object.freeze([{[k.TWO]:"en",[k.THREE]:"eng",[k.ENDONYM]:"English",[k.LOCALE]:"en_GB"},{[k.TWO]:"da",[k.THREE]:"dan",[k.ENDONYM]:"Dansk",[k.LOCALE]:"da_DK"},{[k.TWO]:"nl",[k.THREE]:"dut",[k.ENDONYM]:"Nederlands",[k.LOCALE]:"nl_NL"},{[k.TWO]:"fi",[k.THREE]:"fin",[k.ENDONYM]:"Suomi",[k.LOCALE]:"fi_FI"},{[k.TWO]:"fr",[k.THREE]:"fre",[k.ENDONYM]:"Francais",[k.LOCALE]:"fr_FR"},{[k.TWO]:"de",[k.THREE]:"ger",[k.ENDONYM]:"Deutsch",[k.LOCALE]:"de_DE"},{[k.TWO]:"it",[k.THREE]:"ita",[k.ENDONYM]:"Italiano",[k.LOCALE]:"it_IT"},{[k.TWO]:"no",[k.THREE]:"nor",[k.ENDONYM]:"Norsk",[k.LOCALE]:"nn_NO"},{[k.TWO]:"pl",[k.THREE]:"pol",[k.ENDONYM]:"Polski",[k.LOCALE]:"pl_PL"},{[k.TWO]:"pt",[k.THREE]:"por",[k.ENDONYM]:"Portugues",[k.LOCALE]:"pt_PT"},{[k.TWO]:"es",[k.THREE]:"spa",[k.ENDONYM]:"Espanol",[k.LOCALE]:"es_ES"},{[k.TWO]:"sv",[k.THREE]:"swe",[k.ENDONYM]:"Svenska",[k.LOCALE]:"sv_SE"},{[k.TWO]:"ja",[k.THREE]:"jpn",[k.ENDONYM]:"日本語",[k.LOCALE]:"ja_JP"},{[k.TWO]:"zh",[k.THREE]:"chi",[k.ENDONYM]:"汉语",[k.LOCALE]:"zh_CN"},{[k.TWO]:"ru",[k.THREE]:"rus",[k.ENDONYM]:"Русский",[k.LOCALE]:"ru_RU"},{[k.TWO]:"uk",[k.THREE]:"ukr",[k.ENDONYM]:"Украї́нська",[k.LOCALE]:"uk_UK"},{[k.TWO]:"lv",[k.THREE]:"lav",[k.ENDONYM]:"Latviešu valoda",[k.LOCALE]:"lv-LV"},{[k.TWO]:"kk",[k.THREE]:"kaz",[k.ENDONYM]:"қазақша",[k.LOCALE]:"kk-KZ"},{[k.TWO]:"native",[k.THREE]:"native",[k.ENDONYM]:"Native",[k.LOCALE]:"native"}]);function I(t,e=k.MAPLIBRE_COMPAT){return(A.find((e=>Object.values(e).some((e=>e===t))))||A[0])[e]}class M{map;enabled;container;overlay;boundOnTouchStart;boundOnTouchEnd;boundFullscreenHandler;toggleOverlay;constructor(t){this.map=t,this.enabled=!1,this.boundOnTouchStart=this.onTouchStart.bind(this),this.boundOnTouchEnd=this.onTouchEnd.bind(this),this.boundFullscreenHandler=this.fullscreenHandler.bind(this),this.toggleOverlay=(0,r.Ds)(this._overlayToggle.bind(this),100),this.container=document.getElementsByClassName("maplibregl-control-container")[0],this.overlay=document.createElement("div"),this.setupUI()}setupUI(){this.overlay.classList.add("drag-overlay");const t=document.createElement("label");t.innerText=E.Z.t("fullscreen.notice"),this.overlay.appendChild(t)}enable(){this.container.appendChild(this.overlay),this._enable(),document.fullscreenEnabled&&document.addEventListener("fullscreenchange",this.boundFullscreenHandler),this.enabled=!0}disable(){this.enabled=!1,document.fullscreenEnabled&&document.removeEventListener("fullscreenchange",this.boundFullscreenHandler),this._disable(),this.overlay.remove()}_enable(){this.map.dragPan.disable(),this.map.touchPitch.disable(),this.map.on("touchstart",this.boundOnTouchStart),this.map.on("touchend",this.boundOnTouchEnd)}_disable(){this.map.off("touchstart",this.boundOnTouchStart),this.map.off("touchend",this.boundOnTouchEnd),this.map.touchPitch.enable(),this.map.dragPan.enable()}_overlayToggle(t){this.overlay.classList.contains("animates")||this.overlay.classList.add("animates"),this.overlay.classList.toggle("visible",t)}onTouchStart(t){const e=t.originalEvent;e?.touches?.length>1?(e.stopImmediatePropagation(),this.map.dragPan.enable(),this.toggleOverlay(!1)):(this.map.dragPan.disable(),this.toggleOverlay(!0))}onTouchEnd(){this.toggleOverlay(!1)}fullscreenHandler(){this.enabled&&(document.fullscreenElement?this._disable():this._enable())}}class C{cache;baseUrl;accessToken;constructor(t,e){this.cache=new Map,this.baseUrl=t,this.accessToken=e}async get(t,e){if(this.cache.has(t))return this.cache.get(t);const i=this._get(t,e);return this.cache.set(t,i),this.cache.set(t,await i),this.cache.get(t)}async _get(t,e){let i="";for(const[t,n]of Object.entries(e))i+=`${t}: ${JSON.stringify(n)}; `;return i+=`src: url("${await this.fetch(t)}") format("woff2"); `,`@font-face { ${i}}`}async fetch(t){const e=`${this.baseUrl}${t}.woff2?access_token=${this.accessToken}`,i=await(await fetch(e)).blob(),n=new FileReader;return n.readAsDataURL(i),await new Promise((t=>{n.onloadend=t})),n.result}}var z=i(1362);const P=Object.entries((0,t.A4)(i(2168))).filter((([t])=>!t.startsWith("Abstract"))).map((([,t])=>t));class L extends e{map;imageCache;dimension;originalZoom;controlManager;interactivityManager;behaviorManager;popupPosition;highlightInteractivity;constructor(e={},i={}){super(e,i);const n=new C(this.constructor.vectorFontUrl,this.mapOptions.mcAccessToken);this.imageCache=new l.Z(n),this.mapOptions.transformRequest||(this.mapOptions.transformRequest=e=>({url:e=(0,r.Pm)(e,t.HM,this.mapOptions.mcAccessToken)}))}static get defaultMapOptions(){return{...super.defaultMapOptions,attributionControl:!1,mcAccessToken:a.Z.accessToken,maxBounds:[-1/0,-90,1/0,90]}}static get defaultOptions(){return{...super.defaultOptions}}get favicon(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAtKADAAQAAAABAAAAtAAAAABECLhnAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAE/ElEQVR4Ae3dTU4jVxgFUAMt0XFCoizBU7OE7H8FSJ6yC+eHH6cKQYsMeJ2B7w1POZZKLvPc332cukY9KdhsPAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAIHN5gICge8InL6z/mmWt9vt5nK3260bThzpb/Tse97v9+mLd/Y9p5Fnm38524btl8BIQKFHOtamE1Do6S6ZDY8EFHqkY206AYWe7pLZ8EhAoUc61qYTUOjpLpkNjwQUeqRjbToBhZ7uktnwSEChRzrWphNQ6OkumQ2PBBR6pGNtOgGFnu6S2fBIQKFHOtamE1Do6S6ZDY8EFHqkY206AYWe7pLZ8EhAoUc61qYTUOjpLpkNjwQUeqRjbTqBL9Pt2IbbAtP8ZoDj8bjxE7pdD3lRAYWO8hreFlDotri8qIBCR3kNbwsodFtcXlRAoaO8hrcFFLotLi8qoNBRXsPbAgrdFpcXFVDoKK/hbQGFbovLiwoodJTX8LaAQrfF5UUFFDrKa3hbQKHb4vKiAgod5TW8LaDQbXF5UQGFjvIa3hZQ6La4vKiAQkd5DW8LKHRbXF5UYOa7vs9+N/LhcIhiG54X8BM6byyhKKDQRWxReQGFzhtLKAoodBFbVF5AofPGEooCCl3EFpUXUOi8sYSigEIXsUXlBRQ6byyhKKDQRWxReQGFzhtLKAoodBFbVF5AofPGEooCCl3EFpUXUOi8sYSigEIXsUXlBRQ6byyhKKDQRWxReQGFzhtLKAoodBFbVF5AofPGEooCCl3EFpUXUOi8sYSigEIXsUXlBRQ6byyhKKDQRWxReQGFzhtLKAoodBFbVF5AofPGEooCCl3EFpUXUOi8sYSigEIXsUXlBRQ6byyhKKDQRWxReQGFzhtLKAoodBFbVF5AofPGEooCCl3EFpUXUOi8sYSigEIXsUXlBRQ6byyhKKDQRWxReQGFzhtLKArM/Le+i0z/36jT6fTtb6pfXFycPruEQn/2K/Qf7+/29vb5bQv7/f7tdH3+czn+en3+/fV8ff3Hu/O39fX5YTne/s16/rb2sHxoHtfXl5eXL+fvXj++nj8sH6b1/Gk5Hpb3rc8va+v5+ri6unq8vr5+UuhF0uNjgcPh8NHi9bKwHjcfvaH99e12u/F/6La6vKiAQkd5DW8LKHRbXF5UQKGjvIa3BRS6LS4vKqDQUV7D2wIK3RaXFxVQ6Civ4W0BhW6Ly4sKKHSU1/C2gEK3xeVFBRQ6ymt4W0Ch2+LyogIKHeU1vC2g0G1xeVEBhY7yGt4WUOi2uLyogEJHeQ1vCyh0W1xeVECho7yGtwW+LHfy/nZzc/N1uYv2ejm+LnfX/rAc2+fn55fnZUM/LsdP745flvP1xsifX49fX5//8eG4u7tbvuzxXmC3271/eZbz+/v7s8wZDPn2awwG7/kUS8fjcXPWzS4fiHXey7F8KJ4+xXdpEwQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBA4N8I/A1O6KkX0GDoIwAAAABJRU5ErkJggg=="}get title(){return"Mapcreator"}static get vectorFontUrl(){return`${this.vectorApiUrl}fonts/`}static get vectorStyleUrl(){return`${this.vectorApiUrl}styles/`}static get vectorSpriteUrl(){return`${this.contentCdnUrl}sprites/`}static get vectorApiUrl(){return`https://vapi${t.HM?".bleeding":""}.mc-cdn.io/`}static get contentCdnUrl(){return`https://cdn${t.HM?".bleeding":""}.mapcreator.io/`}async load(e){const{mapstyleSet:i,boundingBox:n,fov:o,center:s,zoom:a,minZoom:l,maxZoom:c,dimension:u,language:h="en",pitch:d=0,rotation:p=0,labels:f=!0,layers:m=[],order:g=[],interactivityType:y=x.POPUP,popupPosition:_,highlightInteractivity:v,fillPatterns:b,webMaxBounds:w}=e.meta??{};this.dimension=u,this.originalZoom=a,this.popupPosition=_,this.highlightInteractivity=v,E.Z.locale=I(h,T.LOCALE),document.body.parentElement.lang=I(h,T.TWO),this._loadFontFaces(),this._initMap();const S=`${this.constructor.vectorStyleUrl}${i??"Index Vector"}.json`,k={duration:0};if(this.map.setPitch(d,k),this.map.setBearing(p,k),this.map.on("styleimagemissing",(t=>{const e=b.find((e=>e.name===t.id));e&&this.loadFillPattern(t.id,e.string)})),void 0!==s&&void 0!==a&&void 0!==o){const t=u?.width?.value,e=u?.height?.value,i=this.map.getContainer();let n=0;if(void 0!==t&&void 0!==e&&i.clientWidth>0&&i.clientHeight>0){const r=Math.min(i.clientWidth/t,i.clientHeight/e);n=Math.log(r)/Math.LN2}this.map.setZoom(a+n,k),this.map.setCenter(s,k),this.map.transform.fov=o}else{const e=this.options.noBounds?[[-180,-90],[180,90]]:(0,t.vU)(n);this.map.fitBounds(e,k)}if(this.map.setMinZoom(l),this.map.setMaxZoom(c),w){const t=this.adjustForAspectRatio(this.map,w);this.map.setMaxBounds(t)}const A=await fetch((0,r.Pm)(S,t.HM,this.mapOptions.mcAccessToken)).then((t=>t.json()));if(this._mergeLayerDiffsWithMapstyle(A,e.data.layers),this.map.setStyle(A),await(0,t.V2)(this.map),this.options.libraryMode||this.setCustomStyle(this.map.getStyle().metadata?.customCssFilePath),this._addBaseControls(),await this._initBehaviors(e.meta.behaviors),await this._loadCustomData(e.data),!f)for(const t of this.map.getStyle().layers)"maps4news"===t.source&&"symbol"===t.type&&this.map.setLayoutProperty(t.id,"visibility","none");const M=await this._loadBaseLayers(m,e.data.layers);this._mergeLayerDiffsWithMap(e.data.layers,M),this._applyLayerOrder(g),this.setLanguage(h),this._initInteractivity(y),this.controlManager.activate(),this.map.on("dragend",(()=>{this.addDummyImages()})),this.map.on("zoomend",(()=>{this.addDummyImages()})),(0,r.PQ)((()=>(0,z.dg)())),(0,r.PQ)((()=>(0,z.zb)())),(0,r.PQ)((()=>this.addDummyImages()))}setLanguage(t){const e="native"===t?["get","name"]:["coalesce",["get","name:en"],["get","name:latin"],["get","name"]];if("en"!==t&&"native"!==t){const i=I(t,T.TWO);e.splice(1,0,["get",`name:${i}`])}for(const t of this.map.getStyle().layers){if("symbol"!==t.type||t.id.startsWith("custom-")||t.id.startsWith("gl-"))continue;const i=t.layout&&t.layout["text-field"];i&&"coalesce"===i[0]&&this.map.setLayoutProperty(t.id,"text-field",e,{validate:!1})}}getLanguage(){for(const t of this.map.getStyle().layers){if("symbol"!==t.type||t.id.startsWith("custom-")||t.id.startsWith("gl-"))continue;const e=t.layout&&t.layout["text-field"];if(e&&"coalesce"===e[0])return e[1][1].split(":")[1]}return"en"}_loadFontFaces(){if(!this.mapOptions.mcAccessToken)return;const e=`https://vapi${t.HM?".bleeding":""}.mc-cdn.io/stylesheets/ff-${this.mapOptions.mcAccessToken}.css?access_token=${this.mapOptions.mcAccessToken}`,i=document.createElement("link");i.setAttribute("rel","stylesheet"),i.setAttribute("href",e),i.setAttribute("type","text/css"),document.head.appendChild(i)}setCustomStyle(e){if(document.getElementById("custom-style")?.remove(),!e)return;let i;(e=(0,r.Pm)(e,t.HM,this.mapOptions.mcAccessToken)).startsWith("http")?(i=document.createElement("link"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",e.replace(/https?:/,""))):(i=document.createElement("style"),i.appendChild(document.createTextNode(e))),i.setAttribute("id","custom-style"),i.setAttribute("type","text/css"),document.head.appendChild(i)}getCustomStyle(){const t=document.getElementById("custom-style");return"LINK"===t?.tagName?t.getAttribute("href"):"STYLE"===t?.tagName?t.innerText.trim():void 0}_initMap(){if(this.map)return;this.map=new o.Map(this.mapOptions),this.controlManager=new h(this.map);const e=()=>{document.querySelector(".maplibregl-compact-show")&&(document.querySelector(".maplibregl-ctrl-attrib-button").click(),this.map.off("styledata",e)),this.map.once("idle",(()=>{this.map.off("styledata",e)}))};if(r.tq&&this.map.on("styledata",e),r.tq&&(0,t.zd)()){new M(this.map).enable()}(0,t.V2)(this.map).then((()=>this.map.resize()))}_addBaseControls(){}async _initBehaviors(t){this.behaviorManager=new S(this,this.map),await this.behaviorManager.init(t)}_initInteractivity(e){const i=this.map.getStyle().metadata,n=(0,t.jj)([i?.language??navigator.languages.map((t=>t.split("-")[0]))].flat());this.interactivityManager=new w(this.map,n,i?.publication,this.popupPosition,this.highlightInteractivity),this.interactivityManager.setType(e);const r=this.map.style._order.filter((t=>!t.endsWith("noneditable")));for(const t of r)this.interactivityManager.layerIds.add(t);const o=this.map.style._order.filter((t=>t.includes("cluster")));for(const t of o)this.map.on("click",t,(t=>this._onClusterClick(t)))}async _loadCustomData({sources:t,layers:e}){for(const i of e){if(!i.id.startsWith("custom-")||!i.source)continue;const e=t[i.source],n=i.metadata?.["mc-layer-constructor"];n&&this._tryLoadLayerModel(i,e)||!n&&this._tryLoadFeatureModels(i,e)||await this._loadGenericLayer(i,e)}}async _loadGenericLayer(t,e){t.id.startsWith("custom-adornment")||(this.map.getSource(t.source)||await this._loadGenericSource(t.source,e),this.map.addLayer(t))}async _loadGenericSource(t,e){const i=[],n=new Set;if(Array.isArray(e.data?.features))for(const t of e.data.features){const e=t.properties?.["mc-svg-string"],r=t.properties?.["bbox-image-key"],o=t.properties?.bbox;if(e&&i.push((async()=>{const i=this.imageCache.getKey(e),r=await this.imageCache.getImage(e);t.properties["mc-image-key"]=i,n.has(i)||this.map.hasImage(i)||this.map.addImage(i,r,{pixelRatio:window.devicePixelRatio}),n.add(i)})),o&&r){const t=o[2]-o[0],e=o[3]-o[1];n.has(r)||this.map.hasImage(r)||this.map.addImage(r,s(t,e,[0,0,0,0])),n.add(r)}}await Promise.all(i.map((t=>t().catch((()=>null))))),this.map.addSource(t,e)}async _loadBaseLayers(t,e){const i=await Promise.all(t.map((async t=>{const e=this.constructor.vectorStyleUrl,i=this.mapOptions.mcAccessToken,n=await fetch(`${e}${t}.json?access_token=${i}`),r=await n.json();return r.sprite=`${this.constructor.vectorStyleUrl}${t}`,r}))),n=new Set,r=new Set(e.map((t=>t.id)));for(const{layers:t,sources:e,sprite:o}of i){this.map.style._loadSprite(o);for(const i of t){const t=i.source;if(t&&!this.map.getSource(t)&&this.map.addSource(t,e[t]),r.has(i.id)){const t=this.map.style._order.includes(i.metadata?.["mc-add-before"])?i.metadata["mc-add-before"]:null;this.map.getLayer(i.id)?this.map.moveLayer(i.id,t):this.map.addLayer(i,t),n.add(i.id)}}}return n}_applyLayerOrder(t){for(const e of t)e.startsWith("gl")||this.map.style._order.includes(e)&&this.map.moveLayer(e)}_mergeLayerDiffsWithMapstyle(t,e){for(const i of e){if(i.id.startsWith("custom"))continue;const e=t.layers.find((t=>t.id===i.id));void 0!==e&&(0,r.TS)(e,i)}}_mergeLayerDiffsWithMap(t,e){for(const i of t){if(i.id.startsWith("custom")||i.id.startsWith("label-free-area"))continue;const t=this.map.getLayer(i.id)?.serialize();e.has(i.id)?t&&(t.layout=i.layout??t.layout??{},t.paint=i.paint??t.paint??{},this.map.removeLayer(i.id),this.map.addLayer(t)):t?((0,r.TS)(t,i),this.map.removeLayer(i.id),this.map.addLayer(t)):this.map.addLayer(i)}}_tryLoadLayerModel(t,e){const i=P.find((e=>e.layerPrefixes.some((e=>t.id.startsWith(e)))));return!!i&&new i({...i.fromSource(e),...i.fromLayer(t),map:this.map,loader:this,dimension:this.dimension})}_tryLoadFeatureModels(t,e){if(!Array.isArray(e?.data?.features))return!1;if(t.id.endsWith("collision-box"))return!1;const i=[];for(const n of e.data.features){const r=P.find((t=>t.featurePrefixes.some((t=>n.id.startsWith(t)))));if(!r)continue;const o={...r.fromFeature(n),...r.fromSource(e),...r.fromLayer(t),map:this.map,loader:this,dimension:this.dimension};i.push(new r(o))}return!!i.length&&i}async _onClusterClick(t){if(t.originalEvent.cancelBubble)return;t.originalEvent.stopPropagation();const e=this.map.queryRenderedFeatures(t.point).find((t=>t.properties.cluster)),i=this.map.getSource(e.source),n=await new Promise(((t,n)=>{i.getClusterExpansionZoom(e.id,((e,i)=>{e?n(e):t(i)}))}));this.map.easeTo({center:e.geometry.coordinates,zoom:n})}addDummyImages(){const t=document.querySelectorAll(".adornment-collision, .maplibregl-ctrl-attrib-inner");for(let e=0;e<t.length;e++)this.addDummyImage(`adornment-${e}`,t[e].getBoundingClientRect())}addDummyImage(t,e){const i=`${t}-dummy-image`,n=`${t}-dummy-image-source`,r=`${t}-dummy-image-layer`;this.map.hasImage(i)&&this.map.removeImage(i),this.map.addImage(i,s(Math.round(e.width),Math.round(e.height),[0,0,0,0]));const o=this.map.unproject([e.left+e.width/2,e.top+e.height/2]);this.map.getSource(n)?this.map.getSource(n).setData({type:"Feature",geometry:{type:"Point",coordinates:[o.lng,o.lat]},properties:{}}):this.map.addSource(n,{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:[o.lng,o.lat]},properties:{}}}),this.map.getLayer(r)||this.map.addLayer({id:r,type:"symbol",source:n,layout:{"icon-padding":0,"icon-image":i},paint:{"icon-opacity":1},metadata:{"mc-name":"Collision Box","mc-skip-load":!0}})}loadFillPattern(t,e){const i=2*window.devicePixelRatio,n=new Image(64*i,64*i);n.onload=()=>{this.map.hasImage(t)||this.map.addImage(t,n,{pixelRatio:i})};const r=new Blob([e],{type:"image/svg+xml"}),o=URL.createObjectURL(r);n.src=o}adjustForAspectRatio(t,e){const i=t.getContainer().clientWidth/this.map.getContainer().clientHeight,n=t.project(e[0]),r=t.project(e[1]),o=n.y-r.y,s=r.x-n.x,a=s/o;if(i<a){const t=o/(i/a)-o;n.y+=t/2,r.y-=t/2}if(i>a){const t=s*(i/a)-s;n.x-=t/2,r.x+=t/2}e[0]=t.unproject(n),e[1]=t.unproject(r);const l=Math.abs(e[0].lng-e[1].lng);if(l>359){const t=l-359;e[0].lng+=t/2,e[1].lng-=t/2}return e}}async function D(t){const{jobId:e,container:i,accessToken:n}=t,r=await fetch(`https://cdn.mapcreator.io/${e}.json?access_token=${n}`),o=await r.json(),s=new L({libraryMode:!0},{mcAccessToken:n,container:i});return await s.load(o),s.map}}(),n}()}));
|