PageSourceSearch

https://www.windy.com/v/51.2.1.ind.3f7b/leaflet-gl.js

js windy.com collected 2026-09-24 07:27:13 UTC 1,216,877 bytes, 53 lines download raw bytes

1/**
2 * MapLibre GL JS
3 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.21.1/LICENSE.txt
4 */
5/* eslint-disable */
6
7var maplibregl = {};
8var modules = {};
9function define(moduleName, _dependencies, moduleFactory) {
10    modules[moduleName] = moduleFactory;
11
12    // to get the list of modules see generated dist/maplibre-gl-dev.js file (look for `define(` calls)
13    if (moduleName !== 'index') {
14        return;
15    }
16
17    // we assume that when an index module is initializing then other modules are loaded already
18    var workerBundleString = 'var sharedModule = {}; (' + modules.shared + ')(sharedModule); (' + modules.worker + ')(sharedModule);'
19
20    var sharedModule = {};
21    // the order of arguments of a module factory depends on rollup (it decides who is whose dependency)
22    // to check the correct order, see dist/maplibre-gl-dev.js file (look for `define(` calls)
23    // we assume that for our 3 chunks it will generate 3 modules and their order is predefined like the following
24    modules.shared(sharedModule);
25    modules.index(maplibregl, sharedModule);
26
27    if (typeof window !== 'undefined') {
28        maplibregl.setWorkerUrl(window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })));
29    }
30
31    return maplibregl;
32};
33
34
35
36define("shared",["exports"],(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{l(r.next(t));}catch(t){s(t);}}function a(t){try{l(r.throw(t));}catch(t){s(t);}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e);}))).then(o,a);}l((r=r.apply(t,e||[])).next());}))}function n(t,e){this.x=t,this.y=e;}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,s;"function"==typeof SuppressedError&&SuppressedError,n.prototype={clone(){return new n(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const 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(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),n=Math.sin(t),r=n*this.x+e*this.y;return this.x=e*this.x-n*this.y,this.y=r,this},_rotateAround(t,e){const n=Math.cos(t),r=Math.sin(t),i=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=e.x+n*(this.x-e.x)-r*(this.y-e.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(t){if(t instanceof n)return t;if(Array.isArray(t))return new n(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new n(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};var o=function(){if(s)return i;function t(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=n,this.p2y=r;}return s=1,i=t,t.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 n=t,r=0;r<8;r++){var i=this.sampleCurveX(n)-t;if(Math.abs(i)<e)return n;var s=this.sampleCurveDerivativeX(n);
36if(Math.abs(s)<1e-6)break;n-=i/s;}var o=0,a=1;for(n=t,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-t)<e));r++)t>i?o=n:a=n,n=.5*(a-o)+o;return n},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},i}(),a=r(o);let l,u;function c(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function h(){if(null==u&&(u=!1,c())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let n=0;n<t*t;n++){const r=4*n;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(n%t,Math.floor(n/t),1,1);}const n=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&n[e]!==e){u=!0;break}}}return u||!1}var p=1e-6,f="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var t=new f(9);return f!=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 y(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 m(){var t=new f(3);return f!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function g(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function x(t,e,n){var r=new f(3);return r[0]=t,r[1]=e,r[2]=n,r}function v(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function b(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function w(t,e,n){var r=e[0],i=e[1],s=e[2],o=n[0],a=n[1],l=n[2];return t[0]=i*l-s*a,t[1]=s*o-r*l,t[2]=r*a-i*o,t}var _,S=g;function A(t,e,n){var r=e[0],i=e[1],s=e[2],o=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*s+n[12]*o,t[1]=n[1]*r+n[5]*i+n[9]*s+n[13]*o,t[2]=n[2]*r+n[6]*i+n[10]*s+n[14]*o,t[3]=n[3]*r+n[7]*i+n[11]*s+n[15]*o,t}function M(){var t=new f(4);return f!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function k(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",s=Math.PI/360;e*=s,r*=s,n*=s;var o=Math.sin(e),a=Math.cos(e),l=Math.sin(n),u=Math.cos(n),c=Math.sin(r),h=Math.cos(r);switch(i){case "xyz":t[0]=o*u*h+a*l*c,t[1]=a*l*h-o*u*c,t[2]=a*u*c+o*l*h,t[3]=a*u*h-o*l*c;break;case "xzy":t[0]=o*u*h-a*l*c,t[1]=a*l*h-o*u*c,t[2]=a*u*c+o*l*h,t[3]=a*u*h+o*l*c;break;case "yxz":t[0]=o*u*h+a*l*c,t[1]=a*l*h-o*u*c,t[2]=a*u*c-o*l*h,t[3]=a*u*h+o*l*c;break;case "yzx":t[0]=o*u*h+a*l*c,t[1]=a*l*h+o*u*c,t[2]=a*u*c-o*l*h,t[3]=a*u*h-o*l*c;break;case "zxy":t[0]=o*u*h-a*l*c,t[1]=a*l*h+o*u*c,t[2]=a*u*c+o*l*h,t[3]=a*u*h-o*l*c;break;case "zyx":t[0]=o*u*h-a*l*c,t[1]=a*l*h+o*u*c,t[2]=a*u*c-o*l*h,t[3]=a*u*h+o*l*c;break;default:throw new Error("Unknown angle order "+i)}return t}function I(){var t=new f(2);return f!=Float32Array&&(t[0]=0,t[1]=0),t}function E(t,e){var n=new f(2);return n[0]=t,n[1]=e,n}m(),_=new f(4),f!=Float32Array&&(_[0]=0,_[1]=0,_[2]=0,_[3]=0),m(),x(1,0,0),x(0,1,0),M(),M(),d(),I();const T=8192;function F(t,e,n){return e*(T/(t.tileSize*Math.pow(2,n-t.tileID.overscaledZ)))}function D(t,e){return (t%e+e)%e}function P(t,e,n){return t*(1-n)+e*n}function z(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function B(t,e,n,r){const i=new a(t,e,n,r);return t=>i.solve(t)}const C=B(.25,.1,.25,1);function V(t,e,n){return Math.min(n,Math.max(e,t))}function L(t,e,n){const r=n-e,i=((t-e)%r+r)%r+e;return i===e?n:i}function O(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}let $=1;function R(t,e,n){const r={};for(const n in t)r[n]=e.call(this,t[n],n,t);return r}function N(t,e,n){const r={};for(const n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}function U(t){return Array.isArray(t)?t.map(U):"object"==typeof t&&t?R(t,U):t}const j={};function q(t){j[t]||("undefined"!=typeof console&&console.warn(t),j[t]=!0);}function G(t,e,n){return (n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function X(t){return "undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let Y=null;function Z(t){return "undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function W(t,n,r,i,s){return e(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const e=new VideoFrame(t,{timestamp:0});try{const o=null==e?void 0:e.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw new Error(`Unrecognized format ${o}`);const a=o.startsWith("BGR"),l=new Uint8ClampedArray(i*s*4);if(yield e.copyTo(l,function(t,e,n,r,i){const s=4*Math.max(-e,0),o=(Math.max(0,n)-n)*r*4+s,a=4*r,l=Math.max(0,e),u=Math.max(0,n);return {rect:{x:l,y:u,width:Math.min(t.width,e+r)-l,height:Math.min(t.height,n+i)-u},layout:[{offset:o,stride:a}]}}(t,n,r,i,s)),a)for(let t=0;t<l.length;t+=4){const e=l[t];l[t]=l[t+2],l[t+2]=e;}return l}finally{e.close();}}))}let K,J;function Q(t,e,n,r){return t.addEventListener(e,n,r),{unsubscribe:()=>{t.removeEventListener(e,n,r);}}}function tt(t){return t*Math.PI/180}function et(t){return t/Math.PI*180}const nt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
36,rt={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},it="AbortError";class st extends Error{constructor(t=it){super(t instanceof Error?t.message:t),this.name=it,t instanceof Error&&t.stack&&(this.stack=t.stack);}}function ot(t){return t.name===it}const at={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function lt(t){return at.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}const ut="global-dispatcher";class ct extends Error{constructor(t,e,n,r){super(`AJAXError: ${e} (${t}): ${n}`),this.status=t,this.statusText=e,this.url=n,this.body=r;}}const ht=()=>X(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,pt=function(t,n){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=lt(t.url);if(e)return e(t,n);if(X(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:ut},n)}if(!(/^file:/.test(r=t.url)||/^file:/.test(ht())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(t,n){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ht(),referrerPolicy:t.referrerPolicy,signal:n.signal});let r,i;"json"!==t.type||e.headers.has("Accept")||e.headers.set("Accept","application/json");try{r=yield fetch(e);}catch(e){if(ot(e))throw e;throw new ct(0,e.message,t.url,new Blob)}if(!r.ok){const e=yield r.blob();throw new ct(r.status,r.statusText,t.url,e)}i="arrayBuffer"===t.type||"image"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text();const s=yield i;return n.signal.throwIfAborted(),{data:s,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}))}(t,n);if(X(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:ut},n)}var r;return function(t,e){return new Promise(((n,r)=>{var i;const s=new XMLHttpRequest;s.open(t.method||"GET",t.url,!0),"arrayBuffer"!==t.type&&"image"!==t.type||(s.responseType="arraybuffer");for(const e in t.headers)s.setRequestHeader(e,t.headers[e]);"json"===t.type&&(s.responseType="text",(null===(i=t.headers)||void 0===i?void 0:i.Accept)||s.setRequestHeader("Accept","application/json")),s.withCredentials="include"===t.credentials,s.onerror=()=>{r(new Error(s.statusText));},s.onload=()=>{if(!e.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let e=s.response;if("json"===t.type)try{e=JSON.parse(s.response);}catch(t){return void r(t)}n({data:e,cacheControl:s.getResponseHeader("Cache-Control"),expires:s.getResponseHeader("Expires"),etag:s.getResponseHeader("ETag")});}else {const e=new Blob([s.response],{type:s.getResponseHeader("Content-Type")});r(new ct(s.status,s.statusText,t.url,e));}},e.signal.addEventListener("abort",(()=>{s.abort(),r(new st(e.signal.reason));})),s.send(t.body);}))}(t,n)};function ft(t){if(!t||t.indexOf("://")<=0||0===t.indexOf("data:image/")||0===t.indexOf("blob:"))return !0;const e=new URL(t),n=window.location;return e.protocol===n.protocol&&e.host===n.host}function dt(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e));}function yt(t,e,n){if(n&&n[t]){const r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1);}}class mt{constructor(t,e={}){O(this,e),this.type=t;}}class gt extends mt{constructor(t,e={}){super("error",O({error:t},e));}}class xt{on(t,e){return this._listeners=this._listeners||{},dt(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e);}}}off(t,e){return yt(t,e,this._listeners),yt(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},dt(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){"string"==typeof t&&(t=new mt(t,e||{}));const n=t.type;if(this.listens(n)){t.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of e)n.call(this,t);const r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const e of r)yt(n,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(O(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof gt&&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 vt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"}
vendor: 34,149 bytes, line 36
36,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const bt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function wt(t,e){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return bt.forEach((t=>{t in e&&(n[t]=e[t]);})),n}function _t(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(let n=0;n<t.length;n++)if(!_t(t[n],e[n]))return !1;return !0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return !1;
36if(Object.keys(t).length!==Object.keys(e).length)return !1;for(const n in t)if(!_t(t[n],e[n]))return !1;return !0}return t===e}function St(t,e){t.push(e);}function At(t,e,n){St(n,{command:"addSource",args:[t,e[t]]});}function Mt(t,e,n){St(e,{command:"removeSource",args:[t]}),n[t]=!0;}function kt(t,e,n,r){Mt(t,n,r),At(t,e,n);}function It(t,e,n){let r;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&"data"!==r&&!_t(t[n][r],e[n][r]))return !1;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&"data"!==r&&!_t(t[n][r],e[n][r]))return !1;return !0}function Et(t,e,n,r,i,s){t=t||{},e=e||{};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(_t(t[o],e[o])||n.push({command:s,args:[r,o,e[o],i]}));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&!Object.prototype.hasOwnProperty.call(t,o)&&(_t(t[o],e[o])||n.push({command:s,args:[r,o,e[o],i]}));}function Tt(t){return t.id}function Ft(t,e){return t[e.id]=e,t}class Dt{constructor(t,e,n,r){this.message=(t?`${t}: `:"")+n,r&&(this.identifier=r),null!=e&&e.__line__&&(this.line=e.__line__);}}function Pt(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}class zt extends Error{constructor(t,e){super(e),this.message=e,this.key=t;}}class Bt{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,n]of e)this.bindings[t]=n;}concat(t){return new Bt(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 Ct={kind:"null"},Vt={kind:"number"},Lt={kind:"string"},Ot={kind:"boolean"},$t={kind:"color"},Rt={kind:"projectionDefinition"},Nt={kind:"object"},Ut={kind:"value"},jt={kind:"collator"},qt={kind:"formatted"},Gt={kind:"padding"},Xt={kind:"colorArray"},Yt={kind:"numberArray"},Zt={kind:"resolvedImage"},Ht={kind:"variableAnchorOffsetCollection"};function Wt(t,e){return {kind:"array",itemType:t,N:e}}function Kt(t){if("array"===t.kind){const e=Kt(t.itemType);return "number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const Jt=[Ct,Vt,Lt,Ot,$t,Rt,qt,Nt,Wt(Ut),Gt,Yt,Xt,Zt,Ht];function Qt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Qt(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 Jt)if(!Qt(t,e))return null}return `Expected ${Kt(t)} but found ${Kt(e)} instead.`}function te(t,e){return e.some((e=>e.kind===t.kind))}function ee(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function ne(t,e){return "array"===t.kind&&"array"===e.kind?t.itemType.kind===e.itemType.kind&&"number"==typeof t.N:t.kind===e.kind}const re=.96422,ie=.82521,se=4/29,oe=6/29,ae=3*oe*oe,le=oe*oe*oe,ue=Math.PI/180,ce=180/Math.PI;function he(t){return (t%=360)<0&&(t+=360),t}function pe([t,e,n,r]){let i,s;const o=de((.2225045*(t=fe(t))+.7168786*(e=fe(e))+.0606169*(n=fe(n)))/1);t===e&&e===n?i=s=o:(i=de((.4360747*t+.3850649*e+.1430804*n)/re),s=de((.0139322*t+.0971045*e+.7141733*n)/ie));const a=116*o-16;return [a<0?0:a,500*(i-o),200*(o-s),r]}function fe(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){return t>le?Math.pow(t,1/3):t/ae+se}function ye([t,e,n,r]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,o=isNaN(n)?i:i-n/200;return i=1*ge(i),s=re*ge(s),o=ie*ge(o),[me(3.1338561*s-1.6168667*i-.4906146*o),me(-.9787684*s+1.9161415*i+.033454*o),me(.0719453*s-.2289914*i+1.4052427*o),r]}
36function me(t){return (t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function ge(t){return t>oe?t*t*t:ae*(t-se)}const xe=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ve(t,e){return xe(t,e)?t[e]:void 0}function be(t){return parseInt(t.padEnd(2,t),16)/255}function we(t,e){return _e(e?t/100:t,0,1)}function _e(t,e,n){return Math.min(Math.max(e,t),n)}function Se(t){return !t.some(Number.isNaN)}const Ae={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Me(t,e,n){return t+n*(e-t)}function ke(t,e,n){return t.map(((t,r)=>Me(t,e[r],n)))}class Ie{constructor(t,e,n,r=1,i=!0){this.r=t,this.g=e,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,n,r]));}static parse(t){if(t instanceof Ie)return t;if("string"!=typeof t)return;const e=function(t){if("transparent"===(t=t.toLowerCase().trim()))return [0,0,0,0];const e=ve(Ae,t);if(e){const[t,n,r]=e;return [t/255,n/255,r/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let n=1;
36return [be(t.slice(n,n+=e)),be(t.slice(n,n+=e)),be(t.slice(n,n+=e)),be(t.slice(n,n+e)||"ff")]}if(t.startsWith("rgb")){const e=t.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(e){const[t,n,r,i,s,o,a,l,u,c,h,p]=e,f=[i||" ",a||" ",c].join("");if("  "===f||"  /"===f||",,"===f||",,,"===f){const t=[r,o,u].join(""),e="%%%"===t?100:""===t?255:0;if(e){const t=[_e(+n/e,0,1),_e(+s/e,0,1),_e(+l/e,0,1),h?we(+h,p):1];if(Se(t))return t}}return}}const n=t.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[t,e,r,i,s,o,a,l,u]=n,c=[r||" ",s||" ",a].join("");if("  "===c||"  /"===c||",,"===c||",,,"===c){const t=[+e,_e(+i,0,100),_e(+o,0,100),l?we(+l,u):1];if(Se(t))return function([t,e,n,r]){function i(r){const i=(r+t/30)%12,s=e*Math.min(n,1-n);return n-s*Math.max(-1,Math.min(i-3,9-i,1))}return t=he(t),e/=100,n/=100,[i(0),i(8),i(4),r]}(t)}}}(t);return e?new Ie(...e,!1):void 0}get rgb(){const{r:t,g:e,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter("rgb",[t/i,e/i,n/i,r])}get hcl(){return this.overwriteGetter("hcl",function(t){const[e,n,r,i]=pe(t),s=Math.sqrt(n*n+r*r);return [Math.round(1e4*s)?he(Math.atan2(r,n)*ce):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,n,r]=this.rgb;return `rgba(${[t,e,n].map((t=>Math.round(255*t))).join(",")},${r})`}static interpolate(t,e,n,r="rgb"){switch(r){case "rgb":{const[r,i,s,o]=ke(t.rgb,e.rgb,n);return new Ie(r,i,s,o,!1)}case "hcl":{const[r,i,s,o]=t.hcl,[a,l,u,c]=e.hcl;let h,p;if(isNaN(r)||isNaN(a))isNaN(r)?isNaN(a)?h=NaN:(h=a,1!==s&&0!==s||(p=l)):(h=r,1!==u&&0!==u||(p=i));else {let t=a-r;a>r&&t>180?t-=360:a<r&&r-a>180&&(t+=360),h=r+n*t;}const[f,d,y,m]=function([t,e,n,r]){return t=isNaN(t)?0:t*ue,ye([n,Math.cos(t)*e,Math.sin(t)*e,r])}([h,null!=p?p:Me(i,l,n),Me(s,u,n),Me(o,c,n)]);return new Ie(f,d,y,m,!1)}case "lab":{const[r,i,s,o]=ye(ke(t.lab,e.lab,n));return new Ie(r,i,s,o,!1)}}}}Ie.black=new Ie(0,0,0,1),Ie.white=new Ie(1,1,1,1),Ie.transparent=new Ie(0,0,0,0),Ie.red=new Ie(1,0,0,1);class Ee{constructor(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,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}}const Te=["bottom","center","top"];class Fe{constructor(t,e,n,r,i,s){this.text=t,this.image=e,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=s;}}class De{constructor(t){this.sections=t;}static fromString(t){return new De([new Fe(t,null,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 De?t:De.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}}class Pe{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Pe)return t;if("number"==typeof t)return new Pe([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 Pe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new Pe(ke(t.values,e.values,n))}}class ze{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof ze)return t;if("number"==typeof t)return new ze([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new ze(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){return new ze(ke(t.values,e.values,n))}}class Be{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Be)return t;if("string"==typeof t){const e=Ie.parse(t);if(!e)return;return new Be([e])}if(!Array.isArray(t))return;const e=[];for(const n of t){if("string"!=typeof n)return;const t=Ie.parse(n);if(!t)return;e.push(t);}return new Be(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n,r="rgb"){const i=[];if(t.values.length!=e.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)i.push(Ie.interpolate(t.values[s],e.values[s],n,r));return new Be(i)}}
36class Ce extends Error{constructor(t){super(t),this.name="RuntimeError";}toJSON(){return this.message}}const Ve=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Le{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Le)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const n=t[e],r=t[e+1];if("string"!=typeof n||!Ve.has(n))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new Le(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,n){const r=t.values,i=e.values;if(r.length!==i.length)throw new Ce(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t<r.length;t+=2){if(r[t]!==i[t])throw new Ce(`Cannot interpolate values containing mismatched anchors. from[${t}]: ${r[t]}, to[${t}]: ${i[t]}`);s.push(r[t]);const[e,o]=r[t+1],[a,l]=i[t+1];s.push([Me(e,a,n),Me(o,l,n)]);}return new Le(s)}}class Oe{constructor(t){this.name=t.name,this.available=t.available;}toString(){return this.name}static fromString(t){return t?new Oe({name:t,available:!1}):null}}class $e{constructor(t,e,n){this.from=t,this.to=e,this.transition=n;}static interpolate(t,e,n){return new $e(t,e,n)}static parse(t){return t instanceof $e?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new $e(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new $e(t.from,t.to,t.transition):"string"==typeof t?new $e(t,t,1):void 0}}function Re(t,e,n,r){return "number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[t,e,n,r]:[t,e,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ne(t){if(null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t||t instanceof $e||t instanceof Ie||t instanceof Ee||t instanceof De||t instanceof Pe||t instanceof ze||t instanceof Be||t instanceof Le||t instanceof Oe)return !0;if(Array.isArray(t)){for(const e of t)if(!Ne(e))return !1;return !0}if("object"==typeof t){for(const e in t)if(!Ne(t[e]))return !1;return !0}return !1}function Ue(t){if(null===t)return Ct;if("string"==typeof t)return Lt;if("boolean"==typeof t)return Ot;if("number"==typeof t)return Vt;if(t instanceof Ie)return $t;if(t instanceof $e)return Rt;if(t instanceof Ee)return jt;if(t instanceof De)return qt;if(t instanceof Pe)return Gt;if(t instanceof ze)return Yt;if(t instanceof Be)return Xt;if(t instanceof Le)return Ht;if(t instanceof Oe)return Zt;if(Array.isArray(t)){const e=t.length;let n;for(const e of t){const t=Ue(e);if(n){if(n===t)continue;n=Ut;break}n=t;}return Wt(n||Ut,e)}return Nt}function je(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ie||t instanceof $e||t instanceof De||t instanceof Pe||t instanceof ze||t instanceof Be||t instanceof Le||t instanceof Oe?t.toString():JSON.stringify(t)}class qe{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(!Ne(t[1]))return e.error("invalid value");const n=t[1];let r=Ue(n);const i=e.expectedType;return "array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new qe(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}}const Ge={string:Lt,number:Vt,boolean:Ot,object:Nt};class Xe{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 n,r=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const n=t[1];if("string"!=typeof n||!(n in Ge)||"object"===n)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Ge[n],r++;}else i=Ut;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);s=t[2],r++;}n=Wt(i,s);}else {if(!Ge[i])throw new Error(`Types doesn't contain name = ${i}`);n=Ge[i];}const s=[];for(;r<t.length;r++){const n=e.parse(t[r],r,Ut);if(!n)return null;s.push(n);}return new Xe(n,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const n=this.args[e].evaluate(t);
36if(!Qt(this.type,Ue(n)))return n;if(e===this.args.length-1)throw new Ce(`Expected value to be of type ${Kt(this.type)}, but found ${Kt(Ue(n))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Ye={"to-boolean":Ot,"to-color":$t,"to-number":Vt,"to-string":Lt};class Ze{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 n=t[0];if(!Ye[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");const r=Ye[n],i=[];for(let n=1;n<t.length;n++){const r=e.parse(t[n],n,Ut);if(!r)return null;i.push(r);}return new Ze(r,i)}evaluate(t){switch(this.type.kind){case "boolean":return Boolean(this.args[0].evaluate(t));case "color":{let e,n;for(const r of this.args){if(e=r.evaluate(t),n=null,e instanceof Ie)return e;if("string"==typeof e){const n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(n=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Re(e[0],e[1],e[2],e[3]),!n))return new Ie(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Ce(n||`Could not parse color from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case "padding":{let e;for(const n of this.args){e=n.evaluate(t);const r=Pe.parse(e);if(r)return r}throw new Ce(`Could not parse padding from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case "numberArray":{let e;for(const n of this.args){e=n.evaluate(t);const r=ze.parse(e);if(r)return r}throw new Ce(`Could not parse numberArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case "colorArray":{let e;for(const n of this.args){e=n.evaluate(t);const r=Be.parse(e);if(r)return r}throw new Ce(`Could not parse colorArray from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case "variableAnchorOffsetCollection":{let e;for(const n of this.args){e=n.evaluate(t);const r=Le.parse(e);if(r)return r}throw new Ce(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof e?e:JSON.stringify(e)}'`)}case "number":{let e=null;for(const n of this.args){if(e=n.evaluate(t),null===e)return 0;const r=Number(e);if(!isNaN(r))return r}throw new Ce(`Could not convert ${JSON.stringify(e)} to number.`)}case "formatted":return De.fromString(je(this.args[0].evaluate(t)));case "resolvedImage":return Oe.fromString(je(this.args[0].evaluate(t)));case "projectionDefinition":return this.args[0].evaluate(t);default:return je(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const He=["Unknown","Point","LineString","Polygon"];class We{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null;}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?He[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.get(t);return e||(e=Ie.parse(t),this._parseColorCache.set(t,e)),e}}class Ke{constructor(t,e,n=[],r,i=new Bt,s=[]){this.registry=t,this.path=n,this.key=n.map((t=>`[${t}]`)).join(""),this.scope=i,this.errors=s,this.expectedType=r,this._isConstant=e;}parse(t,e,n,r,i={}){return e?this.concat(e,n,r)._parse(t,i):this._parse(t,i)}_parse(t,e){function n(t,e,n){return "assert"===n?new Xe(e,[t]):"coerce"===n?new Ze(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind){if("projectionDefinition"===t.kind&&["string","array"].includes(i.kind)||["color","formatted","resolvedImage"].includes(t.kind)&&["value","string"].includes(i.kind)||["padding","numberArray"].includes(t.kind)&&["value","number","array"].includes(i.kind)||"colorArray"===t.kind&&["value","string","array"].includes(i.kind)||"variableAnchorOffsetCollection"===t.kind&&["value","array"].includes(i.kind))r=n(r,t,e.typeAnnotation||"coerce");else if(this.checkSubtype(t,i))return null}else r=n(r,t,e.typeAnnotation||"assert");}if(!(r instanceof qe)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new We;try{r=new qe(r.type,r.evaluate(t));}catch(t){return this.error(t.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,n){const r="number"==typeof t?this.path.concat(t):this.path,i=n?this.scope.concat(n):this.scope;return new Ke(this.registry,this._isConstant,r,e||null,i,this.errors)}error(t,...e){const n=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new zt(n,t));}checkSubtype(t,e){const n=Qt(t,e);return n&&this.error(n),n}}class Je{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 n=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];
vendor: 5,074 bytes, line 36
36if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",r);const s=e.parse(t[r+1],r+1);if(!s)return null;n.push([i,s]);}const r=e.parse(t[t.length-1],t.length-1,e.expectedType,n);return r?new Je(n,r):null}outputDefined(){return this.result.outputDefined()}}class Qe{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 n=t[1];return e.scope.has(n)?new Qe(n,e.scope.get(n)):e.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return !1}}class tn{constructor(t,e,n){this.type=t,this.index=e,this.input=n;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Vt),r=e.parse(t[2],2,Wt(e.expectedType||Ut));return n&&r?new tn(r.type.itemType,n,r):null}evaluate(t){const e=this.index.evaluate(t),n=this.input.evaluate(t);if(e<0)throw new Ce(`Array index out of bounds: ${e} < 0.`);if(e>=n.length)throw new Ce(`Array index out of bounds: ${e} > ${n.length-1}.`);if(e!==Math.floor(e))throw new Ce(`Array index must be an integer, but found ${e} instead.`);return n[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}}class en{constructor(t,e){this.type=Ot,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 n=e.parse(t[1],1,Ut),r=e.parse(t[2],2,Ut);return n&&r?te(n.type,[Ot,Lt,Vt,Ct,Ut])?new en(n,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(n.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return !1;if(!ee(e,["boolean","string","number","null"]))throw new Ce(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ue(e))} instead.`);if(!ee(n,["string","array"]))throw new Ce(`Expected second argument to be of type array or string, but found ${Kt(Ue(n))} instead.`);return n.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}}class nn{constructor(t,e,n){this.type=Vt,this.needle=t,this.haystack=e,this.fromIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Ut),r=e.parse(t[2],2,Ut);if(!n||!r)return null;if(!te(n.type,[Ot,Lt,Vt,Ct,Ut]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(n.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Vt);return i?new nn(n,r,i):null}return new nn(n,r)}evaluate(t){const e=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!ee(e,["boolean","string","number","null"]))throw new Ce(`Expected first argument to be of type boolean, string, number or null, but found ${Kt(Ue(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),ee(n,["string"])){const t=n.indexOf(e,r);return -1===t?-1:[...n.slice(0,t)].length}if(ee(n,["array"]))return n.indexOf(e,r);throw new Ce(`Expected second argument to be of type array or string, but found ${Kt(Ue(n))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}}class rn{constructor(t,e,n,r,i,s){this.inputType=t,this.type=e,this.input=n,this.cases=r,this.outputs=i,this.otherwise=s;}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 n,r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const l=t[o+1];Array.isArray(a)||(a=[a]);const u=e.concat(o);if(0===a.length)return u.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,Ue(t)))return null}else n=Ue(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length;}const c=e.parse(l,o,r);if(!c)return null;r=r||c.type,s.push(c);}const o=e.parse(t[1],1,Ut);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(n,o.type)?null:new rn(n,r,o,i,s,a):null}evaluate(t){const e=this.input.evaluate(t);return (Ue(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}
36eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class sn{constructor(t,e,n){this.type=t,this.branches=e,this.otherwise=n;}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 n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,Ot);if(!s)return null;const o=e.parse(t[i+1],i+1,n);if(!o)return null;r.push([s,o]),n=n||o.type;}const i=e.parse(t[t.length-1],t.length-1,n);if(!i)return null;if(!n)throw new Error("Can't infer output type");return new sn(n,r,i)}evaluate(t){for(const[e,n]of this.branches)if(e.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,n]of this.branches)t(e),t(n);t(this.otherwise);}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class on{constructor(t,e,n,r){this.type=t,this.input=e,this.beginIndex=n,this.endIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const n=e.parse(t[1],1,Ut),r=e.parse(t[2],2,Vt);if(!n||!r)return null;if(!te(n.type,[Wt(Ut),Lt,Ut]))return e.error(`Expected first argument to be of type array or string, but found ${Kt(n.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Vt);return i?new on(n.type,n,r,i):null}return new on(n.type,n,r)}evaluate(t){const e=this.input.evaluate(t),n=this.beginIndex.evaluate(t);let r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),ee(e,["string"]))return [...e].slice(n,r).join("");if(ee(e,["array"]))return e.slice(n,r);throw new Ce(`Expected first argument to be of type array or string, but found ${Kt(Ue(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}}function an(t,e){const n=t.length-1;let r,i,s=0,o=n,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=e){if(a===n||e<i)return a;s=a+1;}else {if(!(r>e))throw new Ce("Input is not a number.");o=a-1;}return 0}class ln{constructor(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of n)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 n=e.parse(t[1],1,Vt);if(!n)return null;const r=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let n=1;n<t.length;n+=2){const s=1===n?-1/0:t[n],o=t[n+1],a=n,l=n+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=e.parse(o,l,i);if(!u)return null;i=i||u.type,r.push([s,u]);}return new ln(i,n,r)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);const i=e.length;return r>=e[i-1]?n[i-1].evaluate(t):n[an(e,r)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function un(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cn,hn,pn=function(){if(hn)return cn;function t(t,e,n,r){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(r-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=n,this.p2y=r;}return hn=1,cn=t,t.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 n=t,r=0;r<8;r++){var i=this.sampleCurveX(n)-t;if(Math.abs(i)<e)return n;var s=this.sampleCurveDerivativeX(n);
36if(Math.abs(s)<1e-6)break;n-=i/s;}var o=0,a=1;for(n=t,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-t)<e));r++)t>i?o=n:a=n,n=.5*(a-o)+o;return n},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},cn}(),fn=un(pn);class dn{constructor(t,e,n,r,i){this.type=t,this.operator=e,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e);}static interpolationFactor(t,e,n,r){let i=0;if("exponential"===t.name)i=yn(e,t.base,n,r);else if("linear"===t.name)i=yn(e,1,n,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new fn(s[0],s[1],s[2],s[3]).solve(yn(e,1,n,r));}return i}static parse(t,e){let[n,r,i,...s]=t;if(!Array.isArray(r)||0===r.length)return e.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t};}else {if("cubic-bezier"!==r[0])return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,Vt),!i)return null;const o=[];let a=null;"interpolate-hcl"!==n&&"interpolate-lab"!==n||e.expectedType==Xt?e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType):a=$t;for(let t=0;t<s.length;t+=2){const n=s[t],r=s[t+1],i=t+3,l=t+4;if("number"!=typeof n)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=n)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(r,l,a);if(!u)return null;a=a||u.type,o.push([n,u]);}return ne(a,Vt)||ne(a,Rt)||ne(a,$t)||ne(a,Gt)||ne(a,Yt)||ne(a,Xt)||ne(a,Ht)||ne(a,Wt(Vt))?new dn(a,n,r,i,o):e.error(`Type ${Kt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);const r=this.input.evaluate(t);if(r<=e[0])return n[0].evaluate(t);const i=e.length;if(r>=e[i-1])return n[i-1].evaluate(t);const s=an(e,r),o=dn.interpolationFactor(this.interpolation,r,e[s],e[s+1]),a=n[s].evaluate(t),l=n[s+1].evaluate(t);switch(this.operator){case "interpolate":switch(this.type.kind){case "number":return Me(a,l,o);case "color":return Ie.interpolate(a,l,o);case "padding":return Pe.interpolate(a,l,o);case "colorArray":return Be.interpolate(a,l,o);case "numberArray":return ze.interpolate(a,l,o);case "variableAnchorOffsetCollection":return Le.interpolate(a,l,o);case "array":return ke(a,l,o);case "projectionDefinition":return $e.interpolate(a,l,o)}case "interpolate-hcl":switch(this.type.kind){case "color":return Ie.interpolate(a,l,o,"hcl");case "colorArray":return Be.interpolate(a,l,o,"hcl")}case "interpolate-lab":switch(this.type.kind){case "color":return Ie.interpolate(a,l,o,"lab");case "colorArray":return Be.interpolate(a,l,o,"lab")}}}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function yn(t,e,n,r){const i=r-n,s=t-n;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}const mn={color:Ie.interpolate,number:Me,padding:Pe.interpolate,numberArray:ze.interpolate,colorArray:Be.interpolate,variableAnchorOffsetCollection:Le.interpolate,array:ke};class gn{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 n=null;const r=e.expectedType;r&&"value"!==r.kind&&(n=r);const i=[];for(const r of t.slice(1)){const t=e.parse(r,1+i.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n=n||t.type,i.push(t);}if(!n)throw new Error("No output type");const s=r&&i.some((t=>Qt(r,t.type)));return new gn(s?Ut:n,i)}evaluate(t){let e,n=null,r=0;for(const i of this.args)if(r++,n=i.evaluate(t),n&&n instanceof Oe&&!n.available&&(e||(e=n.name),n=null,r===this.args.length&&(n=e)),null!==n)break;return n}
vendor: 8,184 bytes, line 36
36eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function xn(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 vn(t,e,n,r){return 0===r.compare(e,n)}function bn(t,e,n){const r="=="!==t&&"!="!==t;return class i{constructor(t,e,n){this.type=Ot,this.lhs=t,this.rhs=e,this.collator=n,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 n=t[0];let s=e.parse(t[1],1,Ut);if(!s)return null;if(!xn(n,s.type))return e.concat(1).error(`"${n}" comparisons are not supported for type '${Kt(s.type)}'.`);let o=e.parse(t[2],2,Ut);if(!o)return null;if(!xn(n,o.type))return e.concat(2).error(`"${n}" comparisons are not supported for type '${Kt(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${Kt(s.type)}' and '${Kt(o.type)}'.`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Xe(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Xe(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,jt),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const e=Ue(s),n=Ue(o);if(e.kind!==n.kind||"string"!==e.kind&&"number"!==e.kind)throw new Ce(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ue(s),n=Ue(o);if("string"!==t.kind||"string"!==n.kind)return e(i,s,o)}return this.collator?n(i,s,o,this.collator.evaluate(i)):e(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}}}const wn=bn("==",(function(t,e,n){return e===n}),vn),_n=bn("!=",(function(t,e,n){return e!==n}),(function(t,e,n,r){return !vn(0,e,n,r)})),Sn=bn("<",(function(t,e,n){return e<n}),(function(t,e,n,r){return r.compare(e,n)<0})),An=bn(">",(function(t,e,n){return e>n}),(function(t,e,n,r){return r.compare(e,n)>0})),Mn=bn("<=",(function(t,e,n){return e<=n}),(function(t,e,n,r){return r.compare(e,n)<=0})),kn=bn(">=",(function(t,e,n){return e>=n}),(function(t,e,n,r){return r.compare(e,n)>=0}));class In{constructor(t,e,n){this.type=jt,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e;}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");const r=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,Ot);if(!r)return null;const i=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,Ot);if(!i)return null;let s=null;return n.locale&&(s=e.parse(n.locale,1,Lt),!s)?null:new In(r,i,s)}evaluate(t){return new Ee(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale);}outputDefined(){return !1}}class En{constructor(t,e,n,r,i,s){this.type=Lt,this.number=t,this.locale=e,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s;}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Vt);if(!n)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=e.parse(r.locale,1,Lt),!i))return null;let s=null;if(r.currency&&(s=e.parse(r.currency,1,Lt),!s))return null;let o=null;if(r.unit&&(o=e.parse(r.unit,1,Lt),!o))return null;if(s&&o)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,Vt),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=e.parse(r["max-fraction-digits"],1,Vt),!l)?null:new En(n,i,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}}class Tn{constructor(t){this.type=qt,this.sections=t;}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return e.error("First argument must be an image or text section.");const r=[];let i=!1;for(let n=1;n<=t.length-1;++n){const s=t[n];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,Vt),!t))return null;let n=null;if(s["text-font"]&&(n=e.parse(s["text-font"],1,Wt(Lt)),!n))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,$t),!o))return null;let a=null;if(s["vertical-align"]){if("string"==typeof s["vertical-align"]&&!Te.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(a=e.parse(s["vertical-align"],1,Lt),!a)return null}const l=r[r.length-1];l.scale=t,l.font=n,l.textColor=o,l.verticalAlign=a;}else {const s=e.parse(t[n],1,Ut);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:s,scale:null,font:null,textColor:null,verticalAlign:null});}}return new Tn(r)}evaluate(t){return new De(this.sections.map((e=>{const n=e.content.evaluate(t);return Ue(n)===Zt?new Fe("",n,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new Fe(je(n),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.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),e.verticalAlign&&t(e.verticalAlign);}outputDefined(){return !1}}class Fn{constructor(t){this.type=Zt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const n=e.parse(t[1],1,Lt);return n?new Fn(n):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),n=Oe.fromString(e);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(e)>-1),n}eachChild(t){t(this.input);}outputDefined(){return !1}}class Dn{constructor(t){this.type=Vt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error(`Expected argument of type string or array, but found ${Kt(n.type)} instead.`):new Dn(n):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 Ce(`Expected value to be of type string or array, but found ${Kt(Ue(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}}const Pn=8192;function zn(t,e){const n=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(n*i*Pn),Math.round(r*i*Pn)]}function Bn(t,e){const n=Math.pow(2,e.z);return [(i=(t[0]/Pn+e.x)/n,360*i-180),(r=(t[1]/Pn+e.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180)
36)-90)];var r,i;}function Cn(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 Vn(t,e){return !(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ln(t,e,n){const r=t[0]-e[0],i=t[1]-e[1],s=t[0]-n[0],o=t[1]-n[1];return r*o-s*i==0&&r*s<=0&&i*o<=0}function On(t,e,n,r){return 0!=(i=[r[0]-n[0],r[1]-n[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!qn(t,e,n,r)||!qn(n,r,t,e));var i,s;}function $n(t,e,n){for(const r of n)for(let n=0;n<r.length-1;++n)if(On(t,e,r[n],r[n+1]))return !0;return !1}function Rn(t,e,n=!1){let r=!1;for(const a of e)for(let e=0;e<a.length-1;e++){if(Ln(t,a[e],a[e+1]))return n;(s=a[e])[1]>(i=t)[1]!=(o=a[e+1])[1]>i[1]&&i[0]<(o[0]-s[0])*(i[1]-s[1])/(o[1]-s[1])+s[0]&&(r=!r);}var i,s,o;return r}function Nn(t,e){for(const n of e)if(Rn(t,n))return !0;return !1}function Un(t,e){for(const n of t)if(!Rn(n,e))return !1;for(let n=0;n<t.length-1;++n)if($n(t[n],t[n+1],e))return !1;return !0}function jn(t,e){for(const n of e)if(Un(t,n))return !0;return !1}function qn(t,e,n,r){const i=r[0]-n[0],s=r[1]-n[1],o=(t[0]-n[0])*s-i*(t[1]-n[1]),a=(e[0]-n[0])*s-i*(e[1]-n[1]);return o>0&&a<0||o<0&&a>0}function Gn(t,e,n){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=zn(t[i][r],n);Cn(e,o),s.push(o);}r.push(s);}return r}function Xn(t,e,n){const r=[];for(let i=0;i<t.length;i++){const s=Gn(t[i],e,n);r.push(s);}return r}function Yn(t,e,n,r){if(t[0]<n[0]||t[0]>n[2]){const e=.5*r;let i=t[0]-n[0]>e?-r:n[0]-t[0]>e?r:0;0===i&&(i=t[0]-n[2]>e?-r:n[2]-t[0]>e?r:0),t[0]+=i;}Cn(e,t);}function Zn(t,e,n,r){const i=Math.pow(2,r.z)*Pn,s=[r.x*Pn,r.y*Pn],o=[];for(const r of t)for(const t of r){const r=[t.x+s[0],t.y+s[1]];Yn(r,e,n,i),o.push(r);}return o}function Hn(t,e,n,r){const i=Math.pow(2,r.z)*Pn,s=[r.x*Pn,r.y*Pn],o=[];for(const n of t){const t=[];for(const r of n){const n=[r.x+s[0],r.y+s[1]];Cn(e,n),t.push(n);}o.push(t);}if(e[2]-e[0]<=i/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)Yn(r,e,n,i);}var a;return o}class Wn{constructor(t,e){this.type=Ot,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(Ne(t[1])){const e=t[1];if("FeatureCollection"===e.type){const t=[];for(const n of e.features){const{type:e,coordinates:r}=n.geometry;"Polygon"===e&&t.push(r),"MultiPolygon"===e&&t.push(...r);}if(t.length)return new Wn(e,{type:"MultiPolygon",coordinates:t})}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new Wn(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new Wn(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 n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Gn(e.coordinates,r,i),o=Zn(t.geometry(),n,r,i);if(!Vn(n,r))return !1;for(const t of o)if(!Rn(t,s))return !1}if("MultiPolygon"===e.type){const s=Xn(e.coordinates,r,i),o=Zn(t.geometry(),n,r,i);if(!Vn(n,r))return !1;for(const t of o)if(!Nn(t,s))return !1}return !0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){const s=Gn(e.coordinates,r,i),o=Hn(t.geometry(),n,r,i);if(!Vn(n,r))return !1;for(const t of o)if(!Un(t,s))return !1}if("MultiPolygon"===e.type){const s=Xn(e.coordinates,r,i),o=Hn(t.geometry(),n,r,i);if(!Vn(n,r))return !1;for(const t of o)if(!jn(t,s))return !1}return !0}(t,this.geometries)}return !1}eachChild(){}outputDefined(){return !0}}let Kn=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this._up(this.length++);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return --this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(n(r,s)>=0)break;e[t]=s,t=i;}e[t]=r;}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1);const s=r+1;if(s<this.length&&n(e[s],e[r])<0&&(r=s),n(e[r],i)>=0)break;e[t]=e[r],t=r;}e[t]=i;}};function Jn(t,e,n=0,r=t.length-1,i=tr){for(;r>n;){if(r-n>600){const s=r-n+1,o=e-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);Jn(t,e,Math.max(n,Math.floor(e-o*l/s+u)),Math.min(r,Math.floor(e+(s-o)*l/s+u)),i);}const s=t[e];let o=n,a=r;for(Qn(t,n,e),i(t[r],s)>0&&Qn(t,n,r);o<a;){for(Qn(t,o,a),o++,a--;i(t[o],s)<0;)o++;for(;i(t[a],s)>0;)a--;}0===i(t[n],s)?Qn(t,n,a):(a++,Qn(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1);}}function Qn(t,e,n){const r=t[e];t[e]=t[n],t[n]=r;}function tr(t,e){return t<e?-1:t>e?1:0}function er(t,e){if(t.length<=1)return [t];const n=[];let r,i;for(const e of t){const t=rr(e);0!==t&&(e.area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(r&&n.push(r),r=[e]):r.push(e));}if(r&&n.push(r),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Jn(n[t],e,1,n[t].length-1,nr),n[t]=n[t].slice(0,e));return n}function nr(t,e){return e.area-t.area}function rr(t){let e=0;for(let n,r,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r=t[o],e+=(r.x-n.x)*(n.y+r.y);return e}const ir=1/298.257223563,sr=ir*(2-ir),or=Math.PI/180;class ar{constructor(t){const e=6378.137*or*1e3,n=Math.cos(t*or),r=1/(1-sr*(1-n*n)),i=Math.sqrt(r);this.kx=e*i*n,this.ky=e*i*r*(1-sr);}distance(t,e){const n=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(t,e){let n,r,i,s,o=1/0;for(let a=0;a<t.length-1;a++){let l=t[a][0],u=t[a][1],c=this.wrap(t[a+1][0]-l)*this.kx,h=(t[a+1][1]-u)*this.ky,p=0;0===c&&0===h||(p=(this.wrap(e[0]-l)*this.kx*c+(e[1]-u)*this.ky*h)/(c*c+h*h),p>1?(l=t[a+1][0],u=t[a+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=this.wrap(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const f=c*c+h*h;f<o&&(o=f,n=l,r=u,i=a,s=p);}return {point:[n,r],index:i,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function lr(t,e){return e[0]-t[0]}function ur(t){return t[1]-t[0]+1}function cr(t,e){return t[1]>=t[0]&&t[1]<e}function hr(t,e){if(t[0]>t[1])return [null,null];const n=ur(t);if(e){if(2===n)return [t,null];const e=Math.floor(n/2);return [[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===n)return [t,null];const r=Math.floor(n/2)-1;return [[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function pr(t,e){if(!cr(e,t.length))return [1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Cn(n,t[r]);return n}function fr(t){const e=[1/0,1/0,-1/0,-1/0];for(const n of t)for(const t of n)Cn(e,t);return e}function dr(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function yr(t,e,n){if(!dr(t)||!dr(e))return NaN;let r=0,i=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),n.distance([0,0],[r,i])}function mr(t,e,n){const r=n.pointOnLine(e,t);return n.distance(t,r.point)}function gr(t,e,n,r,i){const s=Math.min(mr(t,[n,r],i),mr(e,[n,r],i)),o=Math.min(mr(n,[t,e],i),mr(r,[t,e],i));return Math.min(s,o)}function xr(t,e,n,r,i){if(!cr(e,t.length)||!cr(r,n.length))return 1/0;let s=1/0;for(let o=e[0];o<e[1];++o){const e=t[o],a=t[o+1];for(let t=r[0];t<r[1];++t){const r=n[t],o=n[t+1];if(On(e,a,r,o))return 0;s=Math.min(s,gr(e,a,r,o,i));}}return s}function vr(t,e,n,r,i){if(!cr(e,t.length)||!cr(r,n.length))return NaN;let s=1/0;for(let o=e[0];o<=e[1];++o)for(let e=r[0];e<=r[1];++e)if(s=Math.min(s,i.distance(t[o],n[e])),0===s)return s;return s}function br(t,e,n){if(Rn(t,e,!0))return 0;let r=1/0;for(const i of e){const e=i[0],s=i[i.length-1];if(e!==s&&(r=Math.min(r,mr(t,[s,e],n)),0===r))return r;const o=n.pointOnLine(i,t);if(r=Math.min(r,n.distance(t,o.point)),0===r)return r}return r}function wr(t,e,n,r){if(!cr(e,t.length))return NaN;for(let r=e[0];r<=e[1];++r)if(Rn(t[r],n,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s){const e=t[s],o=t[s+1];for(const t of n)for(let n=0,s=t.length,a=s-1;n<s;a=n++){const s=t[a],l=t[n];if(On(e,o,s,l))return 0;i=Math.min(i,gr(e,o,s,l,r));}}return i}function _r(t,e){for(const n of t)for(const t of n)if(Rn(t,e,!0))return !0;return !1}function Sr(t,e,n,r=1/0){const i=fr(t),s=fr(e);if(r!==1/0&&yr(i,s,n)>=r)return r;if(Vn(i,s)){if(_r(t,e))return 0}else if(_r(e,t))return 0;let o=1/0;for(const r of t)for(let t=0,i=r.length,s=i-1;t<i;s=t++){const i=r[s],a=r[t];for(const t of e)for(let e=0,r=t.length,s=r-1;e<r;s=e++){const r=t[s],l=t[e];if(On(i,a,r,l))return 0;o=Math.min(o,gr(i,a,r,l,n));}}return o}function Ar(t,e,n,r,i,s){if(!s)return;const o=yr(pr(r,s),i,n);o<e&&t.push([o,s,[0,0]]);}function Mr(t,e,n,r,i,s,o){if(!s||!o)return;const a=yr(pr(r,s),pr(i,o),n);a<e&&t.push([a,s,o]);}function kr(t,e,n,r,i=1/0){let s=Math.min(r.distance(t[0],n[0][0]),i);if(0===s)return s;const o=new Kn([[0,[0,t.length-1],[0,0]]],lr),a=fr(n);for(;o.length>0;){const i=o.pop();if(i[0]>=s)continue;const l=i[1],u=e?50:100;if(ur(l)<=u){if(!cr(l,t.length))return NaN;if(e){const e=wr(t,l,n,r);if(isNaN(e)||0===e)return e;s=Math.min(s,e);}else for(let e=l[0];e<=l[1];++e){const i=br(t[e],n,r);if(s=Math.min(s,i),0===s)return 0}}else {const n=hr(l,e);Ar(o,s,r,t,a,n[0]),Ar(o,s,r,t,a,n[1]);}}return s}function Ir(t,e,n,r,i,s=1/0){let o=Math.min(s,i.distance(t[0],n[0]));if(0===o)return o;const a=new Kn([[0,[0,t.length-1],[0,n.length-1]]],lr);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],u=s[2],c=e?50:100,h=r?50:100;if(ur(l)<=c&&ur(u)<=h){if(!cr(l,t.length)&&cr(u,n.length))return NaN;let s;if(e&&r)s=xr(t,l,n,u,i),o=Math.min(o,s);else if(e&&!r){const e=t.slice(l[0],l[1]+1);for(let t=u[0];t<=u[1];++t)if(s=mr(n[t],e,i),o=Math.min(o,s),0===o)return o}else if(!e&&r){const e=n.slice(u[0],u[1]+1);for(let n=l[0];n<=l[1];++n)if(s=mr(t[n],e,i),o=Math.min(o,s),0===o)return o}else s=vr(t,l,n,u,i),o=Math.min(o,s);}else {const s=hr(l,e),c=hr(u,r);Mr(a,o,i,t,n,s[0],c[0]),Mr(a,o,i,t,n,s[0],c[1]),Mr(a,o,i,t,n,s[1],c[0]),Mr(a,o,i,t,n,s[1],c[1]);}}return o}
36function Er(t){return "MultiPolygon"===t.type?t.coordinates.map((t=>({type:"Polygon",coordinates:t}))):"MultiLineString"===t.type?t.coordinates.map((t=>({type:"LineString",coordinates:t}))):"MultiPoint"===t.type?t.coordinates.map((t=>({type:"Point",coordinates:t}))):[t]}class Tr{constructor(t,e){this.type=Vt,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ne(t[1])){const e=t[1];if("FeatureCollection"===e.type)return new Tr(e,e.features.map((t=>Er(t.geometry))).flat());if("Feature"===e.type)return new Tr(e,Er(e.geometry));if("type"in e&&"coordinates"in e)return new Tr(e,Er(e))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const n=t.geometry(),r=n.flat().map((e=>Bn([e.x,e.y],t.canonical)));if(0===n.length)return NaN;const i=new ar(r[0][1]);let s=1/0;for(const t of e){switch(t.type){case "Point":s=Math.min(s,Ir(r,!1,[t.coordinates],!1,i,s));break;case "LineString":s=Math.min(s,Ir(r,!1,t.coordinates,!0,i,s));break;case "Polygon":s=Math.min(s,kr(r,!1,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const n=t.geometry(),r=n.flat().map((e=>Bn([e.x,e.y],t.canonical)));if(0===n.length)return NaN;const i=new ar(r[0][1]);let s=1/0;for(const t of e){switch(t.type){case "Point":s=Math.min(s,Ir(r,!0,[t.coordinates],!1,i,s));break;case "LineString":s=Math.min(s,Ir(r,!0,t.coordinates,!0,i,s));break;case "Polygon":s=Math.min(s,kr(r,!0,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries);if("Polygon"===t.geometryType())return function(t,e){const n=t.geometry();if(0===n.length||0===n[0].length)return NaN;const r=er(n,0).map((e=>e.map((e=>e.map((e=>Bn([e.x,e.y],t.canonical))))))),i=new ar(r[0][0][0][1]);let s=1/0;for(const t of e)for(const e of r){switch(t.type){case "Point":s=Math.min(s,kr([t.coordinates],!1,e,i,s));break;case "LineString":s=Math.min(s,kr(t.coordinates,!0,e,i,s));break;case "Polygon":s=Math.min(s,Sr(e,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return !0}}class Fr{constructor(t){this.type=Ut,this.key=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const n=t[1];return null==n?e.error("Global state property must be defined."):"string"!=typeof n?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Fr(n)}evaluate(t){var e;const n=null===(e=t.globals)||void 0===e?void 0:e.globalState;return n&&0!==Object.keys(n).length?ve(n,this.key):null}eachChild(){}outputDefined(){return !1}}const Dr={"==":wn,"!=":_n,">":An,"<":Sn,">=":kn,"<=":Mn,array:Xe,at:tn,boolean:Xe,case:sn,coalesce:gn,collator:In,format:Tn,image:Fn,in:en,"index-of":nn,interpolate:dn,"interpolate-hcl":dn,"interpolate-lab":dn,length:Dn,let:Je,literal:qe,match:rn,number:Xe,"number-format":En,object:Xe,slice:on,step:ln,string:Xe,"to-boolean":Ze,"to-color":Ze,"to-number":Ze,"to-string":Ze,var:Qe,within:Wn,distance:Tr,"global-state":Fr};class Pr{constructor(t,e,n,r){this.name=t,this.type=e,this._evaluate=n,this.args=r;}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}static parse(t,e){const n=t[0],r=Pr.definitions[n];if(!r)return e.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[r,s]of o){a=new Ke(e.registry,Lr,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e<t.length;e++){const n=t[e],i=Array.isArray(r)?r[e-1]:r.type,s=a.parse(n,1+o.length,i);if(!s){l=!0;break}o.push(s);}if(!l)if(Array.isArray(r)&&r.length!==o.length)a.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else {for(let t=0;t<o.length;t++){const e=Array.isArray(r)?r[t]:r.type,n=o[t];a.concat(t+1).checkSubtype(e,n.type);}if(0===a.errors.length)return new Pr(n,i,s,o)}}if(1===o.length)e.errors.push(...a.errors);else {const n=(o.length?o:s).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(Kt).join(", ")})`:`(${Kt(e.type)}...)`;var e;})).join(" | "),r=[];for(let n=1;n<t.length;n++){const i=e.parse(t[n],1+r.length);if(!i)return null;r.push(Kt(i.type));}e.error(`Expected arguments of type ${n}, but found (${r.join(", ")}) instead.`);}return null}static register(t,e){Pr.definitions=e;for(const n in e)t[n]=Pr;}}function zr(t,[e,n,r,i]){e=e.evaluate(t),n=n.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=Re(e,n,r,s);if(o)throw new Ce(o);return new Ie(e/255,n/255,r/255,s,!1)}function Br(t,e){return t in e}function Cr(t,e){const n=e[t];return void 0===n?null:n}function Vr(t){return {type:t}}
36function Lr(t){if(t instanceof Qe)return Lr(t.boundExpression);if(t instanceof Pr&&"error"===t.name)return !1;if(t instanceof In)return !1;if(t instanceof Wn)return !1;if(t instanceof Tr)return !1;if(t instanceof Fr)return !1;const e=t instanceof Ze||t instanceof Xe;let n=!0;return t.eachChild((t=>{n=e?n&&Lr(t):n&&t instanceof qe;})),!!n&&Or(t)&&Rr(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Or(t){if(t instanceof Pr){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 Wn)return !1;if(t instanceof Tr)return !1;let e=!0;return t.eachChild((t=>{e&&!Or(t)&&(e=!1);})),e}function $r(t){if(t instanceof Pr&&"feature-state"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!$r(t)&&(e=!1);})),e}function Rr(t,e){if(t instanceof Pr&&e.indexOf(t.name)>=0)return !1;let n=!0;return t.eachChild((t=>{n&&!Rr(t,e)&&(n=!1);})),n}function Nr(t){return {result:"success",value:t}}function Ur(t){return {result:"error",value:t}}function jr(t){return "data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function qr(t){return !!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Gr(t){return !!t.expression&&t.expression.interpolated}function Xr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Yr(t){return "object"==typeof t&&null!==t&&!Array.isArray(t)&&Ue(t)===Nt}function Zr(t){return t}function Hr(t,e){const n=t.stops&&"object"==typeof t.stops[0][0],r=n||!(n||void 0!==t.property),i=t.type||(Gr(e)?"exponential":"interval"),s=function(t){switch(t.type){case "color":return Ie.parse;case "padding":return Pe.parse;case "numberArray":return ze.parse;case "colorArray":return Be.parse;default:return null}}(e);if(s&&((t=Pt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],s(t[1])]))),t.default=s(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==(o=t.colorSpace)&&"hcl"!==o&&"lab"!==o)throw new Error(`Unknown color space: "${t.colorSpace}"`);var o;const a=function(t){switch(t){case "exponential":return Qr;case "interval":return Jr;case "categorical":return Kr;case "identity":return ti;default:throw new Error(`Unknown function type "${t}"`)}}(i);let l,u;if("categorical"===i){l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0];}if(n){const n={},r=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),n[s].stops.push([i[0].value,i[1]]);}const i=[];for(const t of r)i.push([n[t].zoom,Hr(n[t],e)]);const s={name:"linear"};return {kind:"composite",interpolationType:s,interpolationFactor:dn.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:n},r)=>Qr({stops:i,base:t.base},e,n).evaluate(n,r)}}if(r){const n="exponential"===i?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return {kind:"camera",interpolationType:n,interpolationFactor:dn.interpolationFactor.bind(void 0,n),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:n})=>a(t,e,n,l,u)}}return {kind:"source",evaluate(n,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Wr(t.default,e.default):a(t,e,i,l,u)}}}function Wr(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function Kr(t,e,n,r,i){return Wr(typeof n===i?r[n]:void 0,t.default,e.default)}function Jr(t,e,n){if("number"!==Xr(n))return Wr(t.default,e.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];const i=an(t.stops.map((t=>t[0])),n);return t.stops[i][1]}function Qr(t,e,n){const r=void 0!==t.base?t.base:1;if("number"!==Xr(n))return Wr(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];const s=an(t.stops.map((t=>t[0])),n),o=function(t,e,n,r){const i=r-n,s=t-n;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(n,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],l=t.stops[s+1][1],u=mn[e.type]||Zr;return "function"==typeof a.evaluate?{evaluate(...e){const n=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==n&&void 0!==r)return u(n,r,o,t.colorSpace)}}:u(a,l,o,t.colorSpace)}function ti(t,e,n){switch(e.type){case "color":n=Ie.parse(n);break;case "formatted":n=De.fromString(n.toString());break;case "resolvedImage":n=Oe.fromString(n.toString());break;case "padding":n=Pe.parse(n);break;case "colorArray":n=Be.parse(n);break;case "numberArray":n=ze.parse(n);break;default:Xr(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0);}return Wr(n,t.default,e.default)}Pr.register(Dr,{error:[{kind:"error"},[Lt],(t,[e])=>{throw new Ce(e.evaluate(t))}],typeof:[Lt,[Ut],(t,[e])=>Kt(Ue(e.evaluate(t)))],"to-rgba":[Wt(Vt,4),[$t],(t,[e])=>{const[n,r,i,s]=e.evaluate(t).rgb;return [255*n,255*r,255*i,s]}],rgb:[$t,[Vt,Vt,Vt],zr],rgba:[$t,[Vt,Vt,Vt,Vt],zr],has:{type:Ot,overloads:[[[Lt],(t,[e])=>Br(e.evaluate(t),t.properties())],[[Lt,Nt],(t,[e,n])=>Br(e.evaluate(t),n.evaluate(t))]]},get:{type:Ut,overloads:[[[Lt],(t,[e])=>
vendor: 4,163 bytes, line 36
36Cr(e.evaluate(t),t.properties())],[[Lt,Nt],(t,[e,n])=>Cr(e.evaluate(t),n.evaluate(t))]]},"feature-state":[Ut,[Lt],(t,[e])=>Cr(e.evaluate(t),t.featureState||{})],properties:[Nt,[],t=>t.properties()],"geometry-type":[Lt,[],t=>t.geometryType()],id:[Ut,[],t=>t.id()],zoom:[Vt,[],t=>t.globals.zoom],"heatmap-density":[Vt,[],t=>t.globals.heatmapDensity||0],elevation:[Vt,[],t=>t.globals.elevation||0],"line-progress":[Vt,[],t=>t.globals.lineProgress||0],accumulated:[Ut,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Vt,Vr(Vt),(t,e)=>{let n=0;for(const r of e)n+=r.evaluate(t);return n}],"*":[Vt,Vr(Vt),(t,e)=>{let n=1;for(const r of e)n*=r.evaluate(t);return n}],"-":{type:Vt,overloads:[[[Vt,Vt],(t,[e,n])=>e.evaluate(t)-n.evaluate(t)],[[Vt],(t,[e])=>-e.evaluate(t)]]},"/":[Vt,[Vt,Vt],(t,[e,n])=>e.evaluate(t)/n.evaluate(t)],"%":[Vt,[Vt,Vt],(t,[e,n])=>e.evaluate(t)%n.evaluate(t)],ln2:[Vt,[],()=>Math.LN2],pi:[Vt,[],()=>Math.PI],e:[Vt,[],()=>Math.E],"^":[Vt,[Vt,Vt],(t,[e,n])=>Math.pow(e.evaluate(t),n.evaluate(t))],sqrt:[Vt,[Vt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Vt,[Vt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Vt,[Vt],(t,[e])=>Math.log(e.evaluate(t))],log2:[Vt,[Vt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Vt,[Vt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Vt,[Vt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Vt,[Vt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Vt,[Vt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Vt,[Vt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Vt,[Vt],(t,[e])=>Math.atan(e.evaluate(t))],min:[Vt,Vr(Vt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Vt,Vr(Vt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Vt,[Vt],(t,[e])=>Math.abs(e.evaluate(t))],round:[Vt,[Vt],(t,[e])=>{const n=e.evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[Vt,[Vt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Vt,[Vt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Ot,[Lt,Ut],(t,[e,n])=>t.properties()[e.value]===n.value],"filter-id-==":[Ot,[Ut],(t,[e])=>t.id()===e.value],"filter-type-==":[Ot,[Lt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Ot,[Lt,Ut],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[Ot,[Ut],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<r}],"filter->":[Ot,[Lt,Ut],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[Ot,[Ut],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>r}],"filter-<=":[Ot,[Lt,Ut],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[Ot,[Ut],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n<=r}],"filter->=":[Ot,[Lt,Ut],(t,[e,n])=>{const r=t.properties()[e.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[Ot,[Ut],(t,[e])=>{const n=t.id(),r=e.value;return typeof n==typeof r&&n>=r}],"filter-has":[Ot,[Ut],(t,[e])=>e.value in t.properties()],"filter-has-id":[Ot,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Ot,[Wt(Lt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Ot,[Wt(Ut)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Ot,[Lt,Wt(Ut)],(t,[e,n])=>n.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Ot,[Lt,Wt(Ut)],(t,[e,n])=>function(t,e,n,r){for(;n<=r;){const i=n+r>>1;if(e[i]===t)return !0;e[i]>t?r=i-1:n=i+1;}return !1}(t.properties()[e.value],n.value,0,n.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(t,[e,n])=>e.evaluate(t)&&n.evaluate(t)],[Vr(Ot),(t,e)=>{for(const n of e)if(!n.evaluate(t))return !1;return !0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(t,[e,n])=>e.evaluate(t)||n.evaluate(t)],[Vr(Ot),(t,e)=>{for(const n of e)if(n.evaluate(t))return !0;return !1}]]},"!":[Ot,[Ot],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Ot,[Lt],(t,[e])=>{const n=t.globals&&t.globals.isSupportedScript;return !n||n(e.evaluate(t))}],upcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Lt,[Lt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Lt,Vr(Ut),(t,e)=>e.map((e=>je(e.evaluate(t)))).join("")],split:[Wt(Lt),[Lt,Lt],(t,[e,n])=>e.evaluate(t).split(n.evaluate(t))],join:[Lt,[Wt(Lt),Lt],(t,[e,n])=>
36e.value.join(n.evaluate(t))],"resolved-locale":[Lt,[jt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ei{constructor(t,e,n){this.expression=t,this._warningHistory={},this._evaluator=new We,this._defaultValue=e?function(t){if("color"===t.type&&Yr(t.default))return new Ie(0,0,0,0);switch(t.type){case "color":return Ie.parse(t.default)||null;case "padding":return Pe.parse(t.default)||null;case "numberArray":return ze.parse(t.default)||null;case "colorArray":return Be.parse(t.default)||null;case "variableAnchorOffsetCollection":return Le.parse(t.default)||null;case "projectionDefinition":return $e.parse(t.default)||null;default:return void 0===t.default?null:t.default}}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this._globalState=n;}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=ci(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,n,r,i,s){this._globalState&&(t=ci(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||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 Ce(`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 ni(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Dr}function ri(t,e,n){const r=new Ke(Dr,Lr,[],e?function(t){const e={color:$t,string:Lt,number:Vt,enum:Lt,boolean:Ot,formatted:qt,padding:Gt,numberArray:Yt,colorArray:Xt,projectionDefinition:Rt,resolvedImage:Zt,variableAnchorOffsetCollection:Ht};return "array"===t.type?Wt(e[t.value]||Ut,t.length):e[t.type]}(e):void 0),i=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Nr(new ei(i,e,n)):Ur(r.errors)}class ii{constructor(t,e,n){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!$r(e.expression),this.globalStateRefs=ui(e.expression),this._globalState=n;}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=ci(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,s)}evaluate(t,e,n,r,i,s){return this._globalState&&(t=ci(t,this._globalState)),this._styleExpression.evaluate(t,e,n,r,i,s)}}class si{constructor(t,e,n,r,i){this.kind=t,this.zoomStops=n,this._styleExpression=e,this.isStateDependent="camera"!==t&&!$r(e.expression),this.globalStateRefs=ui(e.expression),this.interpolationType=r,this._globalState=i;}evaluateWithoutErrorHandling(t,e,n,r,i,s){return this._globalState&&(t=ci(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,n,r,i,s)}evaluate(t,e,n,r,i,s){return this._globalState&&(t=ci(t,this._globalState)),this._styleExpression.evaluate(t,e,n,r,i,s)}interpolationFactor(t,e,n){return this.interpolationType?dn.interpolationFactor(this.interpolationType,t,e,n):0}}function oi(t,e,n){const r=ri(t,e,n);if("error"===r.result)return r;const i=r.value.expression,s=Or(i);if(!s&&!jr(e))return Ur([new zt("","data expressions not supported")]);const o=Rr(i,["zoom"]);if(!o&&!qr(e))return Ur([new zt("","zoom expressions not supported")]);const a=li(i);return a||o?a instanceof zt?Ur([a]):a instanceof dn&&!Gr(e)?Ur([new zt("",'"interpolate" expressions cannot be used with this property')]):Nr(a?new si(s?"camera":"composite",r.value,a.labels,a instanceof dn?a.interpolation:void 0,n):new ii(s?"constant":"source",r.value,n)):Ur([new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ai{constructor(t,e){this._parameters=t,this._specification=e,Pt(this,Hr(this._parameters,this._specification));}static deserialize(t){return new ai(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function li(t){let e=null;if(t instanceof Je)e=li(t.result);else if(t instanceof gn){for(const n of t.args)if(e=li(n),e)break}else (t instanceof ln||t instanceof dn)&&t.input instanceof Pr&&"zoom"===t.input.name&&(e=t);return e instanceof zt||t.eachChild((t=>{const n=li(t);n instanceof zt?e=n:!e&&n?e=new zt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new zt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'));})),e}function ui(t,e=new Set){return t instanceof Fr&&e.add(t.key),t.eachChild((t=>{ui(t,e);})),e}function ci(t,e){const{zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=null!=t?t:{};return {zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function hi(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(!hi(e)&&"boolean"!=typeof e)return !1;return !0;default:return !0}}const pi={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fi(t,e){if(null==t)return {filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};hi(t)||(t=mi(t));const n=ri(t,pi,e);if("error"===n.result)throw new Error(n.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return {filter:(t,e,r)=>n.value.evaluate(t,e,{},r),needGeometry:yi(t),getGlobalStateRefs:()=>ui(n.value.expression)}}function di(t,e){return t<e?-1:t>e?1:0}function yi(t){if(!Array.isArray(t))return !1;
36if("within"===t[0]||"distance"===t[0])return !0;for(let e=1;e<t.length;e++)if(yi(t[e]))return !0;return !1}function mi(t){if(!t)return !0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?gi(t[1],t[2],"=="):"!="===e?bi(gi(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?gi(t[1],t[2],e):"any"===e?(n=t.slice(1),["any"].concat(n.map(mi))):"all"===e?["all"].concat(t.slice(1).map(mi)):"none"===e?["all"].concat(t.slice(1).map(mi).map(bi)):"in"===e?xi(t[1],t.slice(2)):"!in"===e?bi(xi(t[1],t.slice(2))):"has"===e?vi(t[1]):"!has"!==e||bi(vi(t[1]));var n;}function gi(t,e,n){switch(t){case "$type":return [`filter-type-${n}`,e];case "$id":return [`filter-id-${n}`,e];default:return [`filter-${n}`,t,e]}}function xi(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(di)]]:["filter-in-small",t,["literal",e]]}}function vi(t){switch(t){case "$type":return !0;case "$id":return ["filter-has-id"];default:return ["filter-has",t]}}function bi(t){return ["!",t]}function wi(t){const e=typeof t;if("number"===e||"boolean"===e||"string"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e="[";for(const n of t)e+=`${wi(n)},`;return `${e}]`}const n=Object.keys(t).sort();let r="{";for(let e=0;e<n.length;e++)r+=`${JSON.stringify(n[e])}:${wi(t[n[e]])},`;return `${r}}`}function _i(t){let e="";for(const n of bt)e+=`/${wi(t[n])}`;return e}function Si(t){const e=t.value;return e?[new Dt(t.key,e,"constants have been deprecated as of v8")]:[]}function Ai(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Mi(t){if(Array.isArray(t))return t.map(Mi);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const n in t)e[n]=Mi(t[n]);return e}return Ai(t)}function ki(t){const e=t.key,n=t.value,r=t.valueSpec||{},i=t.objectElementValidators||{},s=t.style,o=t.styleSpec,a=t.validateSpec;let l=[];const u=Xr(n);if("object"!==u)return [new Dt(e,n,`object expected, ${u} found`)];for(const t in n){const u=t.split(".")[0],c=ve(r,u)||r["*"];let h;if(ve(i,u))h=i[u];else if(ve(r,u)){if(void 0===n[t])continue;h=a;}else if(i["*"])h=i["*"];else {if(!r["*"]){l.push(new Dt(e,n[t],`unknown property "${t}"`));continue}h=a;}l=l.concat(h({key:(e?`${e}.`:e)+t,value:n[t],valueSpec:c,style:s,styleSpec:o,object:n,objectKey:t,validateSpec:a},n));}for(const t in r)i[t]||r[t].required&&void 0===r[t].default&&void 0===n[t]&&l.push(new Dt(e,n,`missing required property "${t}"`));return l}function Ii(t){const e=t.value,n=t.valueSpec,r=t.style,i=t.styleSpec,s=t.key,o=t.arrayElementValidator||t.validateSpec;if("array"!==Xr(e))return [new Dt(s,e,`array expected, ${Xr(e)} found`)];if(n.length&&e.length!==n.length)return [new Dt(s,e,`array length ${n.length} expected, length ${e.length} found`)];let a={type:n.value,values:n.values};i.$version<7&&(a.function=n.function),"object"===Xr(n.value)&&(a=n.value);let l=[];for(let n=0;n<e.length;n++)l=l.concat(o({array:e,arrayIndex:n,value:e[n],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:i,key:`${s}[${n}]`}));return l}function Ei(t){const e=t.key,n=t.value,r=t.valueSpec;let i=Xr(n);return "number"===i&&n!=n&&(i="NaN"),"number"!==i?[new Dt(e,n,`number expected, ${i} found`)]:"minimum"in r&&n<r.minimum?[new Dt(e,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new Dt(e,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function Ti(t){const e=t.valueSpec,n=Ai(t.value.type);let r,i,s,o={};const a="categorical"!==n&&void 0===t.value.property,l=!a,u="array"===Xr(t.value.stops)&&"array"===Xr(t.value.stops[0])&&"object"===Xr(t.value.stops[0][0]),c=ki({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===n)return [new Dt(t.key,t.value,'identity function may not have a "stops" property')];let e=[];const r=t.value;return e=e.concat(Ii({key:t.key,value:r,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Xr(r)&&0===r.length&&e.push(new Dt(t.key,r,"array must have at least one stop")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return "identity"===n&&a&&c.push(new Dt(t.key,t.value,'missing required property "property"')),"identity"===n||t.value.stops||c.push(new Dt(t.key,t.value,'missing required property "stops"')),"exponential"===n&&t.valueSpec.expression&&!Gr(t.valueSpec)&&c.push(new Dt(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!jr(t.valueSpec)?c.push(new Dt(t.key,t.value,"property functions not supported")):a&&!qr(t.valueSpec)&&c.push(new Dt(t.key,t.value,"zoom functions not supported"))),"categorical"!==n&&!u||void 0!==t.value.property||c.push(new Dt(t.key,t.value,'"property" property is required')),c;function h(t){let n=[];const r=t.value,a=t.key;if("array"!==Xr(r))return [new Dt(a,r,`array expected, ${Xr(r)} found`)];if(2!==r.length)return [new Dt(a,r,`array length 2 expected, length ${r.length} found`)];if(u){if("object"!==Xr(r[0]))return [new Dt(a,r,`object expected, ${Xr(r[0])} found`)];if(void 0===r[0].zoom)return [new Dt(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return [new Dt(a,r,"object stop key must have value")];if(s&&s>Ai(r[0].zoom))return [new Dt(a,r[0].zoom,"stop zoom values must appear in ascending order")];Ai(r[0].zoom)!==s&&(s=Ai(r[0].zoom),i=void 0,o={}),n=n.concat(ki({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ei,value:p}}));}else n=n.concat(p({key:`${a}[0]`,value:r[0],validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},r));return ni(Mi(r[1]))?n.concat([new Dt(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):n.
vendor: 4,515 bytes, line 36
36concat(t.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const a=Xr(t.value),l=Ai(t.value),u=null!==t.value?t.value:s;if(r){if(a!==r)return [new Dt(t.key,u,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return [new Dt(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==n){let r=`number expected, ${a} found`;return jr(e)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Dt(t.key,u,r)]}return "categorical"!==n||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===a&&void 0!==i&&l<i?[new Dt(t.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===n&&l in o?[new Dt(t.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new Dt(t.key,u,`integer expected, found ${l}`)]}}function Fi(t){const e=("property"===t.expressionContext?oi:ri)(Mi(t.value),t.valueSpec);if("error"===e.result)return e.value.map((e=>new Dt(`${t.key}${e.key}`,t.value,e.message)));const n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!n.outputDefined())return [new Dt(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&&!$r(n))return [new Dt(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!$r(n))return [new Dt(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Rr(n,["zoom","feature-state"]))return [new Dt(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Or(n))return [new Dt(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return []}function Di(t){const e=t.key,n=t.value,r=Xr(n);return "string"!==r?[new Dt(e,n,`color expected, ${r} found`)]:Ie.parse(String(n))?[]:[new Dt(e,n,`color expected, "${n}" found`)]}function Pi(t){const e=t.key,n=t.value,r=t.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(Ai(n))&&i.push(new Dt(e,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(Ai(n))&&i.push(new Dt(e,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),i}function zi(t){return hi(Mi(t.value))?Fi(Pt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Bi(t)}function Bi(t){const e=t.value,n=t.key;if("array"!==Xr(e))return [new Dt(n,e,`array expected, ${Xr(e)} found`)];const r=t.styleSpec;let i,s=[];if(e.length<1)return [new Dt(n,e,"filter array must have at least 1 element")];switch(s=s.concat(Pi({key:`${n}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ai(e[0])){case "<":case "<=":case ">":case ">=":e.length>=2&&"$type"===Ai(e[1])&&s.push(new Dt(n,e,`"$type" cannot be use with operator "${e[0]}"`));case "==":case "!=":3!==e.length&&s.push(new Dt(n,e,`filter array for operator "${e[0]}" must have 3 elements`));case "in":case "!in":e.length>=2&&(i=Xr(e[1]),"string"!==i&&s.push(new Dt(`${n}[1]`,e[1],`string expected, ${i} found`)));for(let o=2;o<e.length;o++)i=Xr(e[o]),"$type"===Ai(e[1])?s=s.concat(Pi({key:`${n}[${o}]`,value:e[o],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new Dt(`${n}[${o}]`,e[o],`string, number, or boolean expected, ${i} found`));break;case "any":case "all":case "none":for(let r=1;r<e.length;r++)s=s.concat(Bi({key:`${n}[${r}]`,value:e[r],style:t.style,styleSpec:t.styleSpec}));break;case "has":case "!has":i=Xr(e[1]),2!==e.length?s.push(new Dt(n,e,`filter array for "${e[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new Dt(`${n}[1]`,e[1],`string expected, ${i} found`));}return s}function Ci(t,e){const n=t.key,r=t.validateSpec,i=t.style,s=t.styleSpec,o=t.value,a=t.objectKey,l=s[`${e}_${t.layerType}`];if(!l)return [];const u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&l[u[1]]&&l[u[1]].transition)return r({key:n,value:o,valueSpec:s.transition,style:i,styleSpec:s}
36);const c=t.valueSpec||l[a];if(!c)return [new Dt(n,o,`unknown property "${a}"`)];let h;if("string"===Xr(o)&&jr(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(o)))return [new Dt(n,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return "symbol"===t.layerType&&"text-font"===a&&Yr(Mi(o))&&"identity"===Ai(o.type)&&p.push(new Dt(n,o,'"text-font" does not support identity functions')),p.concat(r({key:t.key,value:o,valueSpec:c,style:i,styleSpec:s,expressionContext:"property",propertyType:e,propertyKey:a}))}function Vi(t){return Ci(t,"paint")}function Li(t){return Ci(t,"layout")}function Oi(t){var e,n;let r=[];const i=t.value,s=t.key,o=t.style,a=t.styleSpec;if("object"!==Xr(i))return [new Dt(s,i,`object expected, ${Xr(i)} found`)];i.type||i.ref||r.push(new Dt(s,i,'either "type" or "ref" is required'));let l=Ai(i.type);const u=Ai(i.ref);if(i.id){const e=Ai(i.id);for(let n=0;n<t.arrayIndex;n++){const t=o.layers[n];Ai(t.id)===e&&r.push(new Dt(s,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&&r.push(new Dt(s,i[t],`"${t}" is prohibited for ref layers`));})),o.layers.forEach((e=>{Ai(e.id)===u&&(t=e);})),t?t.ref?r.push(new Dt(s,i.ref,"ref cannot reference another ref layer")):l=Ai(t.type):r.push(new Dt(s,i.ref,`ref layer "${u}" not found`));}else if("background"!==l)if(i.source){const t=o.sources&&o.sources[i.source],e=t&&Ai(t.type);t?"vector"===e&&"raster"===l?r.push(new Dt(s,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==e&&"hillshade"===l||"raster-dem"!==e&&"color-relief"===l?r.push(new Dt(s,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===e&&"raster"!==l?r.push(new Dt(s,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==e||i["source-layer"]?"raster-dem"===e&&"hillshade"!==l&&"color-relief"!==l?r.push(new Dt(s,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==l||!i.paint||!i.paint["line-gradient"]||"geojson"===e&&t.lineMetrics||r.push(new Dt(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Dt(s,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new Dt(s,i.source,`source "${i.source}" not found`));}else r.push(new Dt(s,i,'missing required property "source"'));return "raster"===l&&(null===(e=i.paint)||void 0===e?void 0:e.resampling)&&(null===(n=i.paint)||void 0===n?void 0:n["raster-resampling"])&&r.push(new Dt(s,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ki({key:s,value:i,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${s}.type`,value:i.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:i,objectKey:"type"}),filter:zi,layout:t=>ki({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Li(Pt({layerType:l},t))}}),paint:t=>ki({layer:i,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":t=>Vi(Pt({layerType:l},t))}})}})),r}function $i(t){const e=t.value,n=t.key,r=Xr(e);return "string"!==r?[new Dt(n,e,`string expected, ${r} found`)]:[]}const Ri={promoteId:function({key:t,value:e}){if("string"===Xr(e))return $i({key:t,value:e});{const n=[];for(const r in e)n.push(...$i({key:`${t}.${r}`,value:e[r]}));return n}}};function Ni(t){const e=t.value,n=t.key,r=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return [new Dt(n,e,'"type" is required')];const o=Ai(e.type);let a;switch(o){case "vector":case "raster":return a=ki({key:n,value:e,valueSpec:r[`source_${o.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Ri,validateSpec:s}
36),a;case "raster-dem":return a=function(t){var e;const n=null!==(e=t.sourceName)&&void 0!==e?e:"",r=t.value,i=t.styleSpec,s=i.source_raster_dem,o=t.style;let a=[];const l=Xr(r);if(void 0===r)return a;if("object"!==l)return a.push(new Dt("source_raster_dem",r,`object expected, ${l} found`)),a;const u="custom"===Ai(r.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(const e in r)!u&&c.includes(e)?a.push(new Dt(e,r[e],`In "${n}": "${e}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):s[e]?a=a.concat(t.validateSpec({key:e,value:r[e],valueSpec:s[e],validateSpec:t.validateSpec,style:o,styleSpec:i})):a.push(new Dt(e,r[e],`unknown property "${e}"`));return a}({sourceName:n,value:e,style:t.style,styleSpec:r,validateSpec:s}),a;case "geojson":if(a=ki({key:n,value:e,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:s,objectElementValidators:Ri}),e.cluster)for(const t in e.clusterProperties){const[r,i]=e.clusterProperties[t],s="string"==typeof r?[r,["accumulated"],["get",t]]:r;a.push(...Fi({key:`${n}.${t}.map`,value:i,expressionContext:"cluster-map"})),a.push(...Fi({key:`${n}.${t}.reduce`,value:s,expressionContext:"cluster-reduce"}));}return a;case "video":return ki({key:n,value:e,valueSpec:r.source_video,style:i,validateSpec:s,styleSpec:r});case "image":return ki({key:n,value:e,valueSpec:r.source_image,style:i,validateSpec:s,styleSpec:r});case "canvas":return [new Dt(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Pi({key:`${n}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ui(t){const e=t.value,n=t.styleSpec,r=n.light,i=t.style;let s=[];const o=Xr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new Dt("light",e,`object expected, ${o} found`)]),s;for(const o in e){const a=o.match(/^(.*)-transition$/);s=s.concat(a&&r[a[1]]&&r[a[1]].transition?t.validateSpec({key:o,value:e[o],valueSpec:n.transition,validateSpec:t.validateSpec,style:i,styleSpec:n}):r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:i,styleSpec:n}):[new Dt(o,e[o],`unknown property "${o}"`)]);}return s}function ji(t){const e=t.value,n=t.styleSpec,r=n.sky,i=t.style,s=Xr(e);if(void 0===e)return [];if("object"!==s)return [new Dt("sky",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=o.concat(r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],style:i,styleSpec:n}):[new Dt(s,e[s],`unknown property "${s}"`)]);return o}function qi(t){const e=t.value,n=t.styleSpec,r=n.terrain,i=t.style;let s=[];const o=Xr(e);if(void 0===e)return s;if("object"!==o)return s=s.concat([new Dt("terrain",e,`object expected, ${o} found`)]),s;for(const o in e)s=s.concat(r[o]?t.validateSpec({key:o,value:e[o],valueSpec:r[o],validateSpec:t.validateSpec,style:i,styleSpec:n}):[new Dt(o,e[o],`unknown property "${o}"`)]);return s}function Gi(t){let e=[];const n=t.value,r=t.key;if(Array.isArray(n)){const i=[],s=[];for(const o in n)n[o].id&&i.includes(n[o].id)&&e.push(new Dt(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&s.includes(n[o].url)&&e.push(new Dt(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),s.push(n[o].url),e=e.concat(ki({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return $i({key:r,value:n})}function Xi(t){return Boolean(t)&&t.constructor===Object}function Yi(t){return Xi(t.value)?[]:[new Dt(t.key,t.value,`object expected, ${Xr(t.value)} found`)]}const Zi={"*":()=>[],array:Ii,boolean:function(t){const e=t.value,n=t.key,r=Xr(e);return "boolean"!==r?[new Dt(n,e,`boolean expected, ${r} found`)]:[]},number:Ei,color:Di,constants:Si,enum:Pi,filter:zi,function:Ti,layer:Oi,object:ki,source:Ni,light:Ui,sky:ji,terrain:qi,projection:function(t){const e=t.value,n=t.styleSpec,r=n.projection,i=t.style,s=Xr(e);if(void 0===e)return [];if("object"!==s)return [new Dt("projection",e,`object expected, ${s} found`)];let o=[];for(const s in e)o=o.concat(r[s]?t.validateSpec({key:s,value:e[s],valueSpec:r[s],style:i,styleSpec:n}):[new Dt(s,e[s],`unknown property "${s}"`)]);return o},projectionDefinition:function(t){const e=t.key;let n=t.value;n=n instanceof String?n.valueOf():n;const r=Xr(n);return "array"!==r||function(t){return Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]}(n)||function(t){return !!["interpolate","step","literal"].includes(t[0])}(n)?["array","string"].includes(r)?[]:[new Dt(e,n,`projection expected, invalid type "${r}" found`)]:[new Dt(e,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:$i,formatted:function(t){return 0===$i(t).length?[]:Fi(t)},resolvedImage:function(t){return 0===$i(t).length?[]:Fi(t)},padding:function(t){const e=t.key,n=t.value;
36if("array"===Xr(n)){if(n.length<1||n.length>4)return [new Dt(e,n,`padding requires 1 to 4 values; ${n.length} values found`)];const r={type:"number"};let i=[];for(let s=0;s<n.length;s++)i=i.concat(t.validateSpec({key:`${e}[${s}]`,value:n[s],validateSpec:t.validateSpec,valueSpec:r}));return i}return Ei({key:e,value:n,valueSpec:{}})},numberArray:function(t){const e=t.key,n=t.value;if("array"===Xr(n)){const r={type:"number"};if(n.length<1)return [new Dt(e,n,"array length at least 1 expected, length 0 found")];let i=[];for(let s=0;s<n.length;s++)i=i.concat(t.validateSpec({key:`${e}[${s}]`,value:n[s],validateSpec:t.validateSpec,valueSpec:r}));return i}return Ei({key:e,value:n,valueSpec:{}})},colorArray:function(t){const e=t.key,n=t.value;if("array"===Xr(n)){if(n.length<1)return [new Dt(e,n,"array length at least 1 expected, length 0 found")];let t=[];for(let r=0;r<n.length;r++)t=t.concat(Di({key:`${e}[${r}]`,value:n[r]}));return t}return Di({key:e,value:n})},variableAnchorOffsetCollection:function(t){const e=t.key,n=t.value,r=Xr(n),i=t.styleSpec;if("array"!==r||n.length<1||n.length%2!=0)return [new Dt(e,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let r=0;r<n.length;r+=2)s=s.concat(Pi({key:`${e}[${r}]`,value:n[r],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(Ii({key:`${e}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return s},sprite:Gi,state:Yi,fontFaces:function(t){const e=t.key,n=t.value,r=t.validateSpec,i=t.styleSpec,s=t.style;if(!Xi(n))return [new Dt(e,n,`object expected, ${Xr(n)} found`)];const o=[];for(const t in n){const a=n[t],l=Xr(a);if("string"===l)o.push(...$i({key:`${e}.${t}`,value:a}));else if("array"===l){const n={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,u]of a.entries())o.push(...ki({key:`${e}.${t}[${l}]`,value:u,valueSpec:n,styleSpec:i,style:s,validateSpec:r}));}else o.push(new Dt(`${e}.${t}`,a,`string or array expected, ${l} found`));}return o}};function Hi(t){const e=t.value,n=t.valueSpec,r=t.styleSpec;return t.validateSpec=Hi,n.expression&&Yr(Ai(e))?Ti(t):n.expression&&ni(Mi(e))?Fi(t):n.type&&Zi[n.type]?Zi[n.type](t):ki(Pt({},t,{valueSpec:n.type?r[n.type]:n}))}function Wi(t){const e=t.value,n=t.key,r=$i(t);return r.length||(-1===e.indexOf("{fontstack}")&&r.push(new Dt(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&r.push(new Dt(n,e,'"glyphs" url must include a "{range}" token'))),r}function Ki(t,e=vt){let n=[];return n=n.concat(Hi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Hi,objectElementValidators:{glyphs:Wi,"*":()=>[]}})),t.constants&&(n=n.concat(Si({key:"constants",value:t.constants}))),Qi(n)}function Ji(t){return function(e){return t(Object.assign({},e,{validateSpec:Hi}))}}function Qi(t){return [].concat(t).sort(((t,e)=>t.line-e.line))}function ts(t){return function(...e){return Qi(t.apply(this,e))}}Ki.source=ts(Ji(Ni)),Ki.sprite=ts(Ji(Gi)),Ki.glyphs=ts(Ji(Wi)),Ki.light=ts(Ji(Ui)),Ki.sky=ts(Ji(ji)),Ki.terrain=ts(Ji(qi)),Ki.state=ts(Ji(Yi)),Ki.layer=ts(Ji(Oi)),Ki.filter=ts(Ji(zi)),Ki.paintProperty=ts(Ji(Vi)),Ki.layoutProperty=ts(Ji(Li));const es={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class ns{constructor(t,e){this._globalState=e,this.setValue(t);}evaluate(){var t;return null!==(t=this._literalValue)&&void 0!==t?t:this._compiledValue.evaluate({})}setValue(t){if(null==t||"visible"===t||"none"===t)return this._literalValue="none"===t?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const e=ri(t,es,this._globalState);if("error"===e.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=ui(e.value.expression);}getGlobalStateRefs(){return this._globalStateRefs}}const rs=vt,is=Ki,ss=is.light,os=is.sky,as=is.paintProperty,ls=is.layoutProperty;function us(t,e){let n=!1;if(e&&e.length)for(const r of e)t.fire(new gt(new Error(r.message))),n=!0;return n}class cs{constructor(t,e,n){const r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(n=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],n=i[3+t+1];
36r.push(e===n?null:i.subarray(e,n));}const s=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly;}else {this.d=e+2*n;for(let t=0;t<this.d*this.d;t++)r.push([]);this.keys=[],this.bboxes=[];}this.n=e,this.extent=t,this.padding=n,this.scale=e/t,this.uid=0;const i=n/e*t;this.min=-i,this.max=t+i;}insert(t,e,n,r,i){this._forEachCell(e,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i);}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,n,r,i,s){this.cells[i].push(s);}query(t,e,n,r,i){const s=this.min,o=this.max;if(t<=s&&e<=s&&o<=n&&o<=r&&!i)return [...this.keys];{const s=[];return this._forEachCell(t,e,n,r,this._queryCell,s,{},i),s}}_queryCell(t,e,n,r,i,s,o,a){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===o[h]){const l=4*h;(a?a(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&n>=u[l+0]&&r>=u[l+1])?(o[h]=!0,s.push(i[h])):o[h]=!1;}}}}_forEachCell(t,e,n,r,i,s,o,a){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(n),h=this._convertToCellCoord(r);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,n,r,u,s,o,a))return}}_convertFromCellCoord(t){return (t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let n=0;for(let t=0;t<this.cells.length;t++)n+=this.cells[t].length;const r=new Int32Array(e+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const n=t[e];r[3+e]=i,r.set(n,i),i+=n.length;}return r[3+t.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+t.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(t,e){const n=t.toArrayBuffer();return e&&e.push(n),{buffer:n}}static deserialize(t){return new cs(t.buffer)}}const hs={};function ps(t,e,n={}){if(hs[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),hs[t]={klass:e,omit:n.omit||[],shallow:n.shallow||[]};}ps("Object",Object),ps("Set",Set),ps("TransferableGridIndex",cs),ps("Color",Ie),ps("Error",Error),ps("AJAXError",ct),ps("ResolvedImage",Oe),ps("StylePropertyFunction",ai),ps("StyleExpression",ei,{omit:["_evaluator"]}),ps("ZoomDependentExpression",si),ps("ZoomConstantExpression",ii),ps("CompoundExpression",Pr,{omit:["_evaluate"]});for(const t in Dr)Dr[t]._classRegistryKey||ps(`Expression_${t}`,Dr[t]);function fs(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function ds(t){return t.$name||t.constructor._classRegistryKey}function ys(t){return !function(t){if(null===t||"object"!=typeof t)return !1;const e=ds(t);return !(!e||"Object"===e)}(t)&&(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||fs(t)||Z(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function ms(t,e){if(ys(t))return (fs(t)||Z(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const n=[];for(const r of t)n.push(ms(r,e));return n}if("object"!=typeof t)throw new Error("can't serialize object of type "+typeof t);const n=ds(t);if(!n)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!hs[n])throw new Error(`${n} is not registered.`);const{klass:r}=hs[n],i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else {for(const r in t){if(!t.hasOwnProperty(r))continue;if(hs[n].omit.indexOf(r)>=0)continue;const s=t[r];
36i[r]=hs[n].shallow.indexOf(r)>=0?s:ms(s,e);}t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return "Object"!==n&&(i.$name=n),i}function gs(t){if(ys(t))return t;if(Array.isArray(t))return t.map(gs);if("object"!=typeof t)throw new Error("can't deserialize object of type "+typeof t);const e=ds(t)||"Object";if(!hs[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:n}=hs[e];if(!n)throw new Error(`can't deserialize unregistered class ${e}`);if(n.deserialize)return n.deserialize(t);const r=Object.create(n.prototype);for(const n of Object.keys(t)){if("$name"===n)continue;const i=t[n];r[n]=hs[e].shallow.indexOf(n)>=0?i:gs(i);}return r}class xs{constructor(){this.first=!0;}update(t,e){const n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))}}function vs(t){return /[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function bs(t){return /[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}function ws(t){return /\s/u.test(String.fromCodePoint(t))}function _s(t){for(const e of t)if(bs(e.codePointAt(0)))return !0;return !1}function Ss(t){for(const e of t)if(!ks(e.codePointAt(0)))return !1;return !0}function As(t){const e=t.map((t=>{try{return new RegExp(`\\p{sc=${t}}`,"u").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join("|"),"u")}const Ms=As(["Arab","Dupl","Mong","Ougr","Syrc"]);function ks(t){return !Ms.test(String.fromCodePoint(t))}function Is(t){return !(bs(t)||(e=t,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e)))
36);var e;}const Es=As(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ts(t){return Es.test(String.fromCodePoint(t))}function Fs(t,e){return !(!e&&Ts(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))}function Ds(t){for(const e of t)if(Ts(e.codePointAt(0)))return !0;return !1}const Ps=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{};}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL;}getState(){return {pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Ps.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve();}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,n){return e(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==t.pluginStatus)return this.setState(t),t;const e=t.pluginURL,r=new Promise((t=>{this.loadScriptResolve=t;}));n(e);const i=new Promise((t=>setTimeout((()=>t()),this.TIMEOUT)));if(yield Promise.race([r,i]),this.isParsed()){const t={pluginStatus:"loaded",pluginURL:e};return this.setState(t),t}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${e}`)}))}};class zs{constructor(t,e){this.isSupportedScript=Bs,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new xs,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xs,this.transition={});}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),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}}}function Bs(t){return function(t,e){for(const n of t)if(!Fs(n.codePointAt(0),e))return !1;return !0}(t,"loaded"===Ps.getRTLTextPluginStatus())}const Cs="-transition";class Vs{constructor(t,e,n){this.property=t,this.value=e,this.expression=function(t,e,n){if(Yr(t))return new ai(t,e);if(ni(t)){const r=oi(t,e,n);if("error"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return r.value}{let n=t;return "color"===e.type&&"string"==typeof t?n=Ie.parse(t):"padding"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"numberArray"!==e.type||"number"!=typeof t&&!Array.isArray(t)?"colorArray"!==e.type||"string"!=typeof t&&!Array.isArray(t)?"variableAnchorOffsetCollection"===e.type&&Array.isArray(t)?n=Le.parse(t):"projectionDefinition"===e.type&&"string"==typeof t&&(n=$e.parse(t)):n=Be.parse(t):n=ze.parse(t):n=Pe.parse(t),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}(void 0===e?t.specification.default:e,t.specification,n);}isDataDriven(){return "source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,n){return this.property.possiblyEvaluate(this,t,e,n)}}class Ls{constructor(t,e){this.property=t,this.value=new Vs(t,void 0,e);}transitioned(t,e){return new $s(this.property,this.value,e,O({},t.transition,this.transition),t.now)}untransitioned(){return new $s(this.property,this.value,null,{},0)}}class Os{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=e;}getValue(t){return U(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ls(this._values[t].property,this._globalState)),this._values[t].value=new Vs(this._values[t].property,null===e?void 0:U(e),this._globalState);}getTransition(t){return U(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ls(this._values[t].property,this._globalState)),this._values[t].transition=U(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n);const r=this.getTransition(e);void 0!==r&&(t[`${e}${Cs}`]=r);}return t}transitioned(t,e){const n=new Rs(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(t,e._values[r]);return n}untransitioned(){const t=new Rs(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class $s{constructor(t,e,n,r,i){this.property=t,this.value=e,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=n);}possiblyEvaluate(t,e,n){const r=t.now||0,i=this.value.possiblyEvaluate(t,e,n),s=this.prior;if(s){if(r>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return s.possiblyEvaluate(t,e,n);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,n),i,z(o))}}return i}}class Rs{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,n){const r=new js(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(t,e,n);return r}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class Ns{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=e;}hasValue(t){return void 0!==this._values[t].value}getValue(t){return U(this._values[t].value)}setValue(t,e){this._values[t]=new Vs(this._values[t].property,null===e?void 0:U(e),this._globalState);}serialize(){const t={};for(const e of Object.keys(this._values)){const n=this.getValue(e);void 0!==n&&(t[e]=n);}return t}possiblyEvaluate(t,e,n){const r=new js(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(t,e,n);return r}}class Us{constructor(t,e,n){this.property=t,this.value=e,this.parameters=n;}isConstant(){return "constant"===this.value.kind}constantOr(t){return "constant"===this.value.kind?this.value.value:t}evaluate(t,e,n,r){return this.property.evaluate(this.value,this.parameters,t,e,n,r)}}class js{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class qs{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,n){const r=mn[this.specification.type];return r?r(t,e,n):t}}class Gs{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,n,r){return new Us(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},n,r)}:t.expression,e)}interpolate(t,e,n){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Us(this,{kind:"constant",value:void 0},t.parameters);const r=mn[this.specification.type];if(r){const i=r(t.value.value,e.value.value,n);return new Us(this,{kind:"constant",value:i},t.parameters)}return t}evaluate(t,e,n,r,i,s){return "constant"===t.kind?t.value:t.evaluate(e,n,r,i,s)}}class Xs extends Gs{possiblyEvaluate(t,e,n,r){if(void 0===t.value)return new Us(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},n,r),s="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,o=this._calculate(s,s,s,e);return new Us(this,{kind:"constant",value:o},e)}if("camera"===t.expression.kind){const n=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 Us(this,{kind:"constant",value:n},e)}return new Us(this,t.expression,e)}evaluate(t,e,n,r,i,s){if("source"===t.kind){const o=t.evaluate(e,n,r,i,s);return this._calculate(o,o,o,e)}return "composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},n,r),t.evaluate({zoom:Math.floor(e.zoom)},n,r),t.evaluate({zoom:Math.floor(e.zoom)+1},n,r),e):t.value}_calculate(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class Ys{constructor(t){this.specification=t;}possiblyEvaluate(t,e,n,r){if(void 0!==t.value){if("constant"===t.expression.kind){const i=t.expression.evaluate(e,null,{},n,r);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new zs(Math.floor(e.zoom-1),e)),t.expression.evaluate(new zs(Math.floor(e.zoom),e)),t.expression.evaluate(new zs(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}}interpolate(t){return t}}class Zs{constructor(t){this.specification=t;}possiblyEvaluate(t,e,n,r){return !!t.expression.evaluate(e,null,{},n,r)}interpolate(){return !1}}class Hs{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const n=t[e];n.specification.overridable&&this.overridableProperties.push(e);const r=this.defaultPropertyValues[e]=new Vs(n,void 0,void 0),i=this.defaultTransitionablePropertyValues[e]=new Ls(n,void 0);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({});}}}ps("DataDrivenProperty",Gs),ps("DataConstantProperty",qs),ps("CrossFadedDataDrivenProperty",Xs),ps("CrossFadedProperty",Ys),ps("ColorRampProperty",Zs);class Ws extends xt{constructor(t,e,n){if(super(),this.id=t.id,this.type=t.type,this._globalState=n,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(t,e){return new ns(t,e)}(this.visibility,n),"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,this._featureFilter=fi(t.filter,n)),e.layout&&(this._unevaluatedLayout=new Ns(e.layout,n)),e.paint)){this._transitionablePaint=new Os(e.paint,n);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 js(e.paint);}}setFilter(t){this.filter=t,this._featureFilter=fi(t,this._globalState);}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return "visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;for(const e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(const e in this._unevaluatedLayout._values){const n=this._unevaluatedLayout._values[e];for(const e of n.getGlobalStateRefs())t.add(e);}for(const e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;const e=new globalThis.Map;if(this._transitionablePaint)for(const n in this._transitionablePaint._values){const r=this._transitionablePaint._values[n].value;for(const i of r.getGlobalStateRefs()){const s=null!==(t=e.get(i))&&void 0!==t?t:[];s.push({name:n,value:r.value}),e.set(i,s);}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,n={}
36){if(null==e||!this._validate(ls,`layers.${this.id}.layout.${t}`,t,e,n))return "visibility"===t?(this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){return t.endsWith(Cs)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,n={}){if(null!=e&&this._validate(as,`layers.${this.id}.paint.${t}`,t,e,n))return !1;if(t.endsWith(Cs))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const n=this._transitionablePaint._values[t],r="cross-faded-data-driven"===n.property.specification["property-type"],i=n.value.isDataDriven(),s=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const o=this._transitionablePaint._values[t].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,n){return !1}isHidden(t=this.minzoom,e=!1){return !!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate();}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);}
36serialize(){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),N(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}_validate(t,e,n,r,i={}){return (!i||!1!==i.validate)&&us(this,t.call(is,{key:e,layerType:this.type,objectKey:n,value:r,styleSpec:vt,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 Us&&jr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}}let Ks;var Js={get paint(){return Ks=Ks||new Hs({"raster-opacity":new qs(vt.paint_raster["raster-opacity"]),"raster-hue-rotate":new qs(vt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qs(vt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qs(vt.paint_raster["raster-brightness-max"]),"raster-saturation":new qs(vt.paint_raster["raster-saturation"]),"raster-contrast":new qs(vt.paint_raster["raster-contrast"]),resampling:new qs(vt.paint_raster.resampling),"raster-resampling":new qs(vt.paint_raster["raster-resampling"]),"raster-fade-duration":new qs(vt.paint_raster["raster-fade-duration"])})}};class Qs extends Ws{constructor(t,e){super(t,Js,e);}}const to={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class eo{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 no{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")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews();}}function ro(t,e=1){let n=0,r=0;return {members:t.map((t=>{const i=to[t.type].BYTES_PER_ELEMENT,s=n=io(n,Math.max(e,i)),o=t.components||1;return r=Math.max(r,i),n+=i*o,{name:t.name,type:t.type,components:o,offset:s}})),size:io(n,Math.max(r,e)),alignment:e}}function io(t,e){return Math.ceil(t/e)*e}class so extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.int16[r+0]=e,this.int16[r+1]=n,t}}so.prototype.bytesPerElement=4,ps("StructArrayLayout2i4",so);class oo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=n,this.int16[i+2]=r,t}}oo.prototype.bytesPerElement=6,ps("StructArrayLayout3i6",oo);class ao extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)}emplace(t,e,n,r,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,t}}ao.prototype.bytesPerElement=8,ps("StructArrayLayout4i8",ao);class lo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i,s)}emplace(t,e,n,r,i,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+
vendor: 10,495 bytes, line 36
365]=o,t}}lo.prototype.bytesPerElement=12,ps("StructArrayLayout2i4i12",lo);class uo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i,s)}emplace(t,e,n,r,i,s,o){const a=4*t,l=8*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.uint8[l+4]=r,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=o,t}}uo.prototype.bytesPerElement=8,ps("StructArrayLayout2i4ub8",uo);class co extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.float32[r+0]=e,this.float32[r+1]=n,t}}co.prototype.bytesPerElement=8,ps("StructArrayLayout2f8",co);class ho extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s,o,a,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,n,r,i,s,o,a,l,u)}emplace(t,e,n,r,i,s,o,a,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=n,this.uint16[h+2]=r,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=o,this.uint16[h+6]=a,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}ho.prototype.bytesPerElement=20,ps("StructArrayLayout10ui20",ho);class po extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s,o,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,e,n,r,i,s,o,a)}emplace(t,e,n,r,i,s,o,a,l){const u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=n,this.uint16[u+2]=r,this.uint16[u+3]=i,this.uint16[u+4]=s,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=l,t}}po.prototype.bytesPerElement=16,ps("StructArrayLayout8ui16",po);class fo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s,o,a,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,n,r,i,s,o,a,l,u,c,h)}emplace(t,e,n,r,i,s,o,a,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=n,this.int16[f+2]=r,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=o,this.uint16[f+6]=a,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}fo.prototype.bytesPerElement=24,ps("StructArrayLayout4i4ui4i24",fo);class yo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=n,this.float32[i+2]=r,t}}yo.prototype.bytesPerElement=12,ps("StructArrayLayout3f12",yo);class mo extends no{_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}}mo.prototype.bytesPerElement=4,ps("StructArrayLayout1ul4",mo);class go extends no{_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,n,r,i,s,o,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,n,r,i,s,o,a,l)}emplace(t,e,n,r,i,s,o,a,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=n,this.int16[c+2]=r,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=o,this.uint32[h+3]=a,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}go.prototype.bytesPerElement=20,ps("StructArrayLayout6i1ul2ui20",go);class xo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i,s)}emplace(t,e,n,r,i,s,o){const a=6*t;return this.int16[a+0]=e,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+5]=o,t}}xo.prototype.bytesPerElement=12,ps("StructArrayLayout2i2i2i12",xo);class vo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,n,r,i)}emplace(t,e,n,r,i,s){const o=4*t,a=8*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[a+6]=i,this.int16[a+7]=s,t}}vo.prototype.bytesPerElement=16,ps("StructArrayLayout2f1f2i16",vo);class bo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,n,r,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,n,r,i,s)}emplace(t,e,n,r,i,s,o){const a=16*t,l=4*t,u=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=n,this.float32[l+1]=r,this.float32[l+2]=i,this.int16[u+6]=s,this.int16[u+7]=o,t}}bo.prototype.bytesPerElement=16,ps("StructArrayLayout2ub2f2i16",bo);class wo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,this.uint16[i+2]=r,t}}wo.prototype.bytesPerElement=6,ps("StructArrayLayout3ui6",wo);class _o extends no{_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,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m)}emplace(t,e,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=n,this.uint16[x+2]=r,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=o,this.uint32[v+4]=a,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}_o.prototype.bytesPerElement=48,ps("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",_o);class So extends no{_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,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,M,k,I){const E=this.length;return this.resize(E+1),this.emplace(E,t,e,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,M,k,I)}emplace(t,e,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,M,k,I,E){const T=32*t,F=16*t;return this.int16[T+0]=e,this.int16[T+1]=n,this.int16[T+2]=r,this.int16[T+3]=i,this.int16[T+4]=s,this.int16[T+5]=o,this.int16[T+6]=a,this.int16[T+7]=l,this.uint16[T+8]=u,this.uint16[T+9]=c,this.uint16[T+10]=h,this.uint16[T+11]=p,this.uint16[T+12]=f,this.uint16[T+13]=d,this.uint16[T+14]=y,this.uint16[T+15]=m,this.uint16[T+16]=g,this.uint16[T+17]=x,this.uint16[T+18]=v,this.uint16[T+19]=b,this.uint16[T+20]=w,this.uint16[T+21]=_,this.uint16[T+22]=S,this.uint32[F+12]=A,this.float32[F+13]=M,this.float32[F+14]=k,this.uint16[T+30]=I,this.uint16[T+31]=E,t}}So.prototype.bytesPerElement=64,ps("StructArrayLayout8i15ui1ul2f2ui64",So);class Ao extends no{_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}}Ao.prototype.bytesPerElement=4,ps("StructArrayLayout1f4",Ao);class Mo extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=3*t;return this.uint16[6*t+0]=e,this.float32[i+1]=n,this.float32[i+2]=r,t}}Mo.prototype.bytesPerElement=12,ps("StructArrayLayout1ui2f12",Mo);class ko extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,n){const r=this.length;return this.resize(r+1),this.emplace(r,t,e,n)}emplace(t,e,n,r){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=n,this.uint16[i+3]=r,t}}ko.prototype.bytesPerElement=8,ps("StructArrayLayout1ul2ui8",ko);class Io extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const n=this.length;return this.resize(n+1),this.emplace(n,t,e)}emplace(t,e,n){const r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,t}}Io.prototype.bytesPerElement=4,ps("StructArrayLayout2ui4",Io);class Eo extends no{_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}}Eo.prototype.bytesPerElement=2,ps("StructArrayLayout1ui2",Eo);class To extends no{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,n,r){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,n,r)}emplace(t,e,n,r,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=n,this.float32[s+2]=r,this.float32[s+3]=i,t}}To.prototype.bytesPerElement=16,ps("StructArrayLayout4f16",To);class Fo extends eo{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]}
36get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}Fo.prototype.size=20;class Do extends go{get(t){return new Fo(this,t)}}ps("CollisionBoxArray",Do);class Po extends eo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t;}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Po.prototype.size=48;class zo extends _o{get(t){return new Po(this,t)}}ps("PlacedSymbolArray",zo);class Bo extends eo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t;}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Bo.prototype.size=64;class Co extends So{get(t){return new Bo(this,t)}}ps("SymbolInstanceArray",Co);class Vo extends Ao{getoffsetX(t){return this.float32[1*t+0]}}ps("GlyphOffsetArray",Vo);class Lo extends oo{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}ps("SymbolLineVertexArray",Lo);class Oo extends eo{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Oo.prototype.size=12;class $o extends Mo{get(t){return new Oo(this,t)}}ps("TextAnchorOffsetArray",$o);class Ro extends eo{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]}}Ro.prototype.size=8;class No extends ko{get(t){return new Ro(this,t)}}ps("FeatureIndexArray",No);class Uo extends so{}class jo extends so{}class qo extends so{}class Go extends lo{}class Xo extends uo{}class Yo extends co{}class Zo extends ho{}class Ho extends po{}class Wo extends fo{}class Ko extends yo{}class Jo extends mo{}class Qo extends xo{}class ta extends bo{}class ea extends wo{}class na extends Io{}const ra=ro([{name:"a_pos",components:2,type:"Int16"}],4),{members:ia}=ra;class sa{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t;}prepareSegment(t,e,n,r){const i=this.segments[this.segments.length-1];return t>sa.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${sa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${sa.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!i||i.vertexLength+t>sa.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r?this.createNewSegment(e,n,r):i}createNewSegment(t,e,n){const r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==n&&(r.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,n){return this.prepareSegment(0,t,e,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0;}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,n,r){return new sa([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function oa(t,e){return 256*(t=V(Math.floor(t),0,255))+V(Math.floor(e),0,255)}sa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ps("SegmentVector",sa);const aa=ro([{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"}]),la=ro([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);
36var ua,ca,ha,pa={exports:{}},fa={exports:{}},da={exports:{}},ya=function(){if(ha)return pa.exports;ha=1;var t=(ua||(ua=1,fa.exports=function(t,e){var n,r,i,s,o,a,l,u;for(r=t.length-(n=3&t.length),i=e,o=3432918353,a=461845907,u=0;u<r;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),fa.exports),e=(ca||(ca=1,da.exports=function(t,e){for(var n,r=t.length,i=e^r,s=0;r>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++s;switch(r){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),da.exports);return pa.exports=t,pa.exports.murmur3=t,pa.exports.murmur2=e,pa.exports}(),ma=r(ya);class ga{constructor(){this.ids=[],this.positions=[],this.indexed=!1;}add(t,e,n,r){this.ids.push(xa(t)),this.positions.push(e,n,r);}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const e=xa(t);let n=0,r=this.ids.length-1;for(;n<r;){const t=n+r>>1;this.ids[t]>=e?r=t:n=t+1;}const i=[];for(;this.ids[n]===e;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(t,e){const n=new Float64Array(t.ids),r=new Uint32Array(t.positions);return va(n,r,0,n.length-1),e&&e.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(t){const e=new ga;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function xa(t){const e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ma(String(t))}function va(t,e,n,r){for(;n<r;){const i=t[n+r>>1];let s=n-1,o=r+1;for(;;){do{s++;}while(t[s]<i);do{o--;}while(t[o]>i);if(s>=o)break;ba(t,s,o),ba(e,3*s,3*o),ba(e,3*s+1,3*o+1),ba(e,3*s+2,3*o+2);}o-n<r-o?(va(t,e,n,o),n=o+1):(va(t,e,o+1,r),r=o);}}function ba(t,e,n){const r=t[e];t[e]=t[n],t[n]=r;}ps("FeaturePositionMap",ga);class wa{constructor(t,e){this.gl=t.gl,this.location=e;}}class _a extends wa{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t));}}class Sa extends wa{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 Aa extends wa{constructor(t,e){super(t,e),this.current=Ie.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 Ma=new Float32Array(16);function ka(t){return [oa(255*t.r,255*t.g),oa(255*t.b,255*t.a)]}class Ia{constructor(t,e,n){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=n;}setUniform(t,e,n){t.set(n.constantOr(this.value));}getBinding(t,e,n){return "color"===this.type?new Aa(t,e):new _a(t,e)}}class Ea{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;}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width];}setUniform(t,e,n,r){let i=null;"u_pattern_to"===r?i=this.patternTo:"u_pattern_from"===r?i=this.patternFrom:"u_dasharray_to"===r?i=this.dashTo:"u_dasharray_from"===r?i=this.dashFrom:"u_pixel_ratio_to"===r?i=this.pixelRatioTo:"u_pixel_ratio_from"===r&&(i=this.pixelRatioFrom),null!==i&&t.set(i);}getBinding(t,e,n){return n.startsWith("u_pattern")||n.startsWith("u_dasharray_")?new Sa(t,e):new _a(t,e)}}class Ta{constructor(t,e,n,r){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?2:1,offset:0}))),this.paintVertexArray=new r;}populatePaintArray(t,e,n){const r=this.paintVertexArray.length,i=this.expression.evaluate(new zs(0,n),e,{},n.canonical,[],n.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(r,t,i);}updatePaintArray(t,e,n,r,i){const s=this.expression.evaluate(new zs(0,i),n,r);this._setPaintValue(t,e,s);}_setPaintValue(t,e,n){if("color"===this.type){const r=ka(n);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r[0],r[1]);}else {for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n));}}upload(t){var e;(null===(e=this.paintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&(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 Fa{constructor(t,e,n,r,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===n?4:2,offset:0}))),this.paintVertexArray=new s;}populatePaintArray(t,e,n){const r=this.expression.evaluate(new zs(this.zoom,n),e,{},n.canonical,[],n.formattedSection),i=this.expression.evaluate(new zs(this.zoom+1,n),e,{},n.canonical,[],n.formattedSection),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,r,i);}updatePaintArray(t,e,n,r,i){const s=this.expression.evaluate(new zs(this.zoom,i),n,r),o=this.expression.evaluate(new zs(this.zoom+1,i),n,r);this._setPaintValue(t,e,s,o);}_setPaintValue(t,e,n,r){if("color"===this.type){const i=ka(n),s=ka(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1],s[0],s[1]);}else {for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r));}}upload(t){var e;(null===(e=this.paintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&(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 n=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=V(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(r);}getBinding(t,e,n){return new _a(t,e)}}class Da{constructor(t,e,n,r,i,s){this.expression=t,this.type=e,this.useIntegerZoom=n,this.zoom=r,this.layerId=s,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i;}populatePaintArray(t,e,n){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,this.getPositionIds(e),n);}updatePaintArray(t,e,n,r,i){this._setPaintValues(t,e,this.getPositionIds(n),i);}_setPaintValues(t,e,n,r){const i=this.getPositions(r);if(!i||!n)return;const s=i[n.min],o=i[n.mid],a=i[n.max];if(s&&o&&a)for(let n=t;n<e;n++)this.emplace(this.zoomInPaintVertexArray,n,o,s),this.emplace(this.zoomOutPaintVertexArray,n,o,a);}upload(t){var e,n;if((null===(e=this.zoomInPaintVertexArray)||void 0===e?void 0:e.arrayBuffer.byteLength)&&(null===(n=this.zoomOutPaintVertexArray)||void 0===n?void 0:n.arrayBuffer.byteLength)){const e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent);}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy();}}class Pa extends Da{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns&&t.patterns[this.layerId]}getVertexAttributes(){return aa.members}emplace(t,e,n,r){t.emplace(e,n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.pixelRatio,r.pixelRatio);}}class za extends Da{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes&&t.dashes[this.layerId]}getVertexAttributes(){return la.members}emplace(t,e,n,r){t.emplace(e,0,n.y,n.height,n.width,0,r.y,r.height,r.width);}}class Ba{constructor(t,e,n){this.binders={},this._buffers=[];const r=[];for(const i in t.paint._values){if(!n(i))continue;const s=t.paint.get(i);if(!(s instanceof Us&&jr(s.property.specification)))continue;const o=Va(i,t.type),a=s.value,l=s.property.specification.type,u=s.property.useIntegerZoom,c=s.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===a.kind)this.binders[i]=h?new Ea(a.value,o):new Ia(a.value,o,l),r.push(`/u_${i}`);else if("source"===a.kind||h){const n=La(i,l,"source");this.binders[i]=h?"line-dasharray"===i?new za(a,l,u,e,n,t.id):new Pa(a,l,u,e,n,t.id):new Ta(a,o,l,n),r.push(`/a_${i}`);}else {const t=La(i,l,"composite");this.binders[i]=new Fa(a,o,l,u,e,t),r.push(`/z_${i}`);}}this.cacheKey=r.sort().join("");}getMaxValue(t){const e=this.binders[t];return e instanceof Ta||e instanceof Fa?e.maxValue:0}populatePaintArrays(t,e,n){for(const r in this.binders){const i=this.binders[r];(i instanceof Ta||i instanceof Fa||i instanceof Da)&&i.populatePaintArray(t,e,n);}}setConstantPatternPositions(t,e){for(const n in this.binders){const r=this.binders[n];r instanceof Ea&&r.setConstantPatternPositions(t,e);}}setConstantDashPositions(t,e){for(const n in this.binders){const r=this.binders[n];r instanceof Ea&&r.setConstantDashPositions(t,e);}}updatePaintArrays(t,e,n,r,i){let s=!1;for(const o in t){const a=e.getPositions(o);for(const e of a){const a=n.feature(e.index);for(const n in this.binders){const l=this.binders[n];if((l instanceof Ta||l instanceof Fa||l instanceof Da)&&!0===l.expression.isStateDependent){const u=r.paint.get(n);l.expression=u.value,l.updatePaintArray(e.start,e.end,a,t[o],i),s=!0;}}}}return s}defines(){const t=[];for(const e in this.binders){const n=this.binders[e];
36(n instanceof Ia||n instanceof Ea)&&t.push(...n.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof Ta||n instanceof Fa)for(let e=0;e<n.paintVertexAttributes.length;e++)t.push(n.paintVertexAttributes[e].name);else if(n instanceof Da){const e=n.getVertexAttributes();for(const n of e)t.push(n.name);}}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const n=this.binders[e];if(n instanceof Ia||n instanceof Ea||n instanceof Fa)for(const e of n.uniformNames)t.push(e);}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const n=[];for(const r in this.binders){const i=this.binders[r];if(i instanceof Ia||i instanceof Ea||i instanceof Fa)for(const s of i.uniformNames)if(e[s]){const o=i.getBinding(t,e[s],s);n.push({name:s,property:r,binding:o});}}return n}setUniforms(t,e,n,r){for(const{name:t,property:i,binding:s}of e)this.binders[i].setUniform(s,r,n.get(i),t);}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const n=this.binders[e];if(t&&n instanceof Da){const e=2===t.fromScale?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;e&&this._buffers.push(e);}else (n instanceof Ta||n instanceof Fa)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer);}}upload(t){for(const e in this.binders){const n=this.binders[e];(n instanceof Ta||n instanceof Fa||n instanceof Da)&&n.upload(t);}this.updatePaintBuffers();}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Ta||e instanceof Fa||e instanceof Da)&&e.destroy();}}}class Ca{constructor(t,e,n=()=>!0){this.programConfigurations={};for(const r of t)this.programConfigurations[r.id]=new Ba(r,e,n);this.needsUpload=!1,this._featureMap=new ga,this._bufferOffset=0;}populatePaintArrays(t,e,n,r){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,r);void 0!==e.id&&this._featureMap.add(e.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,n,r){for(const i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,r)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}function Va(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-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function La(t,e,n){const r={color:{source:co,composite:To},number:{source:Ao,composite:co}},i=function(t){return {"line-pattern":{source:Zo,composite:Zo},"fill-pattern":{source:Zo,composite:Zo},"fill-extrusion-pattern":{source:Zo,composite:Zo},"line-dasharray":{source:Ho,composite:Ho}}[t]}(t);return i&&i[n]||r[e][n]}ps("ConstantBinder",Ia),ps("CrossFadedConstantBinder",Ea),ps("SourceExpressionBinder",Ta),ps("CrossFadedPatternBinder",Pa),ps("CrossFadedDasharrayBinder",za),ps("CompositeExpressionBinder",Fa),ps("ProgramConfiguration",Ba,{omit:["_buffers"]}),ps("ProgramConfigurationSet",Ca);const Oa=Math.pow(2,14)-1,$a=-Oa-1;function Ra(t){const e=T/t.extent,n=t.loadGeometry();for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.length;t++){const n=r[t],i=Math.round(n.x*e),s=Math.round(n.y*e);n.x=V(i,$a,Oa),n.y=V(s,$a,Oa),(i<n.x||i>n.x+1||s<n.y||s>n.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size");}}return n}function Na(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Ra(t):[]}}const Ua=-32768;function ja(t,e,n,r,i){t.emplaceBack(Ua+8*e+r,Ua+8*n+i);}class qa{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.hasDependencies=!1,this.layoutVertexArray=new jo,this.indexArray=new ea,this.segments=new sa,this.programConfigurations=new Ca(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,n){const r=this.layers[0],i=[];let s=null,o=!1,a="heatmap"===r.type;if("circle"===r.type){const t=r;
36s=t.layout.get("circle-sort-key"),o=!s.isConstant(),a=a||"map"===t.paint.get("circle-pitch-alignment");}const l=a?e.subdivisionGranularity.circle:1;for(const{feature:e,id:r,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Na(e,t);if(!this.layers[0]._featureFilter.filter(new zs(this.zoom),u,n))continue;const c=o?s.evaluate(u,{},n):void 0,h={id:r,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Ra(e),patterns:{},sortKey:c};i.push(h);}o&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of i){const{geometry:i,index:s,sourceLayerIndex:o}=r,a=t[s].feature;this.addFeature(r,i,s,n,l),e.featureIndex.insert(a,i,s,o,this.index);}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:n});}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ia),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,n,r,i=1){let s;switch(i){case 1:s=[0,7];break;case 3:s=[0,2,5,7];break;case 5:s=[0,1,3,4,6,7];break;case 7:s=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}const o=s.length;for(const n of e)for(const e of n){const n=e.x,r=e.y;if(n<0||n>=T||r<0||r>=T)continue;const i=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t.sortKey),a=i.vertexLength;for(let t=0;t<o;t++)for(let e=0;e<o;e++)ja(this.layoutVertexArray,n,r,s[e],s[t]);for(let t=0;t<o-1;t++)for(let e=0;e<o-1;e++){const n=a+t*o+e,r=a+(t+1)*o+e;this.indexArray.emplaceBack(n,r+1,n+1),this.indexArray.emplaceBack(n,r,r+1);}i.vertexLength+=o*o,i.primitiveLength+=(o-1)*(o-1)*2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{imagePositions:{},canonical:r});}}function Ga(t,e){for(let n=0;n<t.length;n++)if(tl(e,t[n]))return !0;for(let n=0;n<e.length;n++)if(tl(t,e[n]))return !0;return !!Ha(t,e)}function Xa(t,e,n){return !!tl(t,e)||!!Ka(e,t,n)}function Ya(t,e){if(1===t.length)return Qa(e,t[0]);for(let n=0;n<e.length;n++){const r=e[n];for(let e=0;e<r.length;e++)if(tl(t,r[e]))return !0}for(let n=0;n<t.length;n++)if(Qa(e,t[n]))return !0;for(let n=0;n<e.length;n++)if(Ha(t,e[n]))return !0;return !1}function Za(t,e,n){if(t.length>1){if(Ha(t,e))return !0;for(let r=0;r<e.length;r++)if(Ka(e[r],t,n))return !0}for(let r=0;r<t.length;r++)if(Ka(t[r],e,n))return !0;return !1}function Ha(t,e){if(0===t.length||0===e.length)return !1;for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];for(let t=0;t<e.length-1;t++)if(Wa(r,i,e[t],e[t+1]))return !0}return !1}function Wa(t,e,n,r){return G(t,n,r)!==G(e,n,r)&&G(t,e,n)!==G(t,e,r)}function Ka(t,e,n){const r=n*n;if(1===e.length)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(Ja(t,e[n-1],e[n])<r)return !0;return !1}function Ja(t,e,n){const r=e.distSqr(n);if(0===r)return t.distSqr(e);const i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;return t.distSqr(i<0?e:i>1?n:n.sub(e)._mult(i)._add(e))}function Qa(t,e){let n,r,i,s=!1;for(let o=0;o<t.length;o++){n=t[o];for(let t=0,o=n.length-1;t<n.length;o=t++)r=n[t],i=n[o],r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(s=!s);}return s}function tl(t,e){let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const s=t[r],o=t[i];s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(n=!n);}return n}function el(t,e,n){const r=n[0],i=n[2];if(t.x<r.x&&e.x<r.x||t.x>i.x&&e.x>i.x||t.y<r.y&&e.y<r.y||t.y>i.y&&e.y>i.y)return !1;const s=G(t,e,n[0]);return s!==G(t,e,n[1])||s!==G(t,e,n[2])||s!==G(t,e,n[3])}function nl(t,e,n){const r=e.paint.get(t).value;return "constant"===r.kind?r.value:n.programConfigurations.get(e.id).getMaxValue(t)}function rl(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function il(t,e,r,i,s){if(!e[0]&&!e[1])return t;const o=n.convert(e)._mult(s);"viewport"===r&&o._rotate(-i);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(o));return a}function sl(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n],i=e.at(-1);(0===n||i&&!r.equals(i))&&e.push(r);}return e}function ol({queryGeometry:t,size:e},n){return Xa(t,n,e)}function al({queryGeometry:t,size:e,transform:n,unwrappedTileID:r,getElevation:i},s){return Xa(t,s,e*(n.projectTileCoordinates(s.x,s.y,r,i).signedDistanceFromCamera/n.cameraToCenterDistance))}function ll({queryGeometry:t,size:e,transform:n,unwrappedTileID:r,getElevation:i},s){const o=n.projectTileCoordinates(s.x,s.y,r,i).signedDistanceFromCamera,a=e*(n.cameraToCenterDistance/o);return Xa(t,hl(s,n,r,i),a)}function ul({queryGeometry:t,size:e,transform:n,unwrappedTileID:r,getElevation:i},s){return Xa(t,hl(s,n,r,i),e)}function cl({queryGeometry:t,size:e,transform:n,unwrappedTileID:r,getElevation:i,pitchAlignment:s="map",pitchScale:o="map"},a){const l="map"===s?"map"===o?ol:al:"map"===o?ll:ul,u={queryGeometry:t,size:e,transform:n,unwrappedTileID:r,getElevation:i};for(const t of a)for(const e of t)if(l(u,e))return !0;return !1}function hl(t,e,r,i){const s=e.projectTileCoordinates(t.x,t.y,r,i).point;
36return new n((.5*s.x+.5)*e.width,(.5*-s.y+.5)*e.height)}let pl,fl;ps("CircleBucket",qa,{omit:["layers"]});var dl={get paint(){return fl=fl||new Hs({"circle-radius":new Gs(vt.paint_circle["circle-radius"]),"circle-color":new Gs(vt.paint_circle["circle-color"]),"circle-blur":new Gs(vt.paint_circle["circle-blur"]),"circle-opacity":new Gs(vt.paint_circle["circle-opacity"]),"circle-translate":new qs(vt.paint_circle["circle-translate"]),"circle-translate-anchor":new qs(vt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qs(vt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qs(vt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Gs(vt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Gs(vt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Gs(vt.paint_circle["circle-stroke-opacity"])})},get layout(){return pl=pl||new Hs({"circle-sort-key":new Gs(vt.layout_circle["circle-sort-key"])})}};class yl extends Ws{constructor(t,e){super(t,dl,e);}createBucket(t){return new qa(t)}queryRadius(t){const e=t;return nl("circle-radius",this,e)+nl("circle-stroke-width",this,e)+rl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:n,geometry:r,transform:i,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){const l=il(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-i.bearingInRadians,s),u=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),c=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let p,f;return "map"===h?(p=l,f=u*s):(p=function(t,e,n,r){return t.map((t=>hl(t,e,n,r)))}(l,i,o,a),f=u),cl({queryGeometry:p,size:f,transform:i,unwrappedTileID:o,getElevation:a,pitchAlignment:h,pitchScale:c},r)}}class ml extends qa{}let gl;ps("HeatmapBucket",ml,{omit:["layers"]});var xl={get paint(){return gl=gl||new Hs({"heatmap-radius":new Gs(vt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Gs(vt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qs(vt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Zs(vt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qs(vt.paint_heatmap["heatmap-opacity"])})}};function vl(t,{width:e,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*n*r)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*n*r}`)}else i=new Uint8Array(e*n*r);return t.width=e,t.height=n,t.data=i,t}function bl(t,{width:e,height:n},r){if(e===t.width&&n===t.height)return;const i=vl({},{width:e,height:n},r);wl(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,n)},r),t.width=e,t.height=n,t.data=i.data;}function wl(t,e,n,r,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=e.data;if(o===a)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){const u=((n.y+l)*t.width+n.x)*s,c=((r.y+l)*e.width+r.x)*s;for(let t=0;t<i.width*s;t++)a[c+t]=o[u+t];}return e}class _l{constructor(t,e){vl(this,t,1,e);}resize(t){bl(this,t,1);}clone(){return new _l({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,n,r,i){wl(t,e,n,r,i,1);}}class Sl{constructor(t,e){vl(this,t,4,e);}resize(t){bl(this,t,4);}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t;}clone(){return new Sl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,n,r,i){wl(t,e,n,r,i,4);}setPixel(t,e,n){const r=4*(t*this.width+e);this.data[r+0]=Math.round(255*n.r/n.a),this.data[r+1]=Math.round(255*n.g/n.a),this.data[r+2]=Math.round(255*n.b/n.a),this.data[r+3]=Math.round(255*n.a);}}function Al(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n+=4){const r=t[n+3];e[n+0]=Math.round(t[n+0]*r/255),e[n+1]=Math.round(t[n+1]*r/255),e[n+2]=Math.round(t[n+2]*r/255),e[n+3]=r;}return e}function Ml(t){const e={},n=t.resolution||256,r=t.clips?t.clips.length:1,i=t.image||new Sl({width:n,height:r});
36if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const s=(r,s,o)=>{e[t.evaluationKey]=o;const a=t.expression.evaluate(e);i.setPixel(r/4/n,s/4,a);};if(t.clips)for(let e=0,i=0;e<r;++e,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){const a=r/(n-1),{start:l,end:u}=t.clips[e];s(i,o,l*(1-a)+u*a);}else for(let t=0,e=0;t<n;t++,e+=4)s(0,e,t/(n-1));return i}ps("AlphaImage",_l),ps("RGBAImage",Sl);const kl="big-fb";class Il extends Ws{createBucket(t){return new ml(t)}constructor(t,e){super(t,xl,e),this.heatmapFbos=new Map,this._updateColorRamp();}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=Ml({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbos.has(kl)&&this.heatmapFbos.delete(kl);}queryRadius(t){return nl("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:n,geometry:r,transform:i,pixelsToTileUnits:s,unwrappedTileID:o,getElevation:a}){return cl({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,n)*s,transform:i,unwrappedTileID:o,getElevation:a},r)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let El;var Tl={get paint(){return El=El||new Hs({"hillshade-illumination-direction":new qs(vt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new qs(vt.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new qs(vt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qs(vt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qs(vt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qs(vt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qs(vt.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new qs(vt.paint_hillshade["hillshade-method"]),resampling:new qs(vt.paint_hillshade.resampling)})}};class Fl extends Ws{constructor(t,e){super(t,Tl,e),this.recalculate({zoom:0,zoomHistory:{}},void 0);}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,n=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values;const i=Math.max(t.length,e.length,n.length,r.length);t=t.concat(Array(i-t.length).fill(t.at(-1))),e=e.concat(Array(i-e.length).fill(e.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1)));const s=e.map(tt);return {directionRadians:t.map(tt),altitudeRadians:s,shadowColor:r,highlightColor:n}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let Dl;var Pl={get paint(){return Dl=Dl||new Hs({"color-relief-opacity":new qs(vt["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Zs(vt["paint_color-relief"]["color-relief-color"]),resampling:new qs(vt["paint_color-relief"].resampling)})}};function zl(t){return "data"in t}class Bl{constructor(t,e,n,r){this.context=t,this.format=n,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,r);}update(t,e,n){const{width:r,height:i}=t,s=!(this.size&&this.size[0]===r&&this.size[1]===i||n),{context:o}=this,{gl:a}=o;this.useMipmap=Boolean(e&&e.useMipmap),a.bindTexture(a.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);const l=this.format===a.RGBA&&(!e||!1!==e.premultiply);if(s)this.size=[r,i],zl(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,r,i,a)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,a));else {const{x:e,y:s}=n||{x:0,y:0};zl(t)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,e,s,r,i,a)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,e,s,a));}this.useMipmap&&this.isSizePowerOfTwo()&&a.generateMipmap(a.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault();}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t);}_uploadRawData(t,e,n,r,i){let{data:s}=t;e&&s&&(s=Al(s)),i.texImage2D(i.TEXTURE_2D,0,this.format,n,r,0,this.format,i.UNSIGNED_BYTE,s);}_updateDomImage(t,e,n,r){r.texSubImage2D(r.TEXTURE_2D,0,e,n,r.RGBA,r.UNSIGNED_BYTE,t);}_updateRawData(t,e,n,r,i,s,o){let{data:a}=t;e&&a&&(a=Al(a)),o.texSubImage2D(o.TEXTURE_2D,0,n,r,i,s,o.RGBA,o.UNSIGNED_BYTE,a);}bind(t,e,n){const{context:r}=this,{gl:i}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.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,this._ownedHandle=null;}}class Cl{constructor(t,e,n,r=1,i=1,s=1,o=0){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void q(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;const a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),n){case "terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
36case "custom":this.redFactor=r,this.greenFactor=i,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;}for(let t=0;t<a;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(a,t)]=this.data[this._idx(a-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,a)]=this.data[this._idx(t,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<a;t++)for(let e=0;e<a;e++){const n=this.get(t,e);n>this.max&&(this.max=n),n<this.min&&(this.min=n);}}get(t,e){const n=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return [this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);return (e+1)*this.stride+(t+1)}unpack(t,e,n){return t*this.redFactor+e*this.greenFactor+n*this.blueFactor-this.baseShift}pack(t){return Vl(t,this.getUnpackVector())}getPixels(){return new Sl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let r=e*this.dim,i=e*this.dim+this.dim,s=n*this.dim,o=n*this.dim+this.dim;switch(e){case -1:r=i-1;break;case 1:i=r+1;}switch(n){case -1:s=o-1;break;case 1:o=s+1;}const a=-e*this.dim,l=-n*this.dim;for(let e=s;e<o;e++)for(let n=r;n<i;n++)this.data[this._idx(n,e)]=t.data[this._idx(n+a,e+l)];}}function Vl(t,e){const n=e[0],r=e[1],i=e[2],s=e[3],o=Math.min(n,r,i),a=Math.round((t+s)/o);return {r:Math.floor(a*o/n)%256,g:Math.floor(a*o/r)%256,b:Math.floor(a*o/i)%256}}ps("DEMData",Cl);class Ll extends Ws{constructor(t,e){super(t,Pl,e);}_createColorRamp(t){const e={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof ii&&n._styleExpression.expression instanceof dn){this.colorRampExpression=n;const t=n._styleExpression.expression;e.elevationStops=t.labels,e.colorStops=[];for(const n of e.elevationStops)e.colorStops.push(t.evaluate({globals:{elevation:n}}));}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Ie.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;const r={elevationStops:[],colorStops:[]},i=(e.elevationStops.length-1)/(t-1);for(let t=0;t<e.elevationStops.length-.5;t+=i)r.elevationStops.push(e.elevationStops[Math.round(t)]),r.colorStops.push(e.colorStops[Math.round(t)]);return q(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const r=this._createColorRamp(e),i=new Sl({width:r.colorStops.length,height:1}),s=new Sl({width:r.colorStops.length,height:1});for(let t=0;t<r.elevationStops.length;t++){const e=Vl(r.elevationStops[t],n);s.setPixel(0,t,new Ie(e.r/255,e.g/255,e.b/255,1)),i.setPixel(0,t,r.colorStops[t]);}return this.colorRampTextures={elevationTexture:new Bl(t,s,t.gl.RGBA),colorTexture:new Bl(t,i,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return !this.isHidden()&&!!this.colorRampTextures}}const Ol=ro([{name:"a_pos",components:2,type:"Int16"}],4),{members:$l}=Ol;function Rl(t,e,n){const r=n.patternDependencies;let i=!1;for(const n of e){const e=n.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,r[s.to]=!0,r[s.from]=!0);}return i}function Nl(t,e,n,r,i){const{zoom:s}=r,o=i.patternDependencies;for(const r of e){const e=r.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:s-1},n,{},i.availableImages),a=e.evaluate({zoom:s},n,{},i.availableImages),l=e.evaluate({zoom:s+1},n,{},i.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,n.patterns[r.id]={min:t,mid:a,max:l};}}return n}function Ul(t,e,n,r,i){let s;if(i===function(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}(t,e,n,r)>0)for(let i=e;i<n;i+=r)s=cu(i/r|0,t[i],t[i+1],s);else for(let i=n-r;i>=e;i-=r)s=cu(i/r|0,t[i],t[i+1],s);return s&&iu(s,s.next)&&(hu(s),s=s.next),s}function jl(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!iu(r,r.next)&&0!==ru(r.prev,r,r.next))r=r.next;else {if(hu(r),r=e=r.prev,r===r.next)break;n=!0;}}while(n||r!==e);return e}function ql(t,e,n,r,i,s,o){if(!t)return;!o&&s&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=Jl(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let s=null;for(e=0;i;){e++;let o=i,a=0;for(let t=0;t<n&&(a++,o=o.nextZ,o);t++);let l=n;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||i.z<=o.z)?(r=i,i=i.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=o;}s.nextZ=null,n*=2;}while(e>1)}(i);}(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(s?Xl(t,r,i,s):Gl(t))e.push(l.i,t.i,u.i),hu(t),t=u.next,a=u.next;else if((t=u)===a){o?1===o?ql(t=Yl(jl(t),e),e,n,r,i,s,2):2===o&&Zl(t,e,n,r,i,s):ql(jl(t),e,
36n,r,i,s,1);break}}}function Gl(t){const e=t.prev,n=t,r=t.next;if(ru(e,n,r)>=0)return !1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,u=r.y,c=Math.min(i,s,o),h=Math.min(a,l,u),p=Math.max(i,s,o),f=Math.max(a,l,u);let d=r.next;for(;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&eu(i,a,s,l,o,u,d.x,d.y)&&ru(d.prev,d,d.next)>=0)return !1;d=d.next;}return !0}function Xl(t,e,n,r){const i=t.prev,s=t,o=t.next;if(ru(i,s,o)>=0)return !1;const a=i.x,l=s.x,u=o.x,c=i.y,h=s.y,p=o.y,f=Math.min(a,l,u),d=Math.min(c,h,p),y=Math.max(a,l,u),m=Math.max(c,h,p),g=Jl(f,d,e,n,r),x=Jl(y,m,e,n,r);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==o&&eu(a,c,l,h,u,p,v.x,v.y)&&ru(v.prev,v,v.next)>=0)return !1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==o&&eu(a,c,l,h,u,p,b.x,b.y)&&ru(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==o&&eu(a,c,l,h,u,p,v.x,v.y)&&ru(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==o&&eu(a,c,l,h,u,p,b.x,b.y)&&ru(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function Yl(t,e){let n=t;do{const r=n.prev,i=n.next.next;!iu(r,i)&&su(r,n,n.next,i)&&lu(r,i)&&lu(i,r)&&(e.push(r.i,n.i,i.i),hu(n),hu(n.next),n=t=i),n=n.next;}while(n!==t);return jl(n)}function Zl(t,e,n,r,i,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&nu(o,t)){let a=uu(o,t);return o=jl(o,o.next),a=jl(a,a.next),ql(o,e,n,r,i,s,0),void ql(a,e,n,r,i,s,0)}t=t.next;}o=o.next;}while(o!==t)}function Hl(t,e){let n=t.x-e.x;return 0===n&&(n=t.y-e.y,0===n)&&(n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),n}function Wl(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;if(iu(t,n))return n;do{if(iu(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o&&(o=t,s=n.x<n.next.x?n:n.next,t===r))return s}n=n.next;}while(n!==e);if(!s)return null;const a=s,l=s.x,u=s.y;let c=1/0;n=s;do{if(r>=n.x&&n.x>=l&&r!==n.x&&tu(i<u?r:o,i,l,u,i<u?o:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);lu(n,t)&&(e<c||e===c&&(n.x>s.x||n.x===s.x&&Kl(s,n)))&&(s=n,c=e);}n=n.next;}while(n!==a);return s}(t,e);if(!n)return e;const r=uu(n,t);return jl(r,r.next),jl(n,n.next)}function Kl(t,e){return ru(t.prev,t,e.prev)<0&&ru(e.next,t,t.next)<0}function Jl(t,e,n,r,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ql(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;}while(e!==t);return n}function tu(t,e,n,r,i,s,o,a){return (i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function eu(t,e,n,r,i,s,o,a){return !(t===o&&e===a)&&tu(t,e,n,r,i,s,o,a)}function nu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&su(n,n.next,t,e))return !0;n=n.next;}while(n!==t);return !1}(t,e)&&(lu(t,e)&&lu(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;}while(n!==t);return r}(t,e)&&(ru(t.prev,t,e.prev)||ru(t,e.prev,e))||iu(t,e)&&ru(t.prev,t,t.next)>0&&ru(e.prev,e,e.next)>0)}function ru(t,e,n){return (e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function iu(t,e){return t.x===e.x&&t.y===e.y}function su(t,e,n,r){const i=au(ru(t,e,n)),s=au(ru(t,e,r)),o=au(ru(n,r,t)),a=au(ru(n,r,e));return i!==s&&o!==a||!(0!==i||!ou(t,n,e))||!(0!==s||!ou(t,r,e))||!(0!==o||!ou(n,t,r))||!(0!==a||!ou(n,e,r))}function ou(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function au(t){return t>0?1:t<0?-1:0}function lu(t,e){return ru(t.prev,t,t.next)<0?ru(t,e,t.next)>=0&&ru(t,t.prev,e)>=0:ru(t,e,t.prev)<0||ru(t,t.next,e)<0}function uu(t,e){const n=pu(t.i,t.x,t.y),r=pu(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function cu(t,e,n,r){const i=pu(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function hu(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 pu(t,e,n){return {i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class fu{constructor(t,e){if(e>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e;}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class du{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle;}}du.noSubdivision=new du({fill:new fu(0,0),line:new fu(0,0),tile:new fu(0,0),stencil:new fu(0,0),circle:1}),ps("SubdivisionGranularityExpression",fu),ps("SubdivisionGranularitySetting",du);const yu=-32768,mu=32767;class gu{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=T/t,this._canonical=e;}_getKey(t,e){return (t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const n=0|Math.round(t),r=0|Math.round(e),i=this._getKey(n,r);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);const s=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,s),this._vertexBuffer.push(n,r),s}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(t,e){const n=[];for(let r=0;r<e.length;r+=3){const i=e[r],s=e[r+1],o=e[r+2],a=t[2*i],l=t[2*i+1];(t[2*s]-a)*(t[2*o+1]-l)-(t[2*s+1]-l)*(t[2*o]-a)>0?(n.push(i),n.push(o),n.push(s)):(n.push(i),n.push(s),n.push(o));}return n}(this._vertexBuffer,t);const e=[],n=t.length;for(let r=0;r<n;r+=3){const n=[t[r+0],t[r+1],t[r+2]],i=[this._vertexBuffer[2*t[r+0]+0],this._vertexBuffer[2*t[r+0]+1],this._vertexBuffer[2*t[r+1]+0],this._vertexBuffer[2*t[r+1]+1],this._vertexBuffer[2*t[r+2]+0],this._vertexBuffer[2*t[r+2]+1]];let s=1/0,o=1/0,a=-1/0,l=-1/0;for(let t=0;t<3;t++){const e=i[2*t],n=i[2*t+1];s=Math.min(s,e),a=Math.max(a,e),o=Math.min(o,n),l=Math.max(l,n);}if(s===a||o===l)continue;const u=Math.floor(s/this._granularityCellSize),c=Math.ceil(a/this._granularityCellSize),h=Math.floor(o/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(u!==c||h!==p)for(let t=h;t<p;t++){const r=this._scanlineGenerateVertexRingForCellRow(t,i,n);bu(this._vertexBuffer,r,e);}else e.push(...n);}return e}_scanlineGenerateVertexRingForCellRow(t,e,n){const r=t*this._granularityCellSize,i=r+this._granularityCellSize,s=[];for(let t=0;t<3;t++){const o=e[2*t],a=e[2*t+1],l=e[2*(t+1)%6],u=e[(2*(t+1)+1)%6],c=e[2*(t+2)%6],h=e[(2*(t+2)+1)%6],p=l-o,f=u-a,d=0===p,y=0===f,m=(r-a)/f,g=(i-a)/f,x=Math.min(m,g),v=Math.max(m,g);if(!y&&(x>=1||v<=0)||y&&(a<r||a>i)){u>=r&&u<=i&&s.push(n[(t+1)%3]);continue}!y&&x>0&&s.push(this._vertexToIndex(o+p*x,a+f*x));const b=o+p*Math.max(x,0),w=o+p*Math.min(v,1);d||this._generateIntraEdgeVertices(s,o,a,l,u,b,w),!y&&v<1&&s.push(this._vertexToIndex(o+p*v,a+f*v)),(y||u>=r&&u<=i)&&s.push(n[(t+1)%3]),!y&&(u<=r||u>=i)&&this._generateInterEdgeVertices(s,o,a,l,u,c,h,w,r,i);}return s}_generateIntraEdgeVertices(t,e,n,r,i,s,o){const a=r-e,l=i-n,u=0===l,c=u?Math.min(e,r):Math.min(s,o),h=u?Math.max(e,r):Math.max(s,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(h/this._granularityCellSize)-1;
36if(u?e<r:s<o)for(let r=p;r<=f;r++){const i=r*this._granularityCellSize;t.push(this._vertexToIndex(i,n+l*(i-e)/a));}else for(let r=f;r>=p;r--){const i=r*this._granularityCellSize;t.push(this._vertexToIndex(i,n+l*(i-e)/a));}}_generateInterEdgeVertices(t,e,n,r,i,s,o,a,l,u){const c=i-n,h=s-r,p=o-i,f=(l-i)/p,d=(u-i)/p,y=Math.min(f,d),m=Math.max(f,d),g=r+h*y;let x=Math.floor(Math.min(g,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,a)/this._granularityCellSize)-1,b=a<g;const w=0===p;if(w&&(o===l||o===u))return;if(w||y>=1||m<=0){const t=n-o,r=s+(e-s)*Math.min((l-o)/t,(u-o)/t);x=Math.floor(Math.min(r,a)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,a)/this._granularityCellSize)-1,b=a<r;}const _=c>0?u:l;if(b)for(let e=x;e<=v;e++)t.push(this._vertexToIndex(e*this._granularityCellSize,_));else for(let e=v;e>=x;e--)t.push(this._vertexToIndex(e*this._granularityCellSize,_));}_generateOutline(t){const e=[];for(const n of t){const t=vu(n,this._granularity,!0),r=this._pointArrayToIndices(t),i=[];for(let t=1;t<r.length;t++)i.push(r[t-1]),i.push(r[t]);e.push(i);}return e}_handlePoles(t){let e=!1,n=!1;this._canonical&&(0===this._canonical.y&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(e||n)&&this._fillPoles(t,e,n);}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){const n=t[e+1];n===yu&&(t[e+1]=-32767),n===mu&&(t[e+1]=32766);}}_generatePoleQuad(t,e,n,r,i,s){r>i!=(s===yu)?(t.push(e),t.push(n),t.push(this._vertexToIndex(r,s)),t.push(n),t.push(this._vertexToIndex(i,s)),t.push(this._vertexToIndex(r,s))):(t.push(n),t.push(e),t.push(this._vertexToIndex(r,s)),t.push(this._vertexToIndex(i,s)),t.push(n),t.push(this._vertexToIndex(r,s)));}_fillPoles(t,e,n){const r=this._vertexBuffer,i=T,s=t.length;for(let o=2;o<s;o+=3){const s=t[o-2],a=t[o-1],l=t[o],u=r[2*s],c=r[2*s+1],h=r[2*a],p=r[2*a+1],f=r[2*l],d=r[2*l+1];e&&(0===c&&0===p&&this._generatePoleQuad(t,s,a,u,h,yu),0===p&&0===d&&this._generatePoleQuad(t,a,l,h,f,yu),0===d&&0===c&&this._generatePoleQuad(t,l,s,f,u,yu)),n&&(c===i&&p===i&&this._generatePoleQuad(t,s,a,u,h,mu),p===i&&d===i&&this._generatePoleQuad(t,a,l,h,f,mu),d===i&&c===i&&this._generatePoleQuad(t,l,s,f,u,mu));}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1]);}subdividePolygonInternal(t,e){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:n,holeIndices:r}=function(t){const e=[],n=[];for(const r of t)if(0!==r.length){r!==t[0]&&e.push(n.length/2);for(let t=0;t<r.length;t++)n.push(r[t].x),n.push(r[t].y);}return {flattened:n,holeIndices:e}}(t);let i;this._initializeVertices(n);try{const t=function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=Ul(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(r&&(s=function(t,e,n,r){const i=[];for(let n=0,s=e.length;n<s;n++){const o=Ul(t,e[n]*r,n<s-1?e[n+1]*r:t.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Ql(o));}i.sort(Hl);for(let t=0;t<i.length;t++)n=Wl(i[t],n);return n}(t,e,s,n)),t.length>80*n){a=t[0],l=t[1];let e=a,r=l;for(let s=n;s<i;s+=n){const n=t[s],i=t[s+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i);}u=Math.max(e-a,r-l),u=0!==u?32767/u:0;}return ql(s,o,n,a,l,u,0),o}(n,r),e=this._convertIndices(n,t);i=this._subdivideTrianglesScanline(e);}catch(t){console.error(t);}let s=[];return e&&(s=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:s}}_convertIndices(t,e){const n=[];for(let r=0;r<e.length;r++)n.push(this._vertexToIndex(t[2*e[r]],t[2*e[r]+1]));return n}_pointArrayToIndices(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];e.push(this._vertexToIndex(r.x,r.y));}return e}}function xu(t,e,n,r=!0){return new gu(n,e).subdividePolygonInternal(t,r)}function vu(t,e,r=!1){if(!t||t.length<1)return [];if(t.length<2)return [];const i=t[0],s=t[t.length-1],o=r&&(i.x!==s.x||i.y!==s.y);if(e<2)return o?[...t,t[0]]:[...t];const a=Math.floor(T/e),l=[];l.push(new n(t[0].x,t[0].y));const u=t.length,c=o?u:u-1;for(let e=0;e<c;e++){const r=t[e],i=e<u-1?t[e+1]:t[0],s=r.x,o=r.y,c=i.x,h=i.y,p=s!==c,f=o!==h;if(!p&&!f)continue;const d=c-s,y=h-o,m=Math.abs(d),g=Math.abs(y);let x=s,v=o;for(;;){const t=d>
360?(Math.floor(x/a)+1)*a:(Math.ceil(x/a)-1)*a,e=y>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,r=Math.abs(x-t),i=Math.abs(v-e),s=Math.abs(x-c),o=Math.abs(v-h),u=p?r/m:Number.POSITIVE_INFINITY,b=f?i/g:Number.POSITIVE_INFINITY;if((s<=r||!p)&&(o<=i||!f))break;if(u<b&&p||!f){x=t,v+=y*u;const e=new n(x,Math.round(v));l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e);}else {x+=d*b,v=e;const t=new n(Math.round(x),v);l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t);}}const b=new n(c,h);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b);}return l}function bu(t,e,n){if(0===e.length)throw new Error("Subdivision vertex ring is empty.");let r=0,i=t[2*e[0]];for(let n=1;n<e.length;n++){const s=t[2*e[n]];s<i&&(i=s,r=n);}const s=e.length;let o=r,a=(o+1)%s;for(;;){const r=o-1>=0?o-1:s-1,i=(a+1)%s,l=t[2*e[r]],u=t[2*e[i]],c=t[2*e[o]],h=t[2*e[o]+1],p=t[2*e[a]+1];let f=!1;if(l<u)f=!0;else if(l>u)f=!1;else {const n=p-h,s=-(t[2*e[a]]-c),o=h<p?1:-1;((l-c)*n+(t[2*e[r]+1]-h)*s)*o>((u-c)*n+(t[2*e[i]+1]-h)*s)*o&&(f=!0);}if(f){const t=e[r],i=e[o],l=e[a];t!==i&&t!==l&&i!==l&&n.push(l,i,t),o--,o<0&&(o=s-1);}else {const t=e[i],r=e[o],l=e[a];t!==r&&t!==l&&r!==l&&n.push(l,r,t),a++,a>=s&&(a=0);}if(r===i)break}}function wu(t,e,n,r,i,s,o,a,l){const u=i.length/2,c=o&&a&&l;if(u<sa.MAX_VERTEX_ARRAY_LENGTH){const h=e.prepareSegment(u,n,r),p=h.vertexLength;for(let t=0;t<s.length;t+=3)r.emplaceBack(p+s[t],p+s[t+1],p+s[t+2]);let f,d;h.vertexLength+=u,h.primitiveLength+=s.length/3,c&&(d=o.prepareSegment(u,n,a),f=d.vertexLength,d.vertexLength+=u);for(let e=0;e<i.length;e+=2)t(i[e],i[e+1]);if(c)for(let t=0;t<l.length;t++){const e=l[t];for(let t=1;t<e.length;t+=2)a.emplaceBack(f+e[t-1],f+e[t]);d.primitiveLength+=e.length/2;}}else !function(t,e,n,r,i,s){const o=[];for(let t=0;t<r.length/2;t++)o.push(-1);const a={count:0};let l=0,u=t.getOrCreateLatestSegment(e,n),c=u.vertexLength;for(let h=2;h<i.length;h+=3){const p=i[h-2],f=i[h-1],d=i[h];let y=o[p]<l,m=o[f]<l,g=o[d]<l;u.vertexLength+((y?1:0)+(m?1:0)+(g?1:0))>sa.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,n),l=a.count,y=!0,m=!0,g=!0,c=0);const x=_u(o,r,s,a,p,y,u),v=_u(o,r,s,a,f,m,u),b=_u(o,r,s,a,d,g,u);n.emplaceBack(c+x-l,c+v-l,c+b-l),u.primitiveLength++;}}(e,n,r,i,s,t),c&&function(t,e,n,r,i,s){const o=[];for(let t=0;t<r.length/2;t++)o.push(-1);const a={count:0};let l=0,u=t.getOrCreateLatestSegment(e,n),c=u.vertexLength;for(let h=0;h<i.length;h++){const p=i[h];for(let f=1;f<i[h].length;f+=2){const i=p[f-1],h=p[f];let d=o[i]<l,y=o[h]<l;u.vertexLength+((d?1:0)+(y?1:0))>sa.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,n),l=a.count,d=!0,y=!0,c=0);const m=_u(o,r,s,a,i,d,u),g=_u(o,r,s,a,h,y,u);n.emplaceBack(c+m-l,c+g-l),u.primitiveLength++;}}}(o,n,a,i,l,t),e.forceNewSegmentOnNextPrepare(),null==o||o.forceNewSegmentOnNextPrepare();}function _u(t,e,n,r,i,s,o){if(s){const s=r.count;return n(e[2*i],e[2*i+1]),t[i]=r.count,r.count++,o.vertexLength++,s}return t[i]}class Su{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.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new qo,this.indexArray=new ea,this.indexArray2=new na,this.programConfigurations=new Ca(t.layers,t.zoom),this.segments=new sa,this.segments2=new sa,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,n){this.hasDependencies=Rl("fill",this.layers,e);const r=this.layers[0].layout.get("fill-sort-key"),i=!r.isConstant(),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Na(o,t);if(!this.layers[0]._featureFilter.filter(new zs(this.zoom),c,n))continue;const h=i?r.evaluate(c,{},n,e.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ra(o),patterns:{},sortKey:h};s.push(p);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of s){const{geometry:i,index:s,sourceLayerIndex:o}=r;if(this.hasDependencies){const t=Nl("fill",this.layers,r,{zoom:this.zoom},e);this.patternFeatures.push(t);}else this.addFeature(r,i,s,n,{},e.subdivisionGranularity);e.featureIndex.insert(t[s].feature,i,s,o,this.index);}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:n});}addFeatures(t,e,n){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,n,t.subdivisionGranularity);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$l),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,n,r,i,s){for(const t of er(e,500)){const e=xu(t,r,s.fill.getGranularityForZoomLevel(r.z)),n=this.layoutVertexArray;wu(((t,e)=>{n.emplaceBack(t,e);}),this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList);}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{imagePositions:i,canonical:r});}}let Au,Mu;ps("FillBucket",Su,{omit:["layers","patternFeatures"]});var ku={get paint(){return Mu=Mu||new Hs({"fill-antialias":new qs(vt.paint_fill["fill-antialias"]),"fill-opacity":new Gs(vt.paint_fill["fill-opacity"]),"fill-color":new Gs(vt.paint_fill["fill-color"]),"fill-outline-color":new Gs(vt.paint_fill["fill-outline-color"]),"fill-translate":new qs(vt.paint_fill["fill-translate"]),"fill-translate-anchor":new qs(vt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Xs(vt.paint_fill["fill-pattern"])})},get layout(){return Au=Au||new Hs({"fill-sort-key":new Gs(vt.layout_fill["fill-sort-key"])})}};class Iu extends Ws{constructor(t,e){super(t,ku,e);}recalculate(t,e){super.recalculate(t,e);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"]);}createBucket(t){return new Su(t)}queryRadius(){return rl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:n,pixelsToTileUnits:r}){return Ya(il(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,r),e)}isTileClipped(){return !0}}const Eu=ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Tu=ro([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Fu}=Eu;class Du{constructor(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(Pu,this,e);}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,r=[];let i,s=1,o=0,a=0,l=0;for(;t.pos<e;){if(o<=0){const e=t.readVarint();s=7&e,o=e>>3;}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&(i&&r.push(i),i=[]),i&&i.push(new n(a,l));else {if(7!==s)throw new Error(`unknown command ${s}`);i&&i.push(i[0].clone());}}return i&&r.push(i),r}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let n=1,r=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(r<=0){const e=t.readVarint();n=7&e,r=e>>3;}if(r--,1===n||2===n)i+=t.readSVarint(),s+=t.readSVarint(),i<o&&(o=i),i>a&&(a=i),s<l&&(l=s),s>u&&(u=s);else if(7!==n)throw new Error(`unknown command ${n}`)}return [o,l,a,u]}toGeoJSON(t,e,n){const r=this.extent*Math.pow(2,n),i=this.extent*t,s=this.extent*e,o=this.loadGeometry();function a(t){return [360*(t.x+i)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/r)*Math.PI))-90]}function l(t){return t.map(a)}let u;if(1===this.type){const t=[];for(const e of o)t.push(e[0]);const e=l(t);u=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e};}else if(2===this.type){const t=o.map(l);u=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};}else {if(3!==this.type)throw new Error("unknown feature type");{const t=zu(o),e=[];for(const n of t)e.push(n.map(l));u=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e};}}const c={type:"Feature",geometry:u,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function Pu(t,e,n){1===t?e.id=n.readVarint():2===t?function(t,e){const n=t.readVarint()+t.pos;for(;t.pos<n;){const n=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[n]=r;}}(n,e):3===t?e.type=n.readVarint():4===t&&(e._geometry=n.pos);}function zu(t){const e=t.length;if(e<=1)return [t];const n=[];let r,i;for(let s=0;s<e;s++){const e=Bu(t[s]);0!==e&&(void 0===i&&(i=e<0),i===e<0?(r&&n.push(r),r=[t[s]]):r&&r.push(t[s]));}return r&&n.push(r),n}function Bu(t){let e=0;for(let n,r,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r=t[o],e+=(r.x-n.x)*(n.y+r.y);return e}Du.types=["Unknown","Point","LineString","Polygon"];class Cu{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Vu,this,e),this.length=this._features.length;}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new Du(this._pbf,e,this.extent,this._keys,this._values)}}
36function Vu(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){let e=null;const n=t.readVarint()+t.pos;for(;t.pos<n;){const 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;}if(null==e)throw new Error("unknown feature value");return e}(n));}class Lu{constructor(t,e){this.layers=t.readFields(Ou,{},e);}}function Ou(t,e,n){if(3===t){const t=new Cu(n,n.readVarint()+n.pos);t.length&&(e[t.name]=t);}}const $u=Math.pow(2,13);function Ru(t,e,n,r,i,s,o,a){t.emplaceBack(e,n,2*Math.floor(r*$u)+o,i*$u*2,s*$u*2,Math.round(a));}class Nu{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.hasDependencies=!1,this.layoutVertexArray=new Go,this.centroidVertexArray=new Uo,this.indexArray=new ea,this.programConfigurations=new Ca(t.layers,t.zoom),this.segments=new sa,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,n){this.features=[],this.hasDependencies=Rl("fill-extrusion",this.layers,e);for(const{feature:r,id:i,index:s,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,a=Na(r,t);if(!this.layers[0]._featureFilter.filter(new zs(this.zoom),a,n))continue;const l={id:i,sourceLayerIndex:o,index:s,geometry:t?a.geometry:Ra(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Nl("fill-extrusion",this.layers,l,{zoom:this.zoom},e)):this.addFeature(l,l.geometry,s,n,{},e.subdivisionGranularity),e.featureIndex.insert(r,l.geometry,s,o,this.index,!0);}}addFeatures(t,e,n){for(const r of this.features){const{geometry:i}=r;this.addFeature(r,i,r.index,e,n,t.subdivisionGranularity);}}update(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:n});}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,Fu),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Tu.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,n,r,i,s){for(const n of er(e,500)){const e={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(e,r,t,n,s);const o=this.layoutVertexArray.length-i,a=Math.floor(e.x/e.sampleCount),l=Math.floor(e.y/e.sampleCount);for(let t=0;t<o;t++)this.centroidVertexArray.emplaceBack(a,l);}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{imagePositions:i,canonical:r});}processPolygon(t,e,n,r,i){if(r.length<1)return;if(qu(r[0]))return;for(const e of r)0!==e.length&&Uu(t,e);const s={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=i.fill.getGranularityForZoomLevel(e.z),a="Polygon"===Du.types[n.type];for(const t of r){if(0===t.length)continue;if(qu(t))continue;const e=vu(t,o,a);this._generateSideFaces(e,s);}if(!a)return;const l=xu(r,e,o,!1),u=this.layoutVertexArray;wu(((t,e)=>{Ru(u,t,e,0,0,1,1,0);}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles);}_generateSideFaces(t,e){let n=0;for(let r=1;r<t.length;r++){const i=t[r],s=t[r-1];if(ju(i,s))continue;e.segment.vertexLength+4>sa.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const o=i.sub(s)._perp()._unit(),a=s.dist(i);n+a>32768&&(n=0),Ru(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,0,n),Ru(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,1,n),n+=a,Ru(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,n),Ru(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,n);const l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2;}}}function Uu(t,e){for(let n=0;n<e.length;n++){const r=e[n];n===e.length-1&&e[0].x===r.x&&e[0].y===r.y||(t.x+=r.x,t.y+=r.y,t.sampleC
36ount++);}}function ju(t,e){return t.x===e.x&&(t.x<0||t.x>T)||t.y===e.y&&(t.y<0||t.y>T)}function qu(t){return t.every((t=>t.x<0))||t.every((t=>t.x>T))||t.every((t=>t.y<0))||t.every((t=>t.y>T))}let Gu;ps("FillExtrusionBucket",Nu,{omit:["layers","features"]});var Xu={get paint(){return Gu=Gu||new Hs({"fill-extrusion-opacity":new qs(vt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Gs(vt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qs(vt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qs(vt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xs(vt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Gs(vt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Gs(vt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qs(vt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Yu extends Ws{constructor(t,e){super(t,Xu,e);}createBucket(t){return new Nu(t)}queryRadius(){return rl(this.paint.get("fill-extrusion-translate"))}is3D(){return !0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:s,pixelsToTileUnits:o,pixelPosMatrix:a}){const l=il(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-s.bearingInRadians,o),u=this.paint.get("fill-extrusion-height").evaluate(e,r),c=this.paint.get("fill-extrusion-base").evaluate(e,r),h=function(t,e){const r=[];for(const i of t){const t=[i.x,i.y,0,1];A(t,t,e),r.push(new n(t[0]/t[3],t[1]/t[3]));}return r}(l,a),p=function(t,e,r,i){const s=[],o=[],a=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,f=i[10]*r,d=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x,o=s.y,y=i[0]*e+i[4]*o+i[12],m=i[1]*e+i[5]*o+i[13],g=i[2]*e+i[6]*o+i[14],x=i[3]*e+i[7]*o+i[15],v=g+u,b=x+c,w=y+h,_=m+p,S=g+f,A=x+d,M=new n((y+a)/b,(m+l)/b);M.z=v/b,t.push(M);const k=new n(w/A,_/A);k.z=S/A,r.push(k);}s.push(t),o.push(r);}return [s,o]}(i,c,u,a);return function(t,e,n){let r=1/0;Ya(n,e)&&(r=Hu(n,e[0]));for(let i=0;i<e.length;i++){const s=e[i],o=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],o[t+1],o[t],e];Ga(n,i)&&(r=Math.min(r,Hu(n,i)));}}return r!==1/0&&r}(p[0],p[1],h)}}function Zu(t,e){return t.x*e.x+t.y*e.y}function Hu(t,e){if(1===t.length){let n=0;const r=e[n++];let i;for(;!i||r.equals(i);)if(i=e[n++],!i)return 1/0;for(;n<e.length;n++){const s=e[n],o=t[0],a=i.sub(r),l=s.sub(r),u=o.sub(r),c=Zu(a,a),h=Zu(a,l),p=Zu(l,l),f=Zu(u,a),d=Zu(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=r.z*(1-m-g)+i.z*m+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const n of e)t=Math.min(t,n.z);return t}}const Wu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Ku{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,n]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const r=n>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const i=Wu[15&n];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new Ku(o,s,i,t)}constructor(t,e=64,n=Float64Array,r){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Wu.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,o=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+o+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t);}add(t,e){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=e,n}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Ju(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:o}=this,a=[0,i.length-1,0],l=[];for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=o){for(let o=h;o<=c;o++){const a=s[2*o],u=s[2*o+1];a>=t&&a<=n&&u>=e&&u<=r&&l.push(i[o]);}continue}const p=h+c>>1,f=s[2*p],d=s[2*p+1];f>=t&&f<=n&&d>=e&&d<=r&&l.push(i[p]),(0===u?t<=f:e<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?n>=f:r>=d)&&(a.push(p+1),a.push(c),a.push(1-u));}return l}within(t,e,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:i,nodeSize:s}=this,o=[0,r.length-1,0],a=[],l=n*n;for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=s){for(let n=h;n<=c;n++)nc(i[2*n],i[2*n+1],t,e)<=l&&a.push(r[n]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];nc(f,d,t,e)<=l&&a.push(r[p]),(0===u?t-n<=f:e-n<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?t+n>=f:e+n>=d)&&(o.push(p+1),o.push(c),o.push(1-u));}return a}}function Ju(t,e,n,r,i,s){if(i-r<=n)return;const o=r+i>>1;Qu(t,e,o,r,i,s),Ju(t,e,n,r,o-1,1-s),Ju(t,e,n,o+1,i,1-s);}function Qu(t,e,n,r,i,s){for(;i>r;){if(i-r>600){const o=i-r+1,a=n-r+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(a-o/2<0?-1:1);Qu(t,e,n,Math.max(r,Math.floor(n-a*u/o+c)),Math.min(i,Math.floor(n+(o-a)*u/o+c)),s);}const o=e[2*n+s];let a=r,l=i;for(tc(t,e,r,n),e[2*i+s]>o&&tc(t,e,r,i);a<l;){for(tc(t,e,a,l),a++,l--;e[2*a+s]<o;)a++;for(;e[2*l+s]>o;)l--;}e[2*r+s]===o?tc(t,e,r,l):(l++,tc(t,e,l,i)),l<=n&&(r=l+1),n<=l&&(i=l-1);}}function tc(t,e,n,r){ec(t,n,r),ec(e,2*n,2*r),ec(e,2*n+1,2*r+1);}function ec(t,e,n){const r=t[e];t[e]=t[n],t[n]=r;}function nc(t,e,n,r){const i=t-n,s=e-r;return i*i+s*s}function rc(t,e,n,r){let i=r;const s=e+(n-e>>1);let o,a=n-e;const l=t[e],u=t[e+1],c=t[n],h=t[n+1];for(let r=e+3;r<n;r+=3){const e=ic(t[r],t[r+1],l,u,c,h);if(e>i)o=r,i=e;else if(e===i){const t=Math.abs(r-s);t<a&&(o=r,a=t);}}i>r&&(o-e>3&&rc(t,e,o,r),t[o+2]=i,n-o>3&&rc(t,o,n,r));}function ic(t,e,n,r,i,s){let o=i-n,a=s-r;if(0!==o||0!==a){const l=((t-n)*o+(e-r)*a)/(o*o+a*a);l>1?(n=i,r=s):l>0&&(n+=o*l,r+=a*l);}return o=t-n,a=e-r,o*o+a*a}function sc(t,e,n,r){const i={type:e,geom:n},s={id:null==t?null:t,type:i.type,geometry:i.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case "Point":case "MultiPoint":case "LineString":oc(s,i.geom);break;case "Polygon":oc(s,i.geom[0]);break;case "MultiLineString":for(const t of i.geom)oc(s,t);break;case "MultiPolygon":for(const t of i.geom)oc(s,t[0]);}return s}function oc(t,e){for(let n=0;n<e.length;n+=3)t.minX=Math.min(t.minX,e[n]),t.minY=Math.min(t.minY,e[n+1]),t.maxX=Math.max(t.maxX,e[n]),t.maxY=Math.max(t.maxY,e[n+1]);}function ac(t,e){const n=[];
36switch(t.type){case "FeatureCollection":for(let r=0;r<t.features.length;r++)lc(n,t.features[r],e,r);break;case "Feature":lc(n,t,e);break;default:lc(n,{geometry:t,properties:void 0},e);}return n}function lc(t,e,n,r){if(!e.geometry)return;if("GeometryCollection"===e.geometry.type)return void function(t,e,n,r,i){for(const s of n.geometries)lc(t,{id:e.id,geometry:s,properties:e.properties},r,i);}(t,e,e.geometry,n,r);const i=e.geometry.coordinates;if(!i?.length)return;const s=function(t,e,n){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?n||0:t.id}(e,n,r),o=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);switch(e.geometry.type){case "Point":return void function(t,e,n,r){const i=[];i.push(hc(n.coordinates[0]),pc(n.coordinates[1]),0),t.push(sc(e,"Point",i,r));}(t,s,e.geometry,e.properties);case "MultiPoint":return void function(t,e,n,r){const i=[];for(const t of n.coordinates)i.push(hc(t[0]),pc(t[1]),0);t.push(sc(e,"MultiPoint",i,r));}(t,s,e.geometry,e.properties);case "LineString":return void function(t,e,n,r,i){const s=[];uc(n.coordinates,s,r,!1),t.push(sc(e,"LineString",s,i));}(t,s,e.geometry,o,e.properties);case "MultiLineString":return void function(t,e,n,r,i,s){if(i.lineMetrics)for(const i of n.coordinates){const n=[];uc(i,n,r,!1),t.push(sc(e,"LineString",n,s));}else {const i=[];cc(n.coordinates,i,r,!1),t.push(sc(e,"MultiLineString",i,s));}}(t,s,e.geometry,o,n,e.properties);case "Polygon":return void function(t,e,n,r,i){const s=[];cc(n.coordinates,s,r,!0),t.push(sc(e,"Polygon",s,i));}(t,s,e.geometry,o,e.properties);case "MultiPolygon":return void function(t,e,n,r,i){const s=[];for(const t of n.coordinates){const e=[];cc(t,e,r,!0),s.push(e);}t.push(sc(e,"MultiPolygon",s,i));}(t,s,e.geometry,o,e.properties);default:throw new Error("Input data is not a valid GeoJSON object.")}}function uc(t,e,n,r){let i,s,o=0;for(let n=0;n<t.length;n++){const a=hc(t[n][0]),l=pc(t[n][1]);e.push(a,l,0),n>0&&(o+=r?(i*l-a*s)/2:Math.sqrt(Math.pow(a-i,2)+Math.pow(l-s,2))),i=a,s=l;}const a=e.length-3;e[2]=1,n>0&&rc(e,0,a,n),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size;}function cc(t,e,n,r){for(let i=0;i<t.length;i++){const s=[];uc(t[i],s,n,r),e.push(s);}}function hc(t){return t/360+.5}function pc(t){const e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function fc(t){const e={type:"Feature",geometry:dc(t),properties:t.tags};return null!=t.id&&(e.id=t.id),e}function dc(t){const{type:e,geometry:n}=t;switch(e){case "Point":return {type:e,coordinates:mc(n[0],n[1])};case "MultiPoint":case "LineString":return {type:e,coordinates:yc(n)};case "MultiLineString":case "Polygon":return {type:e,coordinates:n.map((t=>yc(t)))};case "MultiPolygon":return {type:e,coordinates:n.map((t=>t.map((t=>yc(t)))))}}}function yc(t){const e=[];for(let n=0;n<t.length;n+=3)e.push(mc(t[n],t[n+1]));return e}function mc(t,e){return [gc(t),xc(e)]}function gc(t){return 360*(t-.5)}function xc(t){const e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var vc;function bc(t,e,n,r,i,s,o,a){if(r/=e,s>=(n/=e)&&o<r)return t;if(o<n||s>=r)return null;const l=[];for(const e of t){const t=i===vc.X?e.minX:e.minY,s=i===vc.X?e.maxX:e.maxY;if(t>=n&&s<r)l.push(e);else if(!(s<n||t>=r))switch(e.type){case "Point":case "MultiPoint":wc(e,l,n,r,i);continue;case "LineString":_c(e,l,n,r,i,a);continue;case "MultiLineString":Sc(e,l,n,r,i);continue;case "Polygon":Ac(e,l,n,r,i);continue;case "MultiPolygon":Mc(e,l,n,r,i);continue}}return l.length?l:null}function wc(t,e,n,r,i){const s=[];((function(t,e,n,r,i){for(let s=0;s<t.length;s+=3){const o=t[s+i];o>=n&&o<=r&&Tc(e,t[s],t[s+1],t[s+2]);}}))(t.geometry,s,n,r,i),s.length&&e.push(sc(t.id,3===s.length?"Point":"MultiPoint",s,t.tags));}function _c(t,e,n,r,i,s){const o=[];if(kc(t.geometry,o,n,r,i,!1,s.lineMetrics),o.length)if(s.lineMetrics)for(const n of o)e.push(sc(t.id,"LineString",n,t.tags));else e.push(o.length>1?sc(t.id,"MultiLineString",o,t.tags):sc(t.id,"LineString",o[0],t.tags));}function Sc(t,e,n,r,i){const s=[];Ec(t.geometry,s,n,r,i,!1),s.length&&e.push(1!==s.length?sc(t.id,"MultiLineString",s,t.tags):sc(t.id,"LineString",s[0],t.tags));}function Ac(t,e,n,r,i){const s=[];Ec(t.geometry,s,n,r,i,!0),s.length&&e.push(sc(t.id,"Polygon",s,t.tags));}function Mc(t,e,n,r,i){const s=[];for(const e of t.geometry){const t=[];Ec(e,t,n,r,i,!0),t.length&&s.push(t);}s.length&&e.push(sc(t.id,"MultiPolygon",s,t.tags));}function kc(t,e,n,r,i,s,o){let a=Ic(t);const l=i===vc.X?Fc:Dc;let u,c,h=t.start;for(let p=0;p<t.length-3;p+=3){const f=t[p],d=t[p+1],y=t[p+2],m=t[p+3],g=t[p+4],x=i===vc.X?f:d,v=i===vc.X?m:g;let b=!1;o&&(u=Math.sqrt(Math.pow(f-m,2)+Math.pow(d-g,2))),x<n?v>n&&(c=l(a,f,d,m,g,n),o&&(a.start=h+u*c)):x>r?v<r&&(c=l(a,f,d,m,g,r),o&&(a.start=h+u*c)):Tc(a,f,d,y),v<n&&x>=n&&(c=l(a,f,d,m,g,n),b=!0),v>r&&x<=r&&(c=l(a,f,d,m,g,r),b=!0),!s&&b&&(o&&(a.end=h+u*c),e.push(a),a=Ic(t)),o&&(h+=u);}let p=t.length-3;const f=t[p],d=t[p+1],y=i===vc.X?f:d;y>=n&&y<=r&&Tc(a,f,d,t[p+2]),p=a.length-3,s&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&Tc(a,a[0],a[1],a[2]),a.length&&e.push(a);}function Ic(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Ec(t,e,n,r,i,s){for(const o of t)kc(o,e,n,r,i,s,!1);}function Tc(t,e,n,r){t.push(e,n,r);}function Fc(t,e,n,r,i,s){const o=(s-e)/(r-e);
36return Tc(t,s,n+(i-n)*o,1),o}function Dc(t,e,n,r,i,s){const o=(s-n)/(i-n);return Tc(t,e+(r-e)*o,s,1),o}function Pc(t,e){const n=e.buffer/e.extent;let r=t;const i=bc(t,1,-1-n,n,vc.X,-1,2,e),s=bc(t,1,1-n,2+n,vc.X,-1,2,e);return i||s?(r=bc(t,1,-n,1+n,vc.X,-1,2,e)||[],i&&(r=zc(i,1).concat(r)),s&&(r=r.concat(zc(s,-1))),r):r}function zc(t,e){const n=[];for(const r of t)switch(r.type){case "Point":case "MultiPoint":case "LineString":{const t=Bc(r.geometry,e);n.push(sc(r.id,r.type,t,r.tags));continue}case "MultiLineString":case "Polygon":{const t=[];for(const n of r.geometry)t.push(Bc(n,e));n.push(sc(r.id,r.type,t,r.tags));continue}case "MultiPolygon":{const t=[];for(const n of r.geometry){const r=[];for(const t of n)r.push(Bc(t,e));t.push(r);}n.push(sc(r.id,r.type,t,r.tags));continue}}return n}function Bc(t,e){const n=[];n.size=t.size,void 0!==t.start&&(n.start=t.start,n.end=t.end);for(let r=0;r<t.length;r+=3)n.push(t[r]+e,t[r+1],t[r+2]);return n}function Cc(t,e,n){const r=!!e.newGeometry,i=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(r){const r=t[0];let s=ac({type:"FeatureCollection",features:[{type:"Feature",id:r.id,geometry:e.newGeometry,properties:i?Vc(r.tags,e):r.tags}]},n);return s=Pc(s,n),s}if(i){const n=[];for(const r of t){const t={...r};t.tags=Vc(t.tags,e),n.push(t);}return n}return []}function Vc(t,e){if(e.removeAllProperties)return {};const n={...t||{}};if(e.removeProperties)for(const t of e.removeProperties)delete n[t];if(e.addOrUpdateProperties)for(const{key:t,value:r}of e.addOrUpdateProperties)n[t]=r;return n}!function(t){t[t.X=0]="X",t[t.Y=1]="Y";}(vc||(vc={}));const Lc={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t};class Oc{constructor(t){this.options=Object.assign(Object.create(Lc),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[];}load(t){const e=[];for(const n of t){if(!n.geometry)continue;const[t,r]=n.geometry.coordinates,[i,s]=[hc(t),pc(r)];e.push({id:n.id,type:"Point",geometry:[i,s],tags:n.properties});}this.createIndex(e);}initialize(t){const e=[];for(const n of t)"Point"===n.type&&e.push(n);this.createIndex(e);}updateIndex(t,e,n){this.options=Object.assign(Object.create(Lc),n.clusterOptions),this.initialize(t);}createIndex(t){const{log:e,minZoom:n,maxZoom:r}=this.options;e&&console.time("total time");const i=`prepare ${t.length} points`;e&&console.time(i),this.points=t;const s=[];for(let e=0;e<t.length;e++){const n=t[e];if(!n?.geometry)continue;let[r,i]=n.geometry;r=Math.fround(r),i=Math.fround(i),s.push(r,i,1/0,e,-1,1),this.options.reduce&&s.push(0);}let o=this.trees[r+1]=this.createTree(s);e&&console.timeEnd(i);for(let t=r;t>=n;t--){const n=Date.now();o=this.trees[t]=this.createTree(this.cluster(o,t)),e&&console.log("z%d: %d clusters in %dms",t,o.numItems,Date.now()-n);}e&&console.timeEnd("total time");}getClusters(t,e){return this.getClustersInternal(t,e).map((t=>fc(t)))}getClustersInternal(t,e){let n=((t[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,t[1]));let i=180===t[2]?180:((t[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,i=180;else if(n>i){const t=this.getClustersInternal([n,r,180,s],e),o=this.getClustersInternal([-180,r,i,s],e);return t.concat(o)}const o=this.trees[this.limitZoom(e)],a=o.range(hc(n),pc(s),hc(i),pc(r)),l=o.flatData,u=[];for(const t of a){const e=this.stride*t;u.push(l[e+5]>1?$c(l,e,this.clusterProps):this.points[l[e+3]]);}return u}getChildren(t){const e=this.getOriginId(t),n=this.getOriginZoom(t),r=new Error("No cluster with the specified id: "+t),i=this.trees[n];if(!i)throw r;const s=i.flatData;if(e*this.stride>=s.length)throw r;const o=this.options.radius/(this.options.extent*Math.pow(2,n-1)),a=i.within(s[e*this.stride],s[e*this.stride+1],o),l=[];for(const e of a){const n=e*this.stride;s[n+4]===t&&l.push(s[n+5]>1?Rc(s,n,this.clusterProps):fc(this.points[s[n+3]]));}if(0===l.length)throw r;return l}getLeaves(t,e,n){const r=[];return this.appendLeaves(r,t,e=e||10,n=n||0,0),r}getTile(t,e,n){const r=this.trees[this.limitZoom(t)];if(!r)return null;const i=Math.pow(2,t),{extent:s,radius:o}=this.options,a=o/s,l=(n-a)/i,u=(n+1+a)/i,c={transformed:!0,features:[],source:null,x:e,y:n,z:t};return this.addTileFeatures(r.range((e-a)/i,l,(e+1+a)/i,u),r.flatData,e,n,i,c),0===e&&this.addTileFeatures(r.range(1-a/i,l,1,u),r.flatData,i,n,i,c),e===i-1&&this.addTileFeatures(r.range(0,l,a/i,u),r.flatData,-1,n,i,c),c}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,n,r,i){const s=this.getChildren(e);for(const e of s){const s=e.properties;if(s?.cluster?i+s.point_count<=r?i+=s.point_count:i=this.appendLeaves(t,s.cluster_id,n,r,i):i<r?i++:t.push(e),t.length===n)break}return i}createTree(t){const e=new Ku(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)e.add(t[n],t[n+1]);return e.finish(),e.flatData=t,e.data=null,e}addTileFeatures(t,e,n,r,i,s){for(const o of t){const t=o*this.stride,a=e[t+5]>1;let l,u,c;if(a)l=Nc(e,t,this.clusterProps),u=e[t],c=e[t+1];else {const n=this.points[e[t+3]];l=n.tags,[u,c]=n.geometry;}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-n)),Math.round(this.options.extent*(c*i-r))]],tags:l};let p;p=a||this.options.generateId?e[t+3]:this.points[e[t+3]].id,void 0!==p&&(h.id=p),s.features.push(h);}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){const{radius:n,extent:r,reduce:i,minPoints:s}=this.options,o=n/(r*Math.pow(2,e)),a=t.flatData,l=[],u=this.stride;for(let n=0;n<a.length;n+=u){if(a[n+2]<=e)continue;a[n+2]=e;const r=a[n],c=a[n+1],h=t.within(a[n],a[n+1],o),p=a[n+5];let f=p;for(const t of h){const n=t*u;a[n+2]>e&&(f+=a[n+5]);}if(f>p&&f>=s){let t,s=r*p,o=c*p,d=-1;const y=(n/u<<5)+(e+1)+this.points.length;for(const r of h){const l=r*u;if(a[l+2]<=e)continue;a[l+2]=e;const c=a[l+5];
36s+=a[l]*c,o+=a[l+1]*c,a[l+4]=y,i&&(t||(t=this.map(a,n,!0),d=this.clusterProps.length,this.clusterProps.push(t)),i(t,this.map(a,l)));}a[n+4]=y,l.push(s/f,o/f,1/0,y,-1,f),i&&l.push(d);}else {for(let t=0;t<u;t++)l.push(a[n+t]);if(f>1)for(const t of h){const n=t*u;if(!(a[n+2]<=e)){a[n+2]=e;for(let t=0;t<u;t++)l.push(a[n+t]);}}}}return l}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return (t-this.points.length)%32}map(t,e,n){if(t[e+5]>1){const r=this.clusterProps[t[e+6]];return n?Object.assign({},r):r}const r=this.points[t[e+3]].tags,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function $c(t,e,n){return {id:t[e+3],type:"Point",tags:Nc(t,e,n),geometry:[t[e],t[e+1]]}}function Rc(t,e,n){return {type:"Feature",id:t[e+3],properties:Nc(t,e,n),geometry:{type:"Point",coordinates:[gc(t[e]),xc(t[e+1])]}}}function Nc(t,e,n){const r=t[e+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,s=t[e+6],o=-1===s?{}:Object.assign({},n[s]);return Object.assign(o,{cluster:!0,cluster_id:t[e+3],point_count:r,point_count_abbreviated:i})}const Uc="geojsonvt_clip_start",jc="geojsonvt_clip_end";function qc(t,e,n,r,i){const s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={transformed:!1,features:[],source:null,x:n,y:r,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(const e of t)Gc(o,e,s,i);return o}function Gc(t,e,n,r){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case "Point":case "MultiPoint":return void function(t,e){const n=[];for(let r=0;r<e.geometry.length;r+=3)n.push(e.geometry[r],e.geometry[r+1]),t.numPoints++,t.numSimplified++;if(!n.length)return;const r={type:1,tags:e.tags||null,geometry:n};null!==e.id&&(r.id=e.id),t.features.push(r);}(t,e);case "LineString":return void function(t,e,n,r){const i=[];if(Xc(i,e.geometry,t,n,!1,!1),!i.length)return;let s=e.tags||null;if(r.lineMetrics){s={};for(const t in e.tags)s[t]=e.tags[t];s[Uc]=e.geometry.start/e.geometry.size,s[jc]=e.geometry.end/e.geometry.size;}const o={type:2,tags:s,geometry:i};null!==e.id&&(o.id=e.id),t.features.push(o);}(t,e,n,r);case "MultiLineString":case "Polygon":return void function(t,e,n){const r=[];for(let i=0;i<e.geometry.length;i++)Xc(r,e.geometry[i],t,n,"Polygon"===e.type,0===i);if(!r.length)return;const i={type:"Polygon"===e.type?3:2,tags:e.tags||null,geometry:r};null!==e.id&&(i.id=e.id),t.features.push(i);}(t,e,n);case "MultiPolygon":return void function(t,e,n){const r=[];for(let i=0;i<e.geometry.length;i++){const s=e.geometry[i];for(let e=0;e<s.length;e++)Xc(r,s[e],t,n,!0,0===e);}if(!r.length)return;const i={type:3,tags:e.tags||null,geometry:r};null!==e.id&&(i.id=e.id),t.features.push(i);}(t,e,n)}}function Xc(t,e,n,r,i,s){const o=r*r;if(r>0&&e.size<(i?o:r))return void(n.numPoints+=e.length/3);const a=[];for(let t=0;t<e.length;t+=3)(0===r||e[t+2]>o)&&(n.numSimplified++,a.push(e[t],e[t+1])),n.numPoints++;i&&function(t,e){let n=0;for(let e=0,r=t.length,i=r-2;e<r;i=e,e+=2)n+=(t[e]-t[i])*(t[e+1]+t[i+1]);if(n>0===e)for(let e=0,n=t.length;e<n/2;e+=2){const r=t[e],i=t[e+1];t[e]=t[n-2-e],t[e+1]=t[n-1-e],t[n-2-e]=r,t[n-1-e]=i;}}(a,s),t.push(a);}function Yc(t,e){if(t.transformed)return t;const n=1<<t.z,r=t.x,i=t.y;for(const s of t.features)1===s.type?Zc(s,e,n,r,i):Hc(s,e,n,r,i);return t.transformed=!0,t}function Zc(t,e,n,r,i){const s=t,o=t.geometry,a=[];for(let t=0;t<o.length;t+=2)a.push(Wc(o[t],o[t+1],e,n,r,i));return s.geometry=a,s}function Hc(t,e,n,r,i){const s=t,o=t.geometry,a=[];for(const t of o){const s=[];for(let o=0;o<t.length;o+=2)s.push(Wc(t[o],t[o+1],e,n,r,i));a.push(s);}return s.geometry=a,s}function Wc(t,e,n,r,i,s){return [Math.round(n*(t*r-i)),Math.round(n*(e*r-s))]}class Kc{constructor(t){this.options=t,this.stats={},this.total=0,this.tiles={},this.tileCoords=[],this.stats={},this.total=0;}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)));}updateIndex(t,e,n){n.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),n.debug>1&&console.timeEnd("invalidating");const[r,i,s]=[0,0,0],o=qc(t,r,i,s,n);o.source=t;const a=Jc(r,i,s);if(this.tiles[a]=o,this.tileCoords.push({z:r,x:i,y:s,id:a}),n.debug){const t=`z${r}`;this.stats[t]=(this.stats[t]||0)+1,this.total++;}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,n){return null}getTile(t,e,n){const{extent:r,debug:i}=this.options,s=1<<t,o=Jc(t,e=e+s&s-1,n);if(this.tiles[o])return Yc(this.tiles[o],r);i>1&&console.log("drilling down to z%d-%d-%d",t,e,n);let a,l=t,u=e,c=n;for(;!a&&l>0;)l--,u>>=1,c>>=1,a=this.tiles[Jc(l,u,c)];return a?.source?(i>1&&(console.log("found parent tile z%d-%d-%d",l,u,c),console.time("drilling down")),this.splitTile(a.source,l,u,c,t,e,n),i>1&&console.timeEnd("drilling down"),this.tiles[o]?Yc(this.tiles[o],r):null):null}splitTile(t,e,n,r,i,s,o){const a=[t,e,n,r],l=this.options,u=l.debug;for(;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();const c=1<<e,h=Jc(e,n,r);let p=this.tiles[h];if(!p&&(u>1&&console.time("creation"),p=this.tiles[h]=qc(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r,id:h}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const t=`z${e}`;this.stats[t]=(this.stats[t]||0)+1,this.total++;}if(p.source=t,null==i){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else {if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(n!==s>
36>t||r!==o>>t)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");const f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f;let g=null,x=null,v=null,b=null;const w=bc(t,c,n-f,n+y,vc.X,p.minX,p.maxX,l),_=bc(t,c,n+d,n+m,vc.X,p.minX,p.maxX,l);w&&(g=bc(w,c,r-f,r+y,vc.Y,p.minY,p.maxY,l),x=bc(w,c,r+d,r+m,vc.Y,p.minY,p.maxY,l)),_&&(v=bc(_,c,r-f,r+y,vc.Y,p.minY,p.maxY,l),b=bc(_,c,r+d,r+m,vc.Y,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),a.push(g||[],e+1,2*n,2*r),a.push(x||[],e+1,2*n,2*r+1),a.push(v||[],e+1,2*n+1,2*r),a.push(b||[],e+1,2*n+1,2*r+1);}}invalidateTiles(t){if(!t.length)return;const e=this.options,{debug:n}=e;let r=1/0,i=-1/0,s=1/0,o=-1/0;for(const e of t)r=Math.min(r,e.minX),i=Math.max(i,e.maxX),s=Math.min(s,e.minY),o=Math.max(o,e.maxY);const a=e.buffer/e.extent,l=new Set;for(const e in this.tiles){const u=this.tiles[e],c=1<<u.z,h=(u.x-a)/c,p=(u.x+1+a)/c,f=(u.y-a)/c,d=(u.y+1+a)/c;if(i<h||r>=p||o<f||s>=d)continue;let y=!1;for(const e of t)if(e.maxX>=h&&e.minX<p&&e.maxY>=f&&e.minY<d){y=!0;break}if(y){if(n){n>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",u.z,u.x,u.y,u.numFeatures,u.numPoints,u.numSimplified);const t=`z${u.z}`;this.stats[t]=(this.stats[t]||0)-1,this.total--;}delete this.tiles[e],l.add(e);}}l.size&&(this.tileCoords=this.tileCoords.filter((t=>!l.has(t.id))));}}function Jc(t,e,n){return 32*((1<<t)*n+e)+t}const Qc={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Lc,debug:0},th=ro([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:eh}=th,nh=ro([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:rh}=nh,ih=Math.cos(Math.PI/180*37.5),sh=Math.pow(2,14)/.5;class oh{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.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new Xo,this.layoutVertexArray2=new Yo,this.indexArray=new ea,this.programConfigurations=new Ca(t.layers,t.zoom),this.segments=new sa,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,n){this.hasDependencies=Rl("line",this.layers,e)||this.hasLineDasharray(this.layers);const r=this.layers[0].layout.get("line-sort-key"),i=!r.isConstant(),s=[];for(const{feature:e,id:o,index:a,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Na(e,t);if(!this.layers[0]._featureFilter.filter(new zs(this.zoom),u,n))continue;const c=i?r.evaluate(u,{},n):void 0,h={id:o,properties:e.properties,type:e.type,sourceLayerIndex:l,index:a,geometry:t?u.geometry:Ra(e),patterns:{},dashes:{},sortKey:c};s.push(h);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const r of s){const{geometry:i,index:s,sourceLayerIndex:o}=r;this.hasDependencies?(Rl("line",this.layers,e)?Nl("line",this.layers,r,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,e),this.patternFeatures.push(r)):this.addFeature(r,i,s,n,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[s].feature,i,s,o,this.index);}}update(t,e,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:n,dashPositions:r});}addFeatures(t,e,n,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,n,r,t.subdivisionGranularity);}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,rh)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eh),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,Uc)&&Object.prototype.hasOwnProperty.call(t.properties,jc))return {start:+t.properties[Uc],end:+t.properties[jc]}}addFeature(t,e,n,r,i,s,o){const a=this.layers[0].layout,l=a.get("line-join").evaluate(t,{}),u=a.get("line-cap"),c=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const n of e)this.addLine(n,t,l,u,c,h,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{imagePositions:i,dashPositions:s,canonical:r});}addLine(t,e,n,r,i,s,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=vu(t,o?a.line.getGranularityForZoomLevel(o.z):1),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 l="Polygon"===Du.types[e.type];let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let c=0;for(;c<u-1&&t[c].equals(t[c+1]);)c++;if(u<(l?3:2))return;"bevel"===n&&(i=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray);let f,d,y,m,g;this.e1=this.e2=-1,l&&(f=t[u-2],g=t[c].sub(f)._unit()._perp());for(let e=c;e<u;e++){if(y=e===u-1?l?t[c+1]:void 0:t[e+1],y&&t[e].equals(y))continue;g&&(m=g),f&&(d=f),f=t[e],g=y?y.sub(f)._unit()._perp():m,m=m||g;let o=m.add(g);0===o.x&&0===o.y||o._unit();const a=m.x*g.x+m.y*g.y,x=o.x*g.x+o.y*g.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<ih&&d&&y,_=m.x*g.y-m.y*g.x>0;if(w&&e>c){const t=f.dist(d);if(t>
362*h){const e=f.sub(f.sub(d)._mult(h/t)._round());this.updateDistance(d,e),this.addCurrentVertex(e,m,0,0,p),d=e;}}const S=d&&y;let A=S?n:l?"butt":r;if(S&&"round"===A&&(v<s?A="miter":v<=2&&(A="fakeround")),"miter"===A&&v>i&&(A="bevel"),"bevel"===A&&(v>2&&(A="flipbevel"),v<i&&(A="miter")),d&&this.updateDistance(d,f),"miter"===A)o._mult(v),this.addCurrentVertex(f,o,0,0,p);else if("flipbevel"===A){if(v>100)o=g.mult(-1);else {const t=v*m.add(g).mag()/m.sub(g).mag();o._perp()._mult(t*(_?-1:1));}this.addCurrentVertex(f,o,0,0,p),this.addCurrentVertex(f,o.mult(-1),0,0,p);}else if("bevel"===A||"fakeround"===A){const t=-Math.sqrt(v*v-1),e=_?t:0,n=_?0:t;if(d&&this.addCurrentVertex(f,m,e,n,p),"fakeround"===A){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let n=e/t;if(.5!==n){const t=n-.5;n+=n*t*(n-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*t*t+(.848013+a*(.215638*a-1.06021)));}const r=g.sub(m)._mult(n)._add(m)._unit()._mult(_?-1:1);this.addHalfVertex(f,r.x,r.y,!1,_,0,p);}}y&&this.addCurrentVertex(f,g,-e,-n,p);}else if("butt"===A)this.addCurrentVertex(f,o,0,0,p);else if("square"===A){const t=d?1:-1;this.addCurrentVertex(f,o,t,t,p);}else "round"===A&&(d&&(this.addCurrentVertex(f,m,0,0,p),this.addCurrentVertex(f,m,1,1,p,!0)),y&&(this.addCurrentVertex(f,g,-1,-1,p,!0),this.addCurrentVertex(f,g,0,0,p)));if(w&&e<u-1){const t=f.dist(y);if(t>2*h){const e=f.add(y.sub(f)._mult(h/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,g,0,0,p),f=e;}}}}addCurrentVertex(t,e,n,r,i,s=!1){const o=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*n,e.y-e.x*n,s,!1,n,i),this.addHalfVertex(t,o,a,s,!0,-r,i),this.distance>sh/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,n,r,i,s));}addHalfVertex({x:t,y:e},n,r,i,s,o,a){const l=.5*(this.lineClips?this.scaledDistance*(sh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*n)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),a.primitiveLength++),s?this.e2=u:this.e1=u;}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();}hasLineDasharray(t){for(const e of t){const t=e.paint.get("line-dasharray");if(t&&!t.isConstant())return !0}return !1}addLineDashDependencies(t,e,n,r){for(const i of t){const t=i.paint.get("line-dasharray");if(!t||"constant"===t.value.kind)continue;const s="round"===i.layout.get("line-cap"),o={dasharray:t.value.evaluate({zoom:n-1},e,{}),round:s},a={dasharray:t.value.evaluate({zoom:n},e,{}),round:s},l={dasharray:t.value.evaluate({zoom:n+1},e,{}),round:s},u=`${o.dasharray.join(",")},${o.round}`,c=`${a.dasharray.join(",")},${a.round}`,h=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[u]=o,r.dashDependencies[c]=a,r.dashDependencies[h]=l,e.dashes[i.id]={min:u,mid:c,max:h};}}}let ah,lh;ps("LineBucket",oh,{omit:["layers","patternFeatures"]});var uh={get paint(){return lh=lh||new Hs({"line-opacity":new Gs(vt.paint_line["line-opacity"]),"line-color":new Gs(vt.paint_line["line-color"]),"line-translate":new qs(vt.paint_line["line-translate"]),"line-translate-anchor":new qs(vt.paint_line["line-translate-anchor"]),"line-width":new Gs(vt.paint_line["line-width"]),"line-gap-width":new Gs(vt.paint_line["line-gap-width"]),"line-offset":new Gs(vt.paint_line["line-offset"]),"line-blur":new Gs(vt.paint_line["line-blur"]),"line-dasharray":new Xs(vt.paint_line["line-dasharray"]),"line-pattern":new Xs(vt.paint_line["line-pattern"]),"line-gradient":new Zs(vt.paint_line["line-gradient"])})},get layout(){return ah=ah||new Hs({"line-cap":new qs(vt.layout_line["line-cap"]),"line-join":new Gs(vt.layout_line["line-join"]),"line-miter-limit":new qs(vt.layout_line["line-miter-limit"]),"line-round-limit":new qs(vt.layout_line["line-round-limit"]),"line-sort-key":new Gs(vt.layout_line["line-sort-key"])})}};class ch extends Gs{possiblyEvaluate(t,e){return e=new zs(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,n,r){return e=O({},e,{zoom:Math.floor(e.zoom)}
36),super.evaluate(t,e,n,r)}}let hh;class ph extends Ws{constructor(t,e){super(t,uh,e),this.gradientVersion=0,hh||(hh=new ch(uh.paint.properties["line-width"].specification),hh.useIntegerZoom=!0);}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof ln,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"]=hh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t);}createBucket(t){return new oh(t)}queryRadius(t){const e=t,n=fh(nl("line-width",this,e),nl("line-gap-width",this,e)),r=nl("line-offset",this,e);return n/2+Math.abs(r)+rl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:s,pixelsToTileUnits:o}){const a=il(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-s.bearingInRadians,o),l=o/2*fh(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(i=function(t,e){const r=[];for(let i=0;i<t.length;i++){const s=sl(t[i]),o=[];for(let t=0;t<s.length;t++){const r=s[t],i=s[t-1],a=s[t+1],l=0===t?new n(0,0):r.sub(i)._unit()._perp(),u=t===s.length-1?new n(0,0):a.sub(r)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),o.push(c._mult(e)._add(r));}r.push(o);}return r}(i,u*o)),function(t,e,n){for(let r=0;r<e.length;r++){const i=e[r];if(t.length>=3)for(let e=0;e<i.length;e++)if(tl(t,i[e]))return !0;if(Za(t,i,n))return !0}return !1}(a,i,l)}isTileClipped(){return !0}}function fh(t,e){return e>0?e+2*t:t}const dh=ro([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),yh=ro([{name:"a_projected_pos",components:3,type:"Float32"}],4);ro([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const mh=ro([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ro([{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 gh=ro([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),xh=ro([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function vh(t,e,n){return t.sections.forEach((t=>{t.text=function(t,e,n){const r=e.layout.get("text-transform").evaluate(n,{});return "uppercase"===r?t=t.toLocaleUpperCase():"lowercase"===r&&(t=t.toLocaleLowerCase()),Ps.applyArabicShaping&&(t=Ps.applyArabicShaping(t)),t}(t.text,e,n);})),t}ro([{name:"triangle",components:3,type:"Uint16"}]),ro([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),ro([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ro([{type:"Float32",name:"offsetX"}]),ro([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ro([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var bh=24;const wh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},_h={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Sh={40:!0};function Ah(t,e,n,r,i,s){if("fontStack"in e){const r=n[e.fontStack],s=r&&r[t];return s?s.metrics.advance*e.scale+i:0}{const t=r[e.imageName];return t?t.displaySize[0]*e.scale*bh/s+i:0}}function Mh(t,e,n,r){const i=Math.pow(t-e,2);return r?t<e?i/2:2*i:i+Math.abs(n)*n}
36function kh(t,e,n){let r=0;return 10===t&&(r-=1e4),n&&(r+=150),40!==t&&65288!==t||(r+=50),41!==e&&65289!==e||(r+=50),r}function Ih(t,e,n,r,i,s){let o=null,a=Mh(e,n,i,s);for(const t of r){const r=Mh(e-t.x,n,i,s)+t.badness;r<=a&&(o=t,a=r);}return {index:t,x:e,priorBreak:o,badness:a}}function Eh(t){return t?Eh(t.priorBreak).concat(t.index):[]}class Th{constructor(t="",e=[],n=[]){this.text=t,this.sections=e,this.sectionIndex=n,this.imageSectionID=null;}static fromFeature(t,e){const n=new Th;for(let r=0;r<t.sections.length;r++){const i=t.sections[r];i.image?n.addImageSection(i):n.addTextSection(i,e);}return n}length(){return [...this.text].length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(){this.text=function(t){let e="",n={premature:!0,value:void 0};const r=t[Symbol.iterator]();let i=r.next();const s=t[Symbol.iterator]();s.next();let o=s.next();for(;!i.done;)e+=!o.done&&Is(o.value.codePointAt(0))&&!wh[o.value]||!n.premature&&Is(n.value.codePointAt(0))&&!wh[n.value]||!wh[i.value]?i.value:wh[i.value],n={value:i.value,premature:!1},i=r.next(),o=s.next();return e}(this.text);}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const t=this.text.match(/^\s*/),e=t?t[0].length:0,n=this.text.match(/\S\s*$/),r=n?n[0].length-1:0;this.text=this.text.substring(e,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(e,this.sectionIndex.length-r);}substring(t,e){const n=[...this.text].slice(t,e).join(""),r=this.sectionIndex.slice(t,e);return new Th(n,this.sections,r)}toCodeUnitIndex(t){return [...this.text].slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}getMaxImageSize(t){let e=0,n=0;for(let r=0;r<this.length();r++){const i=this.getSection(r);if("imageName"in i){const r=t[i.imageName];if(!r)continue;const s=r.displaySize;e=Math.max(e,s[0]),n=Math.max(n,s[1]);}}return {maxImageWidth:e,maxImageHeight:n}}addTextSection(t,e){this.text+=t.text,this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||e});const n=this.sections.length-1;this.sectionIndex.push(...[...t.text].map((()=>n)));}addImageSection(t){const e=t.image?t.image.name:"";if(0===e.length)return void q("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:e}),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401");}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,e,n,r,i){const s=[],o=this.determineAverageLineWidth(t,e,n,r,i),a=this.hasZeroWidthSpaces();let l=0,u=0;const c=this.text[Symbol.iterator]();let h=c.next();const p=this.text[Symbol.iterator]();p.next();let f=p.next();const d=this.text[Symbol.iterator]();d.next(),d.next();let y=d.next();for(;!h.done;){const e=this.getSection(u),m=h.value.codePointAt(0);if(ws(m)||(l+=Ah(m,e,n,r,t,i)),!f.done){const t=vs(m),n=f.value.codePointAt(0);(_h[m]||t||"imageName"in e||!y.done&&Sh[n])&&s.push(Ih(u+1,l,o,s,kh(m,n,t&&a),!1));}u++,h=c.next(),f=p.next(),y=d.next();}return Eh(Ih(this.length(),l,o,s,0,!0))}determineAverageLineWidth(t,e,n,r,i){let s=0,o=0;for(const e of this.text){const a=this.getSection(o);s+=Ah(e.codePointAt(0),a,n,r,t,i),o++;}return s/Math.max(1,Math.ceil(s/e))}}const Fh=4294967296,Dh=1/Fh,Ph="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class zh{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length;}readFields(t,e,n=this.length){for(;this.pos<n;){const n=this.readVarint(),r=n>>3,i=this.pos;this.type=7&n,t(r,e,this),this.pos===i&&this.skip(n);}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Fh;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Fh;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let n,r;return r=e[this.pos++],n=127&r,r<128?n:(r=e[this.pos++],n|=(127&r)<<7,r<128?n:(r=e[this.pos++],n|=(127&r)<<14,r<128?n:(r=e[this.pos++],n|=(127&r)<<21,r<128?n:(r=e[this.pos],n|=(15&r)<<28,function(t,e,n){const r=n.buf;let i,s;if(s=r[n.pos++],i=(112&s)>>4,s<128)return Bh(t,i,e);if(s=r[n.pos++],i|=(127&s)<<3,s<128)return Bh(t,i,e);if(s=r[n.pos++],i|=(127&s)<<10,s<128)return Bh(t,i,e);if(s=r[n.pos++],i|=(127&s)<<17,s<128)return Bh(t,i,e);if(s=r[n.pos++],i|=(127&s)<<24,s<128)return Bh(t,i,e);if(s=r[n.pos++],i|=(1&s)<<31,s<128)return Bh(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(n,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Ph?Ph.decode(this.buf.subarray(e,t)):function(t,e,n){let r="",i=e;for(;i<n;){const e=t[i];let s,o,a,l=null,u=e>239?4:e>223?3:e>191?2:1;if(i+u>n)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=u;}return r}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const n=this.readPackedEnd();for(;this.pos<n;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else {if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8;}}writeTag(t,e){this.writeVarint(t<<3|e);}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e;}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4;}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4;}
vendor: 4,460 bytes, line 36
36writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Dh),!0),this.pos+=8;}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Dh),!0),this.pos+=8;}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let n,r;if(t>=0?(n=t%4294967296|0,r=t/4294967296|0):(n=~(-t%4294967296),r=~(-t/4294967296),4294967295^n?n=n+1|0:(n=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,n.buf[n.pos]=127&(t>>>=7);}(n,0,e),function(t,e){const n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(r,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t);}writeBoolean(t){this.writeVarint(+t);}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,n){for(let r,i,s=0;s<e.length;s++){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){r>56319||s+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null;}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128);}return n}(this.buf,t,this.pos);const n=this.pos-e;n>=128&&Ch(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n;}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4;}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8;}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let n=0;n<e;n++)this.buf[this.pos++]=t[n];}writeRawMessage(t,e){this.pos++;const n=this.pos;t(e,this);const r=this.pos-n;r>=128&&Ch(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r;}writeMessage(t,e,n){this.writeTag(t,2),this.writeRawMessage(e,n);}writePackedVarint(t,e){e.length&&this.writeMessage(t,Vh,e);}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Lh,e);}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Rh,e);}writePackedFloat(t,e){e.length&&this.writeMessage(t,Oh,e);}writePackedDouble(t,e){e.length&&this.writeMessage(t,$h,e);}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Nh,e);}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Uh,e);}writePackedFixed64(t,e){e.length&&this.writeMessage(t,jh,e);}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,qh,e);}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e);}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e);}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e);}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e);}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e);}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e);}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e);}writeStringField(t,e){this.writeTag(t,2),this.writeString(e);}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e);}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e);}writeBooleanField(t,e){this.writeVarintField(t,+e);}}function Bh(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ch(t,e,n){const r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(let e=n.pos-1;e>=t;e--)n.buf[e+r]=n.buf[e];}function Vh(t,e){for(let n=0;n<t.length;n++)e.writeVarint(t[n]);}function Lh(t,e){for(let n=0;n<t.length;n++)e.writeSVarint(t[n]);}function Oh(t,e){for(let n=0;n<t.length;n++)e.writeFloat(t[n]);}function $h(t,e){for(let n=0;n<t.length;n++)e.writeDouble(t[n]);}function Rh(t,e){for(let n=0;n<t.length;n++)e.writeBoolean(t[n]);}function Nh(t,e){for(let n=0;n<t.length;n++)e.writeFixed32(t[n]);}function Uh(t,e){for(let n=0;n<t.length;n++)e.writeSFixed32(t[n]);}function jh(t,e){for(let n=0;n<t.length;
36n++)e.writeFixed64(t[n]);}function qh(t,e){for(let n=0;n<t.length;n++)e.writeSFixed64(t[n]);}function Gh(t,e,n){1===t&&n.readMessage(Xh,e);}function Xh(t,e,n){if(3===t){const{id:t,bitmap:r,width:i,height:s,left:o,top:a,advance:l}=n.readMessage(Yh,{});e.push({id:t,bitmap:new _l({width:i+6,height:s+6},r),metrics:{width:i,height:s,left:o,top:a,advance:l}});}}function Yh(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint());}function Zh(t){let e=0,n=0;for(const r of t)e+=r.w*r.h,n=Math.max(n,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}];let i=0,s=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const n=r[t];if(!(e.w>n.w||e.h>n.h)){if(e.x=n.x,e.y=n.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===n.w&&e.h===n.h){const e=r.pop();e&&t<r.length&&(r[t]=e);}else e.h===n.h?(n.x+=e.w,n.w-=e.w):e.w===n.w?(n.y+=e.h,n.h-=e.h):(r.push({x:n.x+e.w,y:n.y,w:n.w-e.w,h:e.h}),n.y+=e.h,n.h-=e.h);break}}return {w:i,h:s,fill:e/(i*s)||0}}class Hh{constructor(t,{pixelRatio:e,version:n,stretchX:r,stretchY:i,content:s,textFitWidth:o,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=i,this.content=s,this.version=n,this.textFitWidth=o,this.textFitHeight=a;}get tl(){return [this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return [this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return [(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Wh{constructor(t,e){const n={},r={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,n,i),this.addImages(e,r,i);const{w:s,h:o}=Zh(i),a=new Sl({width:s||1,height:o||1});for(const e in t){const r=t[e],i=n[e].paddedRect;Sl.copy(r.data,a,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data);}for(const t in e){const n=e[t],i=r[t].paddedRect,s=i.x+1,o=i.y+1,l=n.data.width,u=n.data.height;Sl.copy(n.data,a,{x:0,y:0},{x:s,y:o},n.data),Sl.copy(n.data,a,{x:0,y:u-1},{x:s,y:o-1},{width:l,height:1}),Sl.copy(n.data,a,{x:0,y:0},{x:s,y:o+u},{width:l,height:1}),Sl.copy(n.data,a,{x:l-1,y:0},{x:s-1,y:o},{width:1,height:u}),Sl.copy(n.data,a,{x:0,y:0},{x:s+l,y:o},{width:1,height:u});}this.image=a,this.iconPositions=n,this.patternPositions=r;}addImages(t,e,n){for(const r in t){const i=t[r],s={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(s),e[r]=new Hh(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r);}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),e);}patchUpdatedImage(t,e,n){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[r,i]=t.tl;n.update(e.data,void 0,{x:r,y:i});}}var Kh;function Jh(e,n,r,i,s,o,a,l,u,c,h,p,f,d,y){const m=Th.fromFeature(e,s);let g;p===t.aw.vertical&&m.verticalizePunctuation();let x=m.determineLineBreaks(c,o,n,i,d);const{processBidirectionalText:v,processStyledBidirectionalText:b}=Ps;if(v&&1===m.sections.length){g=[],x=x.map((t=>m.toCodeUnitIndex(t)));const t=v(m.toString(),x);for(const e of t){const t=[...e].map((()=>0));g.push(new Th(e,m.sections,t));}}else if(b){g=[],x=x.map((t=>m.toCodeUnitIndex(t)));let t=0;const e=[];for(const n of m.text)e.push(...Array(n.length).fill(m.sectionIndex[t])),t++;const n=b(m.text,e,x);for(const t of n){const e=[];let n="";for(const r of t[0])e.push(t[1][n.length]),n+=r;g.push(new Th(t[0],m.sections,e));}}else g=function(t,e){const n=[];let r=0;for(const i of e)n.push(t.substring(r,i)),r=i;return r<t.length()&&n.push(t.substring(r,t.length())),n}(m,x);const w=[],_={positionedLines:w,text:m.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(t,e,n,r,i,s,o,a,l,u,c,h){let p=0,f=0,d=0,y=0;const m="right"===a?1:"left"===a?0:.5,g=bh/h;let x=0;for(const o of i){o.trim();const i=o.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=a;const h=a.positionedGlyphs;let v=0;if(!o.length()){f+=s,++x;continue}const b=tp(r,o,g);let w=0;
36for(const s of o.text){const a=o.getSection(w),d=s.codePointAt(0),y=np(l,c,d),m={glyph:d,imageName:null,x:p,y:f+-17,vertical:y,scale:1,fontStack:"",sectionIndex:o.getSectionIndex(w),metrics:null,rect:null};let x;if("fontStack"in a){if(x=rp(a,d,y,b,e,n),!x)continue;m.fontStack=a.fontStack;}else {if(t.iconsInText=!0,a.scale*=g,x=ip(a,y,i,b,r),!x)continue;v=Math.max(v,x.imageOffset),m.imageName=a.imageName;}const{rect:_,metrics:S,baselineOffset:A}=x;m.y+=A,m.scale=a.scale,m.metrics=S,m.rect=_,h.push(m),y?(t.verticalizable=!0,p+=("imageName"in a?S.advance:bh)*a.scale+u):p+=S.advance*a.scale+u,w++;}0!==h.length&&(d=Math.max(p-u,d),sp(h,0,h.length-1,m)),p=0,a.lineOffset=Math.max(v,(i-1)*bh);const _=s*i+v;f+=_,y=Math.max(_,y),++x;}const{horizontalAlign:v,verticalAlign:b}=Qh(o);((function(t,e,n,r,i,s,o,a,l){const u=(e-n)*i;let c=0;c=s!==o?-a*r- -17:-r*l*o+.5*o;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c;}))(t.positionedLines,m,v,b,d,y,s,f,i.length),t.top+=-b*f,t.bottom=t.top+f,t.left+=-v*d,t.right=t.left+d;}(_,n,r,i,g,a,l,u,p,c,f,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(w)&&_}function Qh(t){let e=.5,n=.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":n=1;break;case "top":case "top-right":case "top-left":n=0;}return {horizontalAlign:e,verticalAlign:n}}function tp(t,e,n){const r=e.getMaxScale()*bh,{maxImageWidth:i,maxImageHeight:s}=e.getMaxImageSize(t),o=Math.max(r,s*n);return {verticalLineContentWidth:Math.max(r,i*n),horizontalLineContentHeight:o}}function ep(t){switch(t){case "top":return 0;case "center":return .5;default:return 1}}function np(e,n,r){return !(e===t.aw.horizontal||!n&&!bs(r)||n&&(ws(r)||(i=r,/\p{sc=Arab}/u.test(String.fromCodePoint(i)))));var i;}function rp(t,e,n,r,i,s){const o=s[t.fontStack],a=function(t,e,n,r){if(t&&t.rect)return t;const i=e[n.fontStack],s=i&&i[r];return s?{rect:null,metrics:s.metrics}:null}(o&&o[e],i,t,e);if(null===a)return null;let l;if(n)l=r.verticalLineContentWidth-t.scale*bh;else {const e=ep(t.verticalAlign);l=(r.horizontalLineContentHeight-t.scale*bh)*e;}return {rect:a.rect,metrics:a.metrics,baselineOffset:l}}function ip(t,e,n,r,i){const s=i[t.imageName];if(!s)return null;const o=s.paddedRect,a=s.displaySize,l={width:a[0],height:a[1],left:1,top:-3,advance:e?a[1]:a[0]};let u;if(e)u=r.verticalLineContentWidth-a[1]*t.scale;else {const e=ep(t.verticalAlign);u=(r.horizontalLineContentHeight-a[1]*t.scale)*e;}return {rect:o,metrics:l,baselineOffset:u,imageOffset:(e?a[0]:a[1])*t.scale-bh*n}}function sp(t,e,n,r){if(0===r)return;const i=t[n],s=(t[n].x+i.metrics.advance*i.scale)*r;for(let r=e;r<=n;r++)t[r].x-=s;}function op(t,e,n){const{horizontalAlign:r,verticalAlign:i}=Qh(n),s=e[0]-t.displaySize[0]*r,o=e[1]-t.displaySize[1]*i;return {image:t,top:o,bottom:o+t.displaySize[1],left:s,right:s+t.displaySize[0]}}function ap(t){var e,n;let r=t.left,i=t.top,s=t.right-r,o=t.bottom-i;const a=null!==(e=t.image.textFitWidth)&&void 0!==e?e:"stretchOrShrink",l=null!==(n=t.image.textFitHeight)&&void 0!==n?n:"stretchOrShrink",u=(t.image.content[2]-t.image.content[0])/(t.image.content[3]-t.image.content[1]);if("proportional"===l){if("stretchOnly"===a&&s/o<u||"proportional"===a){const t=Math.ceil(o*u);r*=t/s,s=t;}}else if("proportional"===a&&"stretchOnly"===l&&0!==u&&s/o>u){const t=Math.ceil(s/u);i*=t/o,o=t;}return {x1:r,y1:i,x2:r+s,y2:i+o}}function lp(t,e,n,r,i,s){const o=t.image;let a;if(o.content){const t=o.content,e=o.pixelRatio||1;a=[t[0]/e,t[1]/e,o.displaySize[0]-t[2]/e,o.displaySize[1]-t[3]/e];}const l=e.left*s,u=e.right*s;let c,h,p,f;"width"===n||"both"===n?(f=i[0]+l-r[3],h=i[0]+u+r[1]):(f=i[0]+(l+u-o.displaySize[0])/2,h=f+o.displaySize[0]);const d=e.top*s,y=e.bottom*s;return "height"===n||"both"===n?(c=i[1]+d-r[0],p=i[1]+y+r[2]):(c=i[1]+(d+y-o.displaySize[1])/2,p=c+o.displaySize[1]),{image:o,top:c,right:h,bottom:p,left:f,collisionPadding:a}}ps("ImagePosition",Hh),ps("ImageAtlas",Wh),t.aw=void 0,(Kh=t.aw||(t.aw={}))[Kh.none=0]="none",Kh[Kh.horizontal=1]="horizontal",Kh[Kh.vertical=2]="vertical",Kh[Kh.horizontalOnly=3]="horizontalOnly";const up=128,cp=32640;function hp(t,e){const{expression:n}=e;if("constant"===n.kind)return {kind:"constant",layoutSize:n.evaluate(new zs(t+1))};if("source"===n.kind)return {kind:"source"};{const{zoomStops:e,interpolationType:r}=n;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const o=e[i],a=e[s];return "composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:a,minSize:n.evaluate(new zs(o)),maxSize:n.evaluate(new zs(a)),interpolationType:r}}}function pp(t,e,n){let r="never";const i=t.get(e);return i?r=i:t.get(n)&&(r="always"),r}const fp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dp(t,e,n,r,i,s,o,a,l,u,c,h,p){const f=a?Math.min(cp,Math.round(a[0])):0,d=a?Math.min(cp,Math.round(a[1])):0;t.emplaceBack(e,n,Math.round(32*r),Math.round(32*i),s,o,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p);}function yp(t,e,n){t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n);}function mp(t){for(const e of t.sections)if(Ds(e.text))return !0;return !1}class gp{constructor(t){this.layoutVertexArray=new Wo,this.indexArray=new ea,this.programConfigurations=t,this.segments=new sa,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Jo,this.hasVisibleVertices=!1,this.placedSymbolArray=new zo;}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dh.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,yh.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,fp,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(t));}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy());}}ps("SymbolBuffers",gp);class xp{constructor(t,e,n){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new n,this.segments=new sa,this.collisionVertexArray=new ta;}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,mh.members,!0);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy());}}ps("CollisionBuffers",xp);class vp{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.s
36ourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hp(this.zoom,n["text-size"]),this.iconSizeData=hp(this.zoom,n["icon-size"]);const r=this.layers[0].layout,i=r.get("symbol-sort-key"),s=r.get("symbol-z-order");this.canOverlap="never"!==pp(r,"text-overlap","text-allow-overlap")||"never"!==pp(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&!i.isConstant(),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>t.aw[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID;}createArrays(){this.text=new gp(new Ca(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new gp(new Ca(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Vo,this.lineVertexArray=new Lo,this.symbolInstances=new Co,this.textAnchorOffsets=new $o;}calculateGlyphDependencies(t,e,n,r,i){for(const s of t)if(e[s.codePointAt(0)]=!0,(n||r)&&i){const t=wh[s];t&&(e[t.codePointAt(0)]=!0);}}populate(e,n,r){const i=this.layers[0],s=i.layout,o=s.get("text-font"),a=s.get("text-field"),l=s.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof De&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),c="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get("symbol-sort-key");if(this.features=[],!u&&!c)return;const p=n.iconDependencies,f=n.glyphDependencies,d=n.availableImages,y=new zs(this.zoom);for(const{feature:n,id:a,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,g=Na(n,e);if(!i._featureFilter.filter(y,g,r))continue;let x,v;if(e||(g.geometry=Ra(n)),u){const t=i.getValueAndResolveTokens("text-field",g,r,d),e=De.factory(t),n=this.hasRTLText=this.hasRTLText||mp(e);(!n||"unavailable"===Ps.getRTLTextPluginStatus()||n&&Ps.isParsed())&&(x=vh(e,i,g));}if(c){const t=i.getValueAndResolveTokens("icon-image",g,r,d);v=t instanceof Oe?t:Oe.fromString(t);}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},r):void 0;if(this.features.push({id:a,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:n.properties,type:Du.types[n.type],sortKey:b}),v&&(p[v.name]=!0),x){const e=o.evaluate(g,{},r).join(","),n="viewport"!==s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.aw.vertical)>=0;for(const t of x.sections)if(t.image)p[t.image.name]=!0;else {const r=_s(x.toString()),i=t.fontStack||e,s=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,s,n,this.allowVerticalPlacement,r);}}}"line"===s.get("symbol-placement")&&(this.features=function(t){const e={},n={},r=[];let i=0;function s(e){r.push(t[e]),i++;}function o(t,e,i){const s=n[t];return delete n[t],n[e]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function a(t,n,i){const s=e[n];return delete e[n],e[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=i[0].concat(r[s].geometry[0]),s}function l(t,e,n){const r=n?e[0][e[0].length-1]:e[0][0];return `${t}:${r.x}:${r.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in n&&d in e&&n[f]!==e[d]){const t=a(f,d,h),i=o(f,d,r[t].geometry);delete e[f],delete n[d],n[l(p,r[i].geometry,!0)]=i,r[t].geometry=null;}else f in n?o(f,d,h):d in e?a(f,d,h):(s(u),e[f]=i-1,n[d]=i-1);}return r.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:n}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:n}));}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 n=this.lineVertexArray.length;if(void 0!==t.segment){let n=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]);const i={};for(let r=t.segment+1;r<e.length;r++)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r<e.length-1&&(n+=e[r+1].dist(e[r]));for(let n=t.segment||0;n>=0;n--)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n>
360&&(r+=e[n-1].dist(e[n]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor);}}return {lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,n,r,i,s,o,a,l,u,c,h,p){const f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*n.length,d,f,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&a===t.aw.vertical?Math.PI/2:0,v=o.text&&o.text.sections;for(let t=0;t<n.length;t++){const{tl:i,tr:s,bl:a,br:u,tex:c,pixelOffsetTL:h,pixelOffsetBR:m,minFontScaleX:g,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:S}=n[t],A=y.vertexLength,M=w[1];dp(d,l.x,l.y,i.x,M+i.y,c.x,c.y,r,_,h.x,h.y,g,b),dp(d,l.x,l.y,s.x,M+s.y,c.x+c.w,c.y,r,_,m.x,h.y,g,b),dp(d,l.x,l.y,a.x,M+a.y,c.x,c.y+c.h,r,_,h.x,m.y,g,b),dp(d,l.x,l.y,u.x,M+u.y,c.x+c.w,c.y+c.h,r,_,m.x,m.y,g,b),yp(e.dynamicLayoutVertexArray,l,x),f.emplaceBack(A,A+2,A+1),f.emplaceBack(A+1,A+2,A+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),t!==n.length-1&&S===n[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(d.length,o,o.index,{imagePositions:{},canonical:p,formattedSection:v&&v[S]});}e.placedSymbolArray.emplaceBack(l.x,l.y,m,this.glyphOffsetArray.length-m,g,u,c,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],a,0,!1,0,h);}_addCollisionDebugVertex(t,e,n,r,i,s){return e.emplaceBack(0,0),t.emplaceBack(n.x,n.y,r,i,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(t,e,r,i,s,o,a){const l=s.segments.prepareSegment(4,s.layoutVertexArray,s.indexArray),u=l.vertexLength,c=s.layoutVertexArray,h=s.collisionVertexArray,p=a.anchorX,f=a.anchorY;this._addCollisionDebugVertex(c,h,o,p,f,new n(t,e)),this._addCollisionDebugVertex(c,h,o,p,f,new n(r,e)),this._addCollisionDebugVertex(c,h,o,p,f,new n(r,i)),this._addCollisionDebugVertex(c,h,o,p,f,new n(t,i)),l.vertexLength+=4;const d=s.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4;}addDebugCollisionBoxes(t,e,n,r){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,r?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,n);}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new xp(Qo,gh.members,na),this.iconCollisionBox=new xp(Qo,gh.members,na);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,n,r,i,s,o,a,l){const u={};for(let r=e;r<n;r++){const e=t.get(r);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=r;e<i;e++){const n=t.get(e);u.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.verticalTextFeatureIndex=n.featureIndex;break}for(let e=s;e<o;e++){const n=t.get(e);u.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.iconFeatureIndex=n.featureIndex;break}for(let e=a;e<l;e++){const n=t.get(e);u.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},u.verticalIconFeatureIndex=n.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const n=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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 n=t.placedSymbolArray.get(e),r=n.vertexStartIndex+4*n.numGlyphs;for(let e=n.vertexStartIndex;e<r;e+=4)t.indexArray.emplaceBack(e,e+2,e+1),t.indexArray.emplaceBack(e+1,e+2,e+3);}
36getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),n=Math.cos(t),r=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const o=this.symbolInstances.get(t);r.push(0|Math.round(e*o.anchorX+n*o.anchorY)),i.push(o.featureIndex);}return s.sort(((t,e)=>r[t]-r[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===e?n.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,n)=>{t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t);})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}let bp,wp;ps("SymbolBucket",vp,{omit:["layers","collisionBoxArray","features","compareText"]}),vp.MAX_GLYPHS=65535,vp.addDynamicAttributes=yp;var _p={get paint(){return wp=wp||new Hs({"icon-opacity":new Gs(vt.paint_symbol["icon-opacity"]),"icon-color":new Gs(vt.paint_symbol["icon-color"]),"icon-halo-color":new Gs(vt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Gs(vt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Gs(vt.paint_symbol["icon-halo-blur"]),"icon-translate":new qs(vt.paint_symbol["icon-translate"]),"icon-translate-anchor":new qs(vt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Gs(vt.paint_symbol["text-opacity"]),"text-color":new Gs(vt.paint_symbol["text-color"],{runtimeType:$t,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Gs(vt.paint_symbol["text-halo-color"]),"text-halo-width":new Gs(vt.paint_symbol["text-halo-width"]),"text-halo-blur":new Gs(vt.paint_symbol["text-halo-blur"]),"text-translate":new qs(vt.paint_symbol["text-translate"]),"text-translate-anchor":new qs(vt.paint_symbol["text-translate-anchor"])})},get layout(){return bp=bp||new Hs({"symbol-placement":new qs(vt.layout_symbol["symbol-placement"]),"symbol-spacing":new qs(vt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qs(vt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Gs(vt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qs(vt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qs(vt.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qs(vt.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qs(vt.layout_symbol["icon-ignore-placement"]),"icon-optional":new qs(vt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qs(vt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Gs(vt.layout_symbol["icon-size"]),"icon-text-fit":new qs(vt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qs(vt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Gs(vt.layout_symbol["icon-image"]),"icon-rotate":new Gs(vt.layout_symbol["icon-rotate"]),"icon-padding":new Gs(vt.layout_symbol["icon-padding"]),"icon-keep-upright":new qs(vt.layout_symbol["icon-keep-upright"]),"icon-offset":new Gs(vt.layout_symbol["icon-offset"]),"icon-anchor":new Gs(vt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qs(vt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qs(vt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qs(vt.layout_symbol["text-rotation-alignment"]),"text-field":new Gs(vt.layout_symbol["text-field"]),"text-font":new Gs(vt.layout_symbol["text-font"]),"text-size":new Gs(vt.layout_symbol["text-size"]),"text-max-width":new Gs(vt.layout_symbol["text-max-width"]),"text-line-height":new qs(vt.layout_symbol["text-line-height"]),"text-letter-spacing":new Gs(vt.layout_symbol["text-letter-spacing"]),"text-justify":new Gs(vt.layout_symbol["text-justify"]),"text-radial-offset":new Gs(vt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qs(vt.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Gs(vt.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Gs(vt.layout_symbol["text-anchor"]),"text-max-angle":new qs(vt.layout_symbol["text-max-angle"]),"text-writing-mode":new qs(vt.layout_symbol["text-writing-mode"]),"text-rotate":new Gs(vt.layout_symbol["text-rotate"]),"text-padding":new qs(vt.layout_symbol["text-padding"]),"text-keep-upright":new qs(vt.layout_symbol["text-keep-upright"]),"text-transform":new Gs(vt.layout_symbol["text-transform"]),"text-offset":new Gs(vt.layout_symbol["text-offset"]),"text-allow-overlap":new qs(vt.layout_symbol["text-allow-overlap"]),"text-overlap":new qs(vt.layout_symbol["text-overlap"]),"text-ignore-placement":new qs(vt.layout_symbol["text-ignore-placement"]),"text-optional":new qs(vt.layout_symbol["text-optional"])})}};class Sp{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:Ct,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}}ps("FormatSectionOverride",Sp,{omit:["defaultValue"]});class Ap extends Ws{constructor(t,e){super(t,_p,e);}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 n of t)e.indexOf(n)<0&&e.push(n);this.layout._values["text-writing-mode"]=e;}else this.layout._values["text-writing-mode"]=["horizontal"];}this._setPaintOverrides();}getValueAndResolveTokens(t,e,n,r){const i=this.layout.get(t).evaluate(e,{},n,r),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||ni(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}
vendor: 4,138 bytes, line 36
36/g,((e,n)=>t&&n in t?String(t[n]):""))}(e.properties,i)}createBucket(t){return new vp(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of _p.paint.overridableProperties){if(!Ap.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),n=new Sp(e),r=new ei(n,e.property.specification);let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new ii("source",r):new si("composite",r,e.value.zoomStops),this.paint._values[t]=new Us(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,n){return !(!this.layout||e.isDataDriven()||n.isDataDriven())&&Ap.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const n=t.get("text-field"),r=_p.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(r.overrides&&r.overrides.hasOverride(e))return void(i=!0)};if("constant"===n.value.kind&&n.value.value instanceof De)s(n.value.value.sections);else if("source"===n.value.kind||"composite"===n.value.kind){const t=e=>{i||(e instanceof qe&&Ue(e.value)===qt?s(e.value.sections):e instanceof Tn?s(e.sections):e.eachChild(t));},e=n.value;e._styleExpression&&t(e._styleExpression.expression);}return i}}let Mp;var kp={get paint(){return Mp=Mp||new Hs({"background-color":new qs(vt.paint_background["background-color"]),"background-pattern":new Ys(vt.paint_background["background-pattern"]),"background-opacity":new qs(vt.paint_background["background-opacity"])})}};class Ip extends Ws{constructor(t,e){super(t,kp,e);}}class Ep extends Ws{constructor(t,e){super(t,{},e),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);},this.implementation=t;}is3D(){return "3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Tp{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle();};}trigger(){var t;this._triggered||(this._triggered=!0,null===(t=this._channel)||void 0===t||t.port1.postMessage(!0));}remove(){delete this._channel,this._methodToThrottle=()=>{};}}const Fp={once:!0},Dp=6371008.8;class Pp{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 Pp(L(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,n=this.lat*e,r=t.lat*e,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return Dp*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Pp)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Pp(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Pp(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const zp=2*Math.PI*Dp;function Bp(t){return zp*Math.cos(t*Math.PI/180)}function Cp(t){return (180+t)/360}function Vp(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Lp(t,e){return t/Bp(e)}function Op(t){return 360*t-180}function $p(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Rp(t,e){return t*Bp($p(e))}class Np{constructor(t,e,n=0){this.x=+t,this.y=+e,this.z=+n;}static fromLngLat(t,e=0){const n=Pp.convert(t);return new Np(Cp(n.lng),Vp(n.lat),Lp(e,n.lat))}toLngLat(){return new Pp(Op(this.x),$p(this.y))}toAltitude(){return Rp(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/zp*(t=$p(this.y),1/Math.cos(t*Math.PI/180)
36);var t;}}function Up(t,e,n){var r=2*Math.PI*6378137/256/Math.pow(2,n);return [t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}class jp{constructor(t,e,n){if(!function(t,e,n){return !(t<0||t>25||n<0||n>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,n))throw new Error(`x=${e}, y=${n}, 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=n,this.key=Xp(0,t,t,e,n);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,n){const r=(s=this.y,o=this.z,a=Up(256*(i=this.x),256*(s=Math.pow(2,o)-s-1),o),l=Up(256*(i+1),256*(s+1),o),a[0]+","+a[1]+","+l[0]+","+l[1]);var i,s,o,a,l;const u=function(t,e,n){let r,i="";for(let s=t;s>0;s--)r=1<<s-1,i+=(e&r?1:0)+(n&r?2:0);return i}(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"===n?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new n((t.x*e-this.x)*T,(t.y*e-this.y)*T)}toString(){return `${this.z}/${this.x}/${this.y}`}}class qp{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Xp(t,e.z,e.z,e.x,e.y);}}class Gp{constructor(t,e,n,r,i){if(this.terrainRttPosMatrix32f=null,t<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${n}`);this.overscaledZ=t,this.wrap=e,this.canonical=new jp(n,+r,+i),this.key=Xp(e,t,n,r,i);}clone(){return new Gp(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 Gp(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gp(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?Xp(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Xp(this.wrap*+e,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return !1;if(this.overscaledZ-t.overscaledZ<=0)return !1;if(0===t.overscaledZ)return this.overscaledZ>0;const e=this.canonical.z-t.canonical.z;return !(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new Gp(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return [new Gp(e,this.wrap,e,n,r),new Gp(e,this.wrap,e,n+1,r),new Gp(e,this.wrap,e,n,r+1),new Gp(e,this.wrap,e,n+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Gp(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Gp(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 qp(this.wrap,this.canonical)}toString(){return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Np(t.x-this.wrap,t.y))}normalizeCoordinates(t,e,n=8192){if(t>=0&&t<n&&e>=0&&e<n)return {tileID:this,x:t,y:e};const r=Math.floor(t/n),i=Math.floor(e/n),s=t-r*n,o=e-i*n,a=this.canonical.z,l=1<<a,u=this.canonical.y+i;if(u<0||u>=l)return null;let c=this.canonical.x+r,h=this.wrap;return c<0?(h-=Math.ceil(-c/l),c=(c%l+l)%l):c>=l&&(h+=Math.floor(c/l),c%=l),{tileID:new Gp(this.overscaledZ,h,a,c,u),x:s,y:o}}}function Xp(t,e,n,r,i){(t*=2)<0&&(t=-1*t-1);const s=1<<n;return (s*s*t+s*i+r).toString(36)+n.toString(36)+e.toString(36)}ps("CanonicalTileID",jp),ps("OverscaledTileID",Gp,{omit:["terrainRttPosMatrix32f"]});class Yp{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0;}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const e=new Yp;return e.extend(t(new n(this.minX,this.minY))),e.extend(t(new n(this.maxX,this.minY))),e.extend(t(new n(this.minX,this.maxY))),e.extend(t(new n(this.maxX,this.maxY))),e}static fromPoints(t){const e=new Yp;for(const n of t)e.extend(n);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return !this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return !this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Zp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const n=t[e];this._stringToNumber[n]=e,this._numberToString[e]=n;}}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 Hp{constructor(t,e,n,r,i){this.type="Feature",this._vectorTileFeature=t,this._x=n,this._y=r,this._z=e,this.properties=t.properties,this.id=i;}projectPoint(t,e,n,r){return [360*(t.x+e)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+n)/r)*Math.PI))-90]}projectLine(t,e,n,r){return t.map((t=>this.projectPoint(t,e,n,r)))}get geometry(){if(this._geometry)return this._geometry;const t=this._vectorTileFeature,e=t.extent*Math.pow(2,this._z),n=t.extent*this._x,r=t.extent*this._y,i=t.loadGeometry();switch(t.type){case 1:{const t=[];for(const e of i)t.push(e[0]);const s=this.projectLine(t,n,r,e);this._geometry=1===t.length?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{const t=i.map((t=>this.projectLine(t,n,r,e)));this._geometry=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t};break}case 3:{const t=zu(i),s=[];for(const i of t)s.push(i.map((t=>this.projectLine(t,n,r,e))));this._geometry=1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw new Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t;}toJSON(){const t={geometry:this.geometry};for(const e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"_x"!==e&&"_y"!==e&&"_z"!==e&&(t[e]=this[e]);return t}}class Wp{constructor(t,e,n){this._name=t,this.dataBuffer=e,"number"==typeof n?this._size=n:(this.nullabilityBuffer=n,this._size=n.size());}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Kp extends Wp{}class Jp extends Kp{getValueFromBuffer(t){return this.dataBuffer[t]}}class Qp extends Kp{getValueFromBuffer(t){return this.dataBuffer[t]}}class tf extends Wp{constructor(t,e,n,r){super(t,e,r),this.delta=n;}}class ef extends tf{constructor(t,e,n,r){super(t,Int32Array.of(e),n,r);}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class nf extends Wp{constructor(t,e,n,r){super(t,r?Int32Array.of(e):Uint32Array.of(e),n);}getValueFromBuffer(t){return this.dataBuffer[0]}}class rf{constructor(t,e,n,r,i=4096){this._name=t,this._geometryVector=e,this._idVector=n,this._propertyVectors=r,this._extent=i;}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((t=>[t.name,t])))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const t=[],e=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let r;if(this.idVector){const t=this.idVector.getValue(n);r=this.containsMaxSafeIntegerValues(this.idVector)&&null!==t?Number(t):t;}
36const i={coordinates:e[n],type:this.geometryVector.geometryType(n)},s={};for(const t of this.propertyVectors){if(!t)continue;const e=t.name,r=t.getValue(n);null!==r&&(s[e]=r);}t.push({id:r,geometry:i,properties:s});}return t}containsMaxSafeIntegerValues(t){return t instanceof Jp||t instanceof nf||t instanceof ef||t instanceof Qp}}class sf{constructor(t){this.value=t;}get(){return this.value}set(t){this.value=t;}increment(){return this.value++}add(t){this.value+=t;}}var of,af;!function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE";}(of||(of={})),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT",t.ALP="ALP";}(af||(af={}));const lf=new Uint32Array(33);lf[0]=0;for(let t=1;t<=32;t++)lf[t]=32===t?4294967295:4294967295>>>32-t;const uf=lf,cf=256;function hf(t,e){return t-t%e}function pf(t){const e=t>>>0;return ((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const ff=function(){if(!Number.isFinite(65536))return 65536;const t=hf(Math.floor(65536),cf);return 0===t?cf:t}(),df=3*ff/cf+ff|0;function yf(){const t=new Uint8Array(df);return {dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function mf(t,e,n,r,i){switch(i){case 1:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0;n[i++]=e>>>0&1,n[i++]=e>>>1&1,n[i++]=e>>>2&1,n[i++]=e>>>3&1,n[i++]=e>>>4&1,n[i++]=e>>>5&1,n[i++]=e>>>6&1,n[i++]=e>>>7&1,n[i++]=e>>>8&1,n[i++]=e>>>9&1,n[i++]=e>>>10&1,n[i++]=e>>>11&1,n[i++]=e>>>12&1,n[i++]=e>>>13&1,n[i++]=e>>>14&1,n[i++]=e>>>15&1,n[i++]=e>>>16&1,n[i++]=e>>>17&1,n[i++]=e>>>18&1,n[i++]=e>>>19&1,n[i++]=e>>>20&1,n[i++]=e>>>21&1,n[i++]=e>>>22&1,n[i++]=e>>>23&1,n[i++]=e>>>24&1,n[i++]=e>>>25&1,n[i++]=e>>>26&1,n[i++]=e>>>27&1,n[i++]=e>>>28&1,n[i++]=e>>>29&1,n[i++]=e>>>30&1,n[i++]=e>>>31&1;}}(t,e,n,r);break;case 2:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0;n[i++]=e>>>0&3,n[i++]=e>>>2&3,n[i++]=e>>>4&3,n[i++]=e>>>6&3,n[i++]=e>>>8&3,n[i++]=e>>>10&3,n[i++]=e>>>12&3,n[i++]=e>>>14&3,n[i++]=e>>>16&3,n[i++]=e>>>18&3,n[i++]=e>>>20&3,n[i++]=e>>>22&3,n[i++]=e>>>24&3,n[i++]=e>>>26&3,n[i++]=e>>>28&3,n[i++]=e>>>30&3,n[i++]=r>>>0&3,n[i++]=r>>>2&3,n[i++]=r>>>4&3,n[i++]=r>>>6&3,n[i++]=r>>>8&3,n[i++]=r>>>10&3,n[i++]=r>>>12&3,n[i++]=r>>>14&3,n[i++]=r>>>16&3,n[i++]=r>>>18&3,n[i++]=r>>>20&3,n[i++]=r>>>22&3,n[i++]=r>>>24&3,n[i++]=r>>>26&3,n[i++]=r>>>28&3,n[i++]=r>>>30&3;}}(t,e,n,r);break;case 3:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0;n[i++]=e>>>0&7,n[i++]=e>>>3&7,n[i++]=e>>>6&7,n[i++]=e>>>9&7,n[i++]=e>>>12&7,n[i++]=e>>>15&7,n[i++]=e>>>18&7,n[i++]=e>>>21&7,n[i++]=e>>>24&7,n[i++]=e>>>27&7,n[i++]=7&(e>>>30|(1&r)<<2),n[i++]=r>>>1&7,n[i++]=r>>>4&7,n[i++]=r>>>7&7,n[i++]=r>>>10&7,n[i++]=r>>>13&7,n[i++]=r>>>16&7,n[i++]=r>>>19&7,n[i++]=r>>>22&7,n[i++]=r>>>25&7,n[i++]=r>>>28&7,n[i++]=7&(r>>>31|(3&o)<<1),n[i++]=o>>>2&7,n[i++]=o>>>5&7,n[i++]=o>>>8&7,n[i++]=o>>>11&7,n[i++]=o>>>14&7,n[i++]=o>>>17&7,n[i++]=o>>>20&7,n[i++]=o>>>23&7,n[i++]=o>>>26&7,n[i++]=o>>>29&7;}}(t,e,n,r);break;case 4:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0;n[i++]=e>>>0&15,n[i++]=e>>>4&15,n[i++]=e>>>8&15,n[i++]=e>>>12&15,n[i++]=e>>>16&15,n[i++]=e>>>20&15,n[i++]=e>>>24&15,n[i++]=e>>>28&15,n[i++]=r>>>0&15,n[i++]=r>>>4&15,n[i++]=r>>>8&15,n[i++]=r>>>12&15,n[i++]=r>>>16&15,n[i++]=r>>>20&15,n[i++]=r>>>24&15,n[i++]=r>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=a>>>0&15,n[i++]=a>>>4&15,n[i++]=a>>>8&15,n[i++]=a>>>12&15,n[i++]=a>>>16&15,n[i++]=a>>>20&15,n[i++]=a>>>24&15,n[i++]=a>>>28&15;}}(t,e,n,r);break;case 5:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0;n[i++]=e>>>0&31,n[i++]=e>>>5&31,n[i++]=e>>>10&31,n[i++]=e>>>15&31,n[i++]=e>>>20&31,n[i++]=e>>>25&31,n[i++]=31&(e>>>30|(7&r)<<2),n[i++]=r>>>3&31,n[i++]=r>>>8&31,n[i++]=r>>>13&31,n[i++]=r>>>18&31,n[i++]=r>>>23&31,n[i++]=31&(r>>>28|(1&o)<<4),n[i++]=o>>>1&31,n[i++]=o>>>6&31,n[i++]=o>>>11&31,n[i++]=o>>>16&31,n[i++]=o>>>21&31,n[i++]=o>>>
3626&31,n[i++]=31&(o>>>31|(15&a)<<1),n[i++]=a>>>4&31,n[i++]=a>>>9&31,n[i++]=a>>>14&31,n[i++]=a>>>19&31,n[i++]=a>>>24&31,n[i++]=31&(a>>>29|(3&l)<<3),n[i++]=l>>>2&31,n[i++]=l>>>7&31,n[i++]=l>>>12&31,n[i++]=l>>>17&31,n[i++]=l>>>22&31,n[i++]=l>>>27&31;}}(t,e,n,r);break;case 6:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0;n[i++]=e>>>0&63,n[i++]=e>>>6&63,n[i++]=e>>>12&63,n[i++]=e>>>18&63,n[i++]=e>>>24&63,n[i++]=63&(e>>>30|(15&r)<<2),n[i++]=r>>>4&63,n[i++]=r>>>10&63,n[i++]=r>>>16&63,n[i++]=r>>>22&63,n[i++]=63&(r>>>28|(3&o)<<4),n[i++]=o>>>2&63,n[i++]=o>>>8&63,n[i++]=o>>>14&63,n[i++]=o>>>20&63,n[i++]=o>>>26&63,n[i++]=a>>>0&63,n[i++]=a>>>6&63,n[i++]=a>>>12&63,n[i++]=a>>>18&63,n[i++]=a>>>24&63,n[i++]=63&(a>>>30|(15&l)<<2),n[i++]=l>>>4&63,n[i++]=l>>>10&63,n[i++]=l>>>16&63,n[i++]=l>>>22&63,n[i++]=63&(l>>>28|(3&u)<<4),n[i++]=u>>>2&63,n[i++]=u>>>8&63,n[i++]=u>>>14&63,n[i++]=u>>>20&63,n[i++]=u>>>26&63;}}(t,e,n,r);break;case 7:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0;n[i++]=e>>>0&127,n[i++]=e>>>7&127,n[i++]=e>>>14&127,n[i++]=e>>>21&127,n[i++]=127&(e>>>28|(7&r)<<4),n[i++]=r>>>3&127,n[i++]=r>>>10&127,n[i++]=r>>>17&127,n[i++]=r>>>24&127,n[i++]=127&(r>>>31|(63&o)<<1),n[i++]=o>>>6&127,n[i++]=o>>>13&127,n[i++]=o>>>20&127,n[i++]=127&(o>>>27|(3&a)<<5),n[i++]=a>>>2&127,n[i++]=a>>>9&127,n[i++]=a>>>16&127,n[i++]=a>>>23&127,n[i++]=127&(a>>>30|(31&l)<<2),n[i++]=l>>>5&127,n[i++]=l>>>12&127,n[i++]=l>>>19&127,n[i++]=127&(l>>>26|(1&u)<<6),n[i++]=u>>>1&127,n[i++]=u>>>8&127,n[i++]=u>>>15&127,n[i++]=u>>>22&127,n[i++]=127&(u>>>29|(15&c)<<3),n[i++]=c>>>4&127,n[i++]=c>>>11&127,n[i++]=c>>>18&127,n[i++]=c>>>25&127;}}(t,e,n,r);break;case 8:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<8;e++){const e=t[s++]>>>0,r=t[s++]>>>0,o=t[s++]>>>0,a=t[s++]>>>0,l=t[s++]>>>0,u=t[s++]>>>0,c=t[s++]>>>0,h=t[s++]>>>0;n[i++]=e>>>0&255,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=r>>>0&255,n[i++]=r>>>8&255,n[i++]=r>>>16&255,n[i++]=r>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=a>>>0&255,n[i++]=a>>>8&255,n[i++]=a>>>16&255,n[i++]=a>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=h>>>0&255,n[i++]=h>>>8&255,n[i++]=h>>>16&255,n[i++]=h>>>24&255;}}(t,e,n,r);break;case 16:!function(t,e,n,r){let i=r,s=e;for(let e=0;e<128;e++){const e=t[s++]>>>0;n[i++]=65535&e,n[i++]=e>>>16&65535;}}(t,e,n,r);break;default:!function(t,e,n,r,i){const s=uf[i]>>>0;let o=e,a=0,l=t[o]>>>0,u=r;for(let e=0;e<8;e++){for(let e=0;e<32;e++)if(a+i<=32)n[u+e]=l>>>a&s,a+=i,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else {const r=32-a,c=l>>>a;o++,l=t[o]>>>0;const h=i-r;n[u+e]=(c|(l&-1>>>32-h>>>0)<<r)&s,a=h;}u+=32,a=0,e<7&&(l=t[o]>>>0);}}(t,e,n,r,i);}return e+(i<<3)|0}function gf(t,e,n,r){if(n+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${e})`);const i=t[n++],s=t[n++];if(i>32)throw new Error(`FastPFOR decode: invalid bitWidth=${i} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return {bitWidth:i,exceptionCount:s,bytePosIn:n}}function xf(t,e,n,r,i,s,o,a,l){const{maxBits:u,exceptionBitWidth:c,bytePosIn:h}=function(t,e,n,r,i,s){if(n+1>e)throw new Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${n}, byteSize=${e})`);const o=t[n++];if(o<r||o>32)throw new Error(`FastPFOR decode: invalid maxBits=${o} at block=${s} (bitWidth=${r}, expected ${r}..32)`);const a=o-r|0;if(a<1||a>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${a} at block=${s} (bitWidth=${r}, maxBits=${o})`);if(n+i>e)throw new Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${i}, have=${e-n})`);
36return {maxBits:o,exceptionBitWidth:a,bytePosIn:n}}(i,s,o,n,r,l);if(o=h,1===c){const s=1<<n;for(let n=0;n<r;n=n+1|0)t[i[o++]+e|0]|=s;return o}const p=a.dataToBePacked[c];if(!p)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c} (bitWidth=${n}, maxBits=${u}) at block ${l}`);const f=a.dataPointers;let d=0|f[c];const y=0|a.exceptionSizes[c];if(d+r>y)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c} (ptr=${d}, need ${r}, size=${y}) at block ${l}`);for(let s=0;s<r;s=s+1|0){const r=i[o++],s=0|p[d++];t[r+e|0]|=s<<n;}return f[c]=d,o}function vf(t,e,n,r,i,s){const o=0|n,a=0|t[o];if(a<=0||o+a>t.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);const l=o+1|0,u=o+a|0,c=t[u]>>>0,h=c+3>>>2,p=u+1,f=p+h;if(f>=t.length)throw new Error(`FastPFOR decode: invalid byteSize=${c} (metaInts=${h}, pageStart=${o}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);const d=function(t,e,n,r){r.byteContainer.length<n&&(r.byteContainer=new Uint8Array(2*n),r.byteContainerI32=void 0);const i=r.byteContainer,s=n>>>2;if(3&i.byteOffset)for(let n=0;n<s;n=n+1|0){const r=0|t[e+n|0],s=n<<2;i[s]=255&r,i[s+1|0]=r>>>8&255,i[s+2|0]=r>>>16&255,i[s+3|0]=r>>>24&255;}else {let n=r.byteContainerI32;(!n||n.buffer!==i.buffer||n.byteOffset!==i.byteOffset||n.length<s)&&(n=r.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),n.set(t.subarray(e,e+s));}const o=3&n;if(o>0){const n=0|t[e+s|0],r=s<<2;for(let t=0;t<o;t=t+1|0)i[r+t|0]=n>>>(t<<3)&255;}return i}(t,p,c,s),y=c,m=function(t,e,n){const r=0|t[e++],i=n.dataToBePacked;for(let s=2;s<=32;s=s+1|0){if(!(r>>>s-1&1))continue;if(e>=t.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);const o=t[e++]>>>0,a=hf(o+31,32),l=o*s+31>>>5;if(e+l>t.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${o}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=i[s];(!u||u.length<a)&&(u=i[s]=new Uint32Array(a));let c=0;for(;c<o;c=c+32|0)bf(t,e,u,c,s),e=e+s|0;e=e-((c-o|0)*s>>>5)|0,n.exceptionSizes[s]=o;}return e}(t,f,s);return s.dataPointers.fill(0),function(t,e,n,r,i,s,o,a,l,u){let c=0|n,h=0;for(let e=0;e<o;e=e+1|0){const n=gf(a,l,h,e);h=n.bytePosIn;const r=n.bitWidth,o=n.exceptionCount,p=s+e*cf|0;switch(r){case 0:i.fill(0,p,p+cf);break;case 32:for(let e=0;e<cf;e=e+1|0)i[p+e|0]=0|t[c+e|0];c=c+cf|0;break;default:c=mf(t,c,i,p,r);}o>0&&(h=xf(i,p,r,o,a,l,h,u,e));}if(c!==r)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${n}, consumedPackedEnd=${c}, expectedPackedEnd=${r}, packedWords=${r-n}, encoded.length=${t.length})`)}(t,o,l,u,e,0|r,i/cf|0,d,y,s),m}function bf(t,e,n,r,i){switch(i){case 2:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0;n[i++]=s>>>0&3,n[i++]=s>>>2&3,n[i++]=s>>>4&3,n[i++]=s>>>6&3,n[i++]=s>>>8&3,n[i++]=s>>>10&3,n[i++]=s>>>12&3,n[i++]=s>>>14&3,n[i++]=s>>>16&3,n[i++]=s>>>18&3,n[i++]=s>>>20&3,n[i++]=s>>>22&3,n[i++]=s>>>24&3,n[i++]=s>>>26&3,n[i++]=s>>>28&3,n[i++]=s>>>30&3,n[i++]=o>>>0&3,n[i++]=o>>>2&3,n[i++]=o>>>4&3,n[i++]=o>>>6&3,n[i++]=o>>>8&3,n[i++]=o>>>10&3,n[i++]=o>>>12&3,n[i++]=o>>>14&3,n[i++]=o>>>16&3,n[i++]=o>>>18&3,n[i++]=o>>>20&3,n[i++]=o>>>22&3,n[i++]=o>>>24&3,n[i++]=o>>>26&3,n[i++]=o>>>28&3,n[i]=o>>>30&3;}(t,e,n,r);case 3:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0;n[i++]=s>>>0&7,n[i++]=s>>>3&7,n[i++]=s>>>6&7,n[i++]=s>>>9&7,n[i++]=s>>>12&7,n[i++]=s>>>15&7,n[i++]=s>>>18&7,n[i++]=s>>>21&7,n[i++]=s>>>24&7,n[i++]=s>>>27&7,n[i++]=7&(s>>>30|(1&o)<<2),n[i++]=o>>>1&7,n[i++]=o>>>4&7,n[i++]=o>>>7&7,n[i++]=o>>>10&7,n[i++]=o>>>13&7,n[i++]=o>>>16&7,n[i++]=o>>>19&7,n[i++]=o>>>22&7,n[i++]=o>>>25&7,n[i++]=o>>>28&7,n[i++]=7&(o>>>31|(3&a)<<1),n[i++]=a>>>2&7,n[i++]=a>>>5&7,n[i++]=a>>>8&7,n[i++]=a>>>11&7,n[i++]=a>>>14&7,n[i++]=a>>>17&7,n[i++]=a>>>20&7,n[i++]=a>>>23&7,n[i++]=a>>>
3626&7,n[i]=a>>>29&7;}(t,e,n,r);case 4:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0;n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=a>>>0&15,n[i++]=a>>>4&15,n[i++]=a>>>8&15,n[i++]=a>>>12&15,n[i++]=a>>>16&15,n[i++]=a>>>20&15,n[i++]=a>>>24&15,n[i++]=a>>>28&15,n[i++]=l>>>0&15,n[i++]=l>>>4&15,n[i++]=l>>>8&15,n[i++]=l>>>12&15,n[i++]=l>>>16&15,n[i++]=l>>>20&15,n[i++]=l>>>24&15,n[i]=l>>>28&15;}(t,e,n,r);case 5:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;n[i++]=s>>>0&31,n[i++]=s>>>5&31,n[i++]=s>>>10&31,n[i++]=s>>>15&31,n[i++]=s>>>20&31,n[i++]=s>>>25&31,n[i++]=31&(s>>>30|(7&o)<<2),n[i++]=o>>>3&31,n[i++]=o>>>8&31,n[i++]=o>>>13&31,n[i++]=o>>>18&31,n[i++]=o>>>23&31,n[i++]=31&(o>>>28|(1&a)<<4),n[i++]=a>>>1&31,n[i++]=a>>>6&31,n[i++]=a>>>11&31,n[i++]=a>>>16&31,n[i++]=a>>>21&31,n[i++]=a>>>26&31,n[i++]=31&(a>>>31|(15&l)<<1),n[i++]=l>>>4&31,n[i++]=l>>>9&31,n[i++]=l>>>14&31,n[i++]=l>>>19&31,n[i++]=l>>>24&31,n[i++]=31&(l>>>29|(3&u)<<3),n[i++]=u>>>2&31,n[i++]=u>>>7&31,n[i++]=u>>>12&31,n[i++]=u>>>17&31,n[i++]=u>>>22&31,n[i]=u>>>27&31;}(t,e,n,r);case 6:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0;n[i++]=s>>>0&63,n[i++]=s>>>6&63,n[i++]=s>>>12&63,n[i++]=s>>>18&63,n[i++]=s>>>24&63,n[i++]=63&(s>>>30|(15&o)<<2),n[i++]=o>>>4&63,n[i++]=o>>>10&63,n[i++]=o>>>16&63,n[i++]=o>>>22&63,n[i++]=63&(o>>>28|(3&a)<<4),n[i++]=a>>>2&63,n[i++]=a>>>8&63,n[i++]=a>>>14&63,n[i++]=a>>>20&63,n[i++]=a>>>26&63,n[i++]=l>>>0&63,n[i++]=l>>>6&63,n[i++]=l>>>12&63,n[i++]=l>>>18&63,n[i++]=l>>>24&63,n[i++]=63&(l>>>30|(15&u)<<2),n[i++]=u>>>4&63,n[i++]=u>>>10&63,n[i++]=u>>>16&63,n[i++]=u>>>22&63,n[i++]=63&(u>>>28|(3&c)<<4),n[i++]=c>>>2&63,n[i++]=c>>>8&63,n[i++]=c>>>14&63,n[i++]=c>>>20&63,n[i]=c>>>26&63;}(t,e,n,r);case 7:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0;n[i++]=s>>>0&127,n[i++]=s>>>7&127,n[i++]=s>>>14&127,n[i++]=s>>>21&127,n[i++]=127&(s>>>28|(7&o)<<4),n[i++]=o>>>3&127,n[i++]=o>>>10&127,n[i++]=o>>>17&127,n[i++]=o>>>24&127,n[i++]=127&(o>>>31|(63&a)<<1),n[i++]=a>>>6&127,n[i++]=a>>>13&127,n[i++]=a>>>20&127,n[i++]=127&(a>>>27|(3&l)<<5),n[i++]=l>>>2&127,n[i++]=l>>>9&127,n[i++]=l>>>16&127,n[i++]=l>>>23&127,n[i++]=127&(l>>>30|(31&u)<<2),n[i++]=u>>>5&127,n[i++]=u>>>12&127,n[i++]=u>>>19&127,n[i++]=127&(u>>>26|(1&c)<<6),n[i++]=c>>>1&127,n[i++]=c>>>8&127,n[i++]=c>>>15&127,n[i++]=c>>>22&127,n[i++]=127&(c>>>29|(15&h)<<3),n[i++]=h>>>4&127,n[i++]=h>>>11&127,n[i++]=h>>>18&127,n[i]=h>>>25&127;}(t,e,n,r);case 8:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0;n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=a>>>0&255,n[i++]=a>>>8&255,n[i++]=a>>>16&255,n[i++]=a>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=h>>>0&255,n[i++]=h>>>8&255,n[i++]=h>>>16&255,n[i++]=h>>>24&255,n[i++]=p>>>0&255,n[i++]=p>>>8&255,n[i++]=p>>>16&255,n[i]=p>>>24&255;}(t,e,n,r);case 9:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;n[i++]=s>>>0&511,n[i++]=s>>>9&511,n[i++]=s>>>18&511,n[i++]=511&(s>>>27|(15&o)<<5),n[i++]=o>>>4&511,n[i++]=o>>>13&511,n[i++]=o>>>22&511,n[i++]=511&(o>>>31|(255&a)<<1),n[i++]=a>>>8&511,n[i++]=a>>>17&511,n[i++]=511&(a>>>26|(7&l)<<6),n[i++]=l>>>3&511,n[i++]=l>>>12&511,n[i++]=l>>>21&511,n[i++]=511&(l>>>30|(127&u)<<2),n[i++]=u>>>7&511,n[i++]=u>>>16&511,n[i++]=511&(u>>>25|(3&c)<<7),n[i++]=c>>>2&511,n[i++]=c>>>11&511,n[i++]=c>>>20&511,n[i++]=511&(c>>>29|(63&h)<<3),n[i++]=h>>>6&511,n[i++]=h>>>15&511,n[i++]=511&(h>>>24|(1&p)<<8),n[i++]=p>>>1&511,n[i++]=p>>>10&511,n[i++]=p>>>19&511,n[i++]=511&(p>>>28|(31&f)<<4),n[i++]=f>>>5&511,n[i++]=f>>>14&511,n[i]=f>>>23&511;}(t,e,n,r);case 10:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;n[i++]=s>>>0&1023,n[i++]=s>>>10&1023,n[i++]=s>>>20&1023,n[i++]=1023&(s>>>30|(255&o)<<2),n[i++]=o>>>8&1023,n[i++]=o>>>18&1023,n[i++]=1023&(o>>>28|(63&a)<<4),n[i++]=a>>>6&1023,n[i++]=a>>>16&1023,n[i++]=1023&(a>>>26|(15&l)<<6),n[i++]=l>>>4&1023,n[i++]=l>>>14&1023,n[i++]=1023&(l>>>24|(3&u)<<8),n[i++]=u>>>2&1023,n[i++]=u>>>12&1023,n[i++]=u>>>22&1023,n[i++]=c>>>0&1023,n[i++]=c>>>10&1023,n[i++]=c>>>20&1023,n[i++]=1023&(c>>>30|(255&h)<<2),n[i++]=h>>>8&1023,n[i++]=h>>>18&1023,n[i++]=1023&(h>>>28|(63&p)<<4),n[i++]=p>>>6&1023,n[i++]=p>>>16&1023,n[i++]=1023&(p>>>
3626|(15&f)<<6),n[i++]=f>>>4&1023,n[i++]=f>>>14&1023,n[i++]=1023&(f>>>24|(3&d)<<8),n[i++]=d>>>2&1023,n[i++]=d>>>12&1023,n[i]=d>>>22&1023;}(t,e,n,r);case 11:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;n[i++]=s>>>0&2047,n[i++]=s>>>11&2047,n[i++]=2047&(s>>>22|(1&o)<<10),n[i++]=o>>>1&2047,n[i++]=o>>>12&2047,n[i++]=2047&(o>>>23|(3&a)<<9),n[i++]=a>>>2&2047,n[i++]=a>>>13&2047,n[i++]=2047&(a>>>24|(7&l)<<8),n[i++]=l>>>3&2047,n[i++]=l>>>14&2047,n[i++]=2047&(l>>>25|(15&u)<<7),n[i++]=u>>>4&2047,n[i++]=u>>>15&2047,n[i++]=2047&(u>>>26|(31&c)<<6),n[i++]=c>>>5&2047,n[i++]=c>>>16&2047,n[i++]=2047&(c>>>27|(63&h)<<5),n[i++]=h>>>6&2047,n[i++]=h>>>17&2047,n[i++]=2047&(h>>>28|(127&p)<<4),n[i++]=p>>>7&2047,n[i++]=p>>>18&2047,n[i++]=2047&(p>>>29|(255&f)<<3),n[i++]=f>>>8&2047,n[i++]=f>>>19&2047,n[i++]=2047&(f>>>30|(511&d)<<2),n[i++]=d>>>9&2047,n[i++]=d>>>20&2047,n[i++]=2047&(d>>>31|(1023&y)<<1),n[i++]=y>>>10&2047,n[i]=y>>>21&2047;}(t,e,n,r);case 12:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;n[i++]=s>>>0&4095,n[i++]=s>>>12&4095,n[i++]=4095&(s>>>24|(15&o)<<8),n[i++]=o>>>4&4095,n[i++]=o>>>16&4095,n[i++]=4095&(o>>>28|(255&a)<<4),n[i++]=a>>>8&4095,n[i++]=a>>>20&4095,n[i++]=l>>>0&4095,n[i++]=l>>>12&4095,n[i++]=4095&(l>>>24|(15&u)<<8),n[i++]=u>>>4&4095,n[i++]=u>>>16&4095,n[i++]=4095&(u>>>28|(255&c)<<4),n[i++]=c>>>8&4095,n[i++]=c>>>20&4095,n[i++]=h>>>0&4095,n[i++]=h>>>12&4095,n[i++]=4095&(h>>>24|(15&p)<<8),n[i++]=p>>>4&4095,n[i++]=p>>>16&4095,n[i++]=4095&(p>>>28|(255&f)<<4),n[i++]=f>>>8&4095,n[i++]=f>>>20&4095,n[i++]=d>>>0&4095,n[i++]=d>>>12&4095,n[i++]=4095&(d>>>24|(15&y)<<8),n[i++]=y>>>4&4095,n[i++]=y>>>16&4095,n[i++]=4095&(y>>>28|(255&m)<<4),n[i++]=m>>>8&4095,n[i]=m>>>20&4095;}(t,e,n,r);case 16:return void function(t,e,n,r){let i=r;const s=t[e]>>>0,o=t[e+1]>>>0,a=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,c=t[e+5]>>>0,h=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;n[i++]=s>>>0&65535,n[i++]=s>>>16&65535,n[i++]=o>>>0&65535,n[i++]=o>>>16&65535,n[i++]=a>>>0&65535,n[i++]=a>>>16&65535,n[i++]=l>>>0&65535,n[i++]=l>>>16&65535,n[i++]=u>>>0&65535,n[i++]=u>>>16&65535,n[i++]=c>>>0&65535,n[i++]=c>>>16&65535,n[i++]=h>>>0&65535,n[i++]=h>>>16&65535,n[i++]=p>>>0&65535,n[i++]=p>>>16&65535,n[i++]=f>>>0&65535,n[i++]=f>>>16&65535,n[i++]=d>>>0&65535,n[i++]=d>>>16&65535,n[i++]=y>>>0&65535,n[i++]=y>>>16&65535,n[i++]=m>>>0&65535,n[i++]=m>>>16&65535,n[i++]=g>>>0&65535,n[i++]=g>>>16&65535,n[i++]=x>>>0&65535,n[i++]=x>>>16&65535,n[i++]=v>>>0&65535,n[i++]=v>>>16&65535,n[i++]=b>>>0&65535,n[i]=b>>>16&65535;}(t,e,n,r);case 32:for(let i=0;i<32;i=i+1|0)n[r+i|0]=0|t[e+i|0];return}const s=uf[i]>>>0;let o=e,a=0,l=t[o]>>>0;for(let e=0;e<32;e++)if(a+i<=32)n[r+e]=l>>>a&s,a+=i,32===a&&(a=0,o++,31!==e&&(l=t[o]>>>0));else {const u=32-a,c=l>>>a;o++,l=t[o]>>>0,n[r+e]=(c|(l&uf[i-u]>>>0)<<u)&s,a=i-u;}}function wf(t,e,n){const r=new Uint32Array(n);let i=0,s=e.get();for(let e=0;e<r.length;e++){let e=t[s++],n=127&e;e<128||(e=t[s++],n|=(127&e)<<7,e<128||(e=t[s++],n|=(127&e)<<14,e<128||(e=t[s++],n|=(127&e)<<21,e<128||(e=t[s++],n|=(15&e)<<28)))),r[i++]=n;}return e.set(s),r}function _f(t,e,n){const r=new BigUint64Array(n);for(let n=0;n<r.length;n++)r[n]=Sf(t,e);return r}function Sf(t,e){let n=0n,r=0,i=e.get();for(;i<t.length;){const e=t[i++];if(n|=BigInt(127&e)<<BigInt(r),!(128&e))break;if(r+=7,r>=64)throw new Error("Varint too long")}return e.set(i),n}function Af(t,e){let n,r;return r=t[e.get()],e.increment(),n=127&r,r<128?n:(r=t[e.get()],e.increment(),n|=(127&r)<<7,r<128?n:(r=t[e.get()],e.increment(),n|=(127&r)<<14,r<128?n:(r=t[e.get()],e.increment(),n|=(127&r)<<21,r<128?n:(r=t[e.get()],n|=(15&r)<<28,function(t,e,n){let r,i;if(i=e[n.get()],n.increment(),r=(112&i)>>4,i<128)return 4294967296*r+(t>>>0);if(i=e[n.get()],n.increment(),r|=(127&i)<<3,i<128)return 4294967296*r+(t>>>0);if(i=e[n.get()],n.increment(),r|=(127&i)<<10,i<128)return 4294967296*r+(t>>>0);if(i=e[n.get()],n.increment(),r|=(127&i)<<17,i<128)return 4294967296*r+(t>>>0);if(i=e[n.get()],n.increment(),r|=(127&i)<<24,i<128)return 4294967296*r+(t>>>0);if(i=e[n.get()],n.increment(),r|=(1&i)<<31,i<128)return 4294967296*r+(t>>>0);throw new Error("Expected varint not more than 10 bytes")}(n,t,e)))))}function Mf(t){return t>>>1^-(1&t)}function kf(t){return t>>1n^-(1n&t)}function If(t){return t%2==1?(t+1)/-2:t/2}function Ef(t,e,n){if(void 0===n){n=0;for(let r=0;r<e;r++)n+=t[r];}
36const r=new Uint32Array(n);let i=0;for(let n=0;n<e;n++){const s=t[n];r.fill(t[n+e],i,i+s),i+=s;}return r}function Tf(t,e,n){if(void 0===n){n=0;for(let r=0;r<e;r++)n+=Number(t[r]);}const r=new BigUint64Array(n);let i=0;for(let n=0;n<e;n++){const s=Number(t[n]);r.fill(t[n+e],i,i+s),i+=s;}return r}function Ff(t,e,n){const r=new Float64Array(n);let i=0;for(let n=0;n<e;n++){const s=t[n];r.fill(t[n+e],i,i+s),i+=s;}return r}function Df(t){const e=new Int32Array(t.length);e[0]=Mf(t[0]);const n=t.length/4*4;let r=1;if(n>=4)for(;r<n-4;r+=4){const n=t[r+1],i=t[r+2],s=t[r+3];e[r]=Mf(t[r])+e[r-1],e[r+1]=Mf(n)+e[r],e[r+2]=Mf(i)+e[r+1],e[r+3]=Mf(s)+e[r+2];}for(;r!==t.length;++r)e[r]=Mf(t[r])+e[r-1];return e}function Pf(t){const e=new BigInt64Array(t.length);e[0]=kf(t[0]);const n=t.length/4*4;let r=1;if(n>=4)for(;r<n-4;r+=4){const n=t[r+1],i=t[r+2],s=t[r+3];e[r]=kf(t[r])+e[r-1],e[r+1]=kf(n)+e[r],e[r+2]=kf(i)+e[r+1],e[r+3]=kf(s)+e[r+2];}for(;r!==e.length;++r)e[r]=kf(t[r])+e[r-1];return e}function zf(t){const e=t.length/4*4;let n=1;if(e>=4)for(let r=t[0];n<e-4;n+=4)r=t[n]+=r,r=t[n+1]+=r,r=t[n+2]+=r,r=t[n+3]+=r;for(;n!==t.length;)t[n]+=t[n-1],++n;}var Bf,Cf,Vf,Lf,Of,$f,Rf,Nf;function Uf(t,e){const n=function(t,e){const n=t[e.get()],r=Object.values(Bf)[n>>4];let i=null;switch(r){case Bf.DATA:i={dictionaryType:Object.values(Cf)[15&n]};break;case Bf.OFFSET:i={offsetType:Object.values(Vf)[15&n]};break;case Bf.LENGTH:i={lengthType:Object.values(Lf)[15&n]};}e.increment();const s=t[e.get()],o=Object.values(of)[s>>5],a=Object.values(of)[s>>2&7],l=Object.values(af)[3&s];e.increment();const u=wf(t,e,2),c=u[0];return {physicalStreamType:r,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:c,byteLength:u[1],decompressedCount:c}}(t,e);return n.logicalLevelTechnique1===of.MORTON?function(t,e,n){const r=wf(e,n,2);return {physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(n,t,e):of.RLE!==n.logicalLevelTechnique1&&of.RLE!==n.logicalLevelTechnique2||af.NONE===n.physicalLevelTechnique?n:function(t,e,n){const r=wf(e,n,2);return {physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(n,t,e)}!function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH";}(Bf||(Bf={})),function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST";}(Cf||(Cf={})),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY";}(Vf||(Vf={})),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY";}(Lf||(Lf={})),function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY";}(Of||(Of={}));class jf{constructor(t,e){this.values=t,this._size=e;}get(t){const e=Math.floor(t/8);return 1==(this.values[e]>>t%8&1)}set(t,e){const n=Math.floor(t/8);this.values[n]=this.values[n]|(e?1:0)<<t%8;}getInt(t){const e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function qf(t,e,n){if(!e)return t;const r=e.size(),i=new(0,t.constructor)(r);let s=0;for(let o=0;o<r;o++)i[o]=e.get(o)?t[s++]:n;return i}function Gf(t,e,n,r,i){return function(t,e,n,r){let i;switch(e.logicalLevelTechnique1){case of.DELTA:if(e.logicalLevelTechnique2===of.RLE){const n=e;if(!r)return function(t,e,n){const r=new Int32Array(n);let i=0,s=0;for(let n=0;n<e;n++){const o=t[n],a=Mf(t[n+e]);for(let t=0;t<o;t++)s+=a,r[i++]=s;}return r}(t,n.runs,n.numRleValues);i=Df(t=Ef(t,n.runs,n.numRleValues));}else i=Df(t);break;case of.RLE:i=function(t,e,n){if(void 0===n){n=0;for(let r=0;r<e;r++)n+=t[r];}const r=new Int32Array(n);let i=0;for(let n=0;n<e;n++){const s=t[n];let o=t[n+e];o=Mf(o),r.fill(o,i,i+s),i+=s;}return r}(t,e.runs,e.numRleValues);break;case of.MORTON:zf(t),i=new Int32Array(t);break;case of.COMPONENTWISE_DELTA:i=function(t){if(t.length<2)return new Int32Array(t);const e=new Int32Array(t.length);e[0]=Mf(t[0]),e[1]=Mf(t[1]);const n=t.length/4*4;let r=2;if(n>=4)for(;r<n-4;r+=4){const n=t[r+1],i=t[r+2],s=t[r+3];e[r]=Mf(t[r])+e[r-2],e[r+1]=Mf(n)+e[r-1],e[r+2]=Mf(i)+e[r],e[r+3]=Mf(s)+e[r+1];}for(;r!==t.length;r+=2)e[r]=Mf(t[r])+e[r-2],e[r+1]=Mf(t[r+1])+e[r-1];return e}(t);break;case of.NONE:i=function(t){const e=new Int32Array(t.length);for(let n=0;n<t.length;n++)e[n]=Mf(t[n]);return e}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?qf(i,r,0):i}(Zf(t,e,n),n,0,i)}function Xf(t,e,n,r,i){return function(t,e,n,r){let i;switch(e.logicalLevelTechnique1){case of.DELTA:i=function(t){const e=new Uint32Array(t.length);e[0]=Mf(t[0])>>>0;for(let n=1;n<t.length;n++)e[n]=e[n-1]+Mf(t[n])>>>0;return e}(e.logicalLevelTechnique2===of.RLE?Ef(t,e.runs,e.numRleValues):t);break;case of.RLE:i=Ef(t,e.runs,e.numRleValues);break;case of.MORTON:zf(t),i=t;break;case of.COMPONENTWISE_DELTA:i=function(t){if(t.length<2)return new Uint32Array(t);const e=new Uint32Array(t.length);e[0]=Mf(t[0])>>>0,e[1]=Mf(t[1])>>>0;for(let n=2;n<t.length;n+=2)e[n]=e[n-2]+Mf(t[n])>>>0,e[n+1]=e[n-1]+Mf(t[n+1])>>>0;return e}(t);break;case of.NONE:i=t;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?qf(i,r,0):i}(Zf(t,e,n),n,0,i)}function Yf(t,e,n){return function(t,e){if(e.logicalLevelTechnique1===of.DELTA&&e.logicalLevelTechnique2===of.NONE)return function(t){const e=new Int32Array(t.length+1);e[0]=0,e[1]=Mf(t[0]);let n=e[1];for(let r=2;r!==e.length;++r)n+=Mf(t[r-1]),e[r]=e[r-1]+n;return new Uint32Array(e)}(t);if(e.logicalLevelTechnique1===of.RLE&&e.logicalLevelTechnique2===of.NONE)return function(t,e,n){const r=new 
36Uint32Array(n+1);r[0]=0;let i=1,s=r[0];for(let n=0;n<e;n++){const o=t[n],a=t[n+e];for(let t=i;t<i+o;t++)r[t]=a+s,s=r[t];i+=o;}return r}(t,e.runs,e.numRleValues);if(e.logicalLevelTechnique1===of.NONE&&e.logicalLevelTechnique2===of.NONE){!function(t){let e=0;for(let n=0;n<t.length;n++)t[n]+=e,e=t[n];}(t);const n=new Uint32Array(e.numValues+1);return n[0]=0,n.set(t,1),n}if(e.logicalLevelTechnique1===of.DELTA&&e.logicalLevelTechnique2===of.RLE){const n=function(t,e,n){const r=new Int32Array(n+1);r[0]=0;let i=1,s=r[0];for(let n=0;n<e;n++){const o=t[n];let a=t[n+e];a=Mf(a);for(let t=i;t<i+o;t++)r[t]=a+s,s=r[t];i+=o;}return r}(t,e.runs,e.numRleValues);return zf(n),new Uint32Array(n)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(Zf(t,e,n),n)}function Zf(t,e,n){const r=n.physicalLevelTechnique;switch(r){case af.FAST_PFOR:return function(t,e,n,r){return function(t,e,n,r,i){const s=r.get();if(3&n)throw new Error(`FastPFOR: invalid encodedByteLength=${n} at offset=${s} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const o=n>>>2,a=function(t,e){if(e<=t.encodedWords.length)return t.encodedWords;const n=new Uint32Array(Math.max(16,2*e));return t.encodedWords=n,n}(i,o);!function(t,e,n,r){if(e<0||n<0||e+n>t.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${n}, bytes.length=${t.length})`);const i=Math.floor(n/4),s=n%4!=0,o=s?i+1:i;if(r.length<o)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${o}`);if(i>0){const n=t.byteOffset+e;if(3&n)for(let n=0;n<i;n++){const i=e+4*n;r[n]=t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3];}else {const e=new Uint32Array(t.buffer,n,i);for(let t=0;t<i;t++)r[t]=0|pf(e[t]);}}if(s){const s=e+4*i,o=n-4*i;let a=0;for(let e=0;e<o;e++)a|=t[s+e]<<24-8*e;r[i]=0|a;}}(t,s,n,a);const l=function(t,e,n){let r=0,i=0;const s=new Uint32Array(e),o=n??yf();if(t.length>0){const e=0|t[r];if(r=r+1|0,255&e)throw new Error(`FastPFOR decode: invalid alignedLength=${e} (expected multiple of 256)`);if(i+e>s.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${e}, out.length=${s.length})`);r=function(t,e,n,r,i,s){const o=r+hf(i,cf);let a=r,l=n;for(;a!==o;){const n=Math.min(ff,o-a);l=vf(t,e,l,a,n,s),a=a+n|0;}return l}(t,s,r,i,e,o),i=i+e|0;}return function(t,e,n,r,i,s){if(0===s)return e;let o=0,a=e;const l=e+n,u=i;let c=i;const h=i+s;let p=0,f=0;for(;a<l&&c<h;){const e=t[a]>>>o&255;if(o+=8,a+=o>>>5,o&=31,p|=(127&e)<<f,128&e)r[c++]=0|p,p=0,f=0;else if(f+=7,f>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${c-u}/${s}, inPos=${a}, inEnd=${l})`)}if(c!==h)throw new Error(`FastPFOR VByte: truncated stream (decoded=${c-u}, expected=${s}, consumedWords=${a-e}/${n}, vbyteStart=${e}, vbyteEnd=${l})`)}(t,r,t.length-r|0,s,i,e-i|0),s}(a.subarray(0,o),e,i.decoderWorkspace);return r.add(n),l}(t,e,n,r,function(t=16){if(t<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);const e=Math.max(16,0|t);return {encodedWords:new Uint32Array(e),decoderWorkspace:yf()}}(n>>>2))}(t,n.numValues,n.byteLength,e);case af.VARINT:return wf(t,e,n.numValues);case af.NONE:{const r=e.get();e.add(n.byteLength);const i=t.subarray(r,e.get());return new Uint32Array(i)}default:throw new Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Hf(t,e,n){const r=Zf(t,e,n);return 1===r.length?r[0]:function(t){return t[1]}(r)}function Wf(t,e,n){return function(t){if(2===t.length){const e=Mf(t[1]);return [e,e]}return [Mf(t[2]),Mf(t[3])]}(Zf(t,e,n))}function Kf(t,e,n){return function(t){if(2===t.length){const e=kf(t[1]);return [e,e]}return [kf(t[2]),kf(t[3])]}(_f(t,e,n.numValues))}function Jf(t,e,n,r){return function(t,e,n){let r;switch(e.logicalLevelTechnique1){case of.DELTA:r=function(t){const e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,kf(t[0]));for(let n=1;n<t.length;n++)e[n]=BigInt.asUintN(64,e[n-1]+kf(t[n]));return e}(e.logicalLevelTechnique2===of.RLE?Tf(t,e.runs,e.numRleValues):t);break;case of.RLE:r=Tf(t,e.runs,e.numRleValues);break;case of.NONE:r=t;break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?qf(r,n,0n):r}(_f(t,e,n.numValues),n,r)}function Qf(t,e,n){const r=_f(t,e,n.numValues);return 1===r.length?r[0]:function(t){return t[1]}(r)}function td(t,e,n,r,i="int32"){const s=t.logicalLevelTechnique1;if(s===of.RLE)return 1===t.runs?Of.CONST:Of.FLAT;if(s!==of.DELTA||t.logicalLevelTechnique2!==of.RLE)return 1===t.numValues?Of.CONST:Of.FLAT;const o=e instanceof jf?e.size():e;if(t.numRleValues!==o)return Of.FLAT;if(1===t.runs)return Of.SEQUENCE;
36if(2!==t.runs)return 1===t.numValues?Of.CONST:Of.FLAT;const a=r.get();if(t.physicalLevelTechnique===af.VARINT)return function(t,e,n){const r=new sf(e.get());if("int64"===n){const e=_f(t,r,4);return 2n===e[2]&&2n===e[3]}const i=wf(t,r,4);return 2===i[2]&&2===i[3]}(n,r,i)?Of.SEQUENCE:1===t.numValues?Of.CONST:Of.FLAT;const l=r.get(),u=new Int32Array(n.buffer,n.byteOffset+l,4);return r.set(a),2===u[2]&&2===u[3]?Of.SEQUENCE:1===t.numValues?Of.CONST:Of.FLAT}class ed extends Kp{getValueFromBuffer(t){return this.dataBuffer[t]}}class nd extends tf{constructor(t,e,n,r){super(t,BigInt64Array.of(e),n,r);}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}function rd(t,e,n){return {x:id(t,e)-n,y:id(t>>1,e)-n}}function id(t,e){let n=0;for(let r=0;r<e;r++)n|=(t&1<<2*r)>>r;return n}function sd(t,e,r,i,s,o,a){return t===Nf.MORTON?function(t,e,r,i,s,o){const a=new Array(s?i+1:i);for(let s=0;s<i;s++){const i=rd(t[e[r+s]],o.numBits,o.coordinateShift);a[s]=new n(i.x,i.y);}return s&&(a[a.length-1]=a[0]),a}(e,r,i,s,o,a):function(t,e,r,i,s){const o=new Array(s?i+1:i);for(let s=0;s<2*i;s+=2){const i=2*e[r+s/2];o[s/2]=new n(t[i],t[i+1]);}return s&&(o[o.length-1]=o[0]),o}(e,r,i,s,o)}function od(t,e,r,i){const s=new Array(i?r+1:r);for(let i=0;i<2*r;i+=2)s[i/2]=new n(t[e+i],t[e+i+1]);return i&&(s[s.length-1]=s[0]),s}!function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON";}($f||($f={})),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON";}(Rf||(Rf={})),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3";}(Nf||(Nf={}));class ad{constructor(t,e,n,r,i){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=n,this._vertexBuffer=r,this._mortonSettings=i;}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return [this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){const e=rd(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return [e.x,e.y]}const e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return [this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return function(t){const e=new Array(t.numGeometries);let r=1,i=1,s=1,o=0,a=0,l=0;const u=t.mortonSettings,c=t.topologyVector,h=c.geometryOffsets,p=c.partOffsets,f=c.ringOffsets,d=t.vertexOffsets,y=!d||0===d.length,m=t.containsPolygonGeometry(),g=t.vertexBuffer;for(let c=0;c<t.numGeometries;c++)switch(t.geometryType(c)){case $f.POINT:{let c,m;if(y)c=g[a++],m=g[a++];else if(t.vertexBufferType===Nf.MORTON){const t=rd(g[d[l++]],u.numBits,u.coordinateShift);c=t.x,m=t.y;}else {const t=2*d[l++];c=g[t],m=g[t+1];}e[o++]=[[new n(c,m)]],h&&s++,p&&r++,f&&i++;}break;case $f.MULTIPOINT:{const t=h[s]-h[s-1];s++;const u=new Array(t);if(y)for(let e=0;e<t;e++){const t=g[a++],r=g[a++];u[e]=new n(t,r);}else for(let e=0;e<t;e++){const t=2*d[l++];u[e]=new n(g[t],g[t+1]);}e[o++]=u.map((t=>[t])),r+=t,i+=t;}break;case $f.LINESTRING:{let n,c;m?(n=f[i]-f[i-1],i++):n=p[r]-p[r-1],r++,y?(c=od(g,a,n,!1),a+=2*n):(c=sd(t.vertexBufferType,g,d,l,n,!1,u),l+=n),e[o++]=[c],h&&s++;}break;case $f.POLYGON:{const n=p[r]-p[r-1];r++;const c=new Array(n-1);let m,x=f[i]-f[i-1];if(i++,y){m=od(g,a,x,!0),a+=2*x;for(let t=0;t<c.length;t++)x=f[i]-f[i-1],i++,c[t]=od(g,a,x,!0),a+=2*x;}else {m=sd(t.vertexBufferType,g,d,l,x,!0,u),l+=x;for(let e=0;e<c.length;e++)x=f[i]-f[i-1],i++,c[e]=sd(t.vertexBufferType,g,d,l,x,!0,u),l+=x;}e[o++]=[m].concat(c),h&&s++;}break;case $f.MULTILINESTRING:{const n=h[s]-h[s-1];s++;const c=new Array(n);for(let e=0;e<n;e++){let n;if(m?(n=f[i]-f[i-1],i++):n=p[r]-p[r-1],r++,y)c[e]=od(g,a,n,!1),a+=2*n;else {const r=sd(t.vertexBufferType,g,d,l,n,!1,u);c[e]=r,l+=n;}}e[o++]=c;}break;case $f.MULTIPOLYGON:{const n=h[s]-h[s-1];s++;const c=new Array(n);for(let e=0;e<n;e++){const n=p[r]-p[r-1];let s;r++;const o=new Array(n-1),h=f[i]-f[i-1];i++,y?(s=od(g,a,h,!0),a+=2*h):(s=sd(t.vertexBufferType,g,d,l,h,!0,u),l+=h);for(let e=0;e<o.length;e++){const n=f[i]-f[i-1];i++,y?(o[e]=od(g,a,n,!0),a+=2*n):(o[e]=sd(t.vertexBufferType,g,d,l,n,!0,u),l+=n);}c[e]=[s].concat(o);}e[o++]=c.flat();}break;default:throw new Error("The specified geometry type is currently not supported.")}return e}(this)}get mortonSettings(){return this._mortonSettings}}class ld extends ad{constructor(t,e,n,r,i,s,o){super(n,r,i,s,o),this._numGeometries=t,this._geometryType=e;}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===$f.POLYGON||this._geometryType===$f.MULTIPOLYGON}containsSingleGeometryType(){return !0}}class ud extends ad{constructor(t,e,n,r,i,s){super(t,n,r,i,s),this._geometryTypes=e;}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===$f.POLYGON||this.geometryType(t)===$f.MULTIPOLYGON)return !0;return !1}containsSingleGeometryType(){return !1}}class cd{constructor(t,e,n,r){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=n,this._topologyVector=r;}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const t=new Array(this.numGeometries),e=this._topologyVector,r=e.partOffsets,i=e.ringOffsets,s=e.geometryOffsets;let o=0,a=1,l=1,u=1;for(let e=0;e<this.numGeometries;e++)switch(this.geometryType(e)){case $f.POLYGON:{const c=r[a]-r[a-1];a++;const h=[];for(let t=0;t<c;t++){const t=i[l]-i[l-1];l++;const e=[];for(let r=0;r<t;r++){const t=this._vertexBuffer[o++],r=this._vertexBuffer[o++];e.push(new n(t,r));}e.length>0&&e.push(e[0]),h.push(e);}t[e]=h,s&&u++;}break;case $f.MULTIPOLYGON:{const c=s[u]-s[u-1];u++;const h=[];for(let t=0;t<c;t++){const t=r[a]-r[a-1];a++;for(let e=0;e<t;e++){const t=i[l]-i[l-1];l++;const e=[];for(let r=0;r<t;r++){const t=this._vertexBuffer[o++],r=this._vertexBuffer[o++];e.push(new n(t,r));}e.length>0&&e.push(e[0]),h.push(e);}}t[e]=h;}}return t}[Symbol.iterator](){return null}}function hd(t,e,n,r,i,s){return new pd(t,e,n,r,i,s)}class pd extends cd{constructor(t,e,n,r,i,s){super(n,r,i,s),this._numGeometries=t,this._geometryType=e;}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return !0}}function fd(t,e,n,r,i){return new dd(t,e,n,r,i)}class dd extends cd{constructor(t,e,n,r,i){super(e,n,r,i),this._geometryTypes=t;}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return !1}}function yd(t,e,n,r,i){const s=Uf(t,n);let o,a,l,u;if(td(s,r,t,n)===Of.CONST){const i=Hf(t,n,s);let c,h,p,f;for(let r=0;r<e-1;r++){const e=Uf(t,n);switch(e.physicalStreamType){case Bf.LENGTH:switch(e.logicalStreamType.lengthType){case Lf.GEOMETRIES:c=Yf(t,n,e);break;case Lf.PARTS:h=Yf(t,n,e);break;case Lf.RINGS:p=Yf(t,n,e);break;case Lf.TRIANGLES:f=Yf(t,n,e);}break;case Bf.OFFSET:switch(e.logicalStreamType.offsetType){case Vf.VERTEX:o=Xf(t,n,e);break;case Vf.INDEX:u=Xf(t,n,e);}break;case Bf.DATA:Cf.VERTEX===e.logicalStreamType.dictionaryType?a=Gf(t,n,e):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},a=Xf(t,n,e));}}return u?void 0!==c||void 0!==h?hd(r,i,f,u,a,{geometryOffsets:c,partOffsets:h,ringOffsets:p}):hd(r,i,f,u,a):void 0===l?function(t,e,n,r,i){return new ld(t,e,Nf.VEC_2,n,r,i)}(r,i,{geometryOffsets:c,partOffsets:h,ringOffsets:p},o,a):function(t,e,n,r,i,s){return new ld(t,e,Nf.MORTON,n,r,i,s)}(r,i,{geometryOffsets:c,partOffsets:h,ringOffsets:p},o,a,l)}const c=Xf(t,n,s);let h,p,f,d,y,m,g;for(let r=0;r<e-1;r++){const e=Uf(t,n);switch(e.physicalStreamType){case Bf.LENGTH:switch(e.logicalStreamType.lengthType){case Lf.GEOMETRIES:h=Xf(t,n,e);break;case Lf.PARTS:p=Xf(t,n,e);break;case Lf.RINGS:f=Xf(t,n,e);break;case Lf.TRIANGLES:d=Yf(t,n,e);}break;case Bf.OFFSET:switch(e.logicalStreamType.offsetType){case Vf.VERTEX:o=Xf(t,n,e);break;case Vf.INDEX:u=Xf(t,n,e);}break;case Bf.DATA:Cf.VERTEX===e.logicalStreamType.dictionaryType?a=Gf(t,n,e):(l={numBits:e.numBits,coordinateShift:e.coordinateShift},a=Xf(t,n,e));}}return h?(y=md(c,h,2),p&&f?(m=gd(c,y,p,!1),g=function(t,e,n,r){const i=new Uint32Array(n[n.length-1]+1);let s=0;i[0]=s;let o=1,a=1,l=0;for(let u=0;u<t.length;u++){const c=t[u],h=e[u+1]-e[u];if(0!==c&&3!==c)for(let t=0;t<h;t++){const t=n[o]-n[o-1];o++;for(let e=0;e<t;e++)s=i[a++]=s+r[l++];}else for(let t=0;t<h;t++)i[a++]=++s,o++;}return i}
36(c,y,m,f)):p&&(m=function(t,e,n){const r=new Uint32Array(e[e.length-1]+1);let i=0;r[0]=i;let s=1,o=0;for(let a=0;a<t.length;a++){const l=t[a],u=e[a+1]-e[a];if(4===l||1===l)for(let t=0;t<u;t++)i=r[s++]=i+n[o++];else for(let t=0;t<u;t++)r[s++]=++i;}return r}(c,y,p))):p&&f?(m=md(c,p,1),g=gd(c,m,f,!0)):p&&(m=md(c,p,0)),u&&!m?fd(c,d,u,a):u?fd(c,d,u,a,{geometryOffsets:y,partOffsets:m,ringOffsets:g}):void 0===l?function(t,e,n,r){return new ud(Nf.VEC_2,t,e,n,r)}(c,{geometryOffsets:y,partOffsets:m,ringOffsets:g},o,a):function(t,e,n,r,i){return new ud(Nf.MORTON,t,e,n,r,i)}(c,{geometryOffsets:y,partOffsets:m,ringOffsets:g},o,a,l)}function md(t,e,n){const r=new Uint32Array(t.length+1);let i=0;r[0]=i;let s=0;for(let o=0;o<t.length;o++)i=r[o+1]=i+(t[o]>n?e[s++]:1);return r}function gd(t,e,n,r){const i=new Uint32Array(e[e.length-1]+1);let s=0;i[0]=s;let o=1,a=0;for(let l=0;l<t.length;l++){const u=t[l],c=e[l+1]-e[l];if(5===u||2===u||r&&(4===u||1===u))for(let t=0;t<c;t++)s=i[o++]=s+n[a++];else for(let t=0;t<c;t++)i[o++]=++s;}return i}class xd extends Wp{constructor(t,e,n){super(t,e.getBuffer(),n),this.dataVector=e;}getValueFromBuffer(t){return this.dataVector.get(t)}}class vd extends Kp{getValueFromBuffer(t){return this.dataBuffer[t]}}class bd extends Wp{constructor(t,e,n,r){super(t,r?BigInt64Array.of(e):BigUint64Array.of(e),n);}getValueFromBuffer(t){return this.dataBuffer[0]}}function wd(t,e,n,r,i){const s=function(t,e,n,r){const i=new Uint8Array(e);let s=0;const o=r.get()+n;for(;s<e&&!(r.get()>=o);){const n=t[r.increment()];if(n<=127){const o=n+3,a=t[r.increment()],l=Math.min(s+o,e);i.fill(a,s,l),s=l;}else {const o=256-n;for(let n=0;n<o&&s<e;n++)i[s++]=t[r.increment()];}}return r.set(o),i}(t,Math.ceil(e/8),n,r);return i?function(t,e,n){if(!n)return t;
36const r=n.size(),i=new jf(t,e),s=new jf(new Uint8Array(Math.ceil(r/8)),r);let o=0;for(let t=0;t<r;t++){const e=!!n.get(t)&&i.get(o++);s.set(t,e);}return s.getBuffer()}(s,e,i):s}const _d=new TextDecoder;function Sd(t,e,n){return n-e>=12?_d.decode(t.subarray(e,n)):function(t,e,n){let r="",i=e;for(;i<n;){const e=t[i];let s,o,a,l=null,u=e>239?4:e>223?3:e>191?2:1;if(i+u>n)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],o=t[i+2],128==(192&s)&&128==(192&o)&&(l=(15&e)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],o=t[i+2],a=t[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&e)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=u;}return r}(t,e,n)}class Ad extends Wp{constructor(t,e,n,r){super(t,n,r),this.offsetBuffer=e;}}class Md extends Ad{constructor(t,e,n,r){super(t,e,n,r??e.length-1);}getValueFromBuffer(t){return Sd(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class kd extends Ad{constructor(t,e,n,r,i){super(t,n,r,i??e.length),this.indexBuffer=e,this.indexBuffer=e;}getValueFromBuffer(t){const e=this.indexBuffer[t];return Sd(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Id extends Ad{constructor(t,e,n,r,i,s,o){super(t,n,r,o),this.indexBuffer=e,this.symbolOffsetBuffer=i,this.symbolTableBuffer=s;}getValueFromBuffer(t){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(t,e,n){const r=[],i=new Array(e.length).fill(0);for(let t=1;t<e.length;t++)i[t]=i[t-1]+e[t-1];for(let s=0;s<n.length;s++)if(255===n[s])r.push(n[++s]);else {const o=e[n[s]],a=i[n[s]];for(let e=0;e<o;e++)r.push(t[a+e]);}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const e=this.indexBuffer[t];return Sd(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}offsetToLengthBuffer(t){const e=new Uint32Array(t.length-1);let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];e[r-1]=i-n,n=i;}return e}}function Ed(t,e,n,r,i,s){return "scalarType"===n.type?function(t,e,n,r,i,s){let o=null;if(0===t)return null;if(s.nullable){const t=Uf(e,n),r=t.numValues,i=n.get(),s=wd(e,r,t.byteLength,n);n.set(i+t.byteLength),o=new jf(s,t.numValues);}const a=o??r;switch(i.physicalType){case 4:case 3:return function(t,e,n,r,i){const s=Uf(t,e),o=td(s,i,t,e),a=3===r.physicalType;if(o===Of.FLAT){const r=Td(i)?i:void 0,o=a?Gf(t,e,s,0,r):Xf(t,e,s,0,r);return new Jp(n.name,o,i)}if(o===Of.SEQUENCE){const r=Wf(t,e,s);return new ef(n.name,r[0],r[1],s.numRleValues)}const l=a?function(t,e,n){const r=Zf(t,e,n);return 1===r.length?Mf(r[0]):function(t){return Mf(t[1])}(r)}(t,e,s):Hf(t,e,s);return new nf(n.name,l,i,a)}(e,n,s,i,a);case 9:return function(t,e,n,r,i){let s=null,o=null,a=null,l=null,u=null,c=i??null,h=null,p=null;for(let t=0;t<r;t++){const t=Uf(e,n);switch(t.physicalStreamType){case Bf.PRESENT:{const r=wd(e,t.numValues,t.byteLength,n),s=new jf(r,t.numValues);c=i??s;break}case Bf.OFFSET:o=Xf(e,n,t,0,c);break;case Bf.LENGTH:{const r=Yf(e,n,t);Lf.DICTIONARY===t.logicalStreamType.lengthType?s=r:Lf.SYMBOL===t.logicalStreamType.lengthType?l=r:h=r;break}case Bf.DATA:{const r=e.subarray(n.get(),n.get()+t.byteLength);n.add(t.byteLength);const i=t.logicalStreamType.dictionaryType;Cf.FSST===i?u=r:Cf.SINGLE===i||Cf.SHARED===i?a=r:Cf.NONE===i&&(p=r);break}}}return function(t,e,n,r,i,s,o){return e?new Id(t,n,r,i,s,e,o):null}(t,u,o,s,a,l,c)??function(t,e,n,r,i){return e?i?new kd(t,n,r,e,i):new kd(t,n,r,e):null}(t,a,o,s,c)??function(t,e,n,r,i){if(!e||!n)return null;if(r)return i?new kd(t,r,e,n,i):new kd(t,r,e,n);if(i&&i.size()!==e.length-1){const r=new Uint32Array(i.size());let s=0;for(let t=0;t<i.size();t++)r[t]=i.get(t)?s++:0;return new kd(t,r,e,n,i)}return i?new Md(t,e,n,i):new Md(t,e,n)}(t,h,p,o,c)}(s.name,e,n,s.nullable?t-1:t,o);case 0:return function(t,e,n,r,i){const s=Uf(t,e),o=s.numValues,a=e.get(),l=Td(i)?i:void 0,u=wd(t,o,s.byteLength,e,l);e.set(a+s.byteLength);const c=new jf(u,o);return new xd(n.name,c,i)}(e,n,s,0,a);case 6:case 5:return function(t,e,n,r,i){const s=Uf(t,e),o=td(s,r,t,e,"int64"),a=5===i.physicalType;if(o===Of.FLAT){const i=Td(r)?r:void 0,o=a?function(t,e,n,r){return function(t,e,n){let r;switch(e.logicalLevelTechnique1){case of.DELTA:if(e.logicalLevelTechnique2===of.RLE){const i=e;if(!n)return function(t,e,n){const r=new BigInt64Array(n);let i=0,s=0n;for(let n=0;n<e;n++){const o=Number(t[n]),a=kf(t[n+e]);for(let t=0;t<o;t++)s+=a,r[i++]=s;}return r}(t,i.runs,i.numRleValues);
36r=Pf(t=Tf(t,i.runs,i.numRleValues));}else r=Pf(t);break;case of.RLE:r=function(t,e,n){if(void 0===n){n=0;for(let r=0;r<e;r++)n+=Number(t[r]);}const r=new BigInt64Array(n);let i=0;for(let n=0;n<e;n++){const s=Number(t[n]);let o=t[n+e];o=kf(o),r.fill(o,i,i+s),i+=s;}return r}(t,e.runs,e.numRleValues);break;case of.NONE:r=function(t){const e=new BigInt64Array(t.length);for(let n=0;n<t.length;n++)e[n]=kf(t[n]);return e}(t);break;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return n?qf(r,n,0n):r}(_f(t,e,n.numValues),n,r)}(t,e,s,i):Jf(t,e,s,i);return new ed(n.name,o,r)}if(o===Of.SEQUENCE){const r=Kf(t,e,s);return new nd(n.name,r[0],r[1],s.numRleValues)}const l=a?function(t,e,n){const r=_f(t,e,n.numValues);return 1===r.length?kf(r[0]):function(t){return kf(t[1])}(r)}(t,e,s):Qf(t,e,s);return new bd(n.name,l,r,a)}(e,n,s,a,i);case 7:return function(t,e,n,r){const i=Uf(t,e),s=Td(r)?r:void 0,o=function(t,e,n,r){const i=e.get(),s=i+n*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(i,s)).buffer,a=new Float32Array(o);return e.set(s),r?qf(a,r,0):a}(t,e,i.numValues,s);return new vd(n.name,o,r)}(e,n,s,a);case 8:return function(t,e,n,r){const i=Uf(t,e),s=Td(r)?r:void 0,o=function(t,e,n,r){const i=e.get(),s=i+n*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(t.subarray(i,s)).buffer,a=new Float64Array(o);return e.set(s),r?qf(a,r,0):a}(t,e,i.numValues,s);return new Qp(n.name,o,r)}(e,n,s,a);default:throw new Error(`The specified data type for the field is currently not supported: ${i}`)}}(r,t,e,i,n.scalarType,n):0===r?null:function(t,e,n,r){let i=null,s=null,o=null,a=null,l=!1;for(;!l;){const n=Uf(t,e);switch(n.physicalStreamType){case Bf.LENGTH:Lf.DICTIONARY===n.logicalStreamType.lengthType?i=Yf(t,e,n):o=Yf(t,e,n);break;case Bf.DATA:Cf.SINGLE===n.logicalStreamType.dictionaryType||Cf.SHARED===n.logicalStreamType.dictionaryType?(s=t.subarray(e.get(),e.get()+n.byteLength),l=!0):a=t.subarray(e.get(),e.get()+n.byteLength),e.add(n.byteLength);}}const u=n.complexType.children,c=[];let h=0;for(const l of u){const u=wf(t,e,1)[0];if(0===u)continue;const p=l.name?`${n.name}${l.name}`:n.name;if(2!==u||"scalarField"!==l.type||9!==l.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const f=Uf(t,e),d=wd(t,f.numValues,f.byteLength,e),y=Uf(t,e),m=Xf(t,e,y,0,y.decompressedCount!==r?new jf(d,f.numValues):void 0);c[h++]=a?new Id(p,m,i,s,o,a,new jf(d,f.numValues)):new kd(p,m,i,s,new jf(d,f.numValues));}return c}(t,e,n,i)}function Td(t){return t instanceof jf}function Fd(t){switch(t){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&t),e.columnScope=0;const n={type:"logicalType",logicalType:0};return n.longID=!!(2&t),e.scalarType=n,e.type="scalarType",e}case 4:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:0};return t.type="complexType",t.complexType=e,t}case 30:{const t={nullable:!1,columnScope:0},e={type:"physicalType",physicalType:1};return t.type="complexType",t.complexType=e,t}default:return function(t){let e;switch(t){case 10:case 11:e=0;break;case 12:case 13:e=1;break;case 14:case 15:e=2;break;case 16:case 17:e=3;break;case 18:case 19:e=4;break;case 20:case 21:e=5;break;case 22:case 23:e=6;break;case 24:case 25:e=7;break;case 26:case 27:e=8;break;case 28:case 29:e=9;break;default:return null}const n={};n.nullable=!!(1&t),n.columnScope=0;const r={type:"physicalType"};return r.physicalType=e,n.type="scalarType",n.scalarType=r,n}(t)}}function Dd(t){return t>=10}function Pd(t){return 30===t}function zd(t){if("scalarType"===t.type){const e=t.scalarType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return !1;case 9:return !0}if("logicalType"===e.type)return !1}else if("complexType"===t.type){const e=t.complexType;if("physicalType"===e.type)switch(e.physicalType){case 0:case 1:return !0;default:return !1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function Bd(t){return "complexType"===t.type&&"physicalType"===t.complexType?.type&&0===t.complexType.physicalType}const Cd=new TextDecoder;function Vd(t,e){const n=wf(t,e,1)[0];if(0===n)return "";const r=e.get(),i=t.subarray(r,r+n);return e.add(n),Cd.decode(i)}function Ld(t,e){const n=wf(t,e,1)[0]>>>0;if(n<10||n>
3630)throw new Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);const r=Fd(n);if(Dd(n)&&(r.name=Vd(t,e)),Pd(n)){const n=wf(t,e,1)[0]>>>0;r.complexType.children=new Array(n);for(let i=0;i<n;i++)r.complexType.children[i]=Ld(t,e);}return function(t){return {name:t.name,nullable:t.nullable,scalarField:t.scalarType,complexField:t.complexType,type:"scalarType"===t.type?"scalarField":"complexField"}}(r)}function Od(t,e){const n=wf(t,e,1)[0]>>>0,r=Fd(n);if(!r)throw new Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(Dd(n)?r.name=Vd(t,e):n>=0&&n<=3?r.name="id":4===n&&(r.name="geometry"),Pd(n)){const n=wf(t,e,1)[0]>>>0,i=r.complexType;i.children=new Array(n);for(let r=0;r<n;r++)i.children[r]=Ld(t,e);}return r}function $d(t,e){const n={featureTables:[]},r={};r.name=Vd(t,e);const i=wf(t,e,1)[0]>>>0,s=wf(t,e,1)[0]>>>0;r.columns=new Array(s);for(let n=0;n<s;n++)r.columns[n]=Od(t,e);return n.featureTables.push(r),[n,i]}function Rd(t,e,n,r,i,s,o=!1){const a=e.scalarType;if(!a||"logicalType"!==a.type||0!==a.logicalType)throw new Error(`ID column must be a logical ID scalar type: ${r}`);const l=a.longID?6:4,u="number"==typeof s?void 0:s,c=td(i,s,t,n,6===l?"int64":"int32");if(4===l)switch(c){case Of.FLAT:{const e=Xf(t,n,i,0,u);return new Jp(r,e,s)}case Of.SEQUENCE:{const e=Wf(t,n,i);return new ef(r,e[0],e[1],i.numRleValues)}case Of.CONST:{const e=Hf(t,n,i);return new nf(r,e,s,!1)}}switch(c){case Of.FLAT:{if(o){const e=function(t,e,n){const r=function(t,e,n){const r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=Af(t,e);return r}(t,e,n.numValues);return function(t,e){switch(e.logicalLevelTechnique1){case of.DELTA:return e.logicalLevelTechnique2===of.RLE&&(t=Ff(t,e.runs,e.numRleValues)),function(t){t[0]=If(t[0]);const e=t.length/4*4;let n=1;if(e>=4)for(;n<e-4;n+=4){const e=t[n+1],r=t[n+2],i=t[n+3];t[n]=If(t[n])+t[n-1],t[n+1]=If(e)+t[n],t[n+2]=If(r)+t[n+1],t[n+3]=If(i)+t[n+2];}for(;n!==t.length;++n)t[n]=If(t[n])+t[n-1];}(t),t;case of.RLE:return function(t,e){return Ff(t,e.runs,e.numRleValues)}(t,e);case of.NONE:return t;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}(r,n)}(t,n,i);return new Qp(r,e,s)}const e=Jf(t,n,i,u);return new ed(r,e,s)}case Of.SEQUENCE:{const e=Kf(t,n,i);return new nd(r,e[0],e[1],i.numRleValues)}case Of.CONST:{const e=Qf(t,n,i);return new bd(r,e,s,!1)}}throw new Error("Vector type not supported for id column.")}class Nd{constructor(t,e){var n;switch(this._featureData=t,this.properties=this._featureData.properties||{},null===(n=this._featureData.geometry)||void 0===n?void 0:n.type){case $f.POINT:case $f.MULTIPOINT:this.type=1;break;case $f.LINESTRING:case $f.MULTILINESTRING:this.type=2;break;case $f.POLYGON:case $f.MULTIPOLYGON:this.type=3;break;default:this.type=0;}this.extent=e,this.id=Number(this._featureData.id);}loadGeometry(){const t=[];for(const e of this._featureData.geometry.coordinates){const r=[];for(const t of e)r.push(new n(t.x,t.y));t.push(r);}return t}}class Ud{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length;}feature(t){return new Nd(this.features[t],this.extent)}}class jd{constructor(t){this.layers={};const e=function(t,e,n=!0){const r=new sf(0),i=[];for(;r.get()<t.length;){const e=wf(t,r,1)[0]>>>0,o=r.get()+e;if(o>t.length)throw new Error(`Block overruns tile: ${o} > ${t.length}`);if(1!=wf(t,r,1)[0]>>>0){r.set(o);continue}const[a,l]=$d(t,r),u=a.featureTables[0];let c=null,h=null;const p=[];let f=0;for(const e of u.columns){const i=e.name;if("scalarType"===(s=e).type&&"logicalType"===s.scalarType?.type&&0===s.scalarType.logicalType){let s=null;if(e.nullable){const e=Uf(t,r),n=r.get(),i=wd(t,e.numValues,e.byteLength,r);r.set(n+e.byteLength),s=new jf(i,e.numValues);}const o=Uf(t,r);f=s?s.size():o.decompressedCount,c=Rd(t,e,r,i,o,s??f,n);}else if(Bd(e)){const e=wf(t,r,1)[0];if(0===f){const e=r.get();f=Uf(t,r).decompressedCount,r.set(e);}h=yd(t,e,r,f);}else {const n=zd(e)?wf(t,r,1)[0]:1;if(0===n)continue;const i=Ed(t,r,e,n,f);if(i)if(Array.isArray(i))for(const t of i)p.push(t);else p.push(i);}}const d=new rf(u.name,h,c,p,l);i.push(d),r.set(o);}var s;return i}(new Uint8Array(t));this.layers=e.reduce(((t,e)=>Object.assign(Object.assign({},t),{[e.name]:new Ud(e)})),{});}}class qd{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{}
36,this.extent=e,"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id));}loadGeometry(){const t=[],e=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const r of e){const e=[];for(const t of r)e.push(new n(t[0],t[1]));t.push(e);}return t}}const Gd="_geojsonTileLayer";function Xd(t,e,n=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);const r={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let n=0;n<t.length;n++)r.feature=t.feature(n),e.writeMessage(2,Yd,r);const i=r.keys;for(const t of i)e.writeStringField(3,t);const s=r.values;for(const t of s)e.writeMessage(4,Jd,t);}function Yd(t,e){if(!t.feature)return;const n=t.feature;void 0!==n.id&&e.writeVarintField(1,n.id),e.writeMessage(2,Zd,t),e.writeVarintField(3,n.type),e.writeMessage(4,Kd,n);}function Zd(t,e){for(const n in t.feature?.properties){let r=t.feature.properties[n],i=t.keycache[n];if(null==r)continue;void 0===i&&(t.keys.push(n),i=t.keys.length-1,t.keycache[n]=i),e.writeVarint(i),"string"!=typeof r&&"boolean"!=typeof r&&"number"!=typeof r&&(r=t.jsonPrefix+JSON.stringify(r));const s=typeof r+":"+r;let o=t.valuecache[s];void 0===o&&(t.values.push(r),o=t.values.length-1,t.valuecache[s]=o),e.writeVarint(o);}}function Hd(t,e){return (e<<3)+(7&t)}function Wd(t){return t<<1^t>>31}function Kd(t,e){const n=t.loadGeometry(),r=t.type;let i=0,s=0;for(const o of n){let n=1;1===r&&(n=o.length),e.writeVarint(Hd(1,n));const a=3===r?o.length-1:o.length;for(let t=0;t<a;t++){1===t&&1!==r&&e.writeVarint(Hd(2,a-1));const n=o[t].x-i,l=o[t].y-s;e.writeVarint(Wd(n)),e.writeVarint(Wd(l)),i+=n,s+=l;}3===t.type&&e.writeVarint(Hd(7,1));}}function Jd(t,e){const n=typeof t;"string"===n?e.writeStringField(1,t):"boolean"===n?e.writeBooleanField(7,t):"number"===n&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t));}class Qd{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new cs(T,16,0),this.grid3D=new cs(T,16,0),this.featureIndexArray=new No,this.promoteId=e;}insert(t,e,n,r,i,s){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);const a=s?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const n=e[t],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<n.length;t++){const e=n[t];r[0]=Math.min(r[0],e.x),r[1]=Math.min(r[1],e.y),r[2]=Math.max(r[2],e.x),r[3]=Math.max(r[3],e.y);}r[0]<T&&r[1]<T&&r[2]>=0&&r[3]>=0&&a.insert(o,r[0],r[1],r[2],r[3]);}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Lu(new zh(this.rawTileData)).layers:new jd(this.rawTileData).layers,this.sourceLayerCoder=new Zp(this.vtLayers?Object.keys(this.vtLayers).sort():[Gd])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();const s=t.params,o=T/t.tileSize/t.scale,a=fi(s.filter,s.globalState),l=t.queryGeometry,u=t.queryPadding*o,c=Yp.fromPoints(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=Yp.fromPoints(t.cameraQueryGeometry).expandBy(u),f=this.grid3D.query(p.minX,p.minY,p.maxX,p.maxY,((e,r,i,s)=>function(t,e,r,i,s){for(const n of t)if(e<=n.x&&r<=n.y&&i>=n.x&&s>=n.y)return !0;const o=[new n(e,r),new n(e,s),new n(i,s),new n(i,r)];if(t.length>2)for(const e of o)if(tl(t,e))return !0;for(let e=0;e<t.length-1;e++)if(el(t[e],t[e+1],o))return !0;return !1}(t.cameraQueryGeometry,e-u,r-u,i+u,s+u)));for(const t of f)h.push(t);h.sort(ey);const d={};let y;for(let n=0;n<h.length;n++){const u=h[n];if(u===y)continue;y=u;const c=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,a,s.layers,s.availableImages,e,r,i,((e,n,r)=>(p||(p=Ra(e)),n.queryIntersectsFeature({queryGeometry:l,feature:e,featureState:r,geometry:p,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))));}return d}loadMatchingFeature(t,e,n,r,i,s,o,a,l,u,c){const h=this.bucketLayerIDs[e];if(s&&!h.some((t=>s.has(t))))return;const p=this.sourceLayerCoder.decode(n),f=this.vtLayers[p].feature(r);if(i.needGeometry){const t=Na(f,!0);
36if(!i.filter(new zs(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new zs(this.tileID.overscaledZ),f))return;const d=this.getId(f,p);for(let e=0;e<h.length;e++){const n=h[e];if(s&&!s.has(n))continue;const i=a[n];if(!i)continue;let p={};d&&u&&(p=u.getState(i.sourceLayer||Gd,d));const y=O({},l[n]);y.paint=ty(y.paint,i.paint,f,p,o),y.layout=ty(y.layout,i.layout,f,p,o);const m=!c||c(f,i,p);if(!m)continue;const g=new Hp(f,this.z,this.x,this.y,d);g.layer=y;let x=t[n];void 0===x&&(x=t[n]=[]),x.push({featureIndex:r,feature:g,intersectionZ:m});}}lookupSymbolFeatures(t,e,n,r,i,s,o,a){const l={};this.loadVTLayers();const u=fi(i.filterSpec,i.globalState);for(const i of t)this.loadMatchingFeature(l,n,r,i,u,s,o,a,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const n of e)if(t===n)return !0;return !1}getId(t,e){var n;let r=t.id;return this.promoteId&&(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&(null===(n=t.properties)||void 0===n?void 0:n.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))),r}}function ty(t,e,n,r,i){return R(t,((t,s)=>{const o=e instanceof js?e.get(s):null;return o&&o.evaluate?o.evaluate(n,r,i):o}))}function ey(t,e){return e-t}function ny(t,e,r,i,s){const o=[];for(let a=0;a<t.length;a++){const l=t[a];let u;for(let t=0;t<l.length-1;t++){let a=l[t],c=l[t+1];a.x<e&&c.x<e||(a.x<e?a=new n(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x<e&&(c=new n(e,a.y+(e-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y<r&&c.y<r||(a.y<r?a=new n(a.x+(r-a.y)/(c.y-a.y)*(c.x-a.x),r)._round():c.y<r&&(c=new n(a.x+(r-a.y)/(c.y-a.y)*(c.x-a.x),r)._round()),a.x>=i&&c.x>=i||(a.x>=i?a=new n(i,a.y+(i-a.x)/(c.x-a.x)*(c.y-a.y))._round():c.x>=i&&(c=new n(i,a.y+(i-a.x)/(c.x-a.x)*(c.y-a.y))._round()),a.y>=s&&c.y>=s||(a.y>=s?a=new n(a.x+(s-a.y)/(c.y-a.y)*(c.x-a.x),s)._round():c.y>=s&&(c=new n(a.x+(s-a.y)/(c.y-a.y)*(c.x-a.x),s)._round()),u&&a.equals(u[u.length-1])||(u=[a],o.push(u)),u.push(c)))));}}return o}function ry(t,e,n,r,i){switch(e){case 1:return function(t,e,n,r){const i=[];for(const s of t)for(const t of s){const s=0===r?t.x:t.y;s>=e&&s<=n&&i.push([t]);}return i}(t,n,r,i);case 2:return sy(t,n,r,i,!1);case 3:return sy(t,n,r,i,!0)}return []}function iy(t,e,r,i,s){const o=0===i?oy:ay;let a=[];const l=[];for(let n=0;n<t.length-1;n++){const u=t[n],c=t[n+1],h=0===i?u.x:u.y,p=0===i?c.x:c.y;let f=!1;h<e?p>e&&a.push(o(u,c,e)):h>r?p<r&&a.push(o(u,c,r)):a.push(u),p<e&&h>=e&&(a.push(o(u,c,e)),f=!0),p>r&&h<=r&&(a.push(o(u,c,r)),f=!0),!s&&f&&(l.push(a),a=[]);}const u=t.length-1,c=0===i?t[u].x:t[u].y;return c>=e&&c<=r&&a.push(t[u]),s&&a.length>0&&!a[0].equals(a[a.length-1])&&a.push(new n(a[0].x,a[0].y)),a.length>0&&l.push(a),l}function sy(t,e,n,r,i){const s=[];for(const o of t){const t=iy(o,e,n,r,i);t.length>0&&s.push(...t);}return s}function oy(t,e,r){return new n(r,t.y+(r-t.x)/(e.x-t.x)*(e.y-t.y))}function ay(t,e,r){return new n(t.x+(r-t.y)/(e.y-t.y)*(e.x-t.x),r)}ps("FeatureIndex",Qd,{omit:["rawTileData","sourceLayerCoder"]});class ly extends n{constructor(t,e,n,r){super(t,e),this.angle=n,void 0!==r&&(this.segment=r);}clone(){return new ly(this.x,this.y,this.angle,this.segment)}}function uy(t,e,n,r,i){if(void 0===e.segment||0===n)return !0;let s=e,o=e.segment+1,a=0;for(;a>-n/2;){if(o--,o<0)return !1;a-=t[o].dist(s),s=t[o];}a+=t[o].dist(t[o+1]),o++;const l=[];let u=0;for(;a<n/2;){const e=t[o],n=t[o+1];if(!n)return !1;let s=t[o-1].angleTo(e)-e.angleTo(n);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),u+=s;a-l[0].distance>r;)u-=l.shift().angleDelta;if(u>i)return !1;o++,a+=e.dist(n);}return !0}function cy(t){let e=0;for(let n=0;n<t.length-1;n++)e+=t[n].dist(t[n+1]);return e}function hy(t,e,n){return t?.6*e*n:0}function py(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function fy(t,e,n,r,i,s){const o=hy(n,i,s),a=py(n,r)*s;let l=0;const u=cy(t)/2;for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1],s=r.dist(i);if(l+s>u){const c=(u-l)/s,h=mn.number(r.x,i.x,c),p=mn.number(r.y,i.y,c),f=new ly(h,p,i.angleTo(r),n);return f._round(),!o||uy(t,f,a,o,e)?f:void 0}l+=s;}}function dy(t,e,n,r,i,s,o,a,l){const u=hy(r,s,o),c=py(r,i),h=c*o,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),yy(t,p?e/2*a%e:(c/2+2*s)*o*a%e,e,u,n,h,p,!1,l)}function yy(t,e,n,r,i,s,o,a,l){const u=s/2,c=cy(t);let h=0,p=e-n,f=[];for(let e=0;e<t.length-1;e++){const o=t[e],a=t[e+1],d=o.dist(a),y=a.angleTo(o);for(;p+n<h+d;){p+=n;const m=(p-h)/d,g=mn.number(o.x,a.x,m),x=mn.number(o.y,a.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const n=new ly(g,x,y,e);n._round(),r&&!uy(t,n,s,r,i)||f.push(n);}}h+=d;}return a||f.length||o||(f=yy(t,h/2,n,r,i,s,o,!0,l)),f}function my(t,e,r,i){const s=[],o=t.image,a=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2;
36let c={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=o.stretchX||[[0,l]],p=o.stretchY||[[0,u]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=l-d,g=u-y;let x=0,v=d,b=0,w=y,_=0,S=m,A=0,M=g;if(o.content&&i){const e=o.content,n=e[2]-e[0],r=e[3]-e[1];(o.textFitWidth||o.textFitHeight)&&(c=ap(t)),x=gy(h,0,e[0]),b=gy(p,0,e[1]),v=gy(h,e[0],e[2]),w=gy(p,e[1],e[3]),_=e[0]-x,A=e[1]-b,S=n-v,M=r-w;}const k=c.x1,I=c.y1,E=c.x2-k,T=c.y2-I,F=(t,i,s,l)=>{const u=vy(t.stretch-x,v,E,k),c=by(t.fixed-_,S,t.stretch,d),h=vy(i.stretch-b,w,T,I),p=by(i.fixed-A,M,i.stretch,y),f=vy(s.stretch-x,v,E,k),m=by(s.fixed-_,S,s.stretch,d),g=vy(l.stretch-b,w,T,I),F=by(l.fixed-A,M,l.stretch,y),D=new n(u,h),P=new n(f,h),z=new n(f,g),B=new n(u,g),C=new n(c/a,p/a),V=new n(m/a,F/a),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),n=[e,-t,t,e];D._matMult(n),P._matMult(n),B._matMult(n),z._matMult(n);}const O=t.stretch+t.fixed,$=i.stretch+i.fixed;return {tl:D,tr:P,bl:B,br:z,tex:{x:o.paddedRect.x+1+O,y:o.paddedRect.y+1+$,w:s.stretch+s.fixed-O,h:l.stretch+l.fixed-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:C,pixelOffsetBR:V,minFontScaleX:S/a/E,minFontScaleY:M/a/T,isSDF:r}};if(i&&(o.stretchX||o.stretchY)){const t=xy(h,m,d),e=xy(p,g,y);for(let n=0;n<t.length-1;n++){const r=t[n],i=t[n+1];for(let t=0;t<e.length-1;t++)s.push(F(r,e[t],i,e[t+1]));}}else s.push(F({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function gy(t,e,n){let r=0;for(const i of t)r+=Math.max(e,Math.min(n,i[1]))-Math.max(e,Math.min(n,i[0]));return r}function xy(t,e,n){const r=[{fixed:-1,stretch:0}];for(const[e,n]of t){const t=r[r.length-1];r.push({fixed:e-t.stretch,stretch:t.stretch}),r.push({fixed:e-t.stretch,stretch:t.stretch+(n-e)});}return r.push({fixed:e+1,stretch:n}),r}function vy(t,e,n,r){return t/e*n+r}function by(t,e,n,r){return t-e*n/r}ps("Anchor",ly);class wy{constructor(t,e,r,i,s,o,a,l,u,c){var h;if(this.boxStartIndex=t.length,u){let t=o.top,e=o.bottom;const n=o.collisionPadding;n&&(t-=n[1],e+=n[3]);let r=e-t;r>0&&(r=Math.max(10,r),this.circleDiameter=r);}else {const u=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?ap(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};u.y1=u.y1*a-l[0],u.y2=u.y2*a+l[2],u.x1=u.x1*a-l[3],u.x2=u.x2*a+l[1];const p=o.collisionPadding;if(p&&(u.x1-=p[0]*a,u.y1-=p[1]*a,u.x2+=p[2]*a,u.y2+=p[3]*a),c){const t=new n(u.x1,u.y1),e=new n(u.x2,u.y1),r=new n(u.x1,u.y2),i=new n(u.x2,u.y2),s=c*Math.PI/180;t._rotate(s),e._rotate(s),r._rotate(s),i._rotate(s),u.x1=Math.min(t.x,e.x,r.x,i.x),u.x2=Math.max(t.x,e.x,r.x,i.x),u.y1=Math.min(t.y,e.y,r.y,i.y),u.y2=Math.max(t.y,e.y,r.y,i.y);}t.emplaceBack(e.x,e.y,u.x1,u.y1,u.x2,u.y2,r,i,s);}this.boxEndIndex=t.length;}}class _y{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this._up(this.length++);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return --this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(n(r,s)>=0)break;e[t]=s,t=i;}e[t]=r;}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1);const s=r+1;if(s<this.length&&n(e[s],e[r])<0&&(r=s),n(e[r],i)>=0)break;e[t]=e[r],t=r;}e[t]=i;}}function Sy(t,e=1,r=!1){const i=Yp.fromPoints(t[0]),s=Math.min(i.width(),i.height());let o=s/2;const a=new _y([],Ay),{minX:l,minY:u,maxX:c,maxY:h}=i;if(0===s)return new n(l,u);for(let e=l;e<c;e+=s)for(let n=u;n<h;n+=s)a.push(new My(e+o,n+o,o,t));let p=function(t){let e=0,n=0,r=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],l=s.x*a.y-a.x*s.y;n+=(s.x+a.x)*l,r+=(s.y+a.y)*l,e+=3*l;}return new My(n/e,r/e,0,t)}(t),f=a.length;for(;a.length;){const n=a.pop();(n.d>p.d||!p.d)&&(p=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=e||(o=n.h/2,a.push(new My(n.p.x-o,n.p.y-o,o,t)),a.push(new My(n.p.x+o,n.p.y-o,o,t)),a.push(new My(n.p.x-o,n.p.y+o,o,t)),a.push(new My(n.p.x+o,n.p.y+o,o,t)),f+=4);}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ay(t,e){return e.max-t.max}function My(t,e,r,i){this.p=new n(t,e),this.h=r,this.d=function(t,e){let n=!1,r=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,o=i-1;e<i;o=e++){const i=s[e],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n),r=Math.min(r,Ja(t,i,a));}}return (n?1:-1)*Math.sqrt(r)}(this.p,i),this.max=this.d+this.h*Math.SQRT2;}var ky;t.aM=void 0,(ky=t.aM||(t.aM={}))[ky.center=1]="center",ky[ky.left=2]="left",ky[ky.right=3]="right",ky[ky.top=4]="top",ky[ky.bottom=5]="bottom",ky[ky["top-left"]=6]="top-left",ky[ky["top-right"]=7]="top-right",ky[ky["bottom-left"]=8]="bottom-left",ky[ky["bottom-right"]=9]="bottom-right";const Iy=Number.POSITIVE_INFINITY;function Ey(t,e){return e[1]!==Iy?function(t,e,n){let r=0,i=0;switch(e=Math.abs(e),n=Math.abs(n),t){case "top-right":case "top-left":case "top":i=n-7;break;case "bottom-right":case "bottom-left":case "bottom":i=7-n;}switch(t){case "top-right":case "bottom-right":case "right":r=-e;break;
36case "top-left":case "bottom-left":case "left":r=e;}return [r,i]}(t,e[0],e[1]):function(t,e){let n=0,r=0;e<0&&(e=0);const i=e/Math.SQRT2;switch(t){case "top-right":case "top-left":r=i-7;break;case "bottom-right":case "bottom-left":r=7-i;break;case "bottom":r=7-e;break;case "top":r=e-7;}switch(t){case "top-right":case "bottom-right":n=-i;break;case "top-left":case "bottom-left":n=i;break;case "left":n=e;break;case "right":n=-e;}return [n,r]}(t,e[0])}function Ty(t,e,n){var r;const i=t.layout,s=null===(r=i.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(e,{},n);if(s){const t=s.values,e=[];for(let n=0;n<t.length;n+=2){const r=e[n]=t[n],i=t[n+1].map((t=>t*bh));r.startsWith("top")?i[1]-=7:r.startsWith("bottom")&&(i[1]+=7),e[n+1]=i;}return new Le(e)}const o=i.get("text-variable-anchor");if(o){let r;r=void 0!==t._unevaluatedLayout.getValue("text-radial-offset")?[i.get("text-radial-offset").evaluate(e,{},n)*bh,Iy]:i.get("text-offset").evaluate(e,{},n).map((t=>t*bh));const s=[];for(const t of o)s.push(t,Ey(t,r));return new Le(s)}return null}function Fy(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 Dy(e,n,r,i,s,o,a,l,u,c,h,p){let f=o.textMaxSize.evaluate(n,{});void 0===f&&(f=a);const d=e.layers[0].layout,y=d.get("icon-offset").evaluate(n,{},h),m=zy(r.horizontal),g=a/24,x=e.tilePixelRatio*g,v=e.tilePixelRatio*f/24,b=e.tilePixelRatio*l,w=e.tilePixelRatio*d.get("symbol-spacing"),_=d.get("text-padding")*e.tilePixelRatio,S=function(t,e,n,r=1){const i=t.get("icon-padding").evaluate(e,{},n),s=i&&i.values;return [s[0]*r,s[1]*r,s[2]*r,s[3]*r]}(d,n,h,e.tilePixelRatio),A=d.get("text-max-angle")/180*Math.PI,M="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),k="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),I=d.get("symbol-placement"),E=w/2,F=d.get("icon-text-fit");let D;i&&"none"!==F&&(e.allowVerticalPlacement&&r.vertical&&(D=lp(i,r.vertical,F,d.get("icon-text-fit-padding"),y,g)),m&&(i=lp(i,m,F,d.get("icon-text-fit-padding"),y,g)));const P=h?p.line.getGranularityForZoomLevel(h.z):1,z=(l,p)=>{p.x<0||p.x>=T||p.y<0||p.y>=T||function(e,n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,A,M){const k=e.addToLineVertexArray(n,r);let I,E,T,F,D=0,P=0,z=0,B=0,C=-1,V=-1;const L={};let O=ma("");if(e.allowVerticalPlacement&&i.vertical){const t=l.layout.get("text-rotate").evaluate(w,{},A)+90;T=new wy(u,n,c,h,p,i.vertical,f,d,y,t),a&&(F=new wy(u,n,c,h,p,a,g,x,y,t));}if(s){const r=l.layout.get("icon-rotate").evaluate(w,{}),i="none"!==l.layout.get("icon-text-fit"),o=my(s,r,S,i),f=a?my(a,r,S,i):void 0;E=new wy(u,n,c,h,p,s,g,x,!1,r),D=4*o.length;const d=e.iconSizeData;let y=null;"source"===d.kind?(y=[up*l.layout.get("icon-size").evaluate(w,{})],y[0]>cp&&q(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===d.kind&&(y=[up*_.compositeIconSizes[0].evaluate(w,{},A),up*_.compositeIconSizes[1].evaluate(w,{},A)],(y[0]>cp||y[1]>cp)&&q(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,o,y,b,v,w,t.aw.none,n,k.lineStartIndex,k.lineLength,-1,A),C=e.icon.placedSymbolArray.length-1,f&&(P=4*f.length,e.addSymbols(e.icon,f,y,b,v,w,t.aw.vertical,n,k.lineStartIndex,k.lineLength,-1,A),V=e.icon.placedSymbolArray.length-1);}const $=Object.keys(i.horizontal);for(const r of $){const s=i.horizontal[r];if(!I){O=ma(s.text);const t=l.layout.get("text-rotate").evaluate(w,{},A);I=new wy(u,n,c,h,p,s,f,d,y,t);}const a=1===s.positionedLines.length;if(z+=Py(e,n,s,o,l,y,w,m,k,i.vertical?t.aw.horizontal:t.aw.horizontalOnly,a?$:[r],L,C,_,A),a)break}i.vertical&&(B+=Py(e,n,i.vertical,o,l,y,w,m,k,t.aw.vertical,["vertical"],L,V,_,A));const R=I?I.boxStartIndex:e.collisionBoxArray.length,N=I?I.boxEndIndex:e.collisionBoxArray.length,U=T?T.boxStartIndex:e.collisionBoxArray.length,j=T?T.boxEndIndex:e.collisionBoxArray.length,G=E?E.boxStartIndex:e.collisionBoxArray.length,X=E?E.boxEndIndex:e.collisionBoxArray.length,Y=F?F.boxStartIndex:e.collisionBoxArray.length,Z=F?F.boxEndIndex:e.collisionBoxArray.length;let H=-1;const W=(t,e)=>
36t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;H=W(I,H),H=W(T,H),H=W(E,H),H=W(F,H);const K=H>-1?1:0;K&&(H*=M/bh),e.glyphOffsetArray.length>=vp.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey);const J=Ty(l,w,A),[Q,tt]=function(e,n){const r=e.length,i=null==n?void 0:n.values;if((null==i?void 0:i.length)>0)for(let n=0;n<i.length;n+=2){const r=i[n+1];e.emplaceBack(t.aM[i[n]],r[0],r[1]);}return [r,e.length]}(e.textAnchorOffsets,J);e.symbolInstances.emplaceBack(n.x,n.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,C,V,O,R,N,U,j,G,X,Y,Z,c,z,B,D,P,K,0,f,H,Q,tt);}(e,p,l,r,i,s,D,e.layers[0],e.collisionBoxArray,n.index,n.sourceLayerIndex,e.index,x,[_,_,_,_],M,u,b,S,k,y,n,o,c,h,a);};if("line"===I)for(const t of ny(n.geometry,0,0,T,T)){const n=vu(t,P),s=dy(n,w,A,r.vertical||m,i,24,v,e.overscaling,T);for(const t of s)m&&By(e,m.text,E,t)||z(n,t);}else if("line-center"===I){for(const t of n.geometry)if(t.length>1){const e=vu(t,P),n=fy(e,A,r.vertical||m,i,24,v);n&&z(e,n);}}else if("Polygon"===n.type)for(const t of er(n.geometry,0)){const e=Sy(t,16);z(vu(t[0],P,!0),new ly(e.x,e.y,0));}else if("LineString"===n.type)for(const t of n.geometry){const e=vu(t,P);z(e,new ly(e[0].x,e[0].y,0));}else if("Point"===n.type)for(const t of n.geometry)for(const e of t)z([e],new ly(e.x,e.y,0));}function Py(t,e,r,i,s,o,a,l,u,c,h,p,f,d,y){const m=function(t,e,r,i,s,o,a,l){const u=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const i of t.positionedGlyphs){if(!i.rect)continue;const o=i.rect||{};let h=4,p=!0,f=1,d=0;const y=(s||l)&&i.vertical,m=i.metrics.advance*i.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(i.imageName?-(bh-i.metrics.width*i.scale)/2:(i.scale-1)*bh)),i.imageName){const t=a[i.imageName];p=t.sdf,f=t.pixelRatio,h=1/f;}const g=s?[i.x+m,i.y]:[0,0];let x=s?[0,0]:[i.x+m+r[0],i.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);const b=i.metrics.isDoubleResolution?2:1,w=(i.metrics.left-h)*i.scale-m+x[0],_=(-i.metrics.top-h)*i.scale+x[1],S=w+o.w/b*i.scale/f,A=_+o.h/b*i.scale/f,M=new n(w,_),k=new n(S,_),I=new n(w,A),E=new n(S,A);if(y){const t=new n(-m,m- -17),e=-Math.PI/2,r=12-m,s=new n(22-r,-(i.imageName?r:0)),o=new n(...v);M._rotateAround(e,t)._add(s)._add(o),k._rotateAround(e,t)._add(s)._add(o),I._rotateAround(e,t)._add(s)._add(o),E._rotateAround(e,t)._add(s)._add(o);}
36if(u){const t=Math.sin(u),e=Math.cos(u),n=[e,-t,t,e];M._matMult(n),k._matMult(n),I._matMult(n),E._matMult(n);}const T=new n(0,0),F=new n(0,0);c.push({tl:M,tr:k,bl:I,br:E,tex:o,writingMode:e.writingMode,glyphOffset:g,sectionIndex:i.sectionIndex,isSDF:p,pixelOffsetTL:T,pixelOffsetBR:F,minFontScaleX:0,minFontScaleY:0});}return c}(0,r,l,s,o,a,i,t.allowVerticalPlacement),g=t.textSizeData;let x=null;"source"===g.kind?(x=[up*s.layout.get("text-size").evaluate(a,{})],x[0]>cp&&q(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[up*d.compositeTextSizes[0].evaluate(a,{},y),up*d.compositeTextSizes[1].evaluate(a,{},y)],(x[0]>cp||x[1]>cp)&&q(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,l,o,a,c,e,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function zy(t){for(const e in t)return t[e];return null}function By(t,e,n,r){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(r.dist(t[e])<n)return !0}else i[e]=[];return i[e].push(r),!1}var Cy;t.cF=void 0,(Cy=t.cF||(t.cF={})).create="create",Cy.load="load",Cy.fullLoad="fullLoad";let Vy=null,Ly=[];const Oy=1e3/60,$y="loadTime",Ry="fullLoadTime",Ny={mark(t){performance.mark(t);},recordStartOfFrameAt(t){null!=Vy&&Ly.push(t-Vy),Vy=t;},resetRuntimeMetrics(){Vy=null,Ly=[];},clearInitializationMetrics(){performance.clearMeasures($y),performance.clearMeasures(Ry);for(const e in t.cF)performance.clearMarks(t.cF[e]);},remove(){this.resetRuntimeMetrics(),this.clearInitializationMetrics();},getPerformanceMetrics(){performance.measure($y,t.cF.create,t.cF.load),performance.measure(Ry,t.cF.create,t.cF.fullLoad);const e=performance.getEntriesByName($y)[0].duration,n=performance.getEntriesByName(Ry)[0].duration,r=Ly.length;return {loadTimeMs:e,fullLoadTimeMs:n,averageFramesPerSecond:1/(Ly.reduce(((t,e)=>t+e),0)/r/1e3),virtualDroppedFramesCount:Ly.filter((t=>t>Oy)).reduce(((t,e)=>t+(e-Oy)/Oy),0),totalFramesCount:r}}};t.$=c,t.A=f,t.B=us,t.C=is,t.D=qs,t.E=xt,t.F=function([t,e,n]){return e+=90,e*=Math.PI/180,n*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(n),y:t*Math.sin(e)*Math.sin(n),z:t*Math.cos(n)}},t.G=mn,t.H=zs,t.I=Hh,t.J=os,t.K=function(t){if(null==Y){const e=t.navigator?t.navigator.userAgent:null;Y=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")));}return Y},t.L=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Tp((()=>this.process())),this.subscription=Q(this.target,"message",(t=>this.receive(t)),!1),this.globalScope=X(self)?t:window;}registerMessageHandler(t,e){this.messageHandlers[t]=e;}unregisterMessageHandler(t){delete this.messageHandlers[t];}sendAsync(t,e){return new Promise(((n,r)=>{const i=Math.round(1e18*Math.random()).toString(36).substring(0,10),s=e?Q(e.signal,"abort",(()=>{null==s||s.unsubscribe(),delete this.resolveRejects[i];const e={id:i,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e);}),Fp):null;this.resolveRejects[i]={resolve:t=>{null==s||s.unsubscribe(),n(t);},reject:t=>{null==s||s.unsubscribe(),r(t);}};const o=[],a=Object.assign(Object.assign({},t),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ms(t.data,o)});this.target.postMessage(a,{transfer:o});}))}receive(t){const e=t.data,n=e.id,r=["file://","resource://android","null"],i=[e.origin,location.origin],s=e.origin===location.origin,o=i.some((t=>r.includes(t)));if((s||o)&&(!e.targetMapId||this.mapId===e.targetMapId)){if("<cancel>"===e.type){delete this.tasks[n];const t=this.abortControllers[n];return delete this.abortControllers[n],void(t&&t.abort())}if(X(self)||e.mustQueue)return this.tasks[n]=e,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,e);}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e);}processTask(t,n){return e(this,void 0,void 0,(function*(){if("<response>"===n.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(n.error?e.reject(gs(n.error)):e.resolve(gs(n.data)))}if(!this.messageHandlers[n.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const e=gs(n.data),r=new AbortController;this.abortControllers[t]=r;try{const i=yield this.messageHandlers[n.type](n.sourceMapId,e,r);this.completeTask(t,null,i);}catch(e){this.completeTask(t,e);}}))}completeTask(t,e,n){const r=[];delete this.abortControllers[t];const i={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?ms(e):null,data:ms(n,r)};this.target.postMessage(i,{transfer:r});}remove(){this.invoker.remove(),this.subscription.unsubscribe();}},t.M=ut,t.N=function(){var t=new f(16);return f!=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.O=function(t,e,n){var r,i,s,o,a,l,u,c,h,p,f,d,y=n[0],m=n[1],g=n[2];return e===t?(t[12]=e[0]*y+e[4]*m+e[8]*g+e[12],t[13]=e[1]*y+e[5]*m+e[9]*g+e[13],t[14]=e[2]*y+e[6]*m+e[10]*g+e[14],t[15]=e[3]*y+e[7]*m+e[11]*g+e[15]):(i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=r=e[0],t[1]=i,t[2]=s,t[3]=o,t[4]=a,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=r*y+a*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+f*g+e[14],t[15]=o*y+c*m+d*g+e[15]),t},t.P=n,t.Q=function(t,e,n){var r=n[0],i=n[1],s=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.R=Sl,t.S=function(t,e,n){var r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],y=e[12],m=e[13],g=e[14],x=e[15],v=n[0],b=n[1],w=n[2],_=n[3];return t[0]=v*r+b*a+w*h+_*y,t[1]=v*i+b*l+w*p+_*m,t[2]=v*s+b*u+w*f+_*g,t[3]=v*o+b*c+w*d+_*x,t[4]=(v=n[4])
36*r+(b=n[5])*a+(w=n[6])*h+(_=n[7])*y,t[5]=v*i+b*l+w*p+_*m,t[6]=v*s+b*u+w*f+_*g,t[7]=v*o+b*c+w*d+_*x,t[8]=(v=n[8])*r+(b=n[9])*a+(w=n[10])*h+(_=n[11])*y,t[9]=v*i+b*l+w*p+_*m,t[10]=v*s+b*u+w*f+_*g,t[11]=v*o+b*c+w*d+_*x,t[12]=(v=n[12])*r+(b=n[13])*a+(w=n[14])*h+(_=n[15])*y,t[13]=v*i+b*l+w*p+_*m,t[14]=v*s+b*u+w*f+_*g,t[15]=v*o+b*c+w*d+_*x,t},t.T=Bl,t.U=function(t,e){const n={};for(let r=0;r<e.length;r++){const i=e[r];i in t&&(n[i]=t[i]);}return n},t.V=Pp,t.W=L,t.X=Vp,t.Y=Cp,t.Z=ot,t._=e,t.a=st,t.a$=function(t){var e=new f(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.a0=h,t.a1=W,t.a2=Gp,t.a3=Op,t.a4=$p,t.a5=T,t.a6=Np,t.a7=Yp,t.a8=25,t.a9=jp,t.aA=function(t){var e=t[0],n=t[1];return Math.sqrt(e*e+n*n)},t.aB=function(t){return t[0]=0,t[1]=0,t},t.aC=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t},t.aD=yp,t.aE=A,t.aF=function(t,e,r,i){const s=e.y-t.y,o=e.x-t.x,a=i.y-r.y,l=i.x-r.x,u=a*o-l*s;if(0===u)return null;const c=(l*(t.y-r.y)-a*(t.x-r.x))/u;return new n(t.x+c*o,t.y+c*s)},t.aG=ny,t.aH=Ga,t.aI=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),i=Math.max(i,s.y);return [e,n,r,i]},t.aJ=bh,t.aK=F,t.aL=function(t,e,n,r,i=!1){if(!n[0]&&!n[1])return [0,0];const s=i?"map"===r?-t.bearingInRadians:0:"viewport"===r?t.bearingInRadians: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];}return [i?n[0]:F(e,n[0],t.zoom),i?n[1]:F(e,n[1],t.zoom)]},t.aN=pp,t.aO=Fy,t.aP=Qh,t.aQ=t=>"symbol"===t.type,t.aR=Ku,t.aS=ro,t.aT=du,t.aU=Uo,t.aV=sa,t.aW=ea,t.aX=et,t.aY=Rp,t.aZ=b,t.a_=v,t.aa=t=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((n=>{e.onloadstart=()=>{n(e);};for(const n of t){const t=window.document.createElement("source");ft(n)||(e.crossOrigin="Anonymous"),t.src=n,e.appendChild(t);}}))},t.ab=Dt,t.ac=function(){return $++},t.ad=Do,t.ae=vp,t.af=Gd,t.ag=fi,t.ah=Na,t.ai=Hp,t.aj=function(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,n,r,i)=>{const s=r||i;return e[n]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t;}return e},t.ak=V,t.al=85.051129,t.am=tt,t.an=function(t){return Math.pow(2,t)},t.ao=y,t.ap=Lp,t.aq=function(t){return Math.log(t)/Math.LN2},t.ar=function(t){var e=t[0],n=t[1];return e*e+n*n},t.as=function(t){if(!t.length)return new Set;const e=Math.max(...t.map((t=>t.canonical.z)));let n=1/0,r=-1/0,i=1/0,s=-1/0;const o=[];for(const a of t){const{x:t,y:l,z:u}=a.canonical,c=Math.pow(2,e-u),h=t*c,p=l*c;o.push({id:a,x:h,y:p}),h<n&&(n=h),h>r&&(r=h),p<i&&(i=p),p>s&&(s=p);}const a=new Set;for(const t of o)t.x!==n&&t.x!==r&&t.y!==i&&t.y!==s||a.add(t.id);return a},t.at=function(t,e){const n=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-n||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x},t.au=class{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,n){const r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const i={value:e,timeout:void 0};if(void 0!==n&&(i.timeout=setTimeout((()=>{this.remove(t,i);}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const n=t.wrapped().key,r=void 0===e?0:this.data[n].indexOf(e),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),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 n in this.data)for(const r of this.data[n])t(r.value)||e.push(r);for(const t of e)this.remove(t.value.tileID,t);}},t.av=function(t,e){let n=0,r=0;if("constant"===t.kind)r=t.layoutSize;else if("source"!==t.kind){const{interpolationType:i,minZoom:s,maxZoom:
36o}=t,a=i?V(dn.interpolationFactor(i,e,s,o),0,1):0;"camera"===t.kind?r=mn.number(t.minSize,t.maxSize,a):n=a;}return {uSizeT:n,uSize:r}},t.ax=function(t,{uSize:e,uSizeT:n},{lowerSize:r,upperSize:i}){return "source"===t.kind?r/up:"composite"===t.kind?mn.number(r/up,i/up,n):e},t.ay=function(t,e){var n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=n*a-r*o,v=n*l-i*o,b=n*u-s*o,w=r*l-i*a,_=r*u-s*a,S=i*u-s*l,A=c*y-h*d,M=c*m-p*d,k=c*g-f*d,I=h*m-p*y,E=h*g-f*y,T=p*g-f*m,F=x*T-v*E+b*I+w*k-_*M+S*A;return F?(t[0]=(a*T-l*E+u*I)*(F=1/F),t[1]=(i*E-r*T-s*I)*F,t[2]=(y*S-m*_+g*w)*F,t[3]=(p*_-h*S-f*w)*F,t[4]=(l*k-o*T-u*M)*F,t[5]=(n*T-i*k+s*M)*F,t[6]=(m*b-d*S-g*v)*F,t[7]=(c*S-p*b+f*v)*F,t[8]=(o*E-a*k+u*A)*F,t[9]=(r*k-n*E-s*A)*F,t[10]=(d*_-y*b+g*x)*F,t[11]=(h*b-c*_-f*x)*F,t[12]=(a*M-o*I-l*A)*F,t[13]=(n*I-r*M+i*A)*F,t[14]=(y*v-d*w-m*x)*F,t[15]=(c*w-h*v+p*x)*F,t):null},t.az=I,t.b=Z,t.b$=Sa,t.b0=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t},t.b1=function(t,e){var n=e[0],r=e[1],i=e[2],s=n*n+r*r+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t},t.b2=w,t.b3=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.b4=function(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t[3]=e[3]*n[3],t},t.b5=g,t.b6=function(t,e,n){const r=e[0]*n[0]+e[1]*n[1]+e[2]*n[2];return 0===r?null:(-(t[0]*n[0]+t[1]*n[1]+t[2]*n[2])-n[3])/r},t.b7=S,t.b8=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},t.b9=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]},t.bA=function(t,e,n){var r=n[0],i=n[1],s=n[2],o=n[3],a=e[0],l=e[1],u=e[2],c=i*u-s*l,h=s*a-r*u,p=r*l-i*a;return t[0]=a+o*(c+=c)+i*(p+=p)-s*(h+=h),t[1]=l+o*h+s*c-r*p,t[2]=u+o*p+r*h-i*c,t},t.bB=function(t,e,n){const r=(i=[t[0],t[1],t[2],e[0],e[1],e[2],n[0],n[1],n[2]])[0]*((c=i[8])*(o=i[4])-(a=i[5])*(u=i[7]))+i[1]*(-c*(s=i[3])+a*(l=i[6]))+i[2]*(u*s-o*l);var i,s,o,a,l,u,c;if(0===r)return null;const h=w([],[e[0],e[1],e[2]],[n[0],n[1],n[2]]),p=w([],[n[0],n[1],n[2]],[t[0],t[1],t[2]]),f=w([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),d=b([],h,-t[3]);return v(d,d,b([],p,-e[3])),v(d,d,b([],f,-n[3])),b(d,d,1/r),d},t.bC=Dp,t.bD=function(){return new Float64Array(4)},t.bE=function(t,e,n,r){var i=[],s=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],s[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),s[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),s[2]=i[2],t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t},t.bF=function(t,e,n,r){var i=[],s=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],s[0]=i[0],s[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),s[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t},t.bG=function(t,e,n,r){var i=[],s=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],s[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),s[1]=i[1],s[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=s[0]+n[0],t[1]=s[1]+n[1],t[2]=s[2]+n[2],t},t.bH=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*r,t[1]=o*i-c*r,t[2]=a*i-h*r,t[3]=l*i-p*r,t[8]=s*r+u*i,t[9]=o*r+c*i,t[10]=a*r+h*i,t[11]=l*r+p*i,t},t.bI=function(t,e){const n=D(t,360),r=D(e,360),i=r-n,s=r>n?i-360:i+360;return Math.abs(i)<Math.abs(s)?i:s},t.bJ=function(t){return t[0]=0,t[1]=0,t[2]=0,t},t.bK=function(t,e,n,r){const i=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+r*r);t/=i,e/=i,n/=s,r/=s;const o=Math.acos(t*n+e*r);return -e*n+t*r>0?o:-o},t.bL=function(t,e){const n=D(t,2*Math.PI),r=D(e,2*Math.PI);return Math.min(Math.abs(n-r),Math.abs(n-r+2*Math.PI),Math.abs(n-r-2*Math.PI))},t.bM=function(){const t={},e=vt.$version;for(const n in vt.$root){const r=vt.$root[n];if(r.required){let i=null;i="version"===n?e:"array"===r.type?[]:{},null!=i&&(t[n]=i);}}return t},t.bN=ht,t.bO=xs,t.bP=function t(e,n){if(Array.isArray(e)){if(!Array.isArray(n)||e.length!==n.length)return !1;for(let r=0;r<e.length;r++)if(!t(e[r],n[r]))return !1;return !0}if("object"==typeof e&&null!==e&&null!==n){if("object"!=typeof n)return !1;
36if(Object.keys(e).length!==Object.keys(n).length)return !1;for(const r in e)if(!t(e[r],n[r]))return !1;return !0}return e===n},t.bQ=function(t){t=t.slice();const e=Object.create(null);for(let n=0;n<t.length;n++)e[t[n].id]=t[n];for(let n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=wt(t[n],e[t[n].ref]));return t},t.bR=function(t,e){if("custom"===t.type)return new Ep(t,e);switch(t.type){case "background":return new Ip(t,e);case "circle":return new yl(t,e);case "color-relief":return new Ll(t,e);case "fill":return new Iu(t,e);case "fill-extrusion":return new Yu(t,e);case "heatmap":return new Il(t,e);case "hillshade":return new Fl(t,e);case "line":return new ph(t,e);case "raster":return new Qs(t,e);case "symbol":return new Ap(t,e)}},t.bS=t=>"raster"===t.type,t.bT=U,t.bU=function(t,e){if(!t)return [{command:"setStyle",args:[e]}];let n=[];try{if(!_t(t.version,e.version))return [{command:"setStyle",args:[e]}];_t(t.center,e.center)||n.push({command:"setCenter",args:[e.center]}),_t(t.state,e.state)||n.push({command:"setGlobalState",args:[e.state]}),_t(t.centerAltitude,e.centerAltitude)||n.push({command:"setCenterAltitude",args:[e.centerAltitude]}),_t(t.zoom,e.zoom)||n.push({command:"setZoom",args:[e.zoom]}),_t(t.bearing,e.bearing)||n.push({command:"setBearing",args:[e.bearing]}),_t(t.pitch,e.pitch)||n.push({command:"setPitch",args:[e.pitch]}),_t(t.roll,e.roll)||n.push({command:"setRoll",args:[e.roll]}),_t(t.sprite,e.sprite)||n.push({command:"setSprite",args:[e.sprite]}),_t(t.glyphs,e.glyphs)||n.push({command:"setGlyphs",args:[e.glyphs]}),_t(t.transition,e.transition)||n.push({command:"setTransition",args:[e.transition]}),_t(t.light,e.light)||n.push({command:"setLight",args:[e.light]}),_t(t.terrain,e.terrain)||n.push({command:"setTerrain",args:[e.terrain]}),_t(t.sky,e.sky)||n.push({command:"setSky",args:[e.sky]}),_t(t.projection,e.projection)||n.push({command:"setProjection",args:[e.projection]});const r={},i=[];!function(t,e,n,r){let i;for(i in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)||Mt(i,n,r));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?_t(t[i],e[i])||("geojson"===t[i].type&&"geojson"===e[i].type&&It(t,e,i)?St(n,{command:"setGeoJSONSourceData",args:[i,e[i].data]}):kt(i,e,n,r)):At(i,e,n));}(t.sources,e.sources,i,r);const s=[];t.layers&&t.layers.forEach((t=>{"source"in t&&r[t.source]?n.push({command:"removeLayer",args:[t.id]}):s.push(t);})),n=n.concat(i),function(t,e,n){e=e||[];const r=(t=t||[]).map(Tt),i=e.map(Tt),s=t.reduce(Ft,{}),o=e.reduce(Ft,{}),a=r.slice(),l=Object.create(null);let u,c,h,p,f;for(let t=0,e=0;t<r.length;t++)u=r[t],Object.prototype.hasOwnProperty.call(o,u)?e++:(St(n,{command:"removeLayer",args:[u]}),a.splice(a.indexOf(u,e),1));for(let t=0,e=0;t<i.length;t++)u=i[i.length-1-t],a[a.length-1-t]!==u&&(Object.prototype.hasOwnProperty.call(s,u)?(St(n,{command:"removeLayer",args:[u]}),a.splice(a.lastIndexOf(u,a.length-e),1)):e++,p=a[a.length-t],St(n,{command:"addLayer",args:[o[u],p]}),a.splice(a.length-t,0,u),l[u]=!0);for(let t=0;t<i.length;t++)if(u=i[t],c=s[u],h=o[u],!l[u]&&!_t(c,h))if(_t(c.source,h.source)&&_t(c["source-layer"],h["source-layer"])&&_t(c.type,h.type)){for(f in Et(c.layout,h.layout,n,u,null,"setLayoutProperty"),Et(c.paint,h.paint,n,u,null,"setPaintProperty"),_t(c.filter,h.filter)||St(n,{command:"setFilter",args:[u,h.filter]}),_t(c.minzoom,h.minzoom)&&_t(c.maxzoom,h.maxzoom)||St(n,{command:"setLayerZoomRange",args:[u,h.minzoom,h.maxzoom]}),c)Object.prototype.hasOwnProperty.call(c,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Et(c[f],h[f],n,u,f.slice(6),"setPaintProperty"):_t(c[f],h[f])||St(n,{command:"setLayerProperty",args:[u,f,h[f]]}));for(f in h)Object.prototype.hasOwnProperty.call(h,f)&&!Object.prototype.hasOwnProperty.call(c,f)&&"layout"!==f&&"paint"!==f&&"filter"!==f&&"metadata"!==f&&"minzoom"!==f&&"maxzoom"!==f&&(0===f.indexOf("paint.")?Et(c[f],h[f],n,u,f.slice(6),"setPaintProperty"):_t(c[f],h[f])||St(n,{command:"setLayerProperty",args:[u,f,h[f]]}));}else St(n,{command:"removeLayer",args:[u]}),p=a[a.lastIndexOf(u)+1],St(n,{command:"addLayer",args:[h,p]});}(s,e.layers,n);}catch(t){console.warn("Unable to compute style diff:",t),n=[{command:"setStyle",args:[e]}];}return n},t.bV=function(t){const e=[],n=t.id;return void 0===n&&e.push({message:`layers.${n}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${n}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),e},t.bW=R,t.bX=N,t.bY=class extends wa{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t));}},t.bZ=Aa,t.b_=class extends wa{constructor(t,e){super(t,e),this.current=Ma;}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.ba=qp,t.bb=Xp,t.bc=function(t,e,n,r,i){var s=1/Math.tan(e/2);if(t[0]=s/n,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!=i&&i!==1/0){var o=1/(r-i);t[10]=(i+r)*o,t[14]=2*i*r*o;}else t[10]=-1,t[14]=-2*r;return t},t.bd=function(t){var e=new f(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.be=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),s=e[0],o=e[1],a=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+u*r,t[1]=o*i+c*r,t[2]=a*i+h*r,t[3]=l*i+p*r,t[4]=u*i-s*r,t[5]=c*i-o*r,t[6]=h*i-a*r,t[7]=p*i-l*r,t},t.bf=function(t,e,n){var r=Math.sin(n),i=Math.cos(n),s=e[4],o=e[5],a=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*r,t[5]=o*i+c*r,t[6]=a*i+h*r,t[7]=l*i+p*r,t[8]=u*i-s*r,t[9]=c*i-o*r,t[10]=h*i-a*r,t[11]=p*i-l*r,t},t.bg=function(){const t=new Float32Array(16);return y(t),t},t.bh=function(){const t=new Float64Array(16);return y(t),t},t.bi=function(){return new Float64Array(16)},t.bj=function(t,e,n){const r=new Float64Array(4);return k(r,t,e-90,n),r},t.bk=function(t,e,n,r){var i,s,o,a,l,u=e[0],c=e[1],h=e[2],f=e[3],d=n[0],y=n[1],m=n[2],g=n[3];return (s=u*d+c*y+h*m+f*g)<0&&(s=-s,d=-d,y=-y,m=-m,g=-g),1-s>p?(i=Math.acos(s),o=Math.sin(i),a=Math.sin((1-r)*i)/o,l=Math.sin(r*i)/o):(a=1-r,l=r),t[0]=a*u+l*d,t[1]=a*c+l*y,t[2]=a*h+l*m,t[3]=a*f+l*g,t},t.bl=function(t){const e=new Float64Array(9);var n,r,i,s,o,a,l,u,c,h,p,f,d,y,m,g,x,v;h=(i=(r=t)[0])*(l=i+i),p=(s=r[1])*l,d=(o=r[2])*l,y=o*(u=s+s),g=(a=r[3])*l,x=a*u,v=a*(c=o+o),(n=e)[0]=1-(f=s*u)-(m=o*c),n[3]=
36p-v,n[6]=d+x,n[1]=p+v,n[4]=1-h-m,n[7]=y-g,n[2]=d-x,n[5]=y+g,n[8]=1-h-f;const b=et(-Math.asin(V(e[2],-1,1)));let w,_;return Math.hypot(e[5],e[8])<.001?(w=0,_=-et(Math.atan2(e[3],e[4]))):(w=et(0===e[5]&&0===e[8]?0:Math.atan2(e[5],e[8])),_=et(0===e[1]&&0===e[0]?0:Math.atan2(e[1],e[0]))),{roll:w,pitch:b+90,bearing:_}},t.bm=function(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing},t.bn=Ie,t.bo=_a,t.bp=yu,t.bq=mu,t.br=fu,t.bs=P,t.bt=z,t.bu=$e,t.bv=function(t,e,n,r,i){return P(r,i,V((t-e)/(n-e),0,1))},t.bw=function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},t.bx=D,t.by=function(){return new Float64Array(3)},t.bz=k,t.c=at,t.c$=class{constructor(t,e){this.layers={[Gd]:this},this.name=Gd,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t;}feature(t){return new qd(this.features[t],this.extent)}},t.c0=class extends wa{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.c1=class extends wa{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.c2=d,t.c3=function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.c4=function(t,e,n){var r=e[0],i=e[1],s=e[2];return t[0]=r*n[0]+i*n[3]+s*n[6],t[1]=r*n[1]+i*n[4]+s*n[7],t[2]=r*n[2]+i*n[5]+s*n[8],t},t.c5=function(t,e,n,r,i,s,o){var a=1/(e-n),l=1/(r-i),u=1/(s-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*a,t[13]=(i+r)*l,t[14]=(o+s)*u,t[15]=1,t},t.c6=class extends wa{constructor(t,e){super(t,e),this.current=new Array;}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(4*t.length);for(let n=0;n<t.length;n++)e[4*n]=t[n].r,e[4*n+1]=t[n].g,e[4*n+2]=t[n].b,e[4*n+3]=t[n].a;this.gl.uniform4fv(this.location,e);}}},t.c7=class extends wa{constructor(t,e){super(t,e),this.current=new Array;}set(t){if(t!=this.current){this.current=t;const e=new Float32Array(t);this.gl.uniform1fv(this.location,e);}}},t.c8=class extends vo{},t.c9=xh,t.cA=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[4]*i+n[12],t[1]=n[1]*r+n[5]*i+n[13],t},t.cB=function(t,e){const{x:n,y:r}=Np.fromLngLat(e);return !(t<0||t>25||r<0||r>=1||n<0||n>=1)},t.cC=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.cD=class extends oo{},t.cE=Ny,t.cG=ct,t.cH=function(t,e){at.REGISTERED_PROTOCOLS[t]=e;},t.cI=function(t){delete at.REGISTERED_PROTOCOLS[t];},t.cJ=function(t,e){const n={};for(let r=0;r<t.length;r++){const i=e&&e[t[r].id]||_i(t[r]);e&&(e[t[r].id]=i);let s=n[i];s||(s=n[i]=[]),s.push(t[r]);}const r=[];for(const t in n)r.push(n[t]);return r},t.cK=ps,t.cL=Zp,t.cM=Qd,t.cN=Wh,t.cO=function(e){var n;e.bucket.createArrays(),e.bucket.tilePixelRatio=T/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const r=e.bucket.layers[0],i=r.layout,s=r._unevaluatedLayout._values,o={layoutIconSize:s["icon-size"].possiblyEvaluate(new zs(e.bucket.zoom+1),e.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new zs(e.bucket.zoom+1),e.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new zs(18))};if("composite"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:n}=e.bucket.textSizeData;o.compositeTextSizes=[s["text-size"].possiblyEvaluate(new zs(t),e.canonical),s["text-size"].possiblyEvaluate(new zs(n),e.canonical)];}if("composite"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:n}=e.bucket.iconSizeData;o.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new zs(t),e.canonical),s["icon-size"].possiblyEvaluate(new zs(n),e.canonical)];}const a=i.get("text-line-height")*bh,l="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),u=i.get("text-keep-upright"),c=i.get("text-size");for(const s of e.bucket.features){const h=i.get("text-font").evaluate(s,{},e.canonical).join(","),p=c.evaluate(s,{},e.canonical),f=o.layoutTextSize.evaluate(s,{},e.canonical),d=o.layoutIconSize.evaluate(s,{},e.canonical),y={horizontal:{},vertical:void 0},m=s.text;let g,x=[0,0];if(m){const n=m.toString(),o=i.get("text-letter-spacing").evaluate(s,{},e.canonical)*bh,c=Ss(n)?o:0,d=i.get("text-anchor").evaluate(s,{},e.canonical),g=Ty(r,s,e.canonical);if(!g){const t=i.get("text-radial-offset").evaluate(s,{},e.canonical);x=t?Ey(d,[t*bh,Iy]):i.get("text-offset").evaluate(s,{},e.canonical).map((t=>t*bh));}
36let v=l?"center":i.get("text-justify").evaluate(s,{},e.canonical);const b="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(s,{},e.canonical)*bh:1/0,w=()=>{e.bucket.allowVerticalPlacement&&_s(n)&&(y.vertical=Jh(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,a,d,"left",c,x,t.aw.vertical,!0,f,p));};if(!l&&g){const n=new Set;if("auto"===v)for(let t=0;t<g.values.length;t+=2)n.add(Fy(g.values[t]));else n.add(v);let r=!1;for(const i of n)if(!y.horizontal[i])if(r)y.horizontal[i]=y.horizontal[0];else {const n=Jh(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,a,"center",i,c,x,t.aw.horizontal,!1,f,p);n&&(y.horizontal[i]=n,r=1===n.positionedLines.length);}w();}else {"auto"===v&&(v=Fy(d));const r=Jh(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,a,d,v,c,x,t.aw.horizontal,!1,f,p);r&&(y.horizontal[v]=r),w(),_s(n)&&l&&u&&(y.vertical=Jh(m,e.glyphMap,e.glyphPositions,e.imagePositions,h,b,a,d,v,c,x,t.aw.vertical,!1,f,p));}}let v=!1;if(s.icon&&s.icon.name){const t=e.imageMap[s.icon.name];t&&(g=op(e.imagePositions[s.icon.name],i.get("icon-offset").evaluate(s,{},e.canonical),i.get("icon-anchor").evaluate(s,{},e.canonical)),v=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(e.bucket.iconsNeedLinear=!0));}const b=zy(y.horizontal)||y.vertical;(n=e.bucket).iconsInText||(n.iconsInText=!!b&&b.iconsInText),(b||g)&&Dy(e.bucket,s,y,g,e.imageMap,o,f,d,x,v,e.canonical,e.subdivisionGranularity);}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers();},t.cP=Su,t.cQ=Nu,t.cR=oh,t.cS=function(t,e=""){const n=new zh;return function(t,e,n=""){for(const r in t.layers)e.writeMessage(3,((t,e)=>Xd(t,e,n)),t.layers[r]);}(t,n,e),n.finish()},t.cT=function(t,e,n,r,i,s){let o=ry(t,e,n,i,0);return o=ry(o,e,r,s,1),o},t.cU=class{constructor(t){this.maxEntries=t,this.map=new Map;}get(t){const e=this.map.get(t);return void 0!==e&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){const t=this.map.keys().next().value;this.map.delete(t);}this.map.set(t,e);}clear(){this.map.clear();}},t.cV=Lu,t.cW=zh,t.cX=jd,t.cY=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start);}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return 0===t.length&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},t.cZ=function(t,n,r,i,s){return e(this,void 0,void 0,(function*(){if(h())try{return yield W(t,n,r,i,s)}catch(t){}return function(t,e,n,r,i){const s=t.width,o=t.height;K&&J||(K=new OffscreenCanvas(s,o),J=K.getContext("2d",{willReadFrequently:!0})),K.width=s,K.height=o,J.drawImage(t,0,0,s,o);const a=J.getImageData(e,n,r,i);return J.clearRect(0,0,s,o),a.data}(t,n,r,i,s)}))},t.c_=Cl,t.ca=class extends wo{},t.cb=kl,t.cc=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.cd=Ml,t.ce=function(t,e,n){var r=e[0],i=e[1],s=e[2],o=n[3]*r+n[7]*i+n[11]*s+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*s+n[12])/(o=o||1),t[1]=(n[1]*r+n[5]*i+n[9]*s+n[13])/o,t[2]=(n[2]*r+n[6]*i+n[10]*s+n[14])/o,t},t.cf=class extends ao{},t.cg=class extends Eo{},t.ch=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.ci=function(t,e){var n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],y=t[12],m=t[13],g=t[14],x=t[15],v=e[0],b=e[1],w=e[2],_=e[3],S=e[4],A=e[5],M=e[6],
36k=e[7],I=e[8],E=e[9],T=e[10],F=e[11],D=e[12],P=e[13],z=e[14],B=e[15];return Math.abs(n-v)<=p*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(r-b)<=p*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-w)<=p*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(s-_)<=p*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-S)<=p*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-A)<=p*Math.max(1,Math.abs(a),Math.abs(A))&&Math.abs(l-M)<=p*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(u-k)<=p*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(c-I)<=p*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(h-E)<=p*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(f-T)<=p*Math.max(1,Math.abs(f),Math.abs(T))&&Math.abs(d-F)<=p*Math.max(1,Math.abs(d),Math.abs(F))&&Math.abs(y-D)<=p*Math.max(1,Math.abs(y),Math.abs(D))&&Math.abs(m-P)<=p*Math.max(1,Math.abs(m),Math.abs(P))&&Math.abs(g-z)<=p*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(x-B)<=p*Math.max(1,Math.abs(x),Math.abs(B))},t.cj=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.ck=t=>"circle"===t.type,t.cl=t=>"heatmap"===t.type,t.cm=t=>"line"===t.type,t.cn=t=>"fill"===t.type,t.co=t=>"fill-extrusion"===t.type,t.cp=t=>"hillshade"===t.type,t.cq=t=>"color-relief"===t.type,t.cr=t=>"background"===t.type,t.cs=t=>"custom"===t.type,t.ct=B,t.cu=function(t,e,n){if(e<=0)return t;const r=1/e;return void 0===n||Math.abs(n)<1e-10?Math.round(t*r)/r:(n>0?Math.ceil(t*r-1e-9):Math.floor(t*r+1e-10))/r},t.cv=function(t,e,n){const r=E(e.x-n.x,e.y-n.y),i=E(t.x-n.x,t.y-n.y);var s,o;return et(Math.atan2(r[0]*i[1]-r[1]*i[0],(s=r)[0]*(o=i)[0]+s[1]*o[1]))},t.cw=C,t.cx=function(t,e){var n;if(!rt[e])return !1;const r=null==t?void 0:t.target,i=(null===(n=null==r?void 0:r.ownerDocument)||void 0===n?void 0:n.defaultView)||window;return t instanceof i.MouseEvent||t instanceof i.WheelEvent},t.cy=function(t,e){return nt[e]&&"touches"in t},t.cz=function(t){return nt[t]||rt[t]},t.d=ft,t.d0=ri,t.d1=class{get tiles(){return this.tileIndex?.tiles??{}}get stats(){return this.tileIndex.stats}get total(){return this.tileIndex.total}constructor(t,e){const n=(e=this.options=Object.assign({},Qc,e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=ac(t,e);n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),r=Pc(r,e),e.updateable&&(this.source=r),this.initializeIndex(r,e);}initializeIndex(t,e){this.tileIndex=e.cluster?new Oc(e.clusterOptions):new Kc(e),t.length&&this.tileIndex.initialize(t);}getTile(t,e,n){return e=+e,n=+n,(t=+t)<0||t>24?null:this.tileIndex.getTile(t,e,n)}updateData(t,e){const n=this.options;if(!n.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:i}=function(t,e,n){const r=function(t){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map((t=>[t.id,t]))),update:new Map(t.update?.map((t=>[t.id,t])))}:{remove:new Set,add:new Map,update:new Map}}(e);let i=[];if(r.removeAll&&(i=t,t=[]),r.remove.size||r.add.size){const e=[];for(const n of t)(r.remove.has(n.id)||r.add.has(n.id))&&e.push(n);if(e.length){i.push(...e);const n=new Set(e.map((t=>t.id)));t=t.filter((t=>!n.has(t.id)));}if(r.add.size){let e=ac({type:"FeatureCollection",features:Array.from(r.add.values())},n);e=Pc(e,n),i.push(...e),t.push(...e);}}if(r.update.size)for(const[e,s]of r.update){const r=[],o=[];for(const n of t)n.id===e?r.push(n):o.push(n);if(!r.length)continue;const a=Cc(r,s,n);a.length&&(i.push(...r,...a),o.push(...a),t=o);}return {affected:i,source:t}}(this.source,t,n);e&&({affected:r,source:i}=this.filterUpdate(i,r,e)),r.length&&(this.source=i,this.tileIndex.updateIndex(i,r,n));}filterUpdate(t,e,n){const r=new Set;for(const i of t)null!=i.id&&(n(fc(i))||(e.push(i),r.add(i.id)));return {affected:e,source:t=t.filter((t=>!r.has(t.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return {type:"FeatureCollection",features:this.source.map((t=>fc(t)))}}updateClusterOptions(t,e){const n=this.options.cluster;this.options.cluster=t,this.options.clusterOptions=e,n!=t?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options);}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,n){return this.tileIndex.getLeaves(t,e,n)}},t.d2=Ps,t.e=O,t.f=t=>e(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),t.g=lt,t.h=t=>new Promise(((e,n)=>{const r=new Image;r.onload=()=>{e(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=H;}));},r.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const i=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(i):H;})),t.i=X,t.j=(t,e)=>pt(O(t,{type:"json"}),e),t.k=gt,t.l=mt,t.m=pt,t.n=(t,e)=>pt(O(t,{type:"arrayBuffer"}),e),t.o=function(t){return new zh(t).readFields(Gh,[])},t.p=Zh,t.q=function(t){return /[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))},t.r=_l,t.s=Q,t.t=Hs,t.u=vt,t.v=rs,t.w=q,t.x=Os,t.y=ss,t.z=Cs;}));
37
38define("worker",["./shared"],(function(e){"use strict";class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t);}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t);}update(t,i,s){for(const i of t){this._layerConfigs[i.id]=i;const t=this._layers[i.id]=e.bR(i,s);t._featureFilter=e.ag(t.filter,s),this.keyCache[i.id]&&delete this.keyCache[i.id];}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(const t of r){const i=t.map((e=>this._layers[e.id])),s=i[0];if(s.isHidden())continue;const r=s.source||"";let o=this.familiesBySource[r];o||(o=this.familiesBySource[r]={});const n=s.sourceLayer||e.af;let a=o[n];a||(a=o[n]=[]),a.push(i);}}}class i{constructor(t){const i={},s=[];for(const e in t){const r=t[e],o=i[e]={};for(const e in r){const t=r[+e];
38if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};s.push(i),o[e]={rect:i,metrics:t.metrics};}}const{w:r,h:o}=e.p(s),n=new e.r({width:r||1,height:o||1});for(const s in t){const r=t[s];for(const t in r){const o=r[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const a=i[s][t].rect;e.r.copy(o.bitmap,n,{x:0,y:0},{x:a.x+1,y:a.y+1},o.bitmap);}}this.image=n,this.positions=i;}}e.cK("GlyphAtlas",i);class s{constructor(t){this.tileID=new e.a2(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[];}parse(t,s,o,n,a){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ad;const l=new e.cL(Object.keys(t.layers).sort()),c=new e.cM(this.tileID,this.promoteId);c.bucketLayerIDs=[];const h={},d={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:a},u=s.familiesBySource[this.source];for(const i in u){const s=t.layers[i];if(!s)continue;1===s.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=l.encode(i),a=[];for(let e=0;e<s.length;e++){const t=s.feature(e),r=c.getId(t,i);a.push({feature:t,id:r,index:e,sourceLayerIndex:n});}for(const t of u[i]){const i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.isHidden(this.zoom,!0)||(r(t,this.zoom,o),(h[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(a,d,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))));}}const g=e.bW(d.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(g).length){const e=new AbortController;this.inFlightDependencies.push(e),p=n.sendAsync({type:"GG",data:{stacks:g,source:this.source,tileID:this.tileID,type:"glyphs"}},e);}const f=Object.keys(d.iconDependencies);let y=Promise.resolve({});if(f.length){const e=new AbortController;this.inFlightDependencies.push(e),y=n.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},e);}const v=Object.keys(d.patternDependencies);let m=Promise.resolve({});if(v.length){const e=new AbortController;this.inFlightDependencies.push(e),m=n.sendAsync({type:"GI",data:{icons:v,source:this.source,tileID:this.tileID,type:"patterns"}},e);}const S=d.dashDependencies;let _=Promise.resolve({});if(Object.keys(S).length){const e=new AbortController;this.inFlightDependencies.push(e),_=n.sendAsync({type:"GDA",data:{dashes:S}},e);}const[w,b,I,k]=yield Promise.all([p,y,m,_]),T=new i(w),x=new e.cN(b,I);for(const t in h){const i=h[t];i instanceof e.ae?(r(i.layers,this.zoom,o),e.cO({bucket:i,glyphMap:w,glyphPositions:T.positions,imageMap:b,imagePositions:x.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):i.hasDependencies&&(i instanceof e.cP||i instanceof e.cQ||i instanceof e.cR)&&(r(i.layers,this.zoom,o),i.addFeatures(d,this.tileID.canonical,x.patternPositions,k));}return this.status="done",{buckets:Object.values(h).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:T.image,imageAtlas:x,dashPositions:k,glyphMap:this.returnDependencies?w:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?T.positions:null}}))}}function r(t,i,s){const r=new e.H(i);for(const e of t)e.recalculate(r,s);}class o{constructor(){this.loading={},this.loaded={},this.parsing={};}startLoading(e,t){this.loading[e]=t;}finishLoading(e){delete this.loading[e];}abort(e){const t=this.loading[e];(null==t?void 0:t.abort)&&(t.abort.abort(),delete this.loading[e]);}setParsing(e,t){this.parsing[e]=t;}consumeParsing(e){const t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e];}markLoaded(e,t){this.loaded[e]=t;}getLoaded(e){const t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e];}clearLoaded(){this.loaded={};}}class n{constructor(e,t,i,s,r){this.type=e,this.properties=i||{},this.extent=r,this.pointsArray=t,this.id=s;}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e.P(t.x,t.y)))))}}class a{constructor(e,t,i){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=i;}feature(e){return this._myFeatures[e]}}class l{constructor(){this.layers={};}addLayer(e){this.layers[e.name]=e;}}function c(t){let i=e.cS(t);return 0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),{vectorTile:t,rawData:i.buffer}}function h(t,i,s){const{extent:r}=t,o=Math.pow(2,s.z-i.z),l=(s.x-i.x*o)*r,c=(s.y-i.y*o)*r,h=[];for(let i=0;i<t.length;i++){const s=t.feature(i);let a=s.loadGeometry();for(const e of a)for(const t of e)t.x=t.x*o-l,t.y=t.y*o-c;const d=128;
38a=e.cT(a,s.type,-d,-d,r+d,r+d),0!==a.length&&h.push(new n(s.type,a,s.properties,s.id,r));}return new a(h,t.name,r)}class d{constructor(t,i,s){this.actor=t,this.layerIndex=i,this.availableImages=s,this.tileState=new o,this.overzoomedTileResultCache=new e.cU(1e3);}loadVectorTile(t,i){try{return {vectorTile:"mlt"!==t.encoding?new e.cV(new e.cW(i)):new e.cX(i),rawData:i}}catch(e){const s=new Uint8Array(i);let r=`Unable to parse the tile at ${t.request.url}, `;throw r+=31===s[0]&&139===s[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.message}`,new Error(r)}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);const o=this._startRequestTiming(t),n=new s(t);this.tileState.startLoading(i,n);const a=new AbortController;n.abort=a;try{const s=yield e.n(t.request,a);if(t.etag&&t.etag===s.etag)return this.tileState.finishLoading(i),this._getEtagUnmodifiedResult(s,o);const l=this.loadVectorTile(t,s.data);if(this.tileState.finishLoading(i),!l)return null;let{vectorTile:c,rawData:h}=l;r&&({vectorTile:c,rawData:h}=this._getOverzoomTile(t,c));const d=this._getExpiryData(s),u=this._finishRequestTiming(o);n.vectorTile=c,this.tileState.markLoaded(i,n);const g={rawData:h,cacheControl:d,resourceTiming:u};this.tileState.setParsing(i,g);try{return yield this._parseWorkerTile(n,t,g)}finally{this.tileState.clearParsing(i);}}catch(e){throw this.tileState.finishLoading(i),n.status="done",this.tileState.markLoaded(i,n),e}}))}_getEtagUnmodifiedResult(t,i){const s=this._getExpiryData(t),r=this._finishRequestTiming(i);return e.e({etagUnmodified:!0},s,r)}_parseWorkerTile(t,i,s){return e._(this,void 0,void 0,(function*(){let r=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(s){const{rawData:t,cacheControl:o,resourceTiming:n}=s;r=e.e({rawTileData:t.slice(0),encoding:i.encoding},r,o,n);}return r}))}_getExpiryData({expires:e,cacheControl:t,etag:i}){const s={};return e&&(s.expires=e),t&&(s.cacheControl=t),i&&(s.etag=i),s}_startRequestTiming(t){var i;if(null===(i=t.request)||void 0===i?void 0:i.collectResourceTiming)return new e.cY(t.request.url)}_finishRequestTiming(e){const t=null==e?void 0:e.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){const{tileID:i,source:s,overzoomParameters:r}=e,{maxZoomTileID:o}=r,n=`${o.key}_${i.key}`,a=this.overzoomedTileResultCache.get(n);if(a)return a;const d=new l,u=this.layerIndex.familiesBySource[s];for(const e in u){const s=t.layers[e];if(!s)continue;const r=h(s,o,i.canonical);r.length>0&&d.addLayer(r);}const g=c(d);return this.overzoomedTileResultCache.set(n,g),g}reloadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){const s=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,s)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid);}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid);}))}}class u{constructor(){this.loaded={};}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,encoding:s,rawImageData:r,redFactor:o,greenFactor:n,blueFactor:a,baseShift:l}=t,c=r.width+2,h=r.height+2,d=e.b(r)?new e.R({width:c,height:h},yield e.cZ(r,-1,-1,c,h)):r,u=new e.c_(i,d,s,o,n,a,l);return this.loaded=this.loaded||{},this.loaded[i]=u,u}))}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i];}}class g{constructor(e,t,i,s=p){this.actor=e,this.layerIndex=t,this.availableImages=i,this.tileState=new o,this._createGeoJSONIndex=s;}loadVectorTile(t){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:i,x:s,y:r}=t.tileID.canonical,o=this._geoJSONIndex.getTile(i,s,r);return o?c(new e.c$(o.features,{version:2,extent:e.a5})):null}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:e}=t,i=new s(t);i.abort=new AbortController;try{const s=this.loadVectorTile(t);if(!s)return null;const{vectorTile:r,rawData:o}=s;i.vectorTile=r,this.tileState.markLoaded(e,i);const n={rawData:o};this.tileState.setParsing(e,n);try{return yield this._parseWorkerTile(i,t,n)}finally{this.tileState.clearParsing(e);}}catch(t){throw i.status="done",this.tileState.markLoaded(e,i),t}}))}_reloadLoadedTile(t){return e._(this,void 0,void 0,(function*(){const e=t.uid,i=this.tileState.getLoaded(e);if(!i)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){const s=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(i,t,s)}if("done"===i.status&&i.vectorTile)return yield this._parseWorkerTile(i,t)}))}_parseWorkerTile(t,i,s){return e._(this,void 0,void 0,(function*(){let r=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,i.subdivisionGranularity);if(s){const{rawData:t}=s;r=e.e({rawTileData:t.slice(0),encoding:"mvt"},r);}return r}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid);}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid);}))}loadData(t){return e._(this,void 0,void 0,(function*(){var i;
38null===(i=this._pendingRequest)||void 0===i||i.abort();const s=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const e={};return t.request&&(e.data=t.data),this._finishRequestTiming(s,t,e),e}catch(t){if(delete this._pendingRequest,!e.Z(t))throw t;return {abandoned:!0}}}))}_startRequestTiming(t){var i;if(null===(i=t.request)||void 0===i?void 0:i.collectResourceTiming)return new e.cY(t.request.url)}_finishRequestTiming(e,t,i){const s=null==e?void 0:e.finish();s&&(i.resourceTiming={[t.source]:JSON.parse(JSON.stringify(s))});}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){var s;if(t.request&&(t.data=(yield e.j(t.request,i)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return null!==(s=this._geoJSONIndex)&&void 0!==s||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,f(t)),null==this._geoJSONIndex)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(e,t){if("FeatureCollection"!==e.type)return e;const i=this._getFilterPredicate(t);return i?{type:"FeatureCollection",features:e.features.filter((e=>i(e)))}:e}_getFilterPredicate(t){if("boolean"!=typeof t&&!(null==t?void 0:t.length))return;const i=e.d0(t,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return e=>i.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,(function*(){var e;null===(e=this._pendingRequest)||void 0===e||e.abort();}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function p(t,i){const s=e.e(i.geojsonVtOptions||{},{updateable:!0,clusterOptions:f(i)});return new e.d1(t,s)}function f({geojsonVtOptions:t,clusterProperties:i}){if(!i||!t.clusterOptions)return t.clusterOptions;const s={},r={},o={accumulated:null,zoom:0},n={properties:null},a=Object.keys(i);for(const t of a){const[o,n]=i[t],a=e.d0(n),l=e.d0("string"==typeof o?[o,["accumulated"],["get",t]]:o);s[t]=a.value,r[t]=l.value;}return t.clusterOptions.map=e=>{n.properties=e;const t={};for(const e of a)t[e]=s[e].evaluate(o,n);return t},t.clusterOptions.reduce=(e,t)=>{n.properties=t;for(const t of a)o.accumulated=e[t],e[t]=r[t].evaluate(o,n);},t.clusterOptions}class y{constructor(t){this.self=t,this.actor=new e.L(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t;},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d2.setMethods(t);},this.actor.registerMessageHandler("LDT",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler("RDT",((t,i)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,i.source).removeTile(i);})))),this.actor.registerMessageHandler("GCEZ",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((e,t)=>
38this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler("LT",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler("RT",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler("AT",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler("RMT",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler("RS",((t,i)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;const e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i);})))),this.actor.registerMessageHandler("RM",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t);})))),this.actor.registerMessageHandler("SR",((t,i)=>e._(this,void 0,void 0,(function*(){this.referrer=i;})))),this.actor.registerMessageHandler("SRPS",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler("IS",((t,i)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(i);})))),this.actor.registerMessageHandler("SI",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler("UL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(i.layers,i.removedIds,this._getGlobalState(t));})))),this.actor.registerMessageHandler("UGS",((t,i)=>e._(this,void 0,void 0,(function*(){const e=this._getGlobalState(t);for(const t in i)e[t]=i[t];})))),this.actor.registerMessageHandler("SL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(i,this._getGlobalState(t));}))));}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,i){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const s=this.workerSources[t][e];for(const e in s)s[e].availableImages=i;}}))}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,(function*(){return yield e.d2.syncState(i,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const s={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case "vector":this.workerSources[e][t][i]=new d(s,this._getLayerIndex(e),this._getAvailableImages(e));break;case "geojson":this.workerSources[e][t][i]=new g(s,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](s,this._getLayerIndex(e),this._getAvailableImages(e));}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new u),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new y(self)),y}));
39
40define("index",["exports","./shared"],(function(t,e){"use strict";function i(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}let o,s,r;const n={frame(t,i,o,s){const r=s||window,n=r.requestAnimationFrame((t=>{a(),i(t);})),{unsubscribe:a}=e.s(t.signal,"abort",(()=>{a(),r.cancelAnimationFrame(n),o(new e.a(t.signal.reason));}),!1);},frameAsync(t,e){return new Promise(((i,o)=>{this.frame(t,i,o,e);}))},taskAsync(t,i){const o=i||window;return new Promise(((i,s)=>{let r;const n=o.setTimeout((()=>{null==r||r(),i();}),0);({unsubscribe:r}=e.s(t.signal,"abort",(()=>{null==r||r(),o.clearTimeout(n),s(new e.a(t.signal.reason));}),!1));}))},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(o||(o=document.createElement("a")),o.href=t,o.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==r?r:!!matchMedia&&(null==s&&(s=matchMedia("(prefers-reduced-motion: reduce)")),s.matches)},set prefersReducedMotion(t){r=t;}},a=new class{constructor(){this._frozenAt=null;}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:performance.now()}setNow(t){this._frozenAt=t;}restoreNow(){this._frozenAt=null;}isFrozen(){return null!==this._frozenAt}};function l(){return a.getCurrentTime()}function h(t){a.setNow(t);}function c(){a.restoreNow();}function u(){return a.isFrozen()}class d{static create(t,e,i){const o=window.document.createElement(t);return void 0!==e&&(o.className=e),i&&i.appendChild(o),o}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]="none");}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect);}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",d.suppressClickInternal,!0);}static suppressClick(){window.addEventListener("click",d.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",d.suppressClickInternal,!0);}),0);}static getScale(t){const e=t.getBoundingClientRect();
40return {x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,o){const s=i.boundingClientRect;return new e.P((o.clientX-s.left)/i.x-t.clientLeft,(o.clientY-s.top)/i.y-t.clientTop)}static mousePos(t,e){const i=d.getScale(t);return d.getPoint(t,i,e)}static touchPos(t,e){const i=[],o=d.getScale(t);for(let s=0;s<e.length;s++)i.push(d.getPoint(t,o,e[s]));return i}static sanitize(t){const e=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),i=e.querySelectorAll("script");for(const t of i)t.remove();return d.clean(e),e.innerHTML}static isPossiblyDangerous(t,e){const i=e.replace(/\s+/g,"").toLowerCase();return !(!["src","href","xlink:href"].includes(t)||!i.includes("javascript:")&&!i.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const e=t.children;for(const t of e)d.removeAttributes(t),d.clean(t);}static removeAttributes(t){for(const{name:e,value:i}of t.attributes)d.isPossiblyDangerous(e,i)&&t.removeAttribute(e);}}d.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,d.selectProp=!d.docStyle||"userSelect"in d.docStyle?"userSelect":"webkitUserSelect";var _,p="5.21.1";!function(t){let i,o,s,r;t.resetRequestQueue=()=>{i=[],o=0,s=0,r={};},t.addThrottleControl=t=>{const e=s++;return r[e]=t,e},t.removeThrottleControl=t=>{delete r[t],a();},t.getImage=(t,o,s=!0)=>new Promise(((r,n)=>{t.headers||(t.headers={}),t.headers.accept="image/webp,*/*",e.e(t,{type:"image"}),i.push({abortController:o,requestParameters:t,supportImageRefresh:s,state:"queued",onError:t=>{n(t);},onSuccess:t=>{r(t);}}),a();}));const n=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:i,supportImageRefresh:s,onError:r,onSuccess:n,abortController:h}=t,c=!1===s&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0));o++;const u=c?l(i,h):e.m(i,h);try{const i=yield u;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?n(i):i.data&&n({data:yield(d=i.data,"function"==typeof createImageBitmap?e.f(d):e.h(d)),cacheControl:i.cacheControl,expires:i.expires});}catch(e){delete t.abortController,r(e);}finally{o--,a();}var d;})),a=()=>{const t=(()=>{for(const t of Object.keys(r))if(r[t]())return !0;return !1})()?e.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=o;e<t&&i.length>0;e++){const t=i.shift();t.abortController.signal.aborted?e--:n(t);}},l=(t,i)=>new Promise(((o,s)=>{const r=new Image,n=t.url,a=t.credentials;a&&"include"===a?r.crossOrigin="use-credentials":(a&&"same-origin"===a||!e.d(n))&&(r.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{r.src="",s(new e.a(i.signal.reason));})),r.fetchPriority="high",r.onload=()=>{r.onerror=r.onload=null,o({data:r});},r.onerror=()=>{r.onerror=r.onload=null,i.signal.aborted||s(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));},r.src=n;}));}(_||(_={})),_.resetRequestQueue();class m{constructor(t){this._transformRequestFn=null!=t?t:null;}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t;}}function f(t){const e=[];if("string"==typeof t)e.push({id:"default",url:t});else if(t&&t.length>0){const i=[];for(const{id:o,url:s}of t){const t=`${o}${s}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:o,url:s}));}}return e}function g(t,e,i){try{const o=new URL(t);return o.pathname+=`${e}${i}`,o.toString()}catch(e){throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function v(t){const{userImage:e}=t;return !!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class y extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0;}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0;}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[];}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null;}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);
40this._validate(t,e)&&(this.images[t]=e);}_validate(t,i){let o=!0;const s=i.data||i.spriteData;return this._validateStretch(i.stretchX,s&&s.width)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchX" value`))),o=!1),this._validateStretch(i.stretchY,s&&s.height)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "stretchY" value`))),o=!1),this._validateContent(i.content,i)||(this.fire(new e.k(new Error(`Image "${t}" has invalid "content" value`))),o=!1),o}_validateStretch(t,e){if(!t)return !0;let i=0;for(const o of t){if(o[0]<i||o[1]<o[0]||e<o[1])return !1;i=o[1];}return !0}_validateContent(t,e){if(!t)return !0;if(4!==t.length)return !1;const i=e.spriteData,o=i&&i.width||e.data.width,s=i&&i.height||e.data.height;return !(t[0]<0||o<t[0]||t[1]<0||s<t[1]||t[2]<0||o<t[2]||t[3]<0||s<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const o=this.getImage(t);if(i&&(o.data.width!==e.data.width||o.data.height!==e.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=o.version+1,this.images[t]=e,this.updatedImages[t]=!0;}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove();}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((e,i)=>{let o=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(o=!1);this.isLoaded()||o?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e});}))}_getImagesForIds(t){const i={};for(const o of t){let t=this.getImage(o);t||(this.fire(new e.l("styleimagemissing",{id:o})),t=this.getImage(o)),t?i[o]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${o}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);}return i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return {width:t,height:e}}getPattern(t){const i=this.patterns[t],o=this.getImage(t);if(!o)return null;if(i&&i.position.version===o.version)return i.position;if(i)i.position.version=o.version;else {const i={w:o.data.width+2,h:o.data.height+2,x:0,y:0},s=new e.I(i,o);this.patterns[t]={bin:i,position:s};}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const i=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.T(t,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE);}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:o}=e.p(t),s=this.atlasImage;s.resize({width:i||1,height:o||1});for(const t in this.patterns){const{bin:i}=this.patterns[t],o=i.x+1,r=i.y+1,n=this.getImage(t).data,a=n.width,l=n.height;e.R.copy(n,s,{x:0,y:0},{x:o,y:r},{width:a,height:l}),e.R.copy(n,s,{x:0,y:l-1},{x:o,y:r-1},{width:a,height:1}),e.R.copy(n,s,{x:0,y:0},{x:o,y:r+l},{width:a,height:1}),e.R.copy(n,s,{x:a-1,y:0},{x:o-1,y:r},{width:1,height:l}),e.R.copy(n,s,{x:0,y:0},{x:o+a,y:r},{width:1,height:l});}this.dirty=!0;}beginFrame(){this.callbackDispatchedThisFrame={};}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: "${i}" was not found`),v(t)&&this.updateImage(i,t);}}cloneImages(){const t={};for(const e in this.images){const i=this.images[e];t[e]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null});}return t}}const b=1e20;function x(t,e,i,o,s,r,n,a,l){for(let h=e;h<e+o;h++)w(t,i*r+h,r,s,n,a,l);for(let h=i;h<i+s;h++)w(t,h*r+e,1,o,n,a,l);}function w(t,e,i,o,s,r,n){r[0]=0,n[0]=-b,n[1]=b,s[0]=t[e];for(let a=1,l=0,h=0;a<o;a++){s[a]=t[e+a*i];const o=a*a;do{const t=r[l];h=(s[a]-s[t]+o-t*t)/(a-t)/2;}
40while(h<=n[l]&&--l>-1);l++,r[l]=a,n[l]=h,n[l+1]=b;}for(let a=0,l=0;a<o;a++){for(;n[l+1]<a;)l++;const o=r[l],h=a-o;t[e+a*i]=s[o]+h*h;}}const T=e.v.layout_symbol["text-font"].default.join(",");class P{constructor(t,e,i){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=i;}setURL(t){this.url=t;}getGlyphs(t){return e._(this,void 0,void 0,(function*(){const e=[];for(const i in t)for(const o of t[i])e.push(this._getAndCacheGlyphsPromise(i,o));const i=yield Promise.all(e),o={};for(const{stack:t,id:e,glyph:s}of i)o[t]||(o[t]={}),o[t][e]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return o}))}_getAndCacheGlyphsPromise(t,i){return e._(this,void 0,void 0,(function*(){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let o=e.glyphs[i];return void 0!==o?{stack:t,id:i,glyph:o}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(o=e.glyphs[i]=this._drawGlyph(e,t,i),{stack:t,id:i,glyph:o}):yield this._downloadAndCacheRangePromise(t,i)}))}_downloadAndCacheRangePromise(t,
40i){return e._(this,void 0,void 0,(function*(){const e=this.entries[t],o=Math.floor(i/256);if(e.ranges[o])return {stack:t,id:i,glyph:null};if(!e.requests[o]){const i=P.loadGlyphRange(t,o,this.url,this.requestManager);e.requests[o]=i;}try{const s=yield e.requests[o];for(const t in s)e.glyphs[+t]=s[+t];return e.ranges[o]=!0,{stack:t,id:i,glyph:s[i]||null}}catch(s){const r=e.glyphs[i]=this._drawGlyph(e,t,i);return this._warnOnMissingGlyphRange(r,o,i,s),{stack:t,id:i,glyph:r}}}))}_warnOnMissingGlyphRange(t,i,o,s){const r=256*i,n=r+255,a=o.toString(16).padStart(4,"0").toUpperCase();e.w(`Unable to load glyph range ${i}, ${r}-${n}. Rendering codepoint U+${a} locally instead. ${s}`);}_charUsesLocalIdeographFontFamily(t){return !!this.localIdeographFontFamily&&e.q(t)}_drawGlyph(t,i,o){const s=i===T&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(o),r=s?"ideographTinySDF":"tinySDF";t[r]||(t[r]=this._createTinySDF(s?this.localIdeographFontFamily:i));const n=t[r].draw(String.fromCodePoint(o)),a=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(o));return {id:o,bitmap:new e.r({width:n.width||60,height:n.height||60},n.data),metrics:{width:a?0:n.glyphWidth/2||24,height:n.glyphHeight/2||24,left:n.glyphLeft/2+.5||0,top:n.glyphTop/2-27.5||-8,advance:a?0:n.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const e=t?t.split(","):[];e.push("sans-serif");const i=e.map((t=>/[-\w]+/.test(t)?t:`'${CSS.escape(t)}'`)).join(",");return new P.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:this._fontWeight(e[0]),fontStyle:this._fontStyle(e[0]),lang:this.lang})}_fontStyle(t){return /italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const e={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let i;for(const[o,s]of Object.entries(e))new RegExp(`\\b${o}\\b`,"i").test(t)&&(i=`${s}`);return i}destroy(){for(const t in this.entries){const e=this.entries[t];e.tinySDF&&(e.tinySDF=null),e.ideographTinySDF&&(e.ideographTinySDF=null),e.glyphs={},e.requests={},e.ranges={};}this.entries={};}}P.loadGlyphRange=function(t,i,o,s){return e._(this,void 0,void 0,(function*(){const r=256*i,n=r+255,a=yield s.transformRequest(o.replace("{fontstack}",t).replace("{range}",`${r}-${n}`),"Glyphs"),l=yield e.n(a,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${r}-${n}`);const h={};for(const t of e.o(l.data))h[t.id]=t;return h}))},P.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:s="sans-serif",fontWeight:r="normal",fontStyle:n="normal",lang:a=null}={}){this.buffer=e,this.cutoff=o,this.radius=i,this.lang=a;const l=this.size=t+4*e,h=this._createCanvas(l),c=this.ctx=h.getContext("2d",{willReadFrequently:!0});c.font=`${n} ${r} ${t}px ${s}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l);}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:s,actualBoundingBoxRight:r}=this.ctx.measureText(t),n=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(r-s))),l=Math.min(this.size-this.buffer,n+Math.ceil(o)),h=a+2*this.buffer,c=l+2*this.buffer,u=Math.max(h*c,0),d=new Uint8ClampedArray(u),_={data:d,width:h,height:c,glyphWidth:a,glyphHeight:l,glyphTop:n,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return _;const{ctx:p,buffer:m,gridInner:f,gridOuter:g}=this;this.lang&&(p.lang=this.lang),p.clearRect(m,m,a,l),p.fillText(t,m,m+n);const v=p.getImageData(m,m,a,l);g.fill(b,0,u),f.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<a;e++){const i=v.data[4*(t*a+e)+3]/255;if(0===i)continue;const o=(t+m)*h+e+m;if(1===i)g[o]=0,f[o]=b;else {const t=.5-i;g[o]=t>0?t*t:0,f[o]=t<0?t*t:0;}}x(g,0,0,h,c,h,this.f,this.v,this.z),x(f,m,m,a,l,h,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(g[t])-Math.sqrt(f[t]);d[t]=Math.round(255-255*(e/this.radius+this.cutoff));}return _}};class M{constructor(){this.specification=e.u.light.position;}possiblyEvaluate(t,i){return e.F(t.expression.evaluate(i))}interpolate(t,i,o){return {x:e.G.number(t.x,i.x,o),y:e.G.number(t.y,i.y,o),z:e.G.number(t.z,i.z,o)}}}let C;class I extends e.E{constructor(t){super(),C=C||new e.t({anchor:new e.D(e.u.light.anchor),position:new M,color:new e.D(e.u.light.color),intensity:new e.D(e.u.light.intensity)}),this._transitionable=new e.x(C,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned();}getLight(){return this._transitionable.serialize()}setLight(t,i={}
40){if(!this._validate(e.y,t,i))for(const i in t){const o=t[i];i.endsWith(e.z)?this._transitionable.setTransition(i.slice(0,-e.z.length),o):this._transitionable.setValue(i,o);}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t);}_validate(t,i,o){return (!o||!1!==o.validate)&&e.B(this,t.call(e.C,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.u}))}}const E=new e.t({"sky-color":new e.D(e.u.sky["sky-color"]),"horizon-color":new e.D(e.u.sky["horizon-color"]),"fog-color":new e.D(e.u.sky["fog-color"]),"fog-ground-blend":new e.D(e.u.sky["fog-ground-blend"]),"horizon-fog-blend":new e.D(e.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new e.D(e.u.sky["sky-horizon-blend"]),"atmosphere-blend":new e.D(e.u.sky["atmosphere-blend"])});class S extends e.E{constructor(t){super(),this._transitionable=new e.x(E,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.H(0));}setSky(t,i={}){if(!this._validate(e.J,t,i)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const i in t){const o=t[i];i.endsWith(e.z)?this._transitionable.setTransition(i.slice(0,-e.z.length),o):this._transitionable.setValue(i,o);}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t);}_validate(t,i,o={}){return !1!==(null==o?void 0:o.validate)&&e.B(this,t.call(e.C,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class L{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 o=[];let s=t.length%2==1?-t[t.length-1]*i:0,r=t[0]*i,n=!0;o.push({left:s,right:r,isDash:n,zeroLength:0===t[0]});let a=t[0];for(let e=1;e<t.length;e++){n=!n;const l=t[e];s=a*i,a+=l,r=a*i,o.push({left:s,right:r,isDash:n,zeroLength:0===l});}return o}addRoundDash(t,e,i){const o=e/2;for(let e=-i;e<=i;e++){const s=this.width*(this.nextRow+i+e);let r=0,n=t[r];for(let a=0;a<this.width;a++){a/n.right>1&&(n=t[++r]);const l=Math.abs(a-n.left),h=Math.abs(a-n.right),c=Math.min(l,h);let u;const d=e/i*(o+1);if(n.isDash){const t=o-Math.abs(d);u=Math.sqrt(c*c+t*t);}else u=o-Math.sqrt(c*c+d*d);this.data[s+a]=Math.max(0,Math.min(255,u+128));}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],o=t[e+1];i.zeroLength?t.splice(e,1):o&&o.isDash===i.isDash&&(o.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 o=this.width*this.nextRow;let s=0,r=t[s];for(let e=0;e<this.width;e++){e/r.right>1&&(r=t[++s]);const i=Math.abs(e-r.left),n=Math.abs(e-r.right),a=Math.min(i,n);this.data[o+e]=Math.max(0,Math.min(255,(r.isDash?a:-a)+128));}}addDash(t,i){const o=i?7:0,s=2*o+1;if(this.nextRow+s>this.height)return e.w("LineAtlas out of space"),null;let r=0;for(let e=0;e<t.length;e++)r+=t[e];if(0!==r){const e=this.width/r,s=this.getDashRanges(t,this.width,e);i?this.addRoundDash(s,e,o):this.addRegularDash(s);}const n={y:this.nextRow+o,height:2*o,width:r};return this.nextRow+=s,this.dirty=!0,n}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data));}}const z="maplibre_preloaded_worker_pool";class R{constructor(){this.active={};}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<R.workerCount;)this.workers.push(new Worker(e.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEac
40h((t=>{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[z]}numActive(){return Object.keys(this.active).length}}const D=Math.floor(n.hardwareConcurrency/2);let A,k;function O(){return A||(A=new R),A}function B(){O().acquire(z);}function F(){const t=A;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(z),A=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"));}R.workerCount=e.K(globalThis)?Math.max(Math.min(D,3),1):1;class j{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const o=this.workerPool.acquire(i);for(let t=0;t<o.length;t++){const s=new e.L(o[t],i);s.name=`Worker ${t}`,this.actors.push(s);}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e){const i=[];for(const o of this.actors)i.push(o.sendAsync({type:t,data:e}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove();})),this.actors=[],t&&this.workerPool.release(this.id);}registerMessageHandler(t,e){for(const i of this.actors)i.registerMessageHandler(t,e);}unregisterMessageHandler(t){for(const e of this.actors)e.unregisterMessageHandler(t);}}function N(){return k||(k=new j(O(),e.M),k.registerMessageHandler("GR",((t,i,o)=>e.m(i,o)))),k}function Z(t,i){const o=e.N();return e.O(o,o,[1,1,0]),e.Q(o,o,[.5*t.width,.5*t.height,1]),t.calculatePosMatrix?e.S(o,o,t.calculatePosMatrix(i.toUnwrapped())):o}function G(t,e,i,o,s,r,n){var a;const l=function(t,e,i){if(t)for(const o of t){const t=e[o];if(t&&t.source===i&&"fill-extrusion"===t.type)return !0}else for(const t in e){const o=e[t];if(o.source===i&&"fill-extrusion"===o.type)return !0}return !1}(null!==(a=null==s?void 0:s.layers)&&void 0!==a?a:null,e,t.id),h=r.maxPitchScaleFactor(),c=t.tilesIn(o,h,l);c.sort(U);const u=[];for(const o of c)u.push({wrappedTileID:o.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(e,i,t.getState(),o.queryGeometry,o.cameraQueryGeometry,o.scale,s,r,h,Z(r,o.tileID),n?(t,e)=>n(o.tileID,t,e):void 0)});return function(t,e){for(const i in t)for(const o of t[i])V(o,e);return t}(function(t){const e={},i={};for(const o of t){const t=o.queryResults,s=o.wrappedTileID,r=i[s]=i[s]||{};for(const i in t){const o=t[i],s=r[i]=r[i]||{},n=e[i]=e[i]||[];for(const t of o)s[t.featureIndex]||(s[t.featureIndex]=!0,n.push(t));}}return e}(u),t)}function U(t,e){const i=t.tileID,o=e.tileID;return i.overscaledZ-o.overscaledZ||i.canonical.y-o.canonical.y||i.wrap-o.wrap||i.canonical.x-o.canonical.x}function V(t,e){const i=t.feature,o=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=o;}function W(t,i,o,s){return e._(this,void 0,void 0,(function*(){let r=t;if(t.url?r=(yield e.j(yield i.transformRequest(t.url,"Source"),o)).data:yield n.frameAsync(o,s),!r)return null;const a=e.U(e.e(r,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return "vector_layers"in r&&r.vector_layers&&(a.vectorLayerIds=r.vector_layers.map((t=>t.id))),a}))}class q{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])));}setNorthEast(t){return this._ne=t instanceof e.V?new e.V(t.lng,t.lat):e.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.V?new e.V(t.lng,t.lat):e.V.convert(t),this}extend(t){const i=this._sw,o=this._ne;let s,r;if(t instanceof e.V)s=t,r=t;else {if(!(t instanceof q))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(q.convert(t)):this.extend(e.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(e.V.convert(t)):this;if(s=t._sw,r=t._ne,!s||!r)return this}return i||o?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),o.lng=Math.max(r.lng,o.lng),o.lat=Math.max(r.lat,o.lat)):(this._sw=new e.V(s.lng,s.lat),this._ne=new e.V(r.lng,r.lat)),this}getCenter(){return new e.V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
40getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new e.V(this.getWest(),this.getNorth())}getSouthEast(){return new e.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(t){const{lng:i,lat:o}=e.V.convert(t);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&s}intersects(t){if(!((t=q.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return !1;const i=Math.abs(this.getEast()-this.getWest()),o=Math.abs(t.getEast()-t.getWest());if(i>=360||o>=360)return !0;const s=e.W(this.getWest(),-180,180),r=e.W(this.getEast(),-180,180),n=e.W(t.getWest(),-180,180),a=e.W(t.getEast(),-180,180),l=s>r,h=n>a;
40return !(!l||!h)||(l?a>=s||n<=r:h?r>=n||s<=a:n<=r&&a>=s)}static convert(t){return t instanceof q?t:t?new q(t):t}static fromLngLat(t,i=0){const o=360*i/40075017,s=o/Math.cos(Math.PI/180*t.lat);return new q(new e.V(t.lng-s,t.lat-o),new e.V(t.lng+s,t.lat+o))}adjustAntiMeridian(){const t=new e.V(this._sw.lng,this._sw.lat),i=new e.V(this._ne.lng,this._ne.lat);return new q(t,t.lng>i.lng?new e.V(i.lng+360,i.lat):i)}}class ${constructor(t,e,i){this.bounds=q.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||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(t){const i=Math.pow(2,t.z),o=Math.floor(e.Y(this.bounds.getWest())*i),s=Math.floor(e.X(this.bounds.getNorth())*i),r=Math.ceil(e.Y(this.bounds.getEast())*i),n=Math.ceil(e.X(this.bounds.getSouth())*i);return t.x>=o&&t.x<r&&t.y>=s&&t.y<n}}class H extends e.E{constructor(t,i,o,s){if(super(),this.id=t,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.U(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=e.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s);}load(){return e._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield W(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(e.e(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})));}catch(t){this._tileJSONRequest=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t));}}))}loaded(){return this._loaded}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load();}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0);}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null);}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:yield this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
40ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};i.request.collectResourceTiming=this._collectResourceTiming;let o="RT";if(t.actor&&"expired"!==t.state){if("loading"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i};}))}else t.actor=this.dispatcher.getActor(),o="LT";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:o,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e);const s={};return (null==e?void 0:e.etagUnmodified)&&(s.unmodified=!0),s}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null);}}))}_getOverzoomParameters(t){return e._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const e=t.tileID.scaledTo(this.maxzoom).canonical,i=e.url(this.tiles,this.map.getPixelRatio(),this.scheme);return {maxZoomTileID:e,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}}))}_afterTileLoadWorkerResponse(t,e){if((null==e?void 0:e.resourceTiming)&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.etag=null==e?void 0:e.etag,t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject);}}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
40ype,source:this.id}}));}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}));}))}hasTransition(){return !1}}class X extends e.E{constructor(t,i,o,s){super(),this.id=t,this.dispatcher=o,this.setEventedParent(s),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.e({type:"raster"},i),e.e(this,e.U(i,["url","scheme","tileSize"]));}load(){return e._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield W(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,i&&(e.e(this,i),i.bounds&&(this.tileBounds=new $(i.bounds,this.minzoom,this.maxzoom)),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})));}catch(t){this._tileJSONRequest=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t));}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load();}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null);}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0);}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}serialize(){return e.e({},this._options)}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const o=yield _.getImage(yield this.map._requestManager.transformRequest(i,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(o&&o.data){this.map._refreshExpiredTiles&&(o.cacheControl||o.expires)&&t.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const i=this.map.painter.context,s=i.gl,r=o.data;t.texture=this.map.painter.getTileTexture(r.width),t.texture?t.texture.update(r,{useMipmap:!0}):(t.texture=new e.T(i,r,s.RGBA,{useMipmap:!0}),t.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST)),t.state="loaded";}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController);}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture);}))}hasTransition(){return !1}}class Y extends X{constructor(t,i,o,s){super(t,i,o,s),this.type="raster-dem",this.maxzoom=22,this._options=e.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift;}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o=yield this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield _.getImage(o,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i&&i.data){const o=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});
40const s=e.b(o)&&e.$()?o:yield this.readImageNow(o),r={type:this.type,uid:t.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&"expired"!==t.state&&"reloading"!==t.state)return;t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor());const n=yield t.actor.sendAsync({type:"LDT",data:r});t.dem=n,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded";}}catch(e){if(delete t.abortController,t.aborted)t.state="unloaded";else if(e)throw t.state="errored",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&e.a0()){const i=t.width+2,o=t.height+2;try{return new e.R({width:i,height:o},yield e.a1(t,-1,-1,i,o))}catch(t){}}return n.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,o=Math.pow(2,i.z),s=(i.x-1+o)%o,r=0===i.x?t.wrap-1:t.wrap,n=(i.x+1+o)%o,a=i.x+1===o?t.wrap+1:t.wrap,l={};return l[new e.a2(t.overscaledZ,r,i.z,s,i.y).key]={backfilled:!1},l[new e.a2(t.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},i.y>0&&(l[new e.a2(t.overscaledZ,r,i.z,s,i.y-1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1}),i.y+1<o&&(l[new e.a2(t.overscaledZ,r,i.z,s,i.y+1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.a2(t.overscaledZ,a,i.z,n,i.y+1).key]={backfilled:!1}),l}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}));}))}}function K(t,e){return e?t.properties[e]:t.id}function Q(t,e){const i={id:t.id};if(e.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const i of e.removeProperties){const e=t.addOrUpdateProperties.findIndex((t=>t.key===i));e>-1&&t.addOrUpdateProperties.splice(e,1);}return (t.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(t.removeProperties||e.removeProperties)&&(i.removeProperties=[...t.removeProperties||[],...e.removeProperties||[]]),(t.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(t.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||t.newGeometry),i}function J(t){var e,i;if(!t)return {};const o={};return o.removeAll=t.removeAll,o.remove=new Set(t.remove||[]),o.add=new Map(null===(e=t.add)||void 0===e?void 0:e.map((t=>[t.id,t]))),o.update=new Map(null===(i=t.update)||void 0===i?void 0:i.map((t=>[t.id,t]))),o}function tt(t){return t&&0!==t.length?"number"==typeof t[0]?[t]:t.flatMap((t=>tt(t))):[]}function et(t){return "GeometryCollection"===t.type?t.geometries.flatMap((t=>et(t))):tt(t.coordinates)}function it(t){const e=new q;let i;switch(t.type){case "FeatureCollection":i=t.features.flatMap((t=>et(t.geometry)));break;case "Feature":i=et(t.geometry);break;default:i=et(t);}if(0===i.length)return e;for(let t=0;t<i.length;t++){const[o,s]=i[t];e.extend([o,s]);}return e}class ot extends e.E{constructor(t,i,o,s){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=o.getActor(),this.setEventedParent(s),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=e.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&e.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMa
40xZoom}".`),this.workerOptions=e.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:e.a5,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1,promoteId:"string"==typeof i.promoteId?i.promoteId:void 0,cluster:i.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.a5,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1}},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions);}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(e.a5/this.tileSize)}_getClusterMaxZoom(t){const i=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||void 0===t||e.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${i}"`),i}load(){return e._(this,void 0,void 0,(function*(){yield this._updateWorkerData();}))}onAdd(t){this.map=t,this.load();}setData(t,e){this._data="string"==typeof t?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const i=this._updateWorkerData();return e?i:this}updateData(t,e){this._pendingWorkerUpdate.diff=function(t,e){if(!t)return e||{};if(!e)return t||{};const i=J(t),o=J(e);!function(t,e){e.removeAll&&(t.add.clear(),t.update.clear(),t.remove.clear(),e.remove.clear());for(const i of e.remove)t.add.delete(i),t.update.delete(i);for(const[i,o]of e.update){const s=t.update.get(i);s&&(e.update.set(i,Q(s,o)),t.update.delete(i));}}(i,o);const s={};if((i.removeAll||o.removeAll)&&(s.removeAll=!0),s.remove=new Set([...i.remove,...o.remove]),s.add=new Map([...i.add,...o.add]),s.update=new Map([...i.update,...o.update]),s.remove.size&&s.add.size)for(const t of s.add.keys())s.remove.delete(t);return function(t){const e={};return t.removeAll&&(e.removeAll=t.removeAll),t.remove&&(e.remove=Array.from(t.remove)),t.add&&(e.add=Array.from(t.add.values())),t.update&&(e.update=Array.from(t.update.values())
40),e}(s)}(this._pendingWorkerUpdate.diff,t);const i=this._updateWorkerData();return e?i:this}getData(){return e._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return e._(this,void 0,void 0,(function*(){return it(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,void 0!==t.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),void 0!==t.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(){return e._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void e.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:i,updateCluster:o}=this._pendingWorkerUpdate,s=this._getLoadGeoJSONParameters(t,i,o);void 0!==t?this._pendingWorkerUpdate.data=void 0:i?this._pendingWorkerUpdate.diff=void 0:o&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(s);}))}_getLoadGeoJSONParameters(t,i,o){return e._(this,void 0,void 0,(function*(){const s=e.e({type:this.type},this.workerOptions);return "string"==typeof t?(s.request=yield this.map._requestManager.transformRequest(n.resolveURL(t),"Source"),s.request.collectResourceTiming=this._collectResourceTiming,s):void 0!==t?(s.data=t,s):i?(s.dataDiff=i,s):o?(s.updateCluster=!0,s):void 0}))}_dispatchWorkerUpdate(t){return e._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new e.l("dataloading",{dataType:"source"}));try{const i=yield t,o=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||o.abandoned)return void this.fire(new e.l("dataabort",{dataType:"source"}));o.data&&(this._data={geojson:o.data});const s=this._applyDiffToSource(i.dataDiff),r=this._getShouldReloadTileOptions(s),n={dataType:"source"};this._applyResourceTiming(n,o),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new e.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content",shouldReloadTileOptions:r})));}catch(t){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new e.l("dataabort",{dataType:"source"}));this.fire(new e.k(t));}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData();}}))}_applyResourceTiming(t,i){var o;if(!this._collectResourceTiming)return;const s=null===(o=i.resourceTiming)||void 0===o?void 0:o[this.id];if(!s)return;const r=s.slice(0);(null==r?void 0:r.length)&&e.e(t,{resourceTiming:r});}_applyDiffToSource(t){if(!t)return;const e="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const t=function(t,e){const i=new Map;if(null==t)return i;if(null==t.type)return i;if("Feature"===t.type){const o=K(t,e);if(null==o)return;return i.set(o,t),i}if("FeatureCollection"===t.type){const o=new Set;for(const s of t.features){const t=K(s,e);if(null==t)return;if(o.has(t))return;o.add(t),i.set(t,s);}return i}}(this._data.geojson,e);if(!t)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:t};}if(!this._data.updateable)return;const i=function(t,e,i){var o,s;const r=[];if(e.removeAll)t.clear();else if(e.remove)for(const i of e.remove){const e=t.get(i);e&&(r.push(e.geometry),t.delete(i));}if(e.add)for(const o of e.add){const e=K(o,i);if(null==e)continue;const s=t.get(e);s&&r.push(s.geometry),r.push(o.geometry),t.set(e,o);}if(e.update)for(const i of e.update){const e=t.get(i.id);if(!e)continue;const n=!!i.newGeometry,a=i.removeAllProperties||(null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0||(null===(s=i.addOrUpdateProperties)||void 0===s?void 0:s.length)>0;if(!n&&!a)continue;r.push(e.geometry);const l=Object.assign({},e);if(t.set(i.id,l),n&&(r.push(i.newGeometry),l.geometry=i.newGeometry),a){if(l.properties=i.removeAllProperties?{}:Object.assign({},l.properties||{}),i.removeProperties)for(const t of i.removeProperties)delete l.properties[t];
40if(i.addOrUpdateProperties)for(const{key:t,value:e}of i.addOrUpdateProperties)l.properties[t]=e;}}return r}(this._data.updateable,t,e);return t.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(t){if(t)return {affectedBounds:t.filter(Boolean).map((t=>it(t)))}}shouldReloadTile(t,{affectedBounds:i}){if("loading"===t.state)return !0;if("unloaded"===t.state)return !1;const{buffer:o,extent:s}=this.workerOptions.geojsonVtOptions,r=function({x:t,y:i,z:o},s=0){const r=e.a3((t-s)/Math.pow(2,o)),n=e.a4((i+1+s)/Math.pow(2,o)),a=e.a3((t+1+s)/Math.pow(2,o)),l=e.a4((i-s)/Math.pow(2,o));return new q([r,n],[a,l])}(t.tileID.canonical,o/s);for(const t of i)if(r.intersects(t))return !0;return !1}loaded(){return !this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?"RT":"LT";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const o=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(o,this.map.painter,"RT"===e);}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0;}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
40ype,source:this.id}});}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}});}serialize(){return e.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return !1}}class st extends e.E{constructor(t,e,i,o){super(),this.flippedWindingOrder=!1,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(o),this.options=e;}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield _.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading());}catch(t){this._request=null,this._loaded=!0,e.Z(t)||this.fire(new e.k(t));}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null;})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.l("data",{dataType:"source",sourceDataType:"metadata"})));}onAdd(t){this.map=t,this.load();}onRemove(){this._request&&(this._request.abort(),this._request=null);}setCoordinates(t){this.coordinates=t;const i=t.map(e.a6.fromLngLat);var o;return this.tileID=function(t){const i=e.a7.fromPoints(t),o=i.width(),s=i.height(),r=Math.max(o,s),n=Math.max(0,Math.floor(-Math.log(r)/Math.LN2)),a=Math.pow(2,n);return new e.a9(n,Math.floor((i.minX+i.maxX)/2*a),Math.floor((i.minY+i.maxY)/2*a))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((t=>this.tileID.getTilePoint(t)._round())),this.flippedWindingOrder=((o=this.tileCoords)[1].x-o[0].x)*(o[2].y-o[0].y)-(o[1].y-o[0].y)*(o[2].x-o[0].x)<0,this.fire(new e.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.texture||(this.texture=new e.T(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let o=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,o=!0);}o&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}));}loadTile(t){return e._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored";}))}serialize(){return {type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}_getOverlappingTileRanges(t){const{minX:i,minY:o,maxX:s,maxY:r}=e.a7.fromPoints(t),n={};for(let t=0;t<=e.a8;t++){const e=Math.pow(2,t),a=Math.floor(i*e),l=Math.floor(o*e),h=Math.floor(s*e),c=Math.floor(r*e),u=(a%e+e)%e,d=h%e,_=Math.floor(a/e),p=Math.floor(h/e);n[t]={minWrap:_,maxWrap:p,minTileXWrapped:u,maxTileXWrapped:d,minTileY:l,maxTileY:c};}return n}}class rt extends st{constructor(t,e,i,o){super(t,e,i,o),this._onPlayingHandler=()=>{var t;null===(t=this.map)||void 0===t||t.triggerRepaint();},this.roundZoom=!0,this.type="video",this.options=e;}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(e,"Source")).url);try{const t=yield e.aa(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading();}catch(t){this.fire(new e.k(t));}}))}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.k(new e.ab(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t;}}getVideo(){return this.video}
40onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause());}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let o=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,o=!0);}o&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}));}serialize(){return {type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class nt extends st{constructor(t,i,o,s){super(t,i,o,s),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>"number"!=typeof t))))||this.fire(new e.k(new e.ab(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.k(new e.ab(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.k(new e.ab(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.k(new e.ab(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.k(new e.ab(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play();}onRemove(){this.pause();}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,o=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new e.T(i,this.canvas,o.RGBA,{premultiply:!0}),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE));let s=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,s=!0);}s&&this.fire(new e.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}));}serialize(){return {type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of [this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return !0;return !1}}const at={},lt=t=>{switch(t){case "geojson":return ot;case "image":return st;case "raster":return X;case "raster-dem":return Y;case "vector":return H;case "video":return rt;case "canvas":return nt}return at[t]},ht=(t,i)=>e._(void 0,void 0,void 0,(function*(){if(lt(t))throw new Error(`A source type called "${t}" already exists.`);((t,e)=>{at[t]=e;})(t,i);})),ct="RTLPluginLoaded";class ut extends e.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=N();}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status="error",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null;}setRTLTextPlugin(t){return e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=n.resolveURL(t),!this.url)throw new Error(`requested url ${t}
40 is invalid`);if("unavailable"===this.status){if(!e)return this._requestImport();this.status="deferred",this._syncState(this.status);}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new e.l(ct));}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport();}}let dt=null;function _t(){return dt||(dt=new ut),dt}var pt,mt;!function(t){t[t.Base=0]="Base",t[t.Parent=1]="Parent";}(pt||(pt={})),function(t){t[t.Departing=0]="Departing",t[t.Incoming=1]="Incoming";}(mt||(mt={}));class ft{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=e.ac(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading";}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:e,fadingParentID:i,fadeEndTime:o}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=e,this.fadingParentID=i,this.fadeEndTime=o;}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t;}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=l(),this.fadeEndTime=0,this.fadeOpacity=1;}wasRequested(){return "errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null;}loadVectorData(t,i,o){if(!0!==(null==t?void 0:t.etagUnmodified))if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const o of t){const t=o.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){o.layers=t,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=o;}}return i}(t.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.ae){if(this.hasSymbolBuckets=!0,!o)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.ae&&i.hasRTLText){this.hasRTLText=!0,_t().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e));}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions;}else this.collisionBoxArray=new e.ad;else this.state="loaded";}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded";}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new e.T(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,i,o,s,r,n,a,l,h,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:s,scale:r,tileSize:this.tileSize,pixelPosMatrix:h,transform:a,params:n,queryPadding:this.queryPadding*l,getElevation:c},t,e,i):{}}querySourceFeatures(t,i){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const s=o.loadVTLayers(),r=i&&i.sourceLayer?i.sourceLayer:"",n=s[e.af]||s[r];if(!n)return;const a=e.ag(null==i?void 0:i.filter,null==i?void 0:i.globalState),{z:l,x:h,y:c}=this.tileID.canonical,u={z:l,x:h,y:c};for(let i=0;i<n.length;i++){const s=n.feature(i);if(a.needGeometry){const t=e.ah(s,!0);
40if(!a.filter(new e.H(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new e.H(this.tileID.overscaledZ),s))continue;const d=o.getId(s,r),_=new e.ai(s,l,h,c,d);_.tile=u,t.push(_);}}hasData(){return "loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.aj(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"]);}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else {const o=this.expirationTime-i;o?this.expirationTime=t+Math.max(o,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,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const o=this.latestFeatureIndex.loadVTLayers();for(const s in this.buckets){if(!i.style.hasLayer(s))continue;const r=this.buckets[s],n=r.layers[0].sourceLayer||e.af,a=o[n],l=t[n];if(!a||!l||0===Object.keys(l).length)continue;r.update(l,a,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const h=i&&i.style&&i.style.getLayer(s);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(r)));}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return !this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0;}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=l()+t;}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 gt{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0;}updateState(t,i,o){const s=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][s]=this.stateChanges[t][s]||{},e.e(this.stateChanges[t][s],o),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==s&&(this.deletedStates[t][e]=null);}else if(this.deletedStates[t]&&null===this.deletedStates[t][s]){this.deletedStates[t][s]={};for(const e in this.state[t][s])o[e]||(this.deletedStates[t][s][e]=null);}else for(const e in o)this.deletedStates[t]&&this.deletedStates[t][s]&&null===this.deletedStates[t][s][e]&&delete this.deletedStates[t][s][e];}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const o=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][o]&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][o]
40)for(i in this.deletedStates[t][o]={},this.stateChanges[t][o])this.deletedStates[t][o][i]=null;else this.deletedStates[t][o]=null;else this.deletedStates[t]=null;}getState(t,i){const o=String(i),s=e.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(null===this.deletedStates[t])return {};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return {};for(const t in e)delete s[t];}return s}initializeTileState(t,e){t.setFeatureState(this.state,e);}coalesceChanges(t,i){const o={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const o in this.stateChanges[t])this.state[t][o]||(this.state[t][o]={}),e.e(this.state[t][o],this.stateChanges[t][o]),i[o]=this.state[t][o];o[t]=i;}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e];}o[t]=o[t]||{},e.e(o[t],i);}this.stateChanges={},this.deletedStates={},0!==Object.keys(o).length&&(this.revision++,t.setFeatureState(o,i));}}const vt=89.25;function yt(t,i){const o=e.ak(i.lat,-e.al,e.al);return new e.P(e.Y(i.lng)*t,e.X(o)*t)}function bt(t,i){return new e.a6(i.x/t,i.y/t).toLngLat()}function xt(t){return t.cameraToCenterDistance*Math.min(.85*Math.tan(e.am(90-t.pitch)),Math.tan(e.am(vt-t.pitch)))}function wt(t,i){const o=t.canonical,s=i/e.an(o.z),r=o.x+Math.pow(2,o.z)*t.wrap,n=e.ao(new Float64Array(16));return e.O(n,n,[r*s,o.y*s,0]),e.Q(n,n,[s/e.a5,s/e.a5,1]),n}function Tt(t,i,o,s,r){const n=e.a6.fromLngLat(t,i),a=r*e.ap(1,t.lat),{x:l,y:h,z:c}=Pt(o,s);return new e.a6(n.x+a*-l,n.y+a*-h,n.z+a*-c)}function Pt(t,i){const o=e.am(t),s=e.am(i),r=Math.cos(-o),n=Math.sin(o);return {x:n*Math.sin(s),y:-n*Math.cos(s),z:r}}function Mt(t,e,i){const o=e.intersectsFrustum(t);if(!i||0===o)return o;const s=e.intersectsPlane(i);return 0===s?0:2===o&&2===s?2:1}function Ct(t,e,i){let o=0;const s=(i-e)/10;for(let r=0;r<10;r++)o+=s*Math.pow(Math.cos(e+(r+.5)/10*(i-e)),t);return o}function It(t,i){return function(o,s,r,n,a){const l=2*((t-1)/e.aq(Math.cos(e.am(vt-a))/Math.cos(e.am(vt)))-1),h=Math.acos(r/n),c=2*Ct(l-1,0,e.am(a/2)),u=Math.min(e.am(vt),h+e.am(a/2)),d=Ct(l-1,Math.min(u,h-e.am(a/2)),u),_=Math.atan(s/r),p=Math.hypot(s,r);let m=o;return m+=e.aq(n/p/Math.max(.5,Math.cos(e.am(a/2)))),m+=l*e.aq(Math.cos(_))/2,m-=e.aq(Math.max(1,d/c/i))/2,m}}const Et=It(9.314,3);function St(t,i){const o=(i.roundZoom?Math.round:Math.floor)(t.zoom+e.aq(t.tileSize/i.tileSize));return Math.max(0,o)}function Lt(t,i){const o=t.getCameraFrustum(),s=t.getClippingPlane(),r=t.screenPointToMercatorCoordinate(t.getCameraPoint()),n=e.a6.fromLngLat(t.center,t.elevation);r.z=n.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;const a=t.getCoveringTilesDetailsProvider(),l=a.allowVariableZoom(t,i),h=St(t,i),c=i.minzoom||0,u=void 0!==i.maxzoom?i.maxzoom:t.maxZoom,d=Math.min(Math.max(0,h),u),_=Math.pow(2,d),p=[_*r.x,_*r.y,0],m=[_*n.x,_*n.y,0],f=Math.hypot(n.x-r.x,n.y-r.y),g=Math.abs(n.z-r.z),v=Math.hypot(f,g),y=t=>({zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),b=[],x=[];if(t.renderWorldCopies&&a.allowWorldCopies())for(let t=1;t<=3;t++)b.push(y(-t)),b.push(y(t));for(b.push(y(0));b.length>0;){const _=b.pop(),f=_.x,y=_.y;let w=_.fullyVisible;const T={x:f,y:y,z:_.zoom},P=a.getTileBoundingVolume(T,_.wrap,t.elevation,i);if(!w){const t=Mt(o,P,s);if(0===t)continue;w=2===t;}const M=a.distanceToTile2d(r.x,r.y,T,P);let C=h;l&&(C=(i.calculateTileZoom||Et)(t.zoom+e.aq(t.tileSize/i.tileSize),M,g,v,t.fov)),C=(i.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);const I=Math.min(C,u);if(_.wrap=a.getWrap(n,T,_.wrap),_.zoom>=I){if(_.zoom<c)continue;const t=d-_.zoom,o=p[0]-.5-(f<<t),s=p[1]-.5-(y<<t),r=i.reparseOverscaled?Math.max(_.zoom,C):_.zoom;x.push({tileID:new e.a2(_.zoom===u?r:_.zoom,_.wrap,_.zoom,f,y),distanceSq:e.ar([m[0]-.5-f,m[1]-.5-y]),tileDistanceToCamera:Math.sqrt(o*o+s*s)});}else for(let t=0;t<4;t++)b.push({zoom:_.zoom+1,x:(f<<1)+t%2,y:(y<<1)+(t>>1),wrap:_.wrap,fullyVisible:w});}return x.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}const zt=e.a7.fromPoints([new e.P(0,0),new e.P(e.a5,e.a5)]);function Rt(t){return "raster"===t||"image"===t||"video"===t}function Dt(t,e,i,o,s,r,n){if(!e.hasData())return !1;const{tileID:a,fadingRole:l,fadingDirection:h,fadingParentID:c}=e;if(l===pt.Base&&h===mt.Incoming&&c)return i[c.key]=c,!0;const u=Math.max(a.overscaledZ-s,r);for(let s=a.overscaledZ-1;s>=u;s--){const r=a.scaledTo(s),l=t.getLoadedTile(r);if(l)return e.setCrossFadeLogic({fadingRole:pt.Base,fadingDirection:mt.Incoming,fadingParentID:l.tileID,fadeEndTime:o+n}),l.setCrossFadeLogic({fadingRole:pt.Parent,fadingDirection:mt.Departing,fadeEndTime:o+n}),i[r.key]=r,!0}return !1}function At(t,e,i,o,s,r){if(!e.hasData())return !1;const n=e.tileID.children(s);let a=kt(t,e,n,i,o,s,r);if(a)return !0;for(const l of n)kt(t,e,l.children(s),i,o,s,r)&&(a=!0);return a}function kt(t,e,i,o,s,r,n){if(i[0].overscaledZ>=r)return !1;let a=!1;for(const r of i){const i=t.getLoadedTile(r);if(!i)continue;const{fadingRole:l,fadingDirection:h,fadingParentID:c}=i;l===pt.Base&&h===mt.Departing&&c||(i.setCrossFadeLogic({fadingRole:pt.Base,fadingDirection:mt.Departing,fadingParentID:e.tileID,fadeEndTime:s+n}),e.setCrossFadeLogic({fadingRole:pt.Parent,fadingDirection:mt.Incoming,fadeEndTime:s+n})),o[r.key]=r,a=!0;}return a}function Ot(t,e,i,o){const s=t.tileID;return !!t.selfFading||!t.hasData()&&!!e.has(s)&&(t.setSelfFadeLogic(i+o),!0)}function Bt(t,e){var i;t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let o=e.tileID.canonical.x-t.tileID.canonical.x;const s=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),n=e.tileID.key;0===o&&0===s||Math.abs(s)>1||(Math.abs(o)>1&&(1===Math.abs(o+r)?o+=r:1===Math.abs(o-r)&&(o-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,o,s),(null===(i=t.neighboringTiles)||void 0===i?void 0:i[n])&&(t.neighboringTiles[n].backfilled=!0)));}class Ft{constructor(){this._tiles={};}handleWrapJump(t){const e={};for(const i in this._tiles){const o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),e[o.tileID.key]=o;}this._tiles=e;}setFeatureState(t,e){for(const i in this._tiles)this._tiles[i].setFeatureState(t,e);}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((t=>t.tileID)).sort(e.at).map((t=>t.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,e){this._tiles[t]=e;}deleteTileById(t){delete this._tiles[t];}getLoadedTile(t){const e=this.getTileById(t.key);return (null==e?void 0:e.hasData())?e:null}isIdRenderable(t,e=!1){var i;return null===(i=this.getTileById(t))||void 0===i?void 0:i.isRenderable(e)}getRenderableIds(t=0,i){const o=[];for(const t of this.getAllIds())this.isIdRenderable(t,i)&&o.push(this.getTileById(t));return i?o.sort(((i,o)=>{const s=i.tileID,r=o.tileID,n=new e.P(s.canonical.x,s.canonical.y)._rotate(-t),a=new e.P(r.canonical.x,r.canonical.y)._rotate(-t);return s.overscaledZ-r.overscaledZ||a.y-n.y||a.x-n.x})).map((t=>t.tileID.key)):o.map((t=>t.tileID)).sort(e.at).map((t=>t.key))}}class jt extends e.E{constructor(t,i,o){super(),this.id=t,this.dispatcher=o,this.on("data",(t=>this._dataHandler(t))),this.on("dataloading",(()=>{this._sourceErrored=!1;})),this.on("error",(()=>{this._sourceErrored=this._source.loaded();})),this._source=((t,e,i,o)=>{const s=new(lt(e.type))(t,e,i,o);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return s})(t,i,o,this),this._inViewTiles=new Ft,this._outOfViewCache=new e.au(0,(t=>this._unloadTile(t))),this._timers={}
40,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new gt,this._didEmitContent=!1,this._updated=!1;}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t);}onRemove(t){for(const t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Ft;}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return !0;if(!this._updated)return !1;for(const t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return !1;return !0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain);}_loadTile(t,i,o){return e._(this,void 0,void 0,(function*(){try{const e=yield this._source.loadTile(t);this._tileLoaded(t,i,o,e);}catch(i){t.state="errored",404!==i.status?this._source.fire(new e.k(i,{tile:t})):this.update(this.transform,this.terrain);}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t);}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}));}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const e of this._inViewTiles.getAllTiles())e.upload(t),e.prepare(this.map.style.imageManager);}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var e;return this._inViewTiles.getRenderableIds(null===(e=this.transform)||void 0===e?void 0:e.bearingInRadians,t)}hasRenderableParent(t){const e=t.overscaledZ-1;if(e>=this._source.minzoom){const i=this.getLoadedTile(t.scaledTo(e));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return !1}reload(t,e=void 0){if(this._paused)this._shouldReloadOnResume=!0;else {this._outOfViewCache.reset();for(const i of this._inViewTiles.getAllIds()){const o=this._inViewTiles.getTileById(i);e&&!this._source.shouldReloadTile(o,e)||(t?this._reloadTile(i,"expired"):"errored"!==o.state&&this._reloadTile(i,"reloading"));}}}_reloadTile(t,i){return e._(this,void 0,void 0,(function*(){const e=this._inViewTiles.getTileById(t);e&&("loading"!==e.state&&(e.state=i),yield this._loadTile(e,t,i));}))}_tileLoaded(t,i,o,s){t.timeAdded=l(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),"expired"===o&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),(null==s?void 0:s.unmodified)||("raster-dem"===this.getSource().type&&t.dem&&function(t,e){var i,o;const s=e.getRenderableIds();for(const r of s){if(!t.neighboringTiles||!t.neighboringTiles[r])continue;const s=e.getTileById(r);t.neighboringTiles[r].backfilled||Bt(t,s),(null===(o=null===(i=s.neighboringTiles)||void 0===i?void 0:i[t.tileID.key])||void 0===o?void 0:o.backfilled)||Bt(s,t);}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new e.l("data",{dataType:"source",tile:t,coord:t.tileID})));}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,e){const i=this._getLoadedDescendents(e),o=new Set;for(const s of e){const e=i[s.key];if(!(null==e?void 0:e.length)){o.add(s);continue}const r=s.overscaledZ+jt.maxOverzooming,n=e.filter((t=>t.tileID.overscaledZ<=r));if(!n.length){o.add(s);continue}const a=Math.min(...n.map((t=>t.tileID.overscaledZ))),l=n.filter((t=>t.tileID.overscaledZ===a)).map((t=>t.tileID));for(const e of l)t[e.key]=e;this._areDescendentsComplete(l,a,s.overscaledZ)||o.add(s);}return o}_getLoadedDescendents(t){var e;const i={};for(const o of this._inViewTiles.getAllTiles().filter((t=>t.hasData())))for(const s of t)o.tileID.isChildOf(s)&&(i[e=s.key]||(i[e]=[])).push(o);return i}_areDescendentsComplete(t,e,i){return 1===t.length&&t[0].isOverscaled()?t[0].overscaledZ===e:Math.pow(4,e-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,o=Math.ceil(t.height/this._source.tileSize)+1,s=Math.floor(i*o*(null===this._maxTileC
40acheZoomLevels?e.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),r="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._outOfViewCache.setMaxSize(r);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);this._prevLng=t,e&&(this._inViewTiles.handleWrapJump(e),this._resetTileReloadTimers());}update(t,i){if(!this._sourceLoaded||this._paused)return;let o;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?o=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.a2(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(o=Lt(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(o=o.filter((t=>this._source.hasTile(t))))):o=[],this.usedForTerrain&&(o=this._addTerrainIdealTiles(o));const s=0===o.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new e.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const r=St(t,this._source),n=this._updateRetainedTiles(o,r),a=Rt(this._source.type);a&&this._rasterFadeDuration>0&&!i&&function(t,i,o,s,r,n,a){const h=l(),c=e.as(i);for(const e of i){const i=t.getTileById(e.key);i.fadingDirection!==mt.Departing&&0!==i.fadeOpacity||i.resetFadeLogic(),Dt(t,i,o,h,s,r,a)||At(t,i,o,h,n,a)||Ot(i,c,h,a)||i.resetFadeLogic();}}(this._inViewTiles,o,n,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),a?this._cleanUpRasterTiles(n):this._cleanUpVectorTiles(n);}_cleanUpRasterTiles(t){for(const e of this._inViewTiles.getAllIds())t[e]||this._removeTile(e);}_cleanUpVectorTiles(t){for(const e of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(e);t[e]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(e):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(e);}}_addTerrainIdealTiles(t){const e=[];for(const i of t)if(i.canonical.z>this._source.minzoom){const t=i.scaledTo(i.canonical.z-1);e.push(t);const o=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));e.push(o);}return t.concat(e)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t);}_updateRetainedTiles(t,e){var i;const o=new Set;for(const e of t)this._addTile(e).hasData()||o.add(e);const s=t.reduce(((t,e)=>(t[e.key]=e,t)),{}),r=this._retainLoadedChildren(s,o),n={},a=Math.max(e-jt.maxUnderzooming,this._source.minzoom);for(const t of r){let e=this._inViewTiles.getTileById(t.key),o=null==e?void 0:e.wasRequested();for(let r=t.overscaledZ-1;r>=a;--r){const a=t.scaledTo(r);if(n[a.key])break;if(n[a.key]=!0,e=this.getTile(a),!e&&o&&(e=this._addTile(a)),e){const t=e.hasData();if((t||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||o)&&(s[a.key]=a),o=e.wasRequested(),t)break}}}return s}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;i=this._outOfViewCache.getAndRemove(t),i&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null));const o=i;return i||(i=new ft(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._inViewTiles.setTile(t.key,i),o||this._source.fire(new e.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,e){this._clearTileReloadTimer(t);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t];}),i));}_clearTileReloadTimer(t){const e=this._timers[t];e&&(clearTimeout(e),delete this._timers[t]);}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const e=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,e);}}refreshTiles(t){for(const e of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(e);(this._inViewTiles.isIdRenderable(e)||"errored"==i.state)&&t.some((t=>t.equals(i.tileID.canonical)))&&this._reloadTile(e,"expired");}}_removeTile(t){const e=this._inViewTiles.getTileById(t);e&&(e.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),e.uses>0||(e.hasData()&&"reloading"!==e.state?this._outOfViewCache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}_dataHandler(t){"source"===t.dataType&&("metadata"!==t.sourceDataType?"content"===t.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0);}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset();}tilesIn(t,i,o){const s=[],r=this.transform;if(!r)return s;const n=r.getCoveringTilesDetailsProvider().allowWorldCopies(),a=o?r.getCameraQueryGeometry(t):t,l=t=>r.screenPointToMercatorCoordinate(t,this.terrain),h=this.transformBbox(t,l,!n),c=this.transformBbox(a,l,!n),u=this.getIds(),d=e.a7.fromPoints(c);for(let t=0;t<u.length;t++){const o=this._inViewTiles.getTileById(u[t]);if(o.holdingForSymbolFade())continue;const a=n?[o.tileID]:[o.tileID.unwrapTo(-1),o.tileID.unwrapTo(0)],l=Math.pow(2,r.zoom-o.tileID.overscaledZ
40),_=i*o.queryPadding*e.a5/o.tileSize/l;for(const t of a){const i=d.map((i=>t.getTilePoint(new e.a6(i.x,i.y))));if(i.expandBy(_),i.intersects(zt)){const e=h.map((e=>t.getTilePoint(e))),i=c.map((e=>t.getTilePoint(e)));s.push({tile:o,tileID:n?t:t.unwrapTo(0),queryGeometry:e,cameraQueryGeometry:i,scale:l});}}}return s}transformBbox(t,i,o){let s=t.map(i);if(o){const o=e.a7.fromPoints(t);o.shrinkBy(.001*Math.min(o.width(),o.height()));const r=o.map(i);e.a7.fromPoints(s).covers(r)||(s=s.map((t=>t.x>.5?new e.a6(t.x-1,t.y,t.z):t)));}return s}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._inViewTiles.getTileById(t).tileID));return this.transform&&this.transform.populateCache(e),e}hasTransition(){return !!this._source.hasTransition()||!(!Rt(this._source.type)||!function(t,e){if(e<=0)return !1;const i=l();for(const e of t.getAllTiles())if(e.fadeEndTime>=i)return !0;return !1}(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t;}setFeatureState(t,i,o){this._state.updateState(t=t||e.af,i,o);}removeFeatureState(t,i,o){this._state.removeFeatureState(t=t||e.af,i,o);}getFeatureState(t,i){return this._state.getState(t=t||e.af,i)}setDependencies(t,e,i){const o=this._inViewTiles.getTileById(t);o&&o.setDependencies(e,i);}reloadTilesForDependencies(t,e){for(const i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,e)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter((i=>!i.hasDependency(t,e)));}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if("loaded"!==t.state&&"errored"!==t.state)return !1;return !0}}jt.maxUnderzooming=10,jt.maxOverzooming=3;class Nt{constructor(t,e){this.reset(t,e);}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding;}lerp(t){if(1===this.points.length)return this.points[0];t=e.ak(t,0,1);let i=1,o=this._distances[i];const s=t*this.paddedLength+this.padding;for(;o<s&&i<this._distances.length;)o=this._distances[++i];const r=i-1,n=this._distances[r],a=o-n,l=a>0?(s-n)/a:0;return this.points[r].mult(1-l).add(this.points[i].mult(l))}}function Zt(t,e){let i=!0;return "always"===t||"never"!==t&&"never"!==e||(i=!1),i}class Gt{constructor(t,e,i){const o=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)o.push([]),s.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0;}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,o,s){this._forEachCell(e,i,o,s,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(o),this.bboxes.push(s);}insertCircle(t,e,i,o){this._forEachCell(e-o,i-o,e+o,i+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(o);}_insertBoxCell(t,e,i,o,s,r){this.boxCells[s].push(r);}_insertCircleCell(t,e,i,o,s,r){this.circleCells[s].push(r);}_query(t,e,i,o,s,r,n){if(i<0||t>this.width||o<0||e>this.height)return [];const a=[];
40if(t<=0&&e<=0&&this.width<=i&&this.height<=o){if(s)return [{key:null,x1:t,y1:e,x2:i,y2:o}];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],o=this.circles[3*t+2];a.push({key:this.circleKeys[t],x1:e-o,y1:i-o,x2:e+o,y2:i+o});}}else this._forEachCell(t,e,i,o,this._queryCell,a,{hitTest:s,overlapMode:r,seenUids:{box:{},circle:{}}},n);return a}query(t,e,i,o){return this._query(t,e,i,o,!1,null)}hitTest(t,e,i,o,s,r){return this._query(t,e,i,o,!0,s,r).length>0}hitTestCircle(t,e,i,o,s){const r=t-i,n=t+i,a=e-i,l=e+i;if(n<0||r>this.width||l<0||a>this.height)return !1;const h=[];return this._forEachCell(r,a,n,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:o,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},s),h.length>0}_queryCell(t,e,i,o,s,r,n,a){const{seenUids:l,hitTest:h,overlapMode:c}=n,u=this.boxCells[s];if(null!==u){const s=this.bboxes;for(const n of u)if(!l.box[n]){l.box[n]=!0;const u=4*n,d=this.boxKeys[n];if(t<=s[u+2]&&e<=s[u+3]&&i>=s[u+0]&&o>=s[u+1]&&(!a||a(d))&&(!h||!Zt(c,d.overlapMode))&&(r.push({key:d,x1:s[u],y1:s[u+1],x2:s[u+2],y2:s[u+3]}),h))return !0}}const d=this.circleCells[s];if(null!==d){const s=this.circles;for(const n of d)if(!l.circle[n]){l.circle[n]=!0;const u=3*n,d=this.circleKeys[n];if(this._circleAndRectCollide(s[u],s[u+1],s[u+2],t,e,i,o)&&(!a||a(d))&&(!h||!Zt(c,d.overlapMode))){const t=s[u],e=s[u+1],i=s[u+2];if(r.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),h)return !0}}}return !1}_queryCellCircle(t,e,i,o,s,r,n,a){const{circle:l,seenUids:h,overlapMode:c}=n,u=this.boxCells[s];if(null!==u){const t=this.bboxes;for(const e of u)if(!h.box[e]){h.box[e]=!0;const i=4*e,o=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(o))&&!Zt(c,o.overlapMode))return r.push(!0),!0}}const d=this.circleCells[s];if(null!==d){const t=this.circles;for(const e of d)if(!h.circle[e]){h.circle[e]=!0;const i=3*e,o=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!a||a(o))&&!Zt(c,o.overlapMode))return r.push(!0),!0}}}_forEachCell(t,e,i,o,s,r,n,a){const l=this._convertToXCellCoord(t),h=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),u=this._convertToYCellCoord(o);for(let d=l;d<=c;d++)for(let l=h;l<=u;l++)if(s.call(this,t,e,i,o,this.xCellCount*l+d,r,n,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,o,s,r){const n=o-t,a=s-e,l=i+r;return l*l>n*n+a*a}_circleAndRectCollide(t,e,i,o,s,r,n){const a=(r-o)/2,l=Math.abs(t-(o+a));if(l>a+i)return !1;const h=(n-s)/2,c=Math.abs(e-(s+h));if(c>h+i)return !1;if(l<=a||c<=h)return !0;const u=l-a,d=c-h;return u*u+d*d<=i*i}}function Ut(t,o,s){const r=e.N();if(!t){const{vecSouth:t,vecEast:e}=Wt(o),s=i();s[0]=e[0],s[1]=e[1],s[2]=t[0],s[3]=t[1],n=s,(d=(l=(a=s)[0])*(u=a[3])-(c=a[2])*(h=a[1]))&&(n[0]=u*(d=1/d),n[1]=-h*d,n[2]=-c*d,n[3]=l*d),r[0]=s[0],r[1]=s[1],r[4]=s[2],r[5]=s[3];}var n,a,l,h,c,u,d;return e.Q(r,r,[1/s,1/s,1]),r}function Vt(t,i,o,s){if(t){const t=e.N();if(!i){const{vecSouth:e,vecEast:i}=Wt(o);t[0]=i[0],t[1]=i[1],t[4]=e[0],t[5]=e[1];}return e.Q(t,t,[s,s,1]),t}return o.pixelsToClipSpaceMatrix}function Wt(t){const i=Math.cos(t.rollInRadians),o=Math.sin(t.rollInRadians),s=Math.cos(t.pitchInRadians),r=Math.cos(t.bearingInRadians),n=Math.sin(t.bearingInRadians),a=e.az();a[0]=-r*s*o-n*i,a[1]=-n*s*o+r*i;const l=e.aA(a);l<1e-9?e.aB(a):e.aC(a,a,1/l);const h=e.az();h[0]=r*s*i-n*o,h[1]=n*s*i+r*o;const c=e.aA(h);return c<1e-9?e.aB(h):e.aC(h,h,1/c),{vecEast:h,vecSouth:a}}function qt(t,i,o,s){let r;s?(r=[t,i,s(t,i),1],e.aE(r,r,o)):(r=[t,i,0,1],he(r,r,o));const n=r[3];return {point:new e.P(r[0]/n,r[1]/n),signedDistanceFromCamera:n,isOccluded:!1}}function $t(t,e){return .5+t/e*.5}function Ht(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function Xt(t,i,o,s,r,n,a,l,h,c,u,d,_){const p=o?t.textSizeData:t.iconSizeData,m=e.av(p,i.transform.zoom),f=[256/i.width*2+1,256/i.height*2+1],g=o?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;g.clear();const v=t.lineVertexArray,y=o?t.text.placedSymbolArray:t.icon.placedSymbolArray,b=i.transform.width/i.transform.height;let x=!1;for(let o=0;o<y.length;o++){const w=y.get(o);if(w.hidden||w.writingMode===e.aw.vertical&&!x){le(w.numGlyphs,g);continue}x=!1;
40const T=new e.P(w.anchorX,w.anchorY),P={getElevation:_,pitchedLabelPlaneMatrix:s,lineVertexArray:v,pitchWithMap:n,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:h,width:c,height:u,translation:d},M=oe(w.anchorX,w.anchorY,P);if(!Ht(M.point,f)){le(w.numGlyphs,g);continue}const C=$t(i.transform.cameraToCenterDistance,M.signedDistanceFromCamera),I=e.ax(p,m,w),E=n?I*i.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,h)/C:I*C,S=Qt({projectionContext:P,pitchedLabelPlaneMatrixInverse:r,symbol:w,fontSize:E,flip:!1,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:b,rotateToLine:l});x=S.useVertical,(S.notEnoughRoom||x||S.needsFlipping&&Qt({projectionContext:P,pitchedLabelPlaneMatrixInverse:r,symbol:w,fontSize:E,flip:!0,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&le(w.numGlyphs,g);}o?t.text.dynamicLayoutVertexBuffer.updateData(g):t.icon.dynamicLayoutVertexBuffer.updateData(g);}function Yt(t,e,i,o,s,r,n,a){const l=r.glyphStartIndex+r.numGlyphs,h=r.lineStartIndex,c=r.lineStartIndex+r.lineLength,u=e.getoffsetX(r.glyphStartIndex),d=e.getoffsetX(l-1),_=ne(t*u,i,o,s,r.segment,h,c,a,n);if(!_)return null;const p=ne(t*d,i,o,s,r.segment,h,c,a,n);return p?a.projectionCache.anyProjectionOccluded?null:{first:_,last:p}:null}function Kt(t,i,o,s){return t===e.aw.horizontal&&Math.abs(o.y-i.y)>Math.abs(o.x-i.x)*s?{useVertical:!0}:(t===e.aw.vertical?i.y<o.y:i.x>o.x)?{needsFlipping:!0}:null}function Qt(t){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:o,symbol:s,fontSize:r,flip:n,keepUpright:a,glyphOffsetArray:l,dynamicLayoutVertexArray:h,aspectRatio:c,rotateToLine:u}=t,d=r/24,_=s.lineOffsetX*d,p=s.lineOffsetY*d;let m;if(s.numGlyphs>1){const t=s.glyphStartIndex+s.numGlyphs,e=s.lineStartIndex,r=s.lineStartIndex+s.lineLength,h=Yt(d,l,_,p,n,s,u,i);if(!h)return {notEnoughRoom:!0};const f=ie(h.first.point.x,h.first.point.y,i,o),g=ie(h.last.point.x,h.last.point.y,i,o);if(a&&!n){const t=Kt(s.writingMode,f,g,c);if(t)return t}m=[h.first];for(let o=s.glyphStartIndex+1;o<t-1;o++){const t=ne(d*l.getoffsetX(o),_,p,n,s.segment,e,r,i,u);if(!t)return {notEnoughRoom:!0};m.push(t);}m.push(h.last);}else {if(a&&!n){const t=ee(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,r=s.lineStartIndex+s.segment+1,n=new e.P(i.lineVertexArray.getx(r),i.lineVertexArray.gety(r)),a=ee(n.x,n.y,i),l=a.signedDistanceFromCamera>0?a.point:Jt(i.tileAnchorPoint,n,t,1,i),h=ie(t.x,t.y,i,o),u=ie(l.x,l.y,i,o),d=Kt(s.writingMode,h,u,c);if(d)return d}const t=ne(d*l.getoffsetX(s.glyphStartIndex),_,p,n,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,i,u);if(!t||i.projectionCache.anyProjectionOccluded)return {notEnoughRoom:!0};m=[t];}for(const t of m)e.aD(h,t.point,t.angle);return {}}function Jt(t,e,i,o,s){const r=t.add(t.sub(e)._unit()),n=ee(r.x,r.y,s).point,a=i.sub(n);return i.add(a._mult(o/a.mag()))}function te(t,i,o){const s=i.projectionCache;if(s.projections[t])return s.projections[t];const r=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),n=ee(r.x,r.y,i);if(n.signedDistanceFromCamera>0)return s.projections[t]=n.point,s.anyProjectionOccluded=s.anyProjectionOccluded||n.isOccluded,n.point;const a=t-o.direction;return Jt(0===o.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(a),i.lineVertexArray.gety(a)),r,o.previousVertex,o.absOffsetX-o.distanceFromAnchor+1,i)}function ee(t,e,i){const o=t+i.translation[0],s=e+i.translation[1];let r;return i.pitchWithMap?(r=qt(o,s,i.pitchedLabelPlaneMatrix,i.getElevation),r.isOccluded=!1):(r=i.transform.projectTileCoordinates(o,s,i.unwrappedTileID,i.getElevation),r.point.x=(.5*r.point.x+.5)*i.width,r.point.y=(.5*-r.point.y+.5)*i.height),r}function ie(t,i,o,s){if(o.pitchWithMap){const r=[t,i,0,1];return e.aE(r,r,s),o.transform.projectTileCoordinates(r[0]/r[3],r[1]/r[3],o.unwrappedTileID,o.getElevation).point}return {x:t/o.width*2-1,y:1-i/o.height*2}}function oe(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,i.getElevation)}function se(t,e,i){return t._unit()._perp()._mult(e*i)}function re(t,i,o,s,r,n,a,l,h){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const c=o.add(i);if(t+h.direction<s||t+h.direction>=r)return l.projectionCache.offsets[t]=c,c;const u=te(t+h.direction,l,h),d=se(u.sub(o),a,h.direction),_=o.add(d),p=u.add(d);return l.projectionCache.offsets[t]=e.aF(n,c,_,p)||c,l.projectionCache.offsets[t]}function ne(t,e,i,o,s,r,n,a,l){const h=o?t-e:t+e;let c=h>0?1:-1,u=0;o&&(c*=-1,u=Math.PI),c<0&&(u+=Math.PI);let d,_=c>0?r+s:r+s+1;
40a.projectionCache.cachedAnchorPoint?d=a.projectionCache.cachedAnchorPoint:(d=ee(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=d);let p,m,f=d,g=d,v=0,y=0;const b=Math.abs(h),x=[];let w;for(;v+y<=b;){if(_+=c,_<r||_>=n)return null;v+=y,g=f,m=p;const t={absOffsetX:b,direction:c,distanceFromAnchor:v,previousVertex:g};if(f=te(_,a,t),0===i)x.push(g),w=f.sub(g);else {let e;const o=f.sub(g);e=0===o.mag()?se(te(_+c,a,t).sub(f),i,c):se(o,i,c),m||(m=g.add(e)),p=re(_,e,f,r,n,m,i,a,t),x.push(m),w=p.sub(m);}y=w.mag();}const T=w._mult((b-v)/y)._add(m||g),P=u+Math.atan2(f.y-g.y,f.x-g.x);return x.push(T),{point:T,angle:l?P:0,path:x}}const ae=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function le(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(ae,3*t);}}function he(t,e,i){const o=e[0],s=e[1];return t[0]=i[0]*o+i[4]*s+i[12],t[1]=i[1]*o+i[5]*s+i[13],t[3]=i[3]*o+i[7]*s+i[15],t}const ce=100;class ue{constructor(t,e=new Gt(t.width+200,t.height+200,25),i=new Gt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ce,this.screenBottomBoundary=t.height+ce,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6;}placeCollisionBox(t,e,i,o,s,r,n,a,l,h,c,u){const d=this.projectAndGetPerspectiveRatio(t.anchorPointX+a[0],t.anchorPointY+a[1],s,h,u),_=i*d.perspectiveRatio;let p;if(r||n)p=this._projectCollisionBox(t,_,o,s,r,n,a,d,h,c,u);else {const e=d.x+(c?c.x*_:0),i=d.y+(c?c.y*_:0);p={allPointsOccluded:!1,box:[e+t.x1*_,i+t.y1*_,e+t.x2*_,i+t.y2*_]};}const[m,f,g,v]=p.box,y=r?p.allPointsOccluded:d.isOccluded;let b=y;return b||(b=d.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(m,f,g,v)),b||"always"!==e&&this.grid.hitTest(m,f,g,v,e,l)?{box:[m,f,g,v],placeable:!1,offscreen:!1,occluded:y}:{box:[m,f,g,v],placeable:!0,offscreen:this.isOffscreen(m,f,g,v),occluded:y}}placeCollisionCircles(t,i,o,s,r,n,a,l,h,c,u,d,_,p){const m=[],f=new e.P(i.anchorX,i.anchorY),g=this.getPerspectiveRatio(f.x,f.y,n,p),v=(h?r*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,n)/g:r*g)/e.aJ,y={getElevation:p,pitchedLabelPlaneMatrix:a,lineVertexArray:o,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:f,unwrappedTileID:n,width:this.transform.width,height:this.transform.height,translation:_},b=Yt(v,s,i.lineOffsetX*v,i.lineOffsetY*v,!1,i,!1,y);let x=!1,w=!1,T=!0;if(b){const i=.5*u*g+d,o=new e.P(-100,-100),s=new e.P(this.screenRightBoundary,this.screenBottomBoundary),r=new Nt,n=b.first,a=b.last;let _=[];for(let t=n.path.length-1;t>=1;t--)_.push(n.path[t]);for(let t=1;t<a.path.length;t++)_.push(a.path[t]);const p=2.5*i;if(h){const t=this.projectPathToScreenSpace(_,y);_=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point));}let f=[];if(_.length>0){const t=_[0].clone(),i=_[0].clone();for(let e=1;e<_.length;e++)t.x=Math.min(t.x,_[e].x),t.y=Math.min(t.y,_[e].y),i.x=Math.max(i.x,_[e].x),i.y=Math.max(i.y,_[e].y);f=t.x>=o.x&&i.x<=s.x&&t.y>=o.y&&i.y<=s.y?[_]:i.x<o.x||t.x>s.x||i.y<o.y||t.y>s.y?[]:e.aG([_],o.x,o.y,s.x,s.y);}for(const e of f){r.reset(e,.25*i);let o=0;o=r.length<=.5*i?1:Math.ceil(r.paddedLength/p)+1;for(let e=0;e<o;e++){const s=e/Math.max(o-1,1),n=r.lerp(s),a=n.x+ce,h=n.y+ce;m.push(a,h,i,0);const u=a-i,d=h-i,_=a+i,p=h+i;if(T=T&&this.isOffscreen(u,d,_,p),w=w||this.isInsideGrid(u,d,_,p),"always"!==t&&this.grid.hitTestCircle(a,h,i,t,c)&&(x=!0,!l))return {circles:[],offscreen:!1,collisionDetected:x}}}}return {circles:!l&&x||!w||g<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(t,i){const o=function(t,i){const o=e.N();return e.ay(o,i.pitchedLabelPlaneMatrix),t.map((t=>{const e=qt(t.x,t.y,o,i.getElevation),s=i.transform.projectTileCoordinates(e.point.x,e.point.y,i.unwrappedTileID,i.getElevation);return s.point.x=(.5*s.point.x+.5)*i.width,s.point.y=(.5*-s.point.y+.5)*i.height,s}))}(t,i);return function(t){let e=0,i=0,o=0,s=0;for(let r=0;r<t.length;r++)t[r].isOccluded?(o=r+1,s=0):(s++,s>i&&(i=s,e=o));return t.slice(e,e+i)}(o)}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return {};const i=[],o=new e.a7;for(const s of t){const t=new e.P(s.x+ce,s.y+ce);o.extend(t),i.push(t);}const{minX:s,minY:r,maxX:n,maxY:a}=o,l=this.grid.query(s,r,n,a).concat(this.ignoredGrid.query(s,r,n,a)),h={},c={};for(const t of l){const o=t.key;if(void 0===h[o.bucketInstanceId]&&(h[o.bucketInstanceId]={}),h[o.bucketInstanceId][o.featureIndex])continue;const s=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.aH(i,s)&&(h[o.bucketInstanceId][o.featureIndex]=!0,void 0===c[o.bucketInstanceId]&&(c[o.bucketInstanceId]=[]),c[o.bucketInstanceId].push(o.featureIndex));}return c}insertCollisionBox(t,e,i,o,s,r){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:s,collisionGroupID:r,overlapMode:e},t[0],t[1],t[2],t[3]);}insertCollisionCircles(t,e,i,o,s,r){const n=i?this.ignoredGrid:this.grid,a={bucketInstanceId:o,featureIndex:s,collisionGroupID:r,overlapMode:e};for(let e=0;e<t.length;
40e+=4)n.insertCircle(a,t[e],t[e+1],t[e+2]);}projectAndGetPerspectiveRatio(t,i,o,s,r){if(r){let o;s?(o=[t,i,s(t,i),1],e.aE(o,o,r)):(o=[t,i,0,1],he(o,o,r));const n=o[3];return {x:(o[0]/n+1)/2*this.transform.width+ce,y:(-o[1]/n+1)/2*this.transform.height+ce,perspectiveRatio:.5+this.transform.cameraToCenterDistance/n*.5,isOccluded:!1,signedDistanceFromCamera:n}}{const e=this.transform.projectTileCoordinates(t,i,o,s);return {x:(e.point.x+1)/2*this.transform.width+ce,y:(1-e.point.y)/2*this.transform.height+ce,perspectiveRatio:.5+this.transform.cameraToCenterDistance/e.signedDistanceFromCamera*.5,isOccluded:e.isOccluded,signedDistanceFromCamera:e.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,o){const s=this.transform.projectTileCoordinates(t,e,i,o);return .5+this.transform.cameraToCenterDistance/s.signedDistanceFromCamera*.5}isOffscreen(t,e,i,o){return i<ce||t>=this.screenRightBoundary||o<ce||e>this.screenBottomBoundary}isInsideGrid(t,e,i,o){return i>=0&&t<this.gridRightBoundary&&o>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const t=e.ao([]);return e.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,o,s,r,n,a,l,h,c,u){let d=1,_=0,p=0,m=1;const f=t.anchorPointX+a[0],g=t.anchorPointY+a[1];if(n&&!r){const t=this.projectAndGetPerspectiveRatio(f+1,g,s,h,u),e=t.x-l.x,i=Math.atan((t.y-l.y)/e)+(e<0?Math.PI:0),o=Math.sin(i),r=Math.cos(i);d=r,_=o,p=-o,m=r;}else if(!n&&r){const t=Wt(this.transform);d=t.vecEast[0],_=t.vecEast[1],p=t.vecSouth[0],m=t.vecSouth[1];}let v=l.x,y=l.y,b=i;r&&(v=f,y=g,b=Math.pow(2,-(this.transform.zoom-o.overscaledZ)),b*=this.transform.getPitchedTextCorrection(f,g,s),c||(b*=e.ak(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),c&&(v+=d*c.x*b+p*c.y*b,y+=_*c.x*b+m*c.y*b);const x=t.x1*b,w=t.x2*b,T=(x+w)/2,P=t.y1*b,M=t.y2*b,C=(P+M)/2,I=[{offsetX:x,offsetY:P},{offsetX:T,offsetY:P},{offsetX:w,offsetY:P},{offsetX:w,offsetY:C},{offsetX:w,offsetY:M},{offsetX:T,offsetY:M},{offsetX:x,offsetY:M},{offsetX:x,offsetY:C}];let E=[];for(const{offsetX:t,offsetY:i}of I)E.push(new e.P(v+d*t+p*i,y+_*t+m*i));let S=!1;if(r){const t=E.map((t=>this.projectAndGetPerspectiveRatio(t.x,t.y,s,h,u)));S=t.some((t=>!t.isOccluded)),E=t.map((t=>new e.P(t.x,t.y)));}else S=!0;return {box:e.aI(E),allPointsOccluded:!S}}}class de{constructor(t,e,i,o){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):o&&i?1:0,this.placed=i;}isHidden(){return 0===this.opacity&&!this.placed}}class _e{constructor(t,e,i,o,s){this.text=new de(t?t.text:null,e,i,s),this.icon=new de(t?t.icon:null,e,o,s);}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class pe{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i;}}class me{constructor(t,e,i,o,s){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=o,this.tileID=s;}}class fe{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 ge(t,i,o,s,r){const{horizontalAlign:n,verticalAlign:a}=e.aP(t);return new e.P(-(n-.5)*i+s[0]*r,-(a-.5)*o+s[1]*r)}class ve{constructor(t,e,i,o,s){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new ue(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new fe(o),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=s,s&&(s.prevPlacement=void 0),this.placedOrientations={};}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,o)=>e.getElevation(t,i,o):null}getBucketParts(t,i,o,s){const r=o.getBucket(i),n=o.latestFeatureIndex;if(!r||!n||i.id!==r.layerIds[0])return;const a=o.collisionBoxArray,l=r.layers[0].layout,h=r.layers[0].paint,c=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),u=o.tileSize/e.a5,d=o.tileID.toUnwrapped(),_="map"===l.get("text-rotation-alignment"),p=e.aK(o,1,this.transform.zoom),m=e.aL(this.collisionIndex.transform,o,h.get("text-translate"),h.get("text-translate-anchor")),f=e.aL(this.collisionIndex.transform,o,h.get("icon-translate"),h.get("icon-translate-anchor")),g=Ut(_,this.transform,p);this.retainedQueryData[r.bucketInstanceId]=new me(r.bucketInstanceId,n,r.sourceLayerIndex,r.index,o.tileID);const v={bucket:r,layout:l,translationText:m,translationIcon:f,unwrappedTileID:d,pitchedLabelPlaneMatr
40ix:g,scale:c,textPixelRatio:u,holdingForFade:o.holdingForSymbolFade(),collisionBoxArray:a,partiallyEvaluatedTextSize:e.av(r.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(r.sourceID)};if(s)for(const e of r.sortKeyRanges){const{sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:s}=e;t.push({sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:s,parameters:v});}else t.push({symbolInstanceStart:0,symbolInstanceEnd:r.symbolInstances.length,parameters:v});}attemptAnchorPlacement(t,i,o,s,r,n,a,l,h,c,u,d,_,p,m,f,g,v,y,b){const x=e.aM[t.textAnchor],w=[t.textOffset0,t.textOffset1],T=ge(x,o,s,w,r),P=this.collisionIndex.placeCollisionBox(i,d,l,h,c,a,n,f,u.predicate,y,T,b);if((!v||this.collisionIndex.placeCollisionBox(v,d,l,h,c,a,n,g,u.predicate,y,T,b).placeable)&&P.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[_.crossTileID]&&this.prevPlacement.placements[_.crossTileID]&&this.prevPlacement.placements[_.crossTileID].text&&(t=this.prevPlacement.variableOffsets[_.crossTileID].anchor),0===_.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[_.crossTileID]={textOffset:w,width:o,height:s,anchor:x,textBoxScale:r,prevAnchor:t},this.markUsedJustification(p,x,_,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,_),this.placedOrientations[_.crossTileID]=m),{shift:T,placedGlyphBoxes:P}}}placeLayerBucketPart(t,i,o){const{bucket:s,layout:r,translationText:n,translationIcon:a,unwrappedTileID:l,pitchedLabelPlaneMatrix:h,textPixelRatio:c,holdingForFade:u,collisionBoxArray:d,partiallyEvaluatedTextSize:_,collisionGroup:p}=t.parameters,m=r.get("text-optional"),f=r.get("icon-optional"),g=e.aN(r,"text-overlap","text-allow-overlap"),v="always"===g,y=e.aN(r,"icon-overlap","icon-allow-overlap"),b="always"===y,x="map"===r.get("text-rotation-alignment"),w="map"===r.get("text-pitch-alignment"),T="none"!==r.get("icon-text-fit"),P="viewport-y"===r.get("symbol-z-order"),M=v&&(b||!s.hasIconData()||f),C=b&&(v||!s.hasTextData()||m);!s.collisionArrays&&d&&s.deserializeCollisionBoxes(d);const I=this.retainedQueryData[s.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(I),S=this.transform.getFastPathSimpleProjectionMatrix(I),L=(t,d,b)=>{var P,L;if(i[t.crossTileID])return;if(u)return void(this.placements[t.crossTileID]=new pe(!1,!1,!1));let z=!1,R=!1,D=!0,A=null,k={box:null,placeable:!1,offscreen:null,occluded:!1},O={placeable:!1},B=null,F=null,j=null,N=0,Z=0,G=0;d.textFeatureIndex?N=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(N=t.featureIndex),d.verticalTextFeatureIndex&&(Z=d.verticalTextFeatureIndex);const U=d.textBox;if(U){const i=i=>{let o=e.aw.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,o=e,this.markUsedOrientation(s,o,t));}return o},r=(i,o)=>{if(s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of s.writingModes)if(t===e.aw.vertical?(k=o(),O=k):k=i(),k&&k.placeable)break}else k=i();},h=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===h){const o=(e,i)=>{const o=this.collisionIndex.placeCollisionBox(e,g,c,I,l,w,x,n,p.predicate,E,void 0,S);return o&&o.placeable&&(this.markUsedOrientation(s,i,t),this.placedOrientations[t.crossTileID]=i),o};r((()=>o(U,e.aw.horizontal)),(()=>{const i=d.verticalTextBox;return s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?o(i,e.aw.vertical):{box:null,offscreen:null}})),i(k&&k.placeable);}else {let _=e.aM[null===(L=null===(P=this.prevPlacement)||void 0===P?void 0:P.variableOffsets[t.crossTileID])||void 0===L?void 0:L.anchor];const m=(e,i,r)=>{const d=e.x2-e.x1,m=e.y2-e.y1,f=t.textBoxScale,v=T&&"never"===y?i:null;let b=null,P="never"===g?1:2,M="never";_&&P++;for(let i=0;i<P;i++){for(let i=h;i<u;i++){const o=s.textAnchorOffsets.get(i);if(_&&o.textAnchor!==_)continue;const h=this.attemptAnchorPlacement(o,e,d,m,f,x,w,c,I,l,p,M,t,s,r,n,a,v,E);if(h&&(b=h.placedGlyphBoxes,b&&b.placeable))return z=!0,A=h.shift,b}_?_=null:M=g;}return o&&!b&&(b={box:this.collisionIndex.placeCollisionBox(U,"always",c,I,l,w,x,n,p.predicate,E,void 0,S).box,offscreen:!1,placeable:!1,occluded:!1}),b};r((()=>m(U,d.iconBox,e.aw.horizontal)),(()=>{const i=d.verticalTextBox;return s.allowVerticalPlacement&&(!k||!k.placeable)&&t.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,e.aw.vertical):{box:null,occluded:!0,offscreen:null}})),k&&(z=k.placeable,D=k.offscreen);const f=i(k&&k.placeable);if(!z&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(s,e.anchor,t,f));}}}if(B=k,z=B&&B.placeable,D=B&&B.offscreen,t.useRuntimeCollisionCircles&&t.centerJustifiedTextSymbolIndex>=0){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),a=e.ax(s.textSizeData,_,i),c=r.get("text-padding");F=this.collisionIndex.placeCollisionCircles(g,i,s.lineVertexArray,s.glyphOffsetArray,a,l,h,o,w,p.predicate,t.collisionCircleDiameter,c,n,E),F.circles.length&&F.collisionDetected&&!o&&e.w("Collisions detected, but collision boxes are not shown"),z=v||F.circles.length>0&&!F.collisionDetected,D=D&&F.offscreen;}if(d.iconFeatureIndex&&(G=d.iconFeatureIndex),d.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,y,c,I,l,w,x,a,p.predicate,E,T&&A?A:void 0,S);O&&O.placeable&&d.verticalIconBox?(j=t(d.verticalIconBox),R=j.placeable):(j=t(d.iconBox),R=j.placeable),D=D&&j.offscreen;}const V=m||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,W=f||0===t.numIconVertices;V||W?W?V||(R=R&&z):z=R&&z:R=z=R&&z;const q=R&&j.placeable;if(z&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,g,r.get("text-ignore-placement"),s.bucketInstanceId,O&&O.placeable&&Z?Z:N,p.ID),q&&this.collisionIndex.insertCollisionBox(j.box,y,r.get("icon-ignore-placement"),s.bucketInstanceId,G,p.ID),F&&z&&this.collisionIndex.insertCollisionCircles(F.circles,g,r.get("text-ignore-placement"),s.bucketInstanceId,N,p.ID),o&&this.storeCollisionData(s.bucketInstanceId,b,d,B,j,F),0===t.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===s.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new pe((z||M)&&!(null==B?void 0:B.occluded),(R||C)&&!(null==j?void 0:j.occluded),D||s.justReloaded),i[t.crossTileID]=!0;};
40if(P){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=s.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let t=e.length-1;t>=0;--t){const i=e[t];L(s.symbolInstances.get(i),s.collisionArrays[i],i);}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)L(s.symbolInstances.get(e),s.collisionArrays[e],e);s.justReloaded=!1;}storeCollisionData(t,e,i,o,s,r){if(i.textBox||i.iconBox){let r,n;this.collisionBoxArrays.has(t)?r=this.collisionBoxArrays.get(t):(r=new Map,this.collisionBoxArrays.set(t,r)),r.has(e)?n=r.get(e):(n={text:null,icon:null},r.set(e,n)),i.textBox&&(n.text=o.box),i.iconBox&&(n.icon=s.box);}if(r){let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=[]);for(let t=0;t<r.circles.length;t+=4)e.push(r.circles[t+0]-ce),e.push(r.circles[t+1]-ce),e.push(r.circles[t+2]),e.push(r.collisionDetected?1:0);}}markUsedJustification(t,i,o,s){let r;r=s===e.aw.vertical?o.verticalPlacedTextSymbolIndex:{left:o.leftJustifiedTextSymbolIndex,center:o.centerJustifiedTextSymbolIndex,right:o.rightJustifiedTextSymbolIndex}[e.aO(i)];const n=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,o.verticalPlacedTextSymbolIndex];for(const e of n)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=r>=0&&e!==r?0:o.crossTileID);}markUsedOrientation(t,i,o){const s=i===e.aw.horizontal||i===e.aw.horizontalOnly?i:0,r=i===e.aw.vertical?i:0,n=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex];for(const e of n)t.text.placedSymbolArray.get(e).placedOrientation=s;o.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=r);}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 o=e?e.symbolFadeChange(t):1,s=e?e.opacities:{},r=e?e.variableOffsets:{},n=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],r=s[t];r?(this.opacities[t]=new _e(r,o,e.text,e.icon),i=i||e.text!==r.text.placed||e.icon!==r.icon.placed):(this.opacities[t]=new _e(null,o,e.text,e.icon,e.skipFade),i=i||e.text||e.icon);}for(const t in s){const e=s[t];if(!this.opacities[t]){const s=new _e(e,o,!1,!1);s.isHidden()||(this.opacities[t]=s,i=i||e.text.placed||e.icon.placed);}}for(const t in r)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=r[t]);for(const t in n)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=n[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 o of e){const e=o.getBucket(t);e&&o.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,o.tileID,i,o.collisionBoxArray);}}updateBucketOpacities(t,i,o,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0],n=r.layout,a=new _e(null,0,!1,!1,!0),l=n.get("text-allow-overlap"),h=n.get("icon-allow-overlap"),c=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u="map"===n.get("text-rotation-alignment"),d="map"===n.get("text-pitch-alignment"),_="none"!==n.get("icon-text-fit"),p=new _e(null,0,l&&(h||!t.hasIconData()||n.get("icon-optional")),h&&(l||!t.hasTextData()||n.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const m=(t,e,i)=>{for(let o=0;o<e/4;o++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==Ee;},f=this.collisionBoxArrays.get(t.bucketInstanceId);for(let i=0;i<t.symbolInstances.length;i++){const s=t.symbolInstances.get(i),{numHorizontalGlyphVertices:r,numVerticalGlyphVertices:n,crossTileID:l}=s;let h=this.opacities[l];o[l]?h=a:h||(h=p,this.opacities[l]=h),o[l]=!0;const g=s.numIconVertices>0,v=this.placedOrientations[s.crossTileID],y=v===e.aw.vertical,b=v===e.aw.horizontal||v===e.aw.horizontalOnly;if(r>0||n>0){const e=Ie(h.text);m(t.text,r,y?Ee:e),m(t.text,n,b?Ee:e);const i=h.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEac
40h((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||y?1:0);})),s.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);const o=this.variableOffsets[s.crossTileID];o&&this.markUsedJustification(t,o.anchor,s,v);const a=this.placedOrientations[s.crossTileID];a&&(this.markUsedJustification(t,"left",s,a),this.markUsedOrientation(t,a,s));}if(g){const e=Ie(h.icon),i=!(_&&s.verticalPlacedIconSymbolIndex&&y);s.placedIconSymbolIndex>=0&&(m(t.icon,s.numIconVertices,i?e:Ee),t.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=h.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,s.numVerticalIconVertices,i?Ee:e),t.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden());}const x=f&&f.has(i)?f.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const o=t.collisionArrays[i];if(o){let i=new e.P(0,0);if(o.textBox||o.verticalTextBox){let e=!0;if(c){const t=this.variableOffsets[l];t?(i=ge(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):e=!1;}if(o.textBox||o.verticalTextBox){let s;o.textBox&&(s=y),o.verticalTextBox&&(s=b),ye(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||s,x.text,i.x,i.y);}}if(o.iconBox||o.verticalIconBox){const e=Boolean(!b&&o.verticalIconBox);let s;o.iconBox&&(s=e),o.verticalIconBox&&(s=!e),ye(t.iconCollisionBox.collisionVertexArray,h.icon.placed,s,x.icon,_?i.x:0,_?i.y:0);}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId]);}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0;}}function ye(t,e,i,o,s,r){o&&0!==o.length||(o=[0,0,0,0]);const n=o[0]-ce,a=o[1]-ce,l=o[2]-ce,h=o[3]-ce;t.emplaceBack(e?1:0,i?1:0,s||0,r||0,n,a),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,l,a),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,l,h),t.emplaceBack(e?1:0,i?1:0,s||0,r||0,n,h);}const be=Math.pow(2,25),xe=Math.pow(2,24),we=Math.pow(2,17),Te=Math.pow(2,16),Pe=Math.pow(2,9),Me=Math.pow(2,8),Ce=Math.pow(2,1);function Ie(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*be+e*xe+i*we+e*Te+i*Pe+e*Me+i*Ce+e}const Ee=0;class Se{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,o,s){const r=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(r,o,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,s())return !0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,r.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<r.length;)if(e.placeLayerBucketPart(r[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,s())return !0;return !1}}class Le{constructor(t,e,i,o,s,r,n,a){this.placement=new ve(t,e,r,n,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=s,this._done=!1;}isDone(){return this._done}continuePlacement(t,i,o){const s=l(),r=()=>!this._forceFullPlacement&&l()-s>2;for(;this._currentPlacementIndex>=0;){const s=i[t[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if(e.aQ(s)&&s.layout&&(!s.minzoom||s.minzoom<=n)&&(!s.maxzoom||s.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new Se(s)),this._inProgressLayer.continuePlacement(o[s.source],this.placement,this._showCollisionBoxes,s,r))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(t){return this.placement.commit(t),this.placement}}const ze=512/e.a5/2;class Re{constructor(t,i,o){this.tileID=t,this.bucketInstanceId=o,this._symbolsByKey={};const s=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),o=e.key,r=s.get(o);r?r.push(e):s.set(o,[e]);}for(const[t,i]of s){const o={positions:i.map((t=>({x:Math.floor(t.anchorX*ze),y:Math.floor(t.anchorY*ze)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(o.positions.length>128){const t=new e.aR(o.positions.length,16,Uint16Array);for(const{x:e,y:i}of o.positions)t.add(e,i);t.finish(),delete o.positions,o.index=t;}this._symbolsByKey[t]=o;}}getScaledCoordinates(t,i){const{x:o,y:s,z:r}=this.tileID.canonical,{x:n,y:a,z:l}=i.canonical,h=ze/Math.pow(2,l-r),c=(a*e.a5+t.anchorY)*h,u=s*e.a5*ze;return {x:Math.floor((n*e.a5+t.anchorX)*h-o*e.a5*ze),y:Math.floor(c-u)}}
40findMatches(t,e,i){const o=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let s=0;s<t.length;s++){const r=t.get(s);if(r.crossTileID)continue;const n=this._symbolsByKey[r.key];if(!n)continue;const a=this.getScaledCoordinates(r,e);if(n.index){const t=n.index.range(a.x-o,a.y-o,a.x+o,a.y+o).sort();for(const e of t){const t=n.crossTileIDs[e];if(!i[t]){i[t]=!0,r.crossTileID=t;break}}}else if(n.positions)for(let t=0;t<n.positions.length;t++){const e=n.positions[t],s=n.crossTileIDs[t];if(Math.abs(e.x-a.x)<=o&&Math.abs(e.y-a.y)<=o&&!i[s]){i[s]=!0,r.crossTileID=s;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class De{constructor(){this.maxCrossTileID=0;}generate(){return ++this.maxCrossTileID}}class Ae{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],o={};for(const t in i){const s=i[t];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),o[s.tileID.key]=s;}this.indexes[t]=o;}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 o=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const s=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in s){const r=s[i];r.tileID.isChildOf(t)&&r.findMatches(e.symbolInstances,t,o);}else {const r=s[t.scaledTo(Number(i)).key];r&&r.findMatches(e.symbolInstances,t,o);}}for(let t=0;t<e.symbolInstances.length;t++){const s=e.symbolInstances.get(t);s.crossTileID||(s.crossTileID=i.generate(),o[s.crossTileID]=!0);}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Re(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e];}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const o=this.indexes[i];for(const s in o)t[o[s].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,o[s]),delete o[s],e=!0);}return e}}class ke{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={};}addLayer(t,e,i){let o=this.layerIndexes[t.id];void 0===o&&(o=this.layerIndexes[t.id]=new Ae);let s=!1;const r={};o.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(i.tileID,e,this.crossTileIDs)&&(s=!0),r[e.bucketInstanceId]=!0);}return o.removeStaleBuckets(r)&&(s=!0),s}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0;}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t];}}var Oe="void main() {fragColor=vec4(1.0);}";const Be={prelude:Fe("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
40return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Fe("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Fe("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:Fe("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Fe("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;
40uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Fe("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:Fe(Oe,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Fe("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Fe("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Fe("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Fe("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Fe("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Fe(Oe,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Fe("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Fe("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Fe("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=patte
40rn_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:Fe("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:Fe("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:Fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/p
40ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Fe("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Fe("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
40float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Fe("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);
40float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Fe("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
40float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Fe("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
40float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Fe("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Fe("uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:Fe("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:Fe("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float 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;
40fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:Fe("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
40float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Fe("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Fe("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Fe("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Fe("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Fe("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
40function Fe(t,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,o=e.match(/in ([\w]+) ([\w]+)/g),s=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=r?r.concat(s):s,a={};return {fragmentSource:t=t.replace(i,((t,e,i,o,s)=>(a[s]=!0,"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nin ${i} ${o} ${s};\n#else\nuniform ${i} ${o} u_${s};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${s}\n    ${i} ${o} ${s} = u_${s};\n#endif\n`))),vertexSource:e=e.replace(i,((t,e,i,o,s)=>{const r="float"===o?"vec2":"vec4",n=s.match(/color/)?"color":r;return a[s]?"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nin ${i} ${r} a_${s};\nout ${i} ${o} ${s};\n#else\nuniform ${i} ${o} u_${s};\n#endif\n`:"vec4"===n?`\n#ifndef HAS_UNIFORM_u_${s}\n    ${s} = a_${s};\n#else\n    ${i} ${o} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n    ${s} = unpack_mix_${n}(a_${s}, u_${s}_t);\n#else\n    ${i} ${o} ${s} = u_${s};\n#endif\n`:"define"===e?`\n#ifndef HAS_UNIFORM_u_${s}\nuniform lowp float u_${s}_t;\nin ${i} ${r} a_${s};\n#else\nuniform ${i} ${o} u_${s};\n#endif\n`:"vec4"===n?`\n#ifndef HAS_UNIFORM_u_${s}\n    ${i} ${o} ${s} = a_${s};\n#else\n    ${i} ${o} ${s} = u_${s};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${s}\n    ${i} ${o} ${s} = unpack_mix_${n}(a_${s}, u_${s}_t);\n#else\n    ${i} ${o} ${s} = u_${s};\n#endif\n`})),staticAttributes:o,staticUniforms:n}}class je{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i;}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null;}}var Ne=e.aS([{name:"a_pos",type:"Int16",components:2}]);const Ze="#define PROJECTION_MERCATOR",Ge="mercator";class Ue{constructor(){this._cachedMesh=null;}get name(){return "mercator"}get useSubdivision(){return !1}get shaderVariantName(){return Ge}get shaderDefine(){return Ze}get shaderPreludeCode(){return Be.projectionMercator}get vertexShaderPreludeCode(){return Be.projectionMercator.vertexSource}get subdivisionGranularity(){return e.aT.noSubdivision}get useGlobeControls(){return !1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,i,o,s,r){if(this._cachedMesh)return this._cachedMesh;const n=new e.aU;n.emplaceBack(0,0),n.emplaceBack(e.a5,0),n.emplaceBack(0,e.a5),n.emplaceBack(e.a5,e.a5);const a=t.createVertexBuffer(n,Ne.members),l=e.aV.simpleSegment(0,0,4,2),h=new e.aW;h.emplaceBack(1,0,2),h.emplaceBack(1,2,3);const c=t.createIndexBuffer(h);return this._cachedMesh=new je(a,c,l),this._cachedMesh}recalculate(){}hasTransition(){return !1}setErrorQueryLatitudeDegrees(t){}}class Ve{constructor(t=0,e=0,i=0,o=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(o)||o<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=o;}interpolate(t,i,o){return null!=i.top&&null!=t.top&&(this.top=e.G.number(t.top,i.top,o)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.G.number(t.bottom,i.bottom,o)),null!=i.left&&null!=t.left&&(this.left=e.G.number(t.left,i.left,o)),null!=i.right&&null!=t.right&&(this.right=e.G.number(t.right,i.right,o)),this}getCenter(t,i){const o=e.ak((this.left+t-this.right)/2,0,t),s=e.ak((this.top+i-this.bottom)/2,0,i);return new e.P(o,s)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ve(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function We(t,e){if(!t.renderWorldCopies||t.lngRange)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0;}function qe(t){return Math.max(0,Math.floor(t))}class $e{constructor(t,i){var o;this.applyConstrain=(t,e)=>null!==this._constrainOverride?this._constrainOverride(t,e):this._callbacks.defaultConstrain(t,e),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=void 0===(null==i?void 0:i.renderWorldCopies)||!!(null==i?void 0:i.renderWorldCopies),this._minZoom=(null==i?void 0:i.minZoom)||0,this._maxZoom=(null==i?void 0:i.maxZoom)||22,this._minPitch=null==(null==i?void 0:i.minPitch)?0:null==i?void 0:i.minPitch,this._maxPitch=null==(null==i?void 0:i.maxPitch)?60:null==i?void 0:i.maxPitch,this._constrainOverride=null!==(o=null==i?void 0:i.constrainOverride)&&void 0!==o?o:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new e.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=qe(this._zoom),this._scale=e.an(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ve,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0;}apply(t,i,o){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=qe(this._zoom),this._scale=e.an(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Ve(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!o&&t.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices();}
40get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t;}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom));}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom));}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)));}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)));}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices());}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const o=e.W(t,-180,180)*Math.PI/180;var s,r,n,a,l,h,c,u,d;this._bearingInRadians!==o&&(this._unmodified=!1,this._bearingInRadians=o,this._calcMatrices(),this._rotationMatrix=i(),s=this._rotationMatrix,n=-this._bearingInRadians,a=(r=this._rotationMatrix)[0],l=r[1],h=r[2],c=r[3],u=Math.sin(n),d=Math.cos(n),s[0]=a*d+h*u,s[1]=l*d+c*u,s[2]=a*-u+h*d,s[3]=l*-u+c*d);}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const i=e.ak(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices());}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices());}get fovInRadians(){return this._fovInRadians}get fov(){return e.aX(this._fovInRadians)}setFov(t){t=e.ak(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=e.am(t),this._calcMatrices());}get zoom(){return this._zoom}setZoom(t){const i=this.applyConstrain(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=e.an(i),this.constrainInternal(),this._calcMatrices());}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices());}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices());}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices();}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices();}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this.constrainInternal(),this._calcMatrices();}resize(t,e,i=!0){this._width=t,this._height=e,i&&this.constrainInternal(),this._calcMatrices();}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new q([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-e.al,e.al]);}getCameraQueryGeometry(t,i){if(1===i.length)return [i[0],t];{const{minX:o,minY:s,maxX:r,maxY:n}=e.a7.fromPoints(i).extend(t);return [new e.P(o,s),new e.P(r,s),new e.P(r,n),new e.P(o,n),new e.P(o,s)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(e),this.setZoom(i),this._unmodified=t,this._constraining=!1;}
40_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=e.ao(new Float64Array(16));e.Q(t,t,[this._width/2,-this._height/2,1]),e.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=e.ao(new Float64Array(16)),e.Q(t,t,[1,-1,1]),e.O(t,t,[-1,-1,0]),e.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height;}this._callbacks.calcMatrices();}calculateCenterFromCameraLngLatAlt(t,i,o,s){const r=void 0!==o?o:this.bearing,n=s=void 0!==s?s:this.pitch,{distanceToCenter:a,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,n),{x:h,y:c}=Pt(n,r),u=e.a6.fromLngLat(t,i);let d,_,p=e.aY(1,u.y),m=0;do{if(m+=1,m>10)break;_=a/p,d=new e.a6(u.x+h*_,u.y+c*_),p=1/d.meterInMercatorCoordinateUnits();}while(Math.abs(a-_*p)>1e-12);return {center:d.toLngLat(),elevation:l,zoom:e.aq(this.height/2/Math.tan(this.fovInRadians/2)/_/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const i=1/this.worldSize,o=e.ap(1,this.center.lat)*this.worldSize,s=e.a6.fromLngLat(this.center,this.elevation),r=s.x/i,n=s.y/i,a=s.z/i,l=this.pitch,h=this.bearing,{x:c,y:u,z:d}=Pt(l,h),_=this.cameraToCenterDistance,p=r+_*-c,m=n+_*-u,f=a+_*d,{distanceToCenter:g,clampedElevation:v}=this._distanceToCenterFromAltElevationPitch(f/o,t,l),y=g*o,b=new e.a6((p+c*y)*i,(m+u*y)*i,0).toLngLat(),x=e.ap(1,b.lat),w=e.aq(this.height/2/Math.tan(this.fovInRadians/2)/g/x/this.tileSize);this._elevation=v,this._center=b,this.setZoom(w);}_distanceToCenterFromAltElevationPitch(t,i,o){const s=-Math.cos(e.am(o)),r=t-i;let n,a=i;return s*r>=0||Math.abs(s)<.1?(n=1e4,a=t+n*s):n=-r/s,{distanceToCenter:n,clampedElevation:a}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=e.ap(1,this.center.lat)*this.worldSize;return Tt(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return [0,0,1,1];const i=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return [t.canonical.x/i,t.canonical.y/i,1/i/e.a5,1/i/e.a5]}}class He{constructor(t,i){this.min=t,this.max=i,this.center=e.aZ([],e.a_([],this.min,this.max),.5);}quadrant(t){const i=[t%2==0,t<2],o=e.a$(this.min),s=e.a$(this.max);for(let t=0;t<i.length;t++)o[t]=i[t]?this.min[t]:this.center[t],s[t]=i[t]?this.center[t]:this.max[t];return s[2]=this.max[2],new He(o,s)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let i=0;i<t.planes.length;i++){const o=this.intersectsPlane(t.planes[i]);if(0===o)return 0;1===o&&(e=!1);}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],i=t[3];for(let o=0;o<3;o++)t[o]>0?(e+=t[o]*this.min[o],i+=t[o]*this.max[o]):(i+=t[o]*this.min[o],e+=t[o]*this.max[o]);return e>=0?2:i<0?0:1}}class Xe{distanceToTile2d(t,e,i,o){const s=o.distanceX([t,e]),r=o.distanceY([t,e]);return Math.hypot(s,r)}getWrap(t,e,i){return i}getTileBoundingVolume(t,i,o,s){var r,n;let a=0,l=0;if(null==s?void 0:s.terrain){const h=new e.a2(t.z,i,t.z,t.x,t.y),c=s.terrain.getMinMaxElevation(h);a=null!==(r=c.minElevation)&&void 0!==r?r:Math.min(0,o),l=null!==(n=c.maxElevation)&&void 0!==n?n:Math.max(0,o);}const h=1<<t.z;return new He([i+t.x/h,t.y/h,a],[i+(t.x+1)/h,(t.y+1)/h,l])}allowVariableZoom(t,i){const o=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,s=e.ak(78.5-o/2,0,60);return !!i.terrain||t.pitch>s}allowWorldCopies(){return !0}prepareNextFrame(){}}class Ye{constructor(t,e,i){this.points=t,this.planes=e,this.aabb=i;}static fromInvProjectionMatrix(t,i=1,o=0,s,r){const n=r?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],a=Math.pow(2,o),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((o=>function(t,i,o,s){const r=e.aE([],t,i),n=1/r[3]/o*s;return e.b4(r,r,[n,n,1/r[3],n])}(o,t,i,a)));s&&function(t,i,o,s){const r=s?4:0,n=s?0:4;let a=0;const l=[],h=[];for(let i=0;i<4;i++){const o=e.b0([],t[i+n],t[i+r]),s=e.b5(o);e.aZ(o,o,1/s),l.push(s),h.push(o);}for(let i=0;i<4;i++){const s=e.b6(t[i+r],h[i],o);a=null!==s&&s>=0?Math.max(a,s):Math.max(a,l[i]);}const c=function(t,i){const o=e.b0([],t[i[0]],t[i[1]]),s=e.b0([],t[i[2]],t[i[1]]),r=[0,0,0,0];return e.b1(r,e.b2([],o,s)),r[3]=-e.b3(r,t[i[0]]),r}(t,i),u=function(t,i){const o=e.b7(t),s=e.b8([],t,1/o),r=e.b0([],i,e.aZ([],s,e.b3(i,s))),n=e.b7(r);if(n>0){const t=Math.sqrt(1-s[3]*s[3]),o=e.aZ([],s,-s[3]),a=e.a_([],o,e.aZ([],r,t/n));return e.b9(i,a)}return null}(o,c);if(null!==u){const t=u/e.b3(h[0],c);a=Math.min(a,t);}for(let e=0;e<4;e++){const i=Math.min(a,l[e]);t[e+n]=[t[e+r][0]+h[e][0]*i,t[e+r][1]+h[e][1]*i,t[e+r][2]+h[e][2]*i,1];}}(l,n[0],s,r);const h=n.map((t=>{const i=e.b0([],l[t[0]],l[t[1]]),o=e.b0([],l[t[2]],l[t[1]]),s=e.b1([],e.b2([],i,o)),r=-e.b3(s,l[t[1]]);return s.concat(r)})),c=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],u=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of l)for(let e=0;e<3;e++)c[e]=Math.min(c[e],t[e]),u[e]=Math.max(u[e],t[e]);return new Ye(l,h,new He(c,u))}}
40class Ke{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t);}setMaxZoom(t){this._helper.setMaxZoom(t);}setMinPitch(t){this._helper.setMinPitch(t);}setMaxPitch(t){this._helper.setMaxPitch(t);}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t);}setBearing(t){this._helper.setBearing(t);}setPitch(t){this._helper.setPitch(t);}setRoll(t){this._helper.setRoll(t);}setFov(t){this._helper.setFov(t);}setZoom(t){this._helper.setZoom(t);}setCenter(t){this._helper.setCenter(t);}setElevation(t){this._helper.setElevation(t);}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t);}setPadding(t){this._helper.setPadding(t);}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i);}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t);}setConstrainOverride(t){this._helper.setConstrainOverride(t);}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e);}clearNearFarZOverride(){this._helper.clearNearFarZOverride();}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(t,i)=>{i=e.ak(+i,this.minZoom,this.maxZoom);const o={center:new e.V(t.lng,t.lat),zoom:i};let s=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===s){const t=180-1e-10;s=[-t,t];}const r=this.tileSize*e.an(o.zoom);let n=0,a=r,l=0,h=r,c=0,u=0;const{x:d,y:_}=this.size;if(this._helper._latRange){const t=this._helper._latRange;n=e.X(t[1])*r,a=e.X(t[0])*r,a-n<_&&(c=_/(a-n));}s&&(l=e.W(e.Y(s[0])*r,0,r),h=e.W(e.Y(s[1])*r,0,r),h<l&&(h+=r),h-l<d&&(u=d/(h-l)));const{x:p,y:m}=yt(r,t);let f,g;const v=Math.max(u||0,c||0);if(v){const t=new e.P(u?(h+l)/2:p,c?(a+n)/2:m);return o.center=bt(r,t).wrap(),o.zoom+=e.aq(v),o}if(this._helper._latRange){const t=_/2;m-t<n&&(g=n+t),m+t>a&&(g=a-t);}if(s){const t=(l+h)/2;let i=p;
40this._helper._renderWorldCopies&&(i=e.W(p,t-r/2,t+r/2));const o=d/2;i-o<l&&(f=l+o),i+o>h&&(f=h-o);}if(void 0!==f||void 0!==g){const t=new e.P(null!=f?f:p,null!=g?g:m);o.center=bt(r,t).wrap();}return o},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new $e({calcMatrices:()=>{this._calcMatrices();},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new Xe;}clone(){const t=new Ke;return t.apply(this,!1),t}apply(t,e,i){this._helper.apply(t,e,i);}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const i=[new e.ba(0,t)];if(this._helper._renderWorldCopies){const o=this.screenPointToMercatorCoordinate(new e.P(0,0)),s=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,0)),r=this.screenPointToMercatorCoordinate(new e.P(this._helper._width,this._helper._height)),n=this.screenPointToMercatorCoordinate(new e.P(0,this._helper._height)),a=Math.floor(Math.min(o.x,s.x,r.x,n.x)),l=Math.floor(Math.max(o.x,s.x,r.x,n.x)),h=1;for(let o=a-h;o<=l+h;o++)0!==o&&i.push(new e.ba(o,t));}return i}getCameraFrustum(){return Ye.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const e=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i);}setLocationAtPoint(t,i){const o=e.ap(this.elevation,this.center.lat),s=this.screenPointToMercatorCoordinateAtZ(i,o),r=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,o),n=e.a6.fromLngLat(t),a=new e.a6(n.x-(s.x-r.x),n.y-(s.y-r.y));this.setCenter(null==a?void 0:a.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap());}locationToScreenPoint(t,i){return i?this.coordinatePoint(e.a6.fromLngLat(t),i.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(e.a6.fromLngLat(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){const i=e.pointCoordinate(t);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){const o=i||0,s=[t.x,t.y,0,1],r=[t.x,t.y,1,1];e.aE(s,s,this._pixelMatrixInverse),e.aE(r,r,this._pixelMatrixInverse);const n=s[3],a=r[3],l=s[1]/n,h=r[1]/a,c=s[2]/n,u=r[2]/a,d=c===u?0:(o-c)/(u-c);return new e.a6(e.G.number(s[0]/n,r[0]/a,d)/this.worldSize,e.G.number(l,h,d)/this.worldSize,o)}coordinatePoint(t,i=0,o=this._pixelMatrix){const s=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.aE(s,s,o),new e.P(s[0]/s[3],s[1]/s[3])}getBounds(){const t=Math.max(0,this._helper._height/2-xt(this));return (new q).extend(this.screenPointToLocation(new e.P(0,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,t))).extend(this.screenPointToLocation(new e.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new e.P(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?null!=e.pointCoordinate(t):t.y>this.height/2-xt(this)}calculatePosMatrix(t,i=!1,o){var s;const r=null!==(s=t.key)&&void 0!==s?s:e.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),n=i?this._alignedPosMatrixCache:this._posMatrixCache;if(n.has(r)){const t=n.get(r);return o?t.f32:t.f64}const a=wt(t,this.worldSize);e.S(a,i?this._alignedProjMatrix:this._viewProjMatrix,a);const l={f64:a,f32:new Float32Array(a)};return n.set(r,l),o?l.f32:l.f64}calculateFogMatrix(t){const i=t.key,o=this._fogMatrixCacheF32;if(o.has(i))return o.get(i);const s=wt(t,this.worldSize);return e.S(s,this._fogMatrix,s),o.set(i,new Float32Array(s)),o.get(i)}calculateCenterFromCameraLngLatAlt(t,e,i,o){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,o)}_calculateNearFarZIfNeeded(t,i,o){if(!this._helper.autoCalculateNearFarZ)return;const s=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),r=t-s*this._helper._pixelPerMeter/Math.cos(i),n=s<0?r:t,a=Math.PI/2+this.pitchInRadians,l=e.am(this.fov)*(Math.abs(Math.cos(e.am(this.roll)))*this.height+Math.abs(Math.sin(e.am(this.roll)))*this.width)/this.height*(.5+o.y/this.height),h=Math.sin(l)*n/Math.sin(e.ak(Math.PI-a-l,.01,Math.PI-.01)),c=xt(this),u=Math.atan(c/this._helper.cameraToCenterDistance),d=e.am(.75
40),_=u>d?2*u*(.5+o.y/(2*c)):d,p=Math.sin(_)*n/Math.sin(e.ak(Math.PI-a-_,.01,Math.PI-.01)),m=Math.min(h,p);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+n),this._helper._nearZ=this._helper._height/50;}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,i=yt(this.worldSize,this.center),o=i.x,s=i.y;this._helper._pixelPerMeter=e.ap(1,this.center.lat)*this.worldSize;const r=e.am(Math.min(this.pitch,vt)),n=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(r));let a;this._calculateNearFarZIfNeeded(n,r,t),a=new Float64Array(16),e.bc(a,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),e.ay(this._invProjMatrix,a),a[8]=2*-t.x/this._helper._width,a[9]=2*t.y/this._helper._height,this._projectionMatrix=e.bd(a),e.Q(a,a,[1,-1,1]),e.O(a,a,[0,0,-this._helper.cameraToCenterDistance]),e.be(a,a,-this.rollInRadians),e.bf(a,a,this.pitchInRadians),e.be(a,a,-this.bearingInRadians),e.O(a,a,[-o,-s,0]),this._mercatorMatrix=e.Q([],a,[this.worldSize,this.worldSize,this.worldSize]),e.Q(a,a,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=e.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,a),e.O(a,a,[0,0,-this.elevation]),this._viewProjMatrix=a,this._invViewProjMatrix=e.ay([],a);const l=[0,0,-1,1];e.aE(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),e.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,n,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,e.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),e.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),e.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),e.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),e.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),e.O(this._fogMatrix,this._fogMatrix,[-o,-s,0]),e.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),e.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=e.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,a);const h=this._helper._width%2/2,c=this._helper._height%2/2,u=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),_=o-Math.round(o)+u*h+d*c,p=s-Math.round(s)+u*c+d*h,m=new Float64Array(a);if(e.O(m,m,[_>.5?_-1:_,p>.5?p-1:p,0]),this._alignedProjMatrix=m,a=e.ay(new Float64Array(16),this._pixelMatrix),!a)throw new Error("failed to invert matrix");this._pixelMatrixInverse=a,this._clearMatrixCaches();}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear();}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.aE(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=e.ap(1,this.center.lat)*this.worldSize;return Tt(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,i){const o=e.a6.fromLngLat(t),s=[o.x*this.worldSize,o.y*this.worldSize,i,1];return e.aE(s,s,this._viewProjMatrix),s[2]/s[3]}getProjectionData(t){const{overscaledTileID:i,aligned:o,applyTerrainMatrix:s}=t,r=this._helper.getMercatorTileCoordinates(i),n=i?this.calculatePosMatrix(i,o,!0):null;let a;return a=i&&i.terrainRttPosMatrix32f&&s?i.terrainRttPosMatrix32f:n||e.bg(),{mainMatrix:a,tileMercatorCoords:r,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a}}isLocationOccluded(t){return !1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,i){return 1}transformLightDirection(t){return e.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,o,s){const r=this.calculatePosMatrix(o);let n;s?(n=[t,i,s(t,i),1],e.aE(n,n,r)):(n=[t,i,0,1],he(n,n,r));const a=n[3];return {point:new e.P(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}populateCache(t){for(const e of t)this.calculatePosMatrix(e);}getMatrixForModel(t,i){const o=e.a6.fromLngLat(t,i),s=o.meterInMercatorCoordinateUnits(),r=e.bh();return e.O(r,r,[o.x,o.y,o.z]),e.be(r,r,Math.PI),e.bf(r,r,Math.PI/2),e.Q(r,r,[-s,s,s]),r}getProjectionDataForCustomLayer(t=!0){const i=new e.a2(0,0,0,0,0),o=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),s=wt(i,this.worldSize);e.S(s,this._viewProjMatrix,s),o.tileMercatorCoords=[0,0,1,1];const r=[e.a5,e.a5,this.worldSize/this._helper.pixelsPerMeter],n=e.bi();return e.Q(n,s,r),o.fallbackMatrix=n,o.mainMatrix=n,o}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Qe(){e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");}function Je(t){if(t.useSlerp)if(t.k<1){const i=e.bj(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),o=e.bj(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),s=new Float64Array(4);e.bk(s,i,o,t.k);const r=e.bl(s);t.tr.setRoll(r.roll),t.tr.setPitch(r.pitch),t.tr.setBearing(r.bearing);}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(e.G.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(e.G.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(e.G.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k));}function ti(t,i,o,s,r){const n=r.padding,a=yt(r.worldSize,o.getNorthWest()),l=yt(r.worldSize,o.getNorthEast()),h=yt(r.worldSize,o.get
40SouthEast()),c=yt(r.worldSize,o.getSouthWest()),u=e.am(-s),d=a.rotate(u),_=l.rotate(u),p=h.rotate(u),m=c.rotate(u),f=new e.P(Math.max(d.x,_.x,m.x,p.x),Math.max(d.y,_.y,m.y,p.y)),g=new e.P(Math.min(d.x,_.x,m.x,p.x),Math.min(d.y,_.y,m.y,p.y)),v=f.sub(g),y=(r.width-(n.left+n.right+i.left+i.right))/v.x,b=(r.height-(n.top+n.bottom+i.top+i.bottom))/v.y;if(b<0||y<0)return void Qe();const x=Math.min(e.aq(r.scale*Math.min(y,b)),t.maxZoom),w=e.P.convert(t.offset),T=new e.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(e.am(s)),P=w.add(T).mult(r.scale/e.an(x));return {center:bt(r.worldSize,a.add(h).div(2).sub(P)),zoom:x,bearing:s}}class ei{get useGlobeControls(){return !1}handlePanInertia(t,e){const i=t.mag(),o=Math.abs(xt(e));return {easingOffset:t.mult(Math.min(.75*o/i,1)),easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta);}handleMapControlsPan(t,e,i){t.around.distSqr(e.centerPoint)<.01||e.setLocationAtPoint(i,t.around);}cameraForBoxAndBearing(t,e,i,o,s){return ti(t,e,i,o,s)}handleJumpToCenterZoom(t,i){t.zoom!==(void 0!==i.zoom?+i.zoom:t.zoom)&&t.setZoom(+i.zoom),void 0!==i.center&&t.setCenter(e.V.convert(i.center));}handleEaseTo(t,i){const o=t.zoom,s=t.padding,r={roll:t.roll,pitch:t.pitch,bearing:t.bearing},n={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},a=void 0!==i.zoom,l=!t.isPaddingEqual(i.padding);let h=!1;const c=a?+i.zoom:t.zoom;let u=t.centerPoint.add(i.offsetAsPoint);const d=t.screenPointToLocation(u),{center:_,zoom:p}=t.applyConstrain(e.V.convert(i.center||d),null!=c?c:o);We(t,_);const m=yt(t.worldSize,d),f=yt(t.worldSize,_).sub(m),g=e.an(p-o);return h=p!==o,{easeFunc:a=>{if(h&&t.setZoom(e.G.number(o,p,a)),e.bm(r,n)||Je({startEulerAngles:r,endEulerAngles:n,tr:t,k:a,useSlerp:r.roll!=n.roll}),l&&(t.interpolatePadding(s,i.padding,a),u=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else {const i=e.an(t.zoom-o),s=p>o?Math.min(2,g):Math.max(.5,g),r=Math.pow(s,1-a),n=bt(t.worldSize,m.add(f.mult(a*r)).mult(i));t.setLocationAtPoint(t.renderWorldCopies?n.wrap():n,u);}},isZooming:h,elevationCenter:_}}handleFlyTo(t,i){const o=void 0!==i.zoom,s=t.zoom,r=t.applyConstrain(e.V.convert(i.center||i.locationAtOffset),o?+i.zoom:s),n=r.center,a=r.zoom;We(t,n);const l=yt(t.worldSize,i.locationAtOffset),h=yt(t.worldSize,n).sub(l),c=h.mag(),u=e.an(a-s);let d;if(void 0!==i.minZoom){const o=Math.min(+i.minZoom,s,a),r=t.applyConstrain(n,o).zoom;d=e.an(r-s);}return {easeFunc:(i,o,r,c)=>{t.setZoom(1===i?a:s+e.aq(o));const u=1===i?n:bt(t.worldSize,l.add(h.mult(r)).mult(o));t.setLocationAtPoint(t.renderWorldCopies?u.wrap():u,c);},scaleOfZoom:u,targetCenter:n,scaleOfMinZoom:d,pixelPathLength:c}}}class ii{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i;}}ii.Replace=[1,0],ii.disabled=new ii(ii.Replace,e.bn.transparent,[!1,!1,!1,!1]),ii.unblended=new ii(ii.Replace,e.bn.transparent,[!0,!0,!0,!0]),ii.alphaBlended=new ii([1,771],e.bn.transparent,[!0,!0,!0,!0]);const oi=2305;class si{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i;}}si.disabled=new si(!1,1029,oi),si.backCCW=new si(!0,1029,oi),si.frontCCW=new si(!0,1028,oi);class ri{constructor(t,e,i){this.func=t,this.mask=e,this.range=i;}}ri.ReadOnly=!1,ri.ReadWrite=!0,ri.disabled=new ri(519,ri.ReadOnly,[0,1]);const ni=7680;class ai{constructor(t,e,i,o,s,r){this.test=t,this.ref=e,this.mask=i,this.fail=o,this.depthFail=s,this.pass=r;}}ai.disabled=new ai({func:519,mask:0},0,0,ni,ni,ni);const li=new WeakMap;function hi(t){var e;if(li.has(t))return li.get(t);{const i=null===(e=t.getParameter(t.VERSION))||void 0===e?void 0:e.startsWith("WebGL 2.0");return li.set(t,i),i}}class ci{get awaitingQuery(){return !!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const i=t.context,o=i.gl;this._texFormat=o.RGBA,this._texType=o.UNSIGNED_BYTE;const s=new e.aU;s.emplaceBack(-1,-1),s.emplaceBack(2,-1),s.emplaceBack(-1,2);const r=new e.aW;r.emplaceBack(0,1,2),this._fullscreenTriangle=new je(i.createVertexBuffer(s,Ne.members),i.createIndexBuffer(r),e.aV.simpleSegment(0,0,s.length,r.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(o.TEXTURE1);const n=o.createTexture();o.bindTexture(o.TEXTURE_2D,n),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.NEAREST),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.NEAREST),o.texImage2D(o.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(n),hi(o)&&(this._pbo=o.createBuffer(),o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.bufferData(o.PIXEL_PACK_BUFFER,4,o.STREAM_READ),o.bindBuffer(o.PIXEL_PACK_BUFFER,null));}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null;}updateErrorLoop(t,e){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer);}_renderErrorTexture(t,i){const o=this._cachedRenderContext.context,s=o.gl;if(this._bindFramebuffer(),o.viewport.set([0,0,this._texWidth,this._texHeight]),o.clear({color:e.bn.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(o,s.TRIANGLES,ri.disabled,ai.disabled,ii.unblended,si.disabled,((t,e)=>
40({u_input:t,u_output_expected:e}))(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&hi(s)){s.bindBuffer(s.PIXEL_PACK_BUFFER,this._pbo),s.readBuffer(s.COLOR_ATTACHMENT0),s.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null);const t=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);s.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:t};}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null};}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&hi(t)){const i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED)return e.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null);}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=ci._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount;}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}const ui=e.a5/128;function di(t,i){const o=void 0!==t.granularity?Math.max(t.granularity,1):1,s=o+(t.generateBorders?2:0),r=o+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),n=s+1,a=r+1,l=t.generateBorders?-1:0,h=t.generateBorders||t.extendToNorthPole?-1:0,c=o+(t.generateBorders?1:0),u=o+(t.generateBorders||t.extendToSouthPole?1:0),d=n*a,_=s*r*6,p=n*a>65536;if(p&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=p||"32bit"===i,f=new Int16Array(2*d);let g=0;for(let i=h;i<=u;i++)for(let s=l;s<=c;s++){let r=s/o*e.a5;-1===s&&(r=-ui),s===o+1&&(r=e.a5+ui);let n=i/o*e.a5;-1===i&&(n=t.extendToNorthPole?e.bp:-ui),i===o+1&&(n=t.extendToSouthPole?e.bq:e.a5+ui),f[g++]=r,f[g++]=n;}const v=m?new Uint32Array(_):new Uint16Array(_);let y=0;for(let t=0;t<r;t++)for(let e=0;e<s;e++){const i=e+1+t*n,o=e+(t+1)*n,s=e+1+(t+1)*n;v[y++]=e+t*n,v[y++]=o,v[y++]=i,v[y++]=i,v[y++]=o,v[y++]=s;}return {vertices:f.buffer.slice(0),indices:v.buffer.slice(0),uses32bitIndices:m}}const _i=new e.aT({fill:new e.br(128,2),line:new e.br(512,0),tile:new e.br(128,32),stencil:new e.br(128,1),circle:3});class pi{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3;}get name(){return "vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return !0}get shaderVariantName(){return "globe"}get shaderDefine(){return "#define GLOBE"}get shaderPreludeCode(){return Be.projectionGlobe}get vertexShaderPreludeCode(){return Be.projectionMercator.vertexSource}get subdivisionGranularity(){return _i}get useGlobeControls(){return !0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy();}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new ci(t));const i=e.X(this._errorQueryLatitudeDegrees),o=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,s=this._errorMeasurement.updateErrorLoop(i,o),r=l();s!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=s,this._errorMeasurementLastChangeTime=r);const n=Math.min(Math.max((r-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=e.bs(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,e.bt(n));}_getMeshKey(t){return `${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,i,o,s){const r=("stencil"===s?_i.stencil:_i.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:r,generateBorders:i,extendToNorthPole:0===e.y&&o,extendToSouthPole:e.y===(1<<e.z)-1&&o})}_getMesh(t,i){const o=this._getMeshKey(i);if(o in this._tileMeshCache)return this._tileMeshCache[o];const s=function(t,i){const o=di(i,"16bit"),s=e.aU.deserialize({arrayBuffer:o.vertices,length:o.vertices.byteLength/2/2}),r=e.aW.deserialize({arrayBuffer:o.indices,length:o.indices.byteLength/2/3});return new je(t.createVertexBuffer(s,Ne.members),t.createIndexBuffer(r),e.aV.simpleSegment(0,0,s.length,r.length))}(t,i);return this._tileMeshCache[o]=s,s}recalculate(t){}hasTransition(){const t=l();let e=!1;return e=e||(t-this._errorMeasurementLastChangeTime)/1e3<.7,e=e||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,e}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t;}}const mi=new e.t({type:new e.D(e.u.projection.type)});class fi extends e.E{constructor(t){super(),this._transitionable=new e.x(mi,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new e.H(0)),this._mercatorProjection=new Ue,this._verticalPerspectiveProjection=new pi;}get transitionState(){const t=this.properties.get("type");if("string"==typeof t&&"mercator"===t)return 0;if("string"==typeof t&&"vertical-perspective"===t)return 1;if(t instanceof e.bu){if("vertical-perspective"===t.from&&"mercator"===t.to)return 1-t.transition;if("mercator"===t.from&&"vertical-perspective"===t.to)return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return "globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy();}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t);}getMeshFromTileID(t,e,i,o,s){return this.currentProjection.getMeshFromTileID(t,e,i,o,s)}setProjection(t){this._transitionable.setValue("type",(null==t?void 0:t.type)||"mercator");}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t);}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t);}}function gi(t){const e=bi(t.worldSize,t.center.lat);return 2*Math.PI*e}function vi(t,i,o,s,r){const n=1/(1<<r),a=i/e.a5*n+s*n,l=e.bx((t/e.a5*n+o*n)*Math.PI*2+Math.PI,2*Math.PI),h=2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI,c=Math.cos(h),u=new Float64Array(3);return u[0]=Math.sin(l)*c,u[1]=Math.sin(h),u[2]=Math.cos(l)*c,u}function yi(t){return function(t,e){const i=Math.cos(e),o=new Float64Array(3);return o[0]=Math.sin(t)*i,o[1]=Math.sin(e),o[2]=Math.cos(t)*i,o}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function bi(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function xi(t){const i=Math.asin(t[1])/Math.PI*180,o=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(o>1e-6){const s=t[0]/o,r=Math.acos(t[2]/o),n=(s>0?r:-r)/Math.PI*180;return new e.V(e.W(n,-180,180),i)}return new e.V(0,i)}function wi(t){return Math.cos(t*Math.PI/180)}function Ti(t,i){const o=wi(t),s=wi(i);return e.aq(s/o)}function Pi(t,i){const o=t.rotate(i.bearingInRadians),s=i.zoom+Ti(i.center.lat,0),r=e.bs(1/wi(i.center.lat),1/wi(Math.min(Math.abs(i.center.lat),60)),e.bv(s,7,3,0,1)),n=360/gi({worldSize:i.worldSize,center:{lat:i.center.lat}});return new e.V(i.center.lng-o.x*n*r,e.ak(i.center.lat+o.y*n,-e.al,e.al))}function Mi(t){const e=.5*t,i=Math.sin(e),o=Math.cos(e);return Math.log(i+o)-Math.log(o-i)}function Ci(t,i,o,s){const r=t.lat+o*s;if(Math.abs(o)>1){const n=(Math.sign(t.lat+o)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,a=Math.abs(t.lat+o)*Math.PI/180,l=Mi(n+s*(a-n)),h=Mi(n),c=Mi(a);return new e.V(t.lng+i*((l-h)/(c-h)),r)}return new e.V(t.lng+i*s,r)}class Ii{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t;}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1;}getTileBoundingVolume(t,e,i,o){const s=`${t.z}_${t.x}_${t.y}_${(null==o?void 0:o.terrain)?"t":""}`,r=this._cache.get(s);if(r)return r;const n=this._cachePrevious.get(s);if(n)return this._cache.set(s,n),n;const a=this._boundingVolumeFactory(t,e,i,o);return this._cache.set(s,a),this._hadAnyChanges=!0,a}}class Ei{constructor(t,e,i,o){this.min=i,this.max=o,this.points=t,this.planes=e;}static fromAabb(t,e){const i=[];for(let o=0;o<8;o++)i.push([1&~o?t[0]:e[0],1==(o>>1&1)?e[1]:t[1],1==(o>>2&1)?e[2]:t[2]]);return new Ei(i,[[-1,0,0,e[0]],[1,0,0,-t[0]],[0,-1,0,e[1]],[0,1,0,-t[1]],[0,0,-1,e[2]],[0,0,1,-t[2]]],t,e)}static fromCenterSizeAngles(t,i,o){const s=e.bz([],o[0],o[1],o[2]),r=e.bA([],[i[0],0,0],s),n=e.bA([],[0,i[1],0],s),a=e.bA([],[0,0,i[2]],s),l=[...t],h=[...t];for(let e=0;e<8;e++)for(let i=0;i<3;i++){const o=t[i]+r[i]*(1&~e?-1:1)+n[i]*(1==(e>>1&1)?1:-1)+a[i]*(1==(e>>
402&1)?1:-1);l[i]=Math.min(l[i],o),h[i]=Math.max(h[i],o);}const c=[];for(let i=0;i<8;i++){const o=[...t];e.a_(o,o,e.aZ([],r,1&~i?-1:1)),e.a_(o,o,e.aZ([],n,1==(i>>1&1)?1:-1)),e.a_(o,o,e.aZ([],a,1==(i>>2&1)?1:-1)),c.push(o);}return new Ei(c,[[...r,-e.b3(r,c[0])],[...n,-e.b3(n,c[0])],[...a,-e.b3(a,c[0])],[-r[0],-r[1],-r[2],-e.b3(r,c[7])],[-n[0],-n[1],-n[2],-e.b3(n,c[7])],[-a[0],-a[1],-a[2],-e.b3(a,c[7])]],l,h)}intersectsFrustum(t){let e=!0;const i=this.points.length,o=this.planes.length,s=t.planes.length,r=t.points.length;for(let o=0;o<s;o++){const s=t.planes[o];let r=0;for(let t=0;t<i;t++){const e=this.points[t];s[0]*e[0]+s[1]*e[1]+s[2]*e[2]+s[3]>=0&&r++;}if(0===r)return 0;r<i&&(e=!1);}if(e)return 2;for(let e=0;e<o;e++){const i=this.planes[e];let o=0;for(let e=0;e<r;e++){const s=t.points[e];i[0]*s[0]+i[1]*s[1]+i[2]*s[2]+i[3]>=0&&o++;}if(0===o)return 0}return 1}intersectsPlane(t){const e=this.points.length;let i=0;for(let o=0;o<e;o++){const e=this.points[o];t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0&&i++;}return i===e?2:0===i?0:1}}function Si(t,e,i){const o=t-e;return o<0?-o:Math.max(0,o-i)}function Li(t,e,i,o,s){const r=t-i;let n;return n=r<0?Math.min(-r,1+r-s):r>s?Math.min(Math.max(r-s,0),1-r):0,Math.max(n,Si(e,o,s))}class zi{constructor(){this._boundingVolumeCache=new Ii(this._computeTileBoundingVolume);}prepareNextFrame(){this._boundingVolumeCache.swapBuffers();}distanceToTile2d(t,e,i,o){const s=1<<i.z,r=1/s,n=i.x/s,a=i.y/s;let l=2;return l=Math.min(l,Li(t,e,n,a,r)),l=Math.min(l,Li(t,e,n+.5,-a-r,r)),l=Math.min(l,Li(t,e,n+.5,2-a-r,r)),l}getWrap(t,e,i){const o=1<<e.z,s=1/o,r=e.x/o,n=Si(t.x,r,s),a=Si(t.x,r-1,s),l=Si(t.x,r+1,s),h=Math.min(n,a,l);return h===l?1:h===a?-1:0}allowVariableZoom(t,e){return St(t,e)>4}allowWorldCopies(){return !1}getTileBoundingVolume(t,e,i,o){return this._boundingVolumeCache.getTileBoundingVolume(t,e,i,o)}_computeTileBoundingVolume(t,i,o,s){var r,n;let a=0,l=0;if(null==s?void 0:s.terrain){const h=new e.a2(t.z,i,t.z,t.x,t.y),c=s.terrain.getMinMaxElevation(h);a=null!==(r=c.minElevation)&&void 0!==r?r:Math.min(0,o),l=null!==(n=c.maxElevation)&&void 0!==n?n:Math.max(0,o);}if(a/=e.bC,l/=e.bC,a+=1,l+=1,t.z<=0)return Ei.fromAabb([-l,-l,-l],[l,l,l]);if(1===t.z)return Ei.fromAabb([0===t.x?-l:0,0===t.y?0:-l,-l],[0===t.x?0:l,0===t.y?l:0,l]);{const i=[vi(0,0,t.x,t.y,t.z),vi(e.a5,0,t.x,t.y,t.z),vi(e.a5,e.a5,t.x,t.y,t.z),vi(0,e.a5,t.x,t.y,t.z)],o=[];for(const t of i)o.push(e.aZ([],t,l));if(l!==a)for(const t of i)o.push(e.aZ([],t,a));0===t.y&&o.push([0,1,0]),t.y===(1<<t.z)-1&&o.push([0,-1,0]);const s=[1,1,1],r=[-1,-1,-1];for(const t of o)for(let e=0;e<3;e++)s[e]=Math.min(s[e],t[e]),r[e]=Math.max(r[e],t[e]);const n=vi(e.a5/2,e.a5/2,t.x,t.y,t.z),h=e.b2([],[0,1,0],n);e.b1(h,h);const c=e.b2([],n,h);e.b1(c,c);const u=e.b2([],i[2],i[1]);e.b1(u,u);const d=e.b2([],i[0],i[3]);e.b1(d,d),o.push(e.aZ([],n,l)),t.y>=(1<<t.z)/2&&o.push(e.aZ([],vi(e.a5/2,0,t.x,t.y,t.z),l)),t.y<(1<<t.z)/2&&o.push(e.aZ([],vi(e.a5/2,e.a5,t.x,t.y,t.z),l));const _=Ri(n,o),p=Ri(c,o),m=[-n[0],-n[1],-n[2],_.max],f=[n[0],n[1],n[2],-_.min],g=[-c[0],-c[1],-c[2],p.max],v=[c[0],c[1],c[2],-p.min],y=[...u,0],b=[...d,0],x=[];return 0===t.y?x.push(e.bB(b,y,m),e.bB(b,y,f)):x.push(e.bB(g,y,m),e.bB(g,y,f),e.bB(g,b,m),e.bB(g,b,f)),t.y===(1<<t.z)-1?x.push(e.bB(b,y,m),e.bB(b,y,f)):x.push(e.bB(v,y,m),e.bB(v,y,f),e.bB(v,b,m),e.bB(v,b,f)),new Ei(x,[m,f,g,v,y,b],s,r)}}}function Ri(t,i){let o=1/0,s=-1/0;for(const r of i){const i=e.b3(t,r);o=Math.min(o,i),s=Math.max(s,i);}return {min:o,max:s}}class Di{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t);}setMaxZoom(t){this._helper.setMaxZoom(t);}setMinPitch(t){this._helper.setMinPitch(t);}setMaxPitch(t){this._helper.setMaxPitch(t);}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t);}setBearing(t){this._helper.setBearing(t);}setPitch(t){this._helper.setPitch(t);}setRoll(t){this._helper.setRoll(t);}setFov(t){this._helper.setFov(t);}setZoom(t){this._helper.setZoom(t);}setCenter(t){this._helper.setCenter(t);}setElevation(t){this._helper.setElevation(t);}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t);}setPadding(t){this._helper.setPadding(t);}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e);}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t);}setConstrainOverride(t){this._helper.setConstrainOverride(t);}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e);}clearNearFarZOverride(){this._helper.clearNearFarZOverride();}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=e.bD(),this._projectionMatrix=e.bh(),this._globeViewProjMatrix32f=e.bg(),this._globeViewProjMatrixNoCorrection=e.bh(),this._globeViewProjMatrixNoCorrectionInverted=e.bh(),this._globeProjMatrixInverted=e.bh(),this._cameraPosition=e.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(t,i)=>{const o=e.ak(t.lat,-e.al,e.al),s=e.ak(+i,this.minZoom+Ti(0,o),this.maxZoom);return {center:new e.V(t.lng,o),zoom:s}},this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new $e({calcMatrices:()=>{this._calcMatrices();},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._coveringTilesDetailsProvider=new zi;}clone(){const t=new Di;return t.apply(this,!1),t}apply(t,e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(t,e);}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=e.by();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:e,applyGlobeMatrix:i}=t,o=this._helper.getMercatorTileCoordinates(e);return {mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:o,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const i=this.pitchInRadians,o=this.cameraToCenterDistance/t,s=Math.sin(i)*o,r=Math.cos(i)*o+1,n=1/Math.sqrt(s*s+r*r)*1;let a=-s,l=r;const h=Math.sqrt(a*a+l*l);a/=h,l/=h;const c=[0,a,l];e.bE(c,c,[0,0,0],-this.bearingInRadians),e.bF(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),e.bG(c,c,[0,0,0],this.center.lng*Math.PI/180);const u=1/e.b5(c);return e.aZ(c,c,u),[...c,-n*u]}isLocationOccluded(t){return !this.isSurfacePointVisible(yi(t))}transformLightDirection(t){const i=this._helper._center.lng*Math.PI/180,o=this._helper._center.lat*Math.PI/180,s=Math.cos(o),r
40=[Math.sin(i)*s,Math.sin(o),Math.cos(i)*s],n=[r[2],0,-r[0]],a=[0,0,0];e.b2(a,n,r),e.b1(n,n),e.b1(a,a);const l=[0,0,0];return e.b1(l,[n[0]*t[0]+a[0]*t[1]+r[0]*t[2],n[1]*t[0]+a[1]*t[1]+r[1]*t[2],n[2]*t[0]+a[2]*t[1]+r[2]*t[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,o){const s=function(t,i,o){const s=1/(1<<o.z);return new e.a6(t/e.a5*s+o.x*s,i/e.a5*s+o.y*s)}(t,i,o.canonical),r=(n=s.y,[e.bx(s.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI]);var n;return this.getCircleRadiusCorrection()/Math.cos(r[1])}projectTileCoordinates(t,i,o,s){const r=o.canonical,n=vi(t,i,r.x,r.y,r.z),a=1+(s?s(t,i):0)/e.bC,l=[n[0]*a,n[1]*a,n[2]*a,1];e.aE(l,l,this._globeViewProjMatrixNoCorrection);const h=this._cachedClippingPlane,c=h[0]*n[0]+h[1]*n[1]+h[2]*n[2]+h[3]<0;return {point:new e.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:c}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=bi(this.worldSize,this.center.lat),i=e.bi(),o=e.bi();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),e.bc(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const s=this.centerOffset;i[8]=2*-s.x/this._helper._width,i[9]=2*s.y/this._helper._height,this._projectionMatrix=e.bd(i),this._globeProjMatrixInverted=e.bi(),e.ay(this._globeProjMatrixInverted,i),e.O(i,i,[0,0,-this.cameraToCenterDistance]),e.be(i,i,this.rollInRadians),e.bf(i,i,-this.pitchInRadians),e.be(i,i,this.bearingInRadians),e.O(i,i,[0,0,-t]);const r=e.by();r[0]=t,r[1]=t,r[2]=t,e.bf(o,i,this.center.lat*Math.PI/180),e.bH(o,o,-this.center.lng*Math.PI/180),e.Q(o,o,r),this._globeViewProjMatrixNoCorrection=o,e.bf(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),e.bH(i,i,-this.center.lng*Math.PI/180),e.Q(i,i,r),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=e.bi(),e.ay(this._globeViewProjMatrixNoCorrectionInverted,o);const n=e.by();this._cameraPosition=e.by(),this._cameraPosition[2]=this.cameraToCenterDistance/t,e.bE(this._cameraPosition,this._cameraPosition,n,-this.rollInRadians),e.bF(this._cameraPosition,this._cameraPosition,n,this.pitchInRadians),e.bE(this._cameraPosition,this._cameraPosition,n,-this.bearingInRadians),e.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),e.bF(this._cameraPosition,this._cameraPosition,n,-this.center.lat*Math.PI/180),e.bG(this._cameraPosition,this._cameraPosition,n,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const a=e.bd(this._globeViewProjMatrixNoCorrectionInverted);e.Q(a,a,[1,1,-1]),this._cachedFrustum=Ye.fromInvProjectionMatrix(a,1,0,this._cachedClippingPlane,!0);}calculateFogMatrix(t){e.w("calculateFogMatrix is not supported on globe projection.");const i=e.bi();return e.ao(i),i}getVisibleUnwrappedCoordinates(t){return [new e.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&e.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0);}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const o=yi(t);e.aZ(o,o,1+i/e.bC);const s=e.bD();return e.aE(s,[o[0],o[1],o[2],1],this._globeViewProjMatrixNoCorrection),s[2]/s[3]}populateCache(t){}getBounds(){const t=.5*this.width,i=.5*this.height,o=[new e.P(0,0),new e.P(t,0),new e.P(this.width,0),new e.P(this.width,i),new e.P(this.width,this.height),new e.P(t,this.height),new e.P(0,this.height),new e.P(0,i)],s=[];for(const t of o)s.push(this.unprojectScreenPoint(t));let r=0,n=0,a=0,l=0;const h=this.center;for(const t of s){const i=e.bI(h.lng,t.lng),o=e.bI(h.lat,t.lat);
40i<n&&(n=i),i>r&&(r=i),o<l&&(l=o),o>a&&(a=o);}const c=[h.lng+n,h.lat+l,h.lng+r,h.lat+a];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new q(c)}calculateCenterFromCameraLngLatAlt(t,e,i,o){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,o)}setLocationAtPoint(t,i){const o=yi(this.unprojectScreenPoint(i)),s=yi(t),r=e.by();e.bJ(r);const n=e.by();e.bG(n,o,r,-this.center.lng*Math.PI/180),e.bF(n,n,r,this.center.lat*Math.PI/180);const a=s[0]*s[0]+s[2]*s[2],l=n[0]*n[0];if(a<l)return;const h=Math.sqrt(a-l),c=-h,u=e.bK(s[0],s[2],n[0],h),d=e.bK(s[0],s[2],n[0],c),_=e.by();e.bG(_,s,r,-u);const p=e.bK(_[1],_[2],n[1],n[2]),m=e.by();e.bG(m,s,r,-d);const f=e.bK(m[1],m[2],n[1],n[2]),g=.5*Math.PI,v=p>=-g&&p<=g,y=f>=-g&&f<=g;let b,x;if(v&&y){const t=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;e.bL(u,t)+e.bL(p,i)<e.bL(d,t)+e.bL(f,i)?(b=u,x=p):(b=d,x=f);}else if(v)b=u,x=p;else {if(!y)return;b=d,x=f;}const w=b/Math.PI*180,T=x/Math.PI*180,P=this.center.lat;this.setCenter(new e.V(w,e.ak(T,-90,90))),this.setZoom(this.zoom+Ti(P,this.center.lat));}locationToScreenPoint(t,i){const o=yi(t);if(i){const s=i.getElevationForLngLatZoom(t,this._helper._tileZoom);e.aZ(o,o,1+s/e.bC);}return this._projectSurfacePointToScreen(o)}_projectSurfacePointToScreen(t){const i=e.bD();return e.aE(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new e.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(e)return e}return e.a6.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var i;return null===(i=this.screenPointToMercatorCoordinate(t,e))||void 0===i?void 0:i.toLngLat()}isPointOnMapSurface(t,e){const i=this._cameraPosition,o=this.getRayDirectionFromPixel(t);return !!this.rayPlanetIntersection(i,o)}getRayDirectionFromPixel(t){const i=e.bD();i[0]=t.x/this.width*2-1,i[1]=-1*(t.y/this.height*2-1),i[2]=1,i[3]=1,e.aE(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const o=e.by();o[0]=i[0]-this._cameraPosition[0],o[1]=i[1]-this._cameraPosition[1],o[2]=i[2]-this._cameraPosition[2];const s=e.by();return e.b1(s,o),s}isSurfacePointVisible(t){const e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return !1;const i=e.bD();return e.aE(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(t,i){const o=e.b3(t,i),s=e.by(),r=e.by();e.aZ(r,i,o),e.b0(s,t,r);const n=1-e.b3(s,s);if(n<0)return null;const a=e.b3(t,t)-1,l=-o+(o<0?1:-1)*Math.sqrt(n),h=a/l,c=l;return {tMin:Math.min(h,c),tMax:Math.max(h,c)}}unprojectScreenPoint(t){const i=this._cameraPosition,o=this.getRayDirectionFromPixel(t),s=this.rayPlanetIntersection(i,o);if(s){const t=e.by();e.a_(t,i,[o[0]*s.tMin,o[1]*s.tMin,o[2]*s.tMin]);const r=e.by();return e.b1(r,t),xi(r)}const r=this._cachedClippingPlane,n=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],a=-e.b9(r,i)/n,l=e.by();if(a>0)e.a_(l,i,[o[0]*a,o[1]*a,o[2]*a]);else {const t=e.by();e.a_(t,i,[2*o[0],2*o[1],2*o[2]]);const s=e.b9(this._cachedClippingPlane,t);e.b0(l,t,[this._cachedClippingPlane[0]*s,this._cachedClippingPlane[1]*s,this._cachedClippingPlane[2]*s]);}const h=function(t){const i=e.by();return i[0]=t[0]*-t[3],i[1]=t[1]*-t[3],i[2]=t[2]*-t[3],{center:i,radius:Math.sqrt(1-t[3]*t[3])}}(r);return xi(function(t,i,o){const s=e.by();e.b0(s,o,t);const r=e.by();return e.bw(r,t,s,i/e.b7(s)),r}(h.center,h.radius,l))}getMatrixForModel(t,i){const o=e.V.convert(t),s=1/e.bC,r=e.bh();return e.bH(r,r,o.lng/180*Math.PI),e.bf(r,r,-o.lat/180*Math.PI),e.O(r,r,[0,0,1+i/e.bC]),e.bf(r,r,.5*Math.PI),e.Q(r,r,[s,s,s]),r}getProjectionDataForCustomLayer(t=!0){const i=this.getProjectionData({overscaledTileID:new e.a2(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}}class Ai{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSp
40aceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t);}setMaxZoom(t){this._helper.setMaxZoom(t);}setMinPitch(t){this._helper.setMinPitch(t);}setMaxPitch(t){this._helper.setMaxPitch(t);}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t);}setBearing(t){this._helper.setBearing(t);}setPitch(t){this._helper.setPitch(t);}setRoll(t){this._helper.setRoll(t);}setFov(t){this._helper.setFov(t);}setZoom(t){this._helper.setZoom(t);}setCenter(t){this._helper.setCenter(t);}setElevation(t){this._helper.setElevation(t);}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t);}setPadding(t){this._helper.setPadding(t);}interpolatePadding(t,e,i){return this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i);}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t);}setConstrainOverride(t){this._helper.setConstrainOverride(t);}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e);}clearNearFarZOverride(){this._helper.clearNearFarZOverride();}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame();}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(t,e)=>this.currentTransform.defaultConstrain(t,e),this.applyConstrain=(t,e)=>this._helper.applyConstrain(t,e),this._helper=new $e({calcMatrices:()=>{this._calcMatrices();},defaultConstrain:(t,e)=>this.defaultConstrain(t,e)},t),this._globeness=1,this._mercatorTransform=new Ke,this._verticalPerspectiveTransform=new Di;}clone(){const t=new Ai;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,e){this._helper.apply(t,e),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians);}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const e=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return {mainMatrix:this.isGlobeRendering?i.mainMatrix:e.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return e.bs(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return e.bs(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,o){const s=this._mercatorTransform.getPitchedTextCorrection(t,i,o),r=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,o);return e.bs(s,r,this._globeness)}projectTileCoordinates(t,e,i,o){return this.currentTransform.projectTileCoordinates(t,e,i,o)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ);}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t);}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t);}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,e,i,o){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,o)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform,!1);}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}
40isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){const e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=e.mainMatrix,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class ki{get useGlobeControls(){return !0}handlePanInertia(t,i){const o=Pi(t,i);return Math.abs(o.lng-i.center.lng)>180&&(o.lng=i.center.lng+179.5*Math.sign(o.lng-i.center.lng)),{easingCenter:o,easingOffset:new e.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){const o=t.around,s=i.screenPointToLocation(o);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);const r=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);const n=i.zoom-r;if(0===n)return;const a=e.bI(i.center.lng,s.lng),l=a/(Math.abs(a/180)+1),h=e.bI(i.center.lat,s.lat),c=i.getRayDirectionFromPixel(o),u=i.cameraPosition,d=-1*e.b3(u,c),_=e.by();e.a_(_,u,[c[0]*d,c[1]*d,c[2]*d]);const p=e.b5(_)-1,m=Math.exp(.5*-Math.max(p-.3,0)),f=bi(i.worldSize,i.center.lat)/Math.min(i.width,i.height),g=e.bv(f,.9,.5,1,.25),v=(1-e.an(-n))*Math.min(m,g),y=i.center.lat,b=i.zoom,x=new e.V(i.center.lng+l*v,e.ak(i.center.lat+h*v,-e.al,e.al));i.setLocationAtPoint(s,o);const w=i.center,T=e.bv(Math.abs(a),45,85,0,1),P=e.bv(f,.75,.35,0,1),M=Math.pow(Math.max(T,P),.25),C=e.bI(w.lng,x.lng),I=e.bI(w.lat,x.lat);i.setCenter(new e.V(w.lng+C*M,w.lat+I*M).wrap()),i.setZoom(b+Ti(y,i.center.lat));}handleMapControlsPan(t,e,i){if(!t.panDelta)return;const o=e.center.lat,s=e.zoom;e.setCenter(Pi(t.panDelta,e).wrap()),e.setZoom(s+Ti(o,e.center.lat));}cameraForBoxAndBearing(t,i,o,s,r){const n=ti(t,i,o,s,r),a=i.left/r.width*2-1,l=(r.width-i.right)/r.width*2-1,h=i.top/r.height*-2+1,c=(r.height-i.bottom)/r.height*-2+1,u=e.bI(o.getWest(),o.getEast())<0,d=u?o.getEast():o.getWest(),_=u?o.getWest():o.getEast(),p=Math.max(o.getNorth(),o.getSouth()),m=Math.min(o.getNorth(),o.getSouth()),f=d+.5*e.bI(d,_),g=p+.5*e.bI(p,m),v=r.clone();v.setCenter(n.center),v.setBearing(n.bearing),v.setPitch(0),v.setRoll(0),v.setZoom(n.zoom);const y=v.modelViewProjectionMatrix,b=[yi(o.getNorthWest()),yi(o.getNorthEast()),yi(o.getSouthWest
40()),yi(o.getSouthEast()),yi(new e.V(_,g)),yi(new e.V(d,g)),yi(new e.V(f,p)),yi(new e.V(f,m))],x=yi(n.center);let w=Number.POSITIVE_INFINITY;for(const t of b)a<0&&(w=ki.getLesserNonNegativeNonNull(w,ki.solveVectorScale(t,x,y,"x",a))),l>0&&(w=ki.getLesserNonNegativeNonNull(w,ki.solveVectorScale(t,x,y,"x",l))),h>0&&(w=ki.getLesserNonNegativeNonNull(w,ki.solveVectorScale(t,x,y,"y",h))),c<0&&(w=ki.getLesserNonNegativeNonNull(w,ki.solveVectorScale(t,x,y,"y",c)));if(Number.isFinite(w)&&0!==w)return n.zoom=v.zoom+e.aq(w),n;Qe();}handleJumpToCenterZoom(t,i){const o=t.center.lat,s=t.applyConstrain(i.center?e.V.convert(i.center):t.center,t.zoom).center;t.setCenter(s.wrap());const r=void 0!==i.zoom?+i.zoom:t.zoom+Ti(o,s.lat);t.zoom!==r&&t.setZoom(r);}handleEaseTo(t,i){const o=t.zoom,s=t.center,r=t.padding,n={roll:t.roll,pitch:t.pitch,bearing:t.bearing},a={roll:void 0===i.roll?t.roll:i.roll,pitch:void 0===i.pitch?t.pitch:i.pitch,bearing:void 0===i.bearing?t.bearing:i.bearing},l=void 0!==i.zoom,h=!t.isPaddingEqual(i.padding);let c=!1;const u=i.center?e.V.convert(i.center):s,d=t.applyConstrain(u,o).center;We(t,d);const _=t.clone();_.setCenter(d),_.setZoom(l?+i.zoom:o+Ti(s.lat,u.lat)),_.setBearing(i.bearing);const p=new e.P(e.ak(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ak(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));_.setLocationAtPoint(d,p);const m=(i.offset&&i.offsetAsPoint.mag())>0?_.center:d,f=l?+i.zoom:o+Ti(s.lat,m.lat),g=o+Ti(s.lat,0),v=f+Ti(m.lat,0),y=e.bI(s.lng,m.lng),b=e.bI(s.lat,m.lat),x=e.an(v-g);return c=f!==o,{easeFunc:o=>{if(e.bm(n,a)||Je({startEulerAngles:n,endEulerAngles:a,tr:t,k:o,useSlerp:n.roll!=a.roll}),h&&t.interpolatePadding(r,i.padding,o),i.around)e.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else {const e=v>g?Math.min(2,x):Math.max(.5,x),i=Math.pow(e,1-o),r=Ci(s,y,b,o*i);t.setCenter(r.wrap());}if(c){const i=e.G.number(g,v,o)+Ti(0,t.center.lat);t.setZoom(i);}},isZooming:c,elevationCenter:m}}handleFlyTo(t,i){const o=void 0!==i.zoom,s=t.center,r=t.zoom,n=t.padding,a=!t.isPaddingEqual(i.padding),l=t.applyConstrain(e.V.convert(i.center||i.locationAtOffset),r).center,h=o?+i.zoom:t.zoom+Ti(t.center.lat,l.lat),c=t.clone();c.setCenter(l),c.setZoom(h),c.setBearing(i.bearing);const u=new e.P(e.ak(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),e.ak(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));c.setLocationAtPoint(l,u);const d=c.center;We(t,d);const _=function(t,i,o){const s=yi(i),r=yi(o),n=e.b3(s,r),a=Math.acos(n),l=gi(t);return a/(2*Math.PI)*l}(t,s,d),p=r+Ti(s.lat,0),m=h+Ti(d.lat,0),f=e.an(m-p);let g;if("number"==typeof i.minZoom){const o=+i.minZoom+Ti(d.lat,0),s=Math.min(o,p,m)+Ti(0,d.lat),r=t.applyConstrain(d,s).zoom+Ti(d.lat,0);g=e.an(r-p);}const v=e.bI(s.lng,d.lng),y=e.bI(s.lat,d.lat);return {easeFunc:(o,r,l,c)=>{const u=Ci(s,v,y,l);a&&t.interpolatePadding(n,i.padding,o);const _=1===o?d:u;t.setCenter(_.wrap());const m=p+e.aq(r);t.setZoom(1===o?h:m+Ti(0,_.lat));},scaleOfZoom:f,targetCenter:d,scaleOfMinZoom:g,pixelPathLength:_}}static solveVectorScale(t,e,i,o,s){const r="x"===o?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],n=[i[3],i[7],i[11],i[15]],a=t[0]*r[0]+t[1]*r[1]+t[2]*r[2],l=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],h=e[0]*r[0]+e[1]*r[1]+e[2]*r[2],c=e[0]*n[0]+e[1]*n[1]+e[2]*n[2];return h+s*l===a+s*c||n[3]*(a-h)+r[3]*(c-l)+a*c==h*l?null:(h+r[3]-s*c-s*n[3])/(h-a-s*c+s*l)}static getLesserNonNegativeNonNull(t,e){return null!==e&&e>=0&&e<t?e:t}}class Oi{constructor(t){this._globe=t,this._mercatorCameraHelper=new ei,this._verticalPerspectiveCameraHelper=new ki;}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,i){this.currentHelper.handleMapControlsPan(t,e,i);}cameraForBoxAndBearing(t,e,i,o,s){return this.currentHelper.cameraForBoxAndBearing(t,e,i,o,s)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e);}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}const Bi=(t,i)=>e.B(t,i&&i.filter((t=>"source.canvas"!==t.identifier))),Fi=e.bM();
40class ji extends e.E{constructor(t,i={}){var o,s;super(),this._rtlPluginLoaded=()=>{for(const t in this.tileManagers){const e=this.tileManagers[t].getSource().type;"vector"!==e&&"geojson"!==e||this.tileManagers[t].reload();}},this.map=t,this.dispatcher=new j(O(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler("GI",((t,e)=>this.getImages(t,e))),this.dispatcher.registerMessageHandler("GDA",((t,e)=>this.getDashes(t,e))),this.imageManager=new y,this.imageManager.setEventedParent(this);const r=(null===(o=t._container)||void 0===o?void 0:o.lang)||"undefined"!=typeof document&&(null===(s=document.documentElement)||void 0===s?void 0:s.lang)||void 0;this.glyphManager=new P(t._requestManager,i.localIdeographFontFamily,r),this.lineAtlas=new L(256,512),this.crossTileSymbolIndex=new ke,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",e.bN()),_t().on(ct,this._rtlPluginLoaded),this.on("data",(t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;const e=this.tileManagers[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);}}));}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new e.bO,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(t=this.crossTileSymbolIndex)||void 0===t?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0;}setGlobalStateProperty(t,i){var o,s,r;this._checkLoaded();const n=null===i?null!==(r=null===(s=null===(o=this.stylesheet.state)||void 0===o?void 0:o[t])||void 0===s?void 0:s.default)&&void 0!==r?r:null:i;if(e.bP(n,this._globalState[t]))return this;this._globalState[t]=n,this._applyGlobalStateChanges([t]);}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const i=[];for(const o in t)!e.bP(this._globalState[o],t[o].default)&&(i.push(o),this._globalState[o]=t[o].default);this._applyGlobalStateChanges(i);}_applyGlobalStateChanges(t){if(0===t.length)return;const e=new Set,i={};for(const o of t){i[o]=this._globalState[o];for(const t in this._layers){const i=this._layers[t],s=i.getLayoutAffectingGlobalStateRefs(),r=i.getPaintAffectingGlobalStateRefs(),n=i.getVisibilityAffectingGlobalStateRefs();if(s.has(o)&&e.add(i.source),r.has(o))for(const{name:t,value:e}of r.get(o))this._updatePaintProperty(i,t,e);(null==n?void 0:n.has(o))&&(i.recalculateVisibility(),this._updateLayer(i));}}this.dispatcher.broadcast("UGS",i);for(const t in this.tileManagers)e.has(t)&&(this._reloadSource(t),this._changed=!0);}loadURL(t){return e._(this,arguments,void 0,(function*(t,i={},o){this.fire(new e.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const s=yield this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const r=this._loadStyleRequest;try{const t=yield e.j(s,this._loadStyleRequest);this._loadStyleRequest=null,this._load(t.data,i,o);}catch(t){this._loadStyleRequest=null,t&&!r.signal.aborted&&this.fire(new e.k(t));}}))}loadJSON(t,i={},o){this.fire(new e.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,n.taskAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,o);})).catch((()=>{}));}loadEmpty(){this.fire(new e.l("dataloading",{dataType:"style"})),this._load(Fi,{validate:!1});}_load(t,i,o){var s,r;let n=i.transformStyle?i.transformStyle(o,t):t;if(!i.validate||!Bi(this,e.C(n))){n=Object.assign({},n),this._loaded=!0,this.stylesheet=n;for(const t in n.sources)this.addSource(t,n.sources[t],{validate:!1});n.sprite?this._loadSprite(n.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(n.glyphs),this._createLayers(),this.light=new I(this.stylesheet.light),this._setProjectionInternal((null===(s=this.stylesheet.projection)||void 0===s?void 0:s.type)||"mercator"),this.sky=new S(this.stylesheet.sky),this.map.setTerrain(null!==(r=this.stylesheet.terrain)&&void 0!==r?r:null),this.fire(new e.l("data",{dataType:"style"})),this.fire(new e.l("style.load"));}}_createLayers(){var t,i,o;
40const s=e.bQ(this.stylesheet.layers);this.setGlobalState(null!==(t=this.stylesheet.state)&&void 0!==t?t:null),this.dispatcher.broadcast("SL",s),this._order=s.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const t of s){const s=e.bR(t,this._globalState);if(s.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=s,e.bS(s)&&this.tileManagers[s.source]){const e=null!==(o=null===(i=t.paint)||void 0===i?void 0:i["raster-fade-duration"])&&void 0!==o?o:s.paint.get("raster-fade-duration");this.tileManagers[s.source].setRasterFadeDuration(e);}}}_loadSprite(t,i=!1,o=void 0){this.imageManager.setLoaded(!1);const s=new AbortController;let r;this._spriteRequest=s,function(t,i,o,s){return e._(this,void 0,void 0,(function*(){const r=f(t),a=o>1?"@2x":"",l={},h={};for(const{id:t,url:o}of r){const r=yield i.transformRequest(g(o,a,".json"),"SpriteJSON");l[t]=e.j(r,s);const n=yield i.transformRequest(g(o,a,".png"),"SpriteImage");h[t]=_.getImage(n,s);}return yield Promise.all([...Object.values(l),...Object.values(h)]),function(t,i){return e._(this,void 0,void 0,(function*(){const e={};for(const o in t){e[o]={};const s=n.getImageCanvasContext((yield i[o]).data),r=(yield t[o]).data;for(const t in r){const{width:i,height:n,x:a,y:l,sdf:h,pixelRatio:c,stretchX:u,stretchY:d,content:_,textFitWidth:p,textFitHeight:m}=r[t];e[o][t]={data:null,pixelRatio:c,sdf:h,stretchX:u,stretchY:d,content:_,textFitWidth:p,textFitHeight:m,spriteData:{width:i,height:n,x:a,y:l,context:s}};}}return e}))}(l,h)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const o=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of o)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const o in t[e]){const s="default"===e?o:`${e}:${o}`;this._spritesImagesIds[e].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,t[e][o],!1):this.imageManager.addImage(s,t[e][o]),i&&(this._changedImages[s]=!0);}}})).catch((t=>{this._spriteRequest=null,r=t,s.signal.aborted||this.fire(new e.k(r));})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"})),o&&o(r);}));}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}));}_validateLayer(t){const i=this.tileManagers[t.source];if(!i)return;const o=t.sourceLayer;if(!o)return;const s=i.getSource();("geojson"===s.type||s.vectorLayerIds&&-1===s.vectorLayerIds.indexOf(o))&&this.fire(new e.k(new Error(`Source layer "${o}" does not exist on source "${s.id}" as specified by style layer "${t.id}".`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return !1;return !!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const o=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?e.bT(o):o);const s=[];for(const r of t)if(o[r]){const t=i?e.bT(o[r]):o[r];s.push(t);}return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];"custom"!==e.type&&(t[i]=e.serialize());}return t}hasTransitions(){var t,e,i;if(null===(t=this.light)||void 0===t?void 0:t.hasTransition())return !0;if(null===(e=this.sky)||void 0===e?void 0:e.hasTransition())return !0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return !0;for(const t in this.tileManagers)if(this.tileManagers[t].hasTransition())return !0;for(const t in this._layers)if(this._layers[t].hasTransition())return !0;return !1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if("reload"===e)this._reloadSource(t);else {if("clear"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t);}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates();}const o={};for(const t in this.tileManagers){const e=this.tileManagers[t];o[t]=e.used,e.used=!1;}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.tileManagers[i.source].used=!0);}for(const t in o){const i=this.tileManagers[t];!!o[t]!=!!i.used&&i.fire(new e.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:t}));}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new e.l("data",{dataType:"style"}));}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={};}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1;}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e});}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1;}setState(t,i={}){var o;this._checkLoaded();const s=this.serialize();if(t=i.transformStyle?i.transformStyle(s,t):t,(null===(o=i.validate)||void 0===o||o)&&Bi(this,e.C(t)))return !1;(t=e.bT(t)).layers=e.bQ(t.layers);const r=e.bU(s,t),n=this._getOperationsToPerform(r);if(n.unimplemented.length>0)throw new Error(`Unimplemented: ${n.unimplemented.join(", ")}.`);
40if(0===n.operations.length)return !1;for(const t of n.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new e.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const e=[],i=[];for(const o of t)switch(o.command){case "setCenter":case "setZoom":case "setBearing":case "setPitch":case "setRoll":continue;case "addLayer":e.push((()=>this.addLayer.apply(this,o.args)));break;case "removeLayer":e.push((()=>this.removeLayer.apply(this,o.args)));break;case "setPaintProperty":e.push((()=>this.setPaintProperty.apply(this,o.args)));break;case "setLayoutProperty":e.push((()=>this.setLayoutProperty.apply(this,o.args)));break;case "setFilter":e.push((()=>this.setFilter.apply(this,o.args)));break;case "addSource":e.push((()=>this.addSource.apply(this,o.args)));break;case "removeSource":e.push((()=>this.removeSource.apply(this,o.args)));break;case "setLayerZoomRange":e.push((()=>this.setLayerZoomRange.apply(this,o.args)));break;case "setLight":e.push((()=>this.setLight.apply(this,o.args)));break;case "setGeoJSONSourceData":e.push((()=>this.setGeoJSONSourceData.apply(this,o.args)));break;case "setGlyphs":e.push((()=>this.setGlyphs.apply(this,o.args)));break;case "setSprite":e.push((()=>this.setSprite.apply(this,o.args)));break;case "setTerrain":e.push((()=>this.map.setTerrain.apply(this,o.args)));break;case "setSky":e.push((()=>this.setSky.apply(this,o.args)));break;case "setProjection":this.setProjection.apply(this,o.args);break;case "setGlobalState":e.push((()=>this.setGlobalState.apply(this,o.args)));break;case "setTransition":e.push((()=>{}));break;default:i.push(o.command);}return {operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t);}updateImage(t,e){this.imageManager.updateImage(t,e);}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t);}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}));}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,o={}){if(this._checkLoaded(),void 0!==this.tileManagers[t])throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.C.source,`sources.${t}`,i,null,o))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const s=this.tileManagers[t]=new jt(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,(()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t}))),s.onAdd(this.map),this._changed=!0;}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw new Error(`There is no source with this ID=${t}`);for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.k(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));const i=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],i.fire(new e.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0;}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.tileManagers[t])throw new Error(`There is no source with this ID=${t}`);const i=this.tileManagers[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.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,i,o={}){this._checkLoaded();const s=t.id;if(this.getLayer(s))return void this.fire(new e.k(new Error(`Layer "${s}" already exists on this map.`)));let r;if("custom"===t.type){if(Bi(this,e.bV(t)))return;r=e.bR(t,this._globalState);}else {if("source"in t&&"object"==typeof t.source&&(this.addSource(s,t.source),t=e.bT(t),t=e.e(t,{source:s}
40)),this._validate(e.C.layer,`layers.${s}`,t,{arrayIndex:-1},o))return;r=e.bR(t,this._globalState),this._validateLayer(r),r.setEventedParent(this,{layer:{id:s}});}const n=i?this._order.indexOf(i):this._order.length;if(i&&-1===n)this.fire(new e.k(new Error(`Cannot add layer "${s}" before non-existing layer "${i}".`)));else {if(this._order.splice(n,0,s),this._layerOrderChanged=!0,this._layers[s]=r,this._removedLayers[s]&&r.source&&"custom"!==r.type){const t=this._removedLayers[s];delete this._removedLayers[s],t.type!==r.type?this._updatedSources[r.source]="clear":(this._updatedSources[r.source]="reload",this.tileManagers[r.source].pause());}this._updateLayer(r),r.onAdd&&r.onAdd(this.map);}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const o=this._order.indexOf(t);this._order.splice(o,1);const s=i?this._order.indexOf(i):this._order.length;i&&-1===s?this.fire(new e.k(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(s,0,t),this._layerOrderChanged=!0);}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.k(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const o=this._order.indexOf(t);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map);}getLayer(t){return this._layers[t]}getLayersOrder(){return [...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,o){this._checkLoaded();const s=this.getLayer(t);s?s.minzoom===i&&s.maxzoom===o||(null!=i&&(s.minzoom=i),null!=o&&(s.maxzoom=o),this._updateLayer(s)):this.fire(new e.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)));}setFilter(t,i,o={}){this._checkLoaded();const s=this.getLayer(t);if(s){if(!e.bP(s.filter,i))return null==i?(s.setFilter(void 0),void this._updateLayer(s)):void(this._validate(e.C.filter,`layers.${s.id}.filter`,i,null,o)||(s.setFilter(e.bT(i)),this._updateLayer(s)))}else this.fire(new e.k(new Error(`Cannot filter non-existing layer "${t}".`)));}getFilter(t){return e.bT(this.getLayer(t).filter)}setLayoutProperty(t,i,o,s={}){this._checkLoaded();const r=this.getLayer(t);r?e.bP(r.getLayoutProperty(i),o)||(r.setLayoutProperty(i,o,s),this._updateLayer(r)):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)));}getLayoutProperty(t,i){const o=this.getLayer(t);if(o)return o.getLayoutProperty(i);this.fire(new e.k(new Error(`Cannot get style of non-existing layer "${t}".`)));}setPaintProperty(t,i,o,s={}){this._checkLoaded();const r=this.getLayer(t);r?e.bP(r.getPaintProperty(i),o)||this._updatePaintProperty(r,i,o,s):this.fire(new e.k(new Error(`Cannot style non-existing layer "${t}".`)));}_updatePaintProperty(t,i,o,s={}){t.setPaintProperty(i,o,s)&&this._updateLayer(t),e.bS(t)&&"raster-fade-duration"===i&&this.tileManagers[t.source].setRasterFadeDuration(o),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null;}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const o=t.source,s=t.sourceLayer,r=this.tileManagers[o];if(void 0===r)return void this.fire(new e.k(new Error(`The source '${o}' does not exist in the map's style.`)));const n=r.getSource().type;"geojson"===n&&s?this.fire(new e.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==n||s?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),r.setFeatureState(s,t.id,i)):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));}removeFeatureState(t,i){this._checkLoaded();const o=t.source,s=this.tileManagers[o];if(void 0===s)return void this.fire(new e.k(new Error(`The source '${o}' does not exist in the map's style.`)));const r=s.getSource().type,n="vector"===r?t.sourceLayer:void 0;"vector"!==r||n?i&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new e.k(new Error("A feature id is required to remove its specific state property."))):s.removeFeatureState(n,t.id,i):this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));}getFeatureState(t){this._checkLoaded();const i=t.source,o=t.sourceLayer,s=this.tileManagers[i];
40if(void 0!==s)return "vector"!==s.getSource().type||o?(void 0===t.id&&this.fire(new e.k(new Error("The feature id parameter must be provided."))),s.getFeatureState(o,t.id)):void this.fire(new e.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new e.k(new Error(`The source '${i}' does not exist in the map's style.`)));}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.bW(this.tileManagers,(t=>t.serialize())),i=this._serializeByIds(this._order,!0),o=this.map.getTerrain()||void 0,s=this.stylesheet;return e.bX({version:s.version,name:s.name,metadata:s.metadata,light:s.light,sky:s.sky,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,projection:s.projection,sources:t,layers:i,terrain:o},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0;}_flattenAndSortRenderedFeatures(t){const e=t=>"fill-extrusion"===this._layers[t].type,i={},o=[];for(let s=this._order.length-1;s>=0;s--){const r=this._order[s];if(e(r)){i[r]=s;for(const e of t){const t=e[r];if(t)for(const e of t)o.push(e);}}}o.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const s=[];for(let r=this._order.length-1;r>=0;r--){const n=this._order[r];if(e(n))for(let t=o.length-1;t>=0;t--){const e=o[t].feature;if(i[e.layer.id]<r)break;s.push(e),o.pop();}else for(const e of t){const t=e[n];if(t)for(const e of t)s.push(e.feature);}}return s}queryRenderedFeatures(t,i,o){i&&i.filter&&this._validate(e.C.filter,"queryRenderedFeatures.filter",i.filter,null,i);const s={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new e.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const t of i.layers){const i=this._layers[t];if(!i)return this.fire(new e.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];s[i.source]=!0;}}const r=[];i.availableImages=this._availableImages;const n=this._serializedAllLayers(),a=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:a,globalState:this._globalState});for(const e in this.tileManagers)i.layers&&!s[e]||r.push(G(this.tileManagers[e],this._layers,n,t,l,o,this.map.terrain?(t,e,i)=>this.map.terrain.getElevation(t,e,i):void 0));return this.placement&&r.push(function(t,e,i,o,s,r,n){const a={},l=r.queryRenderedSymbols(o),h=[];for(const t of Object.keys(l).map(Number))h.push(n[t]);h.sort(U);for(const i of h){const o=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,{filterSpec:s.filter,globalState:s.globalState},s.layers,s.availableImages,t);for(const t in o){const e=a[t]=a[t]||[],s=o[t];s.sort(((t,e)=>{const o=i.featureSortOrder;if(o){const i=o.indexOf(t.featureIndex);return o.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of s)e.push(t);}}return function(t,e,i){for(const o in t)for(const s of t[o])V(s,i[e[o].source]);return t}(a,t,i)}(this._layers,n,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(r)}querySourceFeatures(t,i){(null==i?void 0:i.filter)&&this._validate(e.C.filter,"querySourceFeatures.filter",i.filter,null,i);const o=this.tileManagers[t];return o?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),o=[],s={};for(let t=0;t<i.length;t++){const r=i[t],n=r.tileID.canonical.key;s[n]||(s[n]=!0,r.querySourceFeatures(o,e));}return o}(o,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();const o=this.light.getLight();let s=!1;for(const i in t)if(!e.bP(t[i],o[i])){s=!0;break}if(!s)return;const r={now:l(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(r);}getProjection(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.stylesheet.projection=t,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection;}this._setProjectionInternal(t.type);}getSky(){var t;return null===(t=this.stylesheet)||void 0===t?void 0:t.sky}setSky(t,i={}){this._checkLoaded();const o=this.getSky();let s=!1;if(!t&&!o)return;if(t&&!o)s=!0;else if(!t&&o)s=!0;else for(const i in t)if(!e.bP(t[i],o[i])){s=!0;break}if(!s)return;const r={now:l(),transition:e.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(r);}_setProjectionInternal(t){const i=function(t,i){const o={constrainOverride:i};if(Array.isArray(t)){const e=new fi({type:t});return {projection:e,transform:new Ai(o),cameraHelper:new Oi(e)}}switch(t){case "mercator":return {projection:new Ue,transform:new Ke(o),cameraHelper:new ei};case "globe":{const t=new fi({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return {projection:t,transform:new Ai(o),cameraHelper:new Oi(t)}}case "vertical-perspective":return {projection:new pi,transform:new Di(o),cameraHelper:new ki};default:return e.w(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new Ue,transform:new Ke(o),cameraHelper:new ei}}}(t,this.map.transformConstrain);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const t in this.tileManagers)this.tileManagers[t].reload();}_validate(t,i,o,s,r={}){return (!r||!1!==r.validate)&&Bi(this,t.call(e.C,e.e({key:i,style:this.serialize(),value:o,styleSpec:e.u},s)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),_t().off(ct,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map);}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t);}_clearSource(t){this.tileManagers[t].clearTiles();}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload();}_updateSources(t){for(const e in this.tileManagers)this.tileManagers[e].update(t,this.map.terrain);}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t);}_updatePlacement(t,e,i,o,s=!1){let r=!1,n=!1;const a={};for(const e of this._order){const i=this._layers[e];
40if("symbol"!==i.type)continue;if(!a[i.source]){const t=this.tileManagers[i.source];a[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 o=this.crossTileSymbolIndex.addLayer(i,a[i.source],t.center.lng);r=r||o;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l(),t.zoom))&&(this.pauseablePlacement=new Le(t,this.map.terrain,this._order,s,e,i,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,a),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l()),n=!0),r&&this.pauseablePlacement.placement.setStale()),n||r)for(const t of this._order){const e=this._layers[t];"symbol"===e.type&&this.placement.updateLayerOpacities(e,a[e.source]);}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(l())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles();}getImages(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.tileManagers[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t}))}getGlyphs(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.tileManagers[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[""]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.C.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t));}getDashes(t,i){return e._(this,void 0,void 0,(function*(){const t={};for(const[e,o]of Object.entries(i.dashes))t[e]=this.lineAtlas.getDash(o.dasharray,o.round);return t}))}addSprite(t,i,o={},s){this._checkLoaded();const r=[{id:t,url:i}],n=[...f(this.stylesheet.sprite),...r];this._validate(e.C.sprite,"sprite",n,null,o)||(this.stylesheet.sprite=n,this._loadSprite(r,!0,s));}removeSprite(t){this._checkLoaded();const i=f(this.stylesheet.sprite);if(i.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new e.l("data",{dataType:"style"}));}else this.fire(new e.k(new Error(`Sprite "${t}" doesn't exists on this map.`)));}getSprite(){return f(this.stylesheet.sprite)}setSprite(t,i={},o){this._checkLoaded(),t&&this._validate(e.C.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,o):(this._unloadSprite(),o&&o(null)));}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map);}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const e=this._layers[t];e.setEventedParent(null),e.onRemove&&e.onRemove(this.map);}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={};}}var Ni=e.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Zi{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,o,s,r,n,a,l){this.context=t;let h=this.boundPaintVertexBuffers.length!==o.length;for(let t=0;!h&&t<o.length;t++)this.boundPaintVertexBuffers[t]!==o[t]&&(h=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||h||this.boundIndexBuffer!==s||this.boundVertexOffset!==r||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,o,s,r,n,a,l):(t.bindVertexArray.set(this.vao),n&&n.bind(),s&&s.dynamicDraw&&s.bind(),a&&a.bind(),l&&l.bind());}freshBind(t,e,i,o,s,r,n,a){const l=t.numAttributes,h=this.context,c=h.gl;this.vao&&this.destroy(),this.vao=h.createVertexArray(),h.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=o,this.boundVertexOffset=s,this.boundDynamicVertexBuffer=r,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=a,e.enableAttributes(c,t);for(const e of i)e.enableAttributes(c,t);r&&r.enableAttributes(c,t),n&&n.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,s);for(const e of i)e.bind(),e.setVertexAttribPointers(c,t,s);r&&(r.bind(),r.setVertexAttribPointers(c,t,s)),o&&o.bind(),n&&(n.bind(),n.setVertexAttribPointers(c,t,s)),a&&(a.bind(),a.setVertexAttribPointers(c,t,s)),h.currentNumAttributes=l;}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null);}}const Gi=(t,i,o,s,r)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:i,u_fog_color:o?o.properties.get("fog-color"):e.bn.white,u_fog_ground_blend:o?o.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:r?0:o?o.calculateFogBlendOpacity(s):0,u_horizon_color:o?o.properties.get("horizon-color"):e.bn.white,u_horizon_fog_blend:o?o.properties.get("horizon-fog-blend"):1,u_is_globe_mode:r?1:0}),Ui={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Vi(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const o=t[i].split(" ");e.push(o.pop());}return e}class Wi{constructor(t,i,o,s,r,n,a,l,h=[]){const c=t.gl;this.program=c.createProgram();const u=Vi(i.staticAttributes),d=o?o.getBinderAttributes():[],_=u.concat(d),p=Be.prelude.staticUniforms?Vi(Be.prelude.staticUniforms):[],m=a.staticUniforms?Vi(a.staticUniforms):[],f=i.staticUniforms?Vi(i.staticUniforms):[],g=o?o.getBinderUniforms():[],v=p.concat(m).concat(f).concat(g),y=[];for(const t of v)y.indexOf(t)<0&&y.push(t);const b=o?o.defines():[];hi(c)&&b.unshift("#version 300 es"),r&&b.push("#define OVERDRAW_INSPECTOR;"),n&&b.push("#define TERRAIN3D;
40"),l&&b.push(l),h&&b.push(...h);let x=b.concat(Be.prelude.fragmentSource,a.fragmentSource,i.fragmentSource).join("\n"),w=b.concat(Be.prelude.vertexSource,a.vertexSource,i.vertexSource).join("\n");hi(c)||(x=function(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),w=function(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(T,x),c.compileShader(T),!c.getShaderParameter(T,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(T)}`);c.attachShader(this.program,T);const P=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(P,w),c.compileShader(P),!c.getShaderParameter(P,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(P)}`);c.attachShader(this.program,P),this.attributes={};const M={};this.numAttributes=_.length;for(let t=0;t<this.numAttributes;t++)_[t]&&(c.bindAttribLocation(this.program,t,_[t]),this.attributes[_[t]]=t);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(P),c.deleteShader(T);for(let t=0;t<y.length;t++){const e=y[t];if(e&&!M[e]){const t=c.getUniformLocation(this.program,e);t&&(M[e]=t);}}this.fixedUniforms=s(t,M),this.terrainUniforms=((t,i)=>({u_depth:new e.bY(t,i.u_depth),u_terrain:new e.bY(t,i.u_terrain),u_terrain_dim:new e.bo(t,i.u_terrain_dim),u_terrain_matrix:new e.b_(t,i.u_terrain_matrix),u_terrain_unpack:new e.b$(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.bo(t,i.u_terrain_exaggeration)}))(t,M),this.projectionUniforms=((t,i)=>({u_projection_matrix:new e.b_(t,i.u_projection_matrix),u_projection_tile_mercator_coords:new e.b$(t,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new e.b$(t,
40i.u_projection_clipping_plane),u_projection_transition:new e.bo(t,i.u_projection_transition),u_projection_fallback_matrix:new e.b_(t,i.u_projection_fallback_matrix)}))(t,M),this.binderUniforms=o?o.getUniforms(t,M):[];}draw(t,e,i,o,s,r,n,a,l,h,c,u,d,_,p,m,f,g,v){const y=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(o),t.setColorMode(s),t.setCullFace(r),a){t.activeTexture.set(y.TEXTURE2),y.bindTexture(y.TEXTURE_2D,a.depthTexture),t.activeTexture.set(y.TEXTURE3),y.bindTexture(y.TEXTURE_2D,a.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(a[t]);}if(l)for(const t in l)this.projectionUniforms[Ui[t]].set(l[t]);if(n)for(const t in this.fixedUniforms)this.fixedUniforms[t].set(n[t]);m&&m.setUniforms(t,this.binderUniforms,_,{zoom:p});let b=0;switch(e){case y.LINES:b=2;break;case y.TRIANGLES:b=3;break;case y.LINE_STRIP:b=1;}for(const i of d.get()){const o=i.vaos||(i.vaos={});(o[h]||(o[h]=new Zi)).bind(t,this,c,m?m.getPaintVertexBuffers():[],u,i.vertexOffset,f,g,v),y.drawElements(e,i.primitiveLength*b,y.UNSIGNED_SHORT,i.primitiveOffset*b*2);}}}function qi(t,i,o){const s=1/e.aK(o,1,i.transform.tileZoom),r=Math.pow(2,o.tileID.overscaledZ),n=o.tileSize*Math.pow(2,i.transform.tileZoom)/r,a=n*(o.tileID.canonical.x+o.tileID.wrap*r),l=n*o.tileID.canonical.y;return {u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[s,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,l>>16],u_pixel_coord_lower:[65535&a,65535&l]}}const $i=(t,i,o,s)=>{const r=t.style.light,n=r.properties.get("position"),a=[n.x,n.y,n.z],l=e.c2();"viewport"===r.properties.get("anchor")&&e.c3(l,t.transform.bearingInRadians),e.c4(a,a,l);const h=t.transform.transformLightDirection(a),c=r.properties.get("color");return {u_lightpos:a,u_lightpos_globe:h,u_lightintensity:r.properties.get("intensity"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+i,u_opacity:o,u_fill_translate:s}},Hi=(t,i,o,s,r,n,a)=>e.e($i(t,i,o,s),qi(n,t,a),{u_height_factor:-Math.pow(2,r.overscaledZ)/a.tileSize/8}),Xi=(t,i,o,s)=>e.e(qi(i,t,o),{u_fill_translate:s}),Yi=(t,e)=>({u_world:t,u_fill_translate:e}),Ki=(t,i,o,s,r)=>e.e(Xi(t,i,o,r),{u_world:s}),Qi=(t,i,o,s,r)=>{const n=t.transform;let a,l,h=0;if("map"===o.paint.get("circle-pitch-alignment")){const t=e.aK(i,1,n.zoom);a=!0,l=[t,t],h=t/(e.a5*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*r;}else a=!1,l=n.pixelsToGLUnits;return {u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+("map"===o.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:h,u_translate:s}},Ji=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),to=t=>({u_viewport_size:[t.width,t.height]}),eo=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),io=(t,i,o,s)=>{const r=e.aK(t,1,i)/(e.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*s;return {u_extrude_scale:e.aK(t,1,i),u_intensity:o,u_globe_extrude_scale:r}},oo=(t,i,o,s)=>{const r=e.N();e.c5(r,0,t.width,t.height,0,0,1);const n=t.context.gl;return {u_matrix:r,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:o,u_color_ramp:s,u_opacity:i.paint.get("heatmap-opacity")}},so=(t,e,i)=>{const o=i.paint.get("hillshade-accent-color");let s;switch(i.paint.get("hillshade-method")){case "basic":s=4;break;case "combined":s=1;break;case "igor":s=2;break;case "multidirectional":s=3;break;default:s=0;}const r=i.getIlluminationProperties();for(let e=0;e<r.directionRadians.length;e++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(r.directionRadians[e]+=t.transform.bearingInRadians);return {u_image:0,u_latrange:no(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:r.altitudeRadians,u_azimuths:r.directionRadians,u_accent:o,u_method:s,u_highlights:r.highlightColor,u_shadows:r.shadowColor}},ro=(t,i)=>{const o=i.stride,s=e.N();return e.c5(s,0,e.a5,-e.a5,0,0,1),e.O(s,s,[0,-e.a5,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}};function no(t,i){const o=Math.pow(2,i.canonical.z),s=i.canonical.y;return [new e.a6(0,s/o).toLngLat().lat,new e.a6(0,(s+1)/o).toLngLat().lat]}const ao=(t,e,i=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),lo=(t,i,o,s)=>{const r=t.transform;return {u_translation:mo(t,i,o),u_ratio:s/e.aK(i,1,r.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/r.pixelsToGLUnits[0],1/r.pixelsToGLUnits[1]]}},ho=(t,i,o,s,r)=>e.e(lo(t,i,o,s),{u_image:0,u_image_height:r}),co=(t,i,o,s,r)=>{const n=t.transform,a=po(i,n);return {u_translation:mo(t,i,o),u_texsize:i.imageAtlasTexture.size,u_ratio:s/e.aK(i,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},uo=(t,i,o,s,r)=>{const n=po(i,t.transform);return e.e(lo(t,i,o,s),{u_tileratio:n,u_crossfade_from:r.fromScale,u_crossfade_to:r.toScale,u_image:0,u_mix:r.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},_o=(t,i,o,s,r,n)=>{const a=po(i,t.transform);return e.e(lo(t,i,o,s),{u_image:0,u_image_height:n,u_tileratio:a,u_crossfade_from:r.fromScale,u_crossfade_to:r.toScale,u_image_dash:1,u_mix:r.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function po(t,i){return 1/e.aK(t,1,i.tileZoom)}function mo(t,i,o){return e.aL(t.transform,i,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const fo=(t,e,i,o,s)=>{return {u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*o.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:o.paint.get("raster-brightness-min"),u_brightness_high:o.paint.get("raster-brightness-max"),u_saturation_factor:(n=o.paint.get("raster-saturation"),n>0?1-1/(1.001-n):-n),u_contrast_factor:(r=o.paint.get("raster-contrast"),r>0?1/(1-r):1+r),u_spin_weights:go(o.paint.get("raster-hue-rotate")),u_coords_top:[s[0].x,s[0].y,s[1].x,s[1].y],u_coords_bottom:[s[3].x,s[3].y,s[2].x,s[2].y]};var r,n;};function go(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 vo=(t,e,i,o,s,r,n,a,l,h,c,u,d)=>{const _=n.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:_.cameraToCenterDistance,u_pitch:_.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:_.width/_.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+o,u_is_along_line:s,u_is_variable_anchor:r,u_texsize:u,u_texture:0,u_translation:h,u_pitched_scale:d}},yo=(t,i,o,s,r,n,a,l,h,c,u,d,_,p)=>{const m=a.transform;return e.e(vo(t,i,o,s,r,n,a,l,h,c,u,d,p),{u_gamma_scale:s?Math.cos(m.pitch
vendor: 4,279 bytes, line 40
40*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:1})},bo=(t,i,o,s,r,n,a,l,h,c,u,d,_)=>e.e(yo(t,i,o,s,r,n,a,l,h,c,!0,u,0,_),{u_texsize_icon:d,u_texture_icon:1}),xo=(t,e)=>({u_opacity:t,u_color:e}),wo=(t,i,o,s,r)=>e.e(function(t,i,o,s){const r=o.imageManager.getPattern(t.from.toString()),n=o.imageManager.getPattern(t.to.toString()),{width:a,height:l}=o.imageManager.getPixelSize(),h=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,o.transform.tileZoom)/h,u=c*(s.tileID.canonical.x+s.tileID.wrap*h),d=c*s.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[a,l],u_mix:i.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/e.aK(s,1,o.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(o,r,i,s),{u_opacity:t}),To=(t,e)=>{},Po={fillExtrusion:(t,i)=>({u_lightpos:new e.c0(t,i.u_lightpos),u_lightpos_globe:new e.c0(t,i.u_lightpos_globe),u_lightintensity:new e.bo(t,i.u_lightintensity),u_lightcolor:new e.c0(t,i.u_lightcolor),u_vertical_gradient:new e.bo(t,i.u_vertical_gradient),u_opacity:new e.bo(t,i.u_opacity),u_fill_translate:new e.c1(t,i.u_fill_translate)}),fillExtrusionPattern:(t,i)=>({u_lightpos:new e.c0(t,i.u_lightpos),u_lightpos_globe:new e.c0(t,i.u_lightpos_globe),u_lightintensity:new e.bo(t,i.u_lightintensity),u_lightcolor:new e.c0(t,i.u_lightcolor),u_vertical_gradient:new e.bo(t,i.u_vertical_gradient),u_height_factor:new e.bo(t,i.u_height_factor),u_opacity:new e.bo(t,i.u_opacity),u_fill_translate:new e.c1(t,i.u_fill_translate),u_image:new e.bY(t,i.u_image),u_texsize:new e.c1(t,i.u_texsize),u_pixel_coord_upper:new e.c1(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.c1(t,i.u_pixel_coord_lower),u_scale:new e.c0(t,i.u_scale),u_fade:new e.bo(t,i.u_fade)}),fill:(t,i)=>({u_fill_translate:new e.c1(t,i.u_fill_translate)}),fillPattern:(t,i)=>({u_image:new e.bY(t,i.u_image),u_texsize:new e.c1(t,i.u_texsize),u_pixel_coord_upper:new e.c1(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.c1(t,i.u_pixel_coord_lower),u_scale:new e.c0(t,i.u_scale),u_fade:new e.bo(t,i.u_fade),u_fill_translate:new e.c1(t,i.u_fill_translate)}),fillOutline:(t,i)=>({u_world:new e.c1(t,i.u_world),u_fill_translate:new e.c1(t,i.u_fill_translate)}),fillOutlinePattern:(t,i)=>({u_world:new e.c1(t,i.u_world),u_image:new e.bY(t,i.u_image),u_texsize:new e.c1(t,i.u_texsize),u_pixel_coord_upper:new e.c1(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.c1(t,i.u_pixel_coord_lower),u_scale:new e.c0(t,i.u_scale),u_fade:new e.bo(t,i.u_fade),u_fill_translate:new e.c1(t,i.u_fill_translate)}),circle:(t,i)=>({u_camera_to_center_distance:new e.bo(t,i.u_camera_to_center_distance),u_scale_with_map:new e.bY(t,i.u_scale_with_map),u_pitch_with_map:new e.bY(t,i.u_pitch_with_map),u_extrude_scale:new e.c1(t,i.u_extrude_scale),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_globe_extrude_scale:new e.bo(t,i.u_globe_extrude_scale),u_translate:new e.c1(t,i.u_translate)}),collisionBox:(t,i)=>({u_pixel_extrude_scale:new e.c1(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_viewport_size:new e.c1(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new e.bZ(t,i.u_color),u_overlay:new e.bY(t,i.u_overlay),u_overlay_scale:new e.bo(t,i.u_overlay_scale)}),depth:To,clippingMask:To,heatmap:(t,i)=>({u_extrude_scale:new e.bo(t,i.u_extrude_scale),u_intensity:new e.bo(t,i.u_intensity),u_globe_extrude_scale:new e.bo(t,i.u_globe_extrude_scale)}),heatmapTexture:(t,i)=>({u_matrix:new e.b_(t,i.u_matrix),u_world:new e.c1(t,i.u_world),u_image:new e.bY(t,i.u_image),u_color_ramp:new e.bY(t,i.u_color_ramp),u_opacity:new e.bo(t,i.u_opacity)}),hillshade:(t,i)=>({u_image:new e.bY(t,i.u_image),u_latrange:new e.c1(t,i.u_latrange),u_exaggeration:new e.bo(t,i.u_exaggeration),u_altitudes:new e.c7(t,i.u_altitudes),u_azimuths:new e.c7(t,i.u_azimuths),u_accent:new e.bZ(t,i.u_accent),u_method:new e.bY(t,i.u_method),u_shadows:new e.c6(t,i.u_shadows),u_highlights:new e.c6(t,i.u_highlights)}),hillshadePrepare:(t,i)=>({u_matrix:new e.b_(t,i.u_matrix),u_image:new e.bY(t,i.u_image),u_dimension:new e.c1(t,i.u_dimension),u_zoom:new e.bo(t,i.u_zoom),u_unpack:new e.b$(t,
40i.u_unpack)}),colorRelief:(t,i)=>({u_image:new e.bY(t,i.u_image),u_unpack:new e.b$(t,i.u_unpack),u_dimension:new e.c1(t,i.u_dimension),u_elevation_stops:new e.bY(t,i.u_elevation_stops),u_color_stops:new e.bY(t,i.u_color_stops),u_color_ramp_size:new e.bY(t,i.u_color_ramp_size),u_opacity:new e.bo(t,i.u_opacity)}),line:(t,i)=>({u_translation:new e.c1(t,i.u_translation),u_ratio:new e.bo(t,i.u_ratio),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.c1(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_translation:new e.c1(t,i.u_translation),u_ratio:new e.bo(t,i.u_ratio),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.c1(t,i.u_units_to_pixels),u_image:new e.bY(t,i.u_image),u_image_height:new e.bo(t,i.u_image_height)}),linePattern:(t,i)=>({u_translation:new e.c1(t,i.u_translation),u_texsize:new e.c1(t,i.u_texsize),u_ratio:new e.bo(t,i.u_ratio),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_image:new e.bY(t,i.u_image),u_units_to_pixels:new e.c1(t,i.u_units_to_pixels),u_scale:new e.c0(t,i.u_scale),u_fade:new e.bo(t,i.u_fade)}),lineSDF:(t,i)=>({u_translation:new e.c1(t,i.u_translation),u_ratio:new e.bo(t,i.u_ratio),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.c1(t,i.u_units_to_pixels),u_image:new e.bY(t,i.u_image),u_mix:new e.bo(t,i.u_mix),u_tileratio:new e.bo(t,i.u_tileratio),u_crossfade_from:new e.bo(t,i.u_crossfade_from),u_crossfade_to:new e.bo(t,i.u_crossfade_to),u_lineatlas_width:new e.bo(t,i.u_lineatlas_width),u_lineatlas_height:new e.bo(t,i.u_lineatlas_height)}),lineGradientSDF:(t,i)=>({u_translation:new e.c1(t,i.u_translation),u_ratio:new e.bo(t,i.u_ratio),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.c1(t,i.u_units_to_pixels),u_image:new e.bY(t,i.u_image),u_image_height:new e.bo(t,i.u_image_height),u_tileratio:new e.bo(t,i.u_tileratio),u_crossfade_from:new e.bo(t,i.u_crossfade_from),u_crossfade_to:new e.bo(t,i.u_crossfade_to),u_image_dash:new e.bY(t,i.u_image_dash),u_mix:new e.bo(t,i.u_mix),u_lineatlas_width:new e.bo(t,i.u_lineatlas_width),u_lineatlas_height:new e.bo(t,i.u_lineatlas_height)}),raster:(t,i)=>({u_tl_parent:new e.c1(t,i.u_tl_parent),u_scale_parent:new e.bo(t,i.u_scale_parent),u_buffer_scale:new e.bo(t,i.u_buffer_scale),u_fade_t:new e.bo(t,i.u_fade_t),u_opacity:new e.bo(t,i.u_opacity),u_image0:new e.bY(t,i.u_image0),u_image1:new e.bY(t,i.u_image1),u_brightness_low:new e.bo(t,i.u_brightness_low),u_brightness_high:new e.bo(t,i.u_brightness_high),u_saturation_factor:new e.bo(t,i.u_saturation_factor),u_contrast_factor:new e.bo(t,i.u_contrast_factor),u_spin_weights:new e.c0(t,i.u_spin_weights),u_coords_top:new e.b$(t,i.u_coords_top),u_coords_bottom:new e.b$(t,
40i.u_coords_bottom)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.bY(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bY(t,i.u_is_size_feature_constant),u_size_t:new e.bo(t,i.u_size_t),u_size:new e.bo(t,i.u_size),u_camera_to_center_distance:new e.bo(t,i.u_camera_to_center_distance),u_pitch:new e.bo(t,i.u_pitch),u_rotate_symbol:new e.bY(t,i.u_rotate_symbol),u_aspect_ratio:new e.bo(t,i.u_aspect_ratio),u_fade_change:new e.bo(t,i.u_fade_change),u_label_plane_matrix:new e.b_(t,i.u_label_plane_matrix),u_coord_matrix:new e.b_(t,i.u_coord_matrix),u_is_text:new e.bY(t,i.u_is_text),u_pitch_with_map:new e.bY(t,i.u_pitch_with_map),u_is_along_line:new e.bY(t,i.u_is_along_line),u_is_variable_anchor:new e.bY(t,i.u_is_variable_anchor),u_texsize:new e.c1(t,i.u_texsize),u_texture:new e.bY(t,i.u_texture),u_translation:new e.c1(t,i.u_translation),u_pitched_scale:new e.bo(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.bY(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bY(t,i.u_is_size_feature_constant),u_size_t:new e.bo(t,i.u_size_t),u_size:new e.bo(t,i.u_size),u_camera_to_center_distance:new e.bo(t,i.u_camera_to_center_distance),u_pitch:new e.bo(t,i.u_pitch),u_rotate_symbol:new e.bY(t,i.u_rotate_symbol),u_aspect_ratio:new e.bo(t,i.u_aspect_ratio),u_fade_change:new e.bo(t,i.u_fade_change),u_label_plane_matrix:new e.b_(t,i.u_label_plane_matrix),u_coord_matrix:new e.b_(t,i.u_coord_matrix),u_is_text:new e.bY(t,i.u_is_text),u_pitch_with_map:new e.bY(t,i.u_pitch_with_map),u_is_along_line:new e.bY(t,i.u_is_along_line),u_is_variable_anchor:new e.bY(t,i.u_is_variable_anchor),u_texsize:new e.c1(t,i.u_texsize),u_texture:new e.bY(t,i.u_texture),u_gamma_scale:new e.bo(t,i.u_gamma_scale),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_is_halo:new e.bY(t,i.u_is_halo),u_translation:new e.c1(t,i.u_translation),u_pitched_scale:new e.bo(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.bY(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.bY(t,i.u_is_size_feature_constant),u_size_t:new e.bo(t,i.u_size_t),u_size:new e.bo(t,i.u_size),u_camera_to_center_distance:new e.bo(t,i.u_camera_to_center_distance),u_pitch:new e.bo(t,i.u_pitch),u_rotate_symbol:new e.bY(t,i.u_rotate_symbol),u_aspect_ratio:new e.bo(t,i.u_aspect_ratio),u_fade_change:new e.bo(t,i.u_fade_change),u_label_plane_matrix:new e.b_(t,i.u_label_plane_matrix),u_coord_matrix:new e.b_(t,i.u_coord_matrix),u_is_text:new e.bY(t,i.u_is_text),u_pitch_with_map:new e.bY(t,i.u_pitch_with_map),u_is_along_line:new e.bY(t,i.u_is_along_line),u_is_variable_anchor:new e.bY(t,i.u_is_variable_anchor),u_texsize:new e.c1(t,i.u_texsize),u_texsize_icon:new e.c1(t,i.u_texsize_icon),u_texture:new e.bY(t,i.u_texture),u_texture_icon:new e.bY(t,i.u_texture_icon),u_gamma_scale:new e.bo(t,i.u_gamma_scale),u_device_pixel_ratio:new e.bo(t,i.u_device_pixel_ratio),u_is_halo:new e.bY(t,i.u_is_halo),u_translation:new e.c1(t,i.u_translation),u_pitched_scale:new e.bo(t,i.u_pitched_scale)}),background:(t,i)=>({u_opacity:new e.bo(t,i.u_opacity),u_color:new e.bZ(t,i.u_color)}),backgroundPattern:(t,i)=>({u_opacity:new e.bo(t,i.u_opacity),u_image:new e.bY(t,i.u_image),u_pattern_tl_a:new e.c1(t,i.u_pattern_tl_a),u_pattern_br_a:new e.c1(t,i.u_pattern_br_a),u_pattern_tl_b:new e.c1(t,i.u_pattern_tl_b),u_pattern_br_b:new e.c1(t,i.u_pattern_br_b),u_texsize:new e.c1(t,i.u_texsize),u_mix:new e.bo(t,i.u_mix),u_pattern_size_a:new e.c1(t,i.u_pattern_size_a),u_pattern_size_b:new e.c1(t,i.u_pattern_size_b),u_scale_a:new e.bo(t,i.u_scale_a),u_scale_b:new e.bo(t,i.u_scale_b),u_pixel_coord_upper:new e.c1(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.c1(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.bo(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_texture:new e.bY(t,i.u_texture),u_ele_delta:new e.bo(t,i.u_ele_delta),u_fog_matrix:new e.b_(t,i.u_fog_matrix),u_fog_color:new e.bZ(t,i.u_fog_color),u_fog_ground_blend:new e.bo(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.bo(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.bZ(t,i.u_horizon_color),u_horizon_fog_blend:new e.bo(t,i.u_horizon_fog_blend),u_is_globe_mode:new e.bo(t,i.u_is_globe_mode)}),terrainDepth:(t,i)=>({u_ele_delta:new e.bo(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_texture:new e.bY(t,i.u_texture),u_terrain_coords_id:new e.bo(t,i.u_terrain_coords_id),u_ele_delta:new e.bo(t,i.u_ele_delta)}),projectionErrorMeasurement:(t,i)=>
40({u_input:new e.bo(t,i.u_input),u_output_expected:new e.bo(t,i.u_output_expected)}),atmosphere:(t,i)=>({u_sun_pos:new e.c0(t,i.u_sun_pos),u_atmosphere_blend:new e.bo(t,i.u_atmosphere_blend),u_globe_position:new e.c0(t,i.u_globe_position),u_globe_radius:new e.bo(t,i.u_globe_radius),u_inv_proj_matrix:new e.b_(t,i.u_inv_proj_matrix)}),sky:(t,i)=>({u_sky_color:new e.bZ(t,i.u_sky_color),u_horizon_color:new e.bZ(t,i.u_horizon_color),u_horizon:new e.c1(t,i.u_horizon),u_horizon_normal:new e.c1(t,i.u_horizon_normal),u_sky_horizon_blend:new e.bo(t,i.u_sky_horizon_blend),u_sky_blend:new e.bo(t,i.u_sky_blend)})};class Mo{constructor(t,e,i){this.context=t;const o=t.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload();}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 Co={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Io{constructor(t,e,i,o){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=o,this.context=t;const s=t.gl;this.buffer=s.createBuffer(),t.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload();}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 o=e.attributes[this.attributes[i].name];void 0!==o&&t.enableVertexAttribArray(o);}}setVertexAttribPointers(t,e,i){for(let o=0;o<this.attributes.length;o++){const s=this.attributes[o],r=e.attributes[s.name];void 0!==r&&t.vertexAttribPointer(r,s.components,t[Co[s.type]],!1,this.itemSize,s.offset+this.itemSize*(i||0));}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}class Eo{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 So extends Eo{getDefault(){return e.bn.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 Lo extends Eo{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1);}}class zo extends Eo{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1);}}class Ro extends Eo{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 Do extends Eo{getDefault(){return !0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1);}}
vendor: 3,437 bytes, line 40
40class Ao extends Eo{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1);}}class ko extends Eo{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 Oo extends Eo{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 Bo extends Eo{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 Fo extends Eo{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 jo extends Eo{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 No extends Eo{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1);}}class Zo extends Eo{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 Go extends Eo{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 Uo extends Eo{getDefault(){return e.bn.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 Vo extends Eo{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1);}}class Wo extends Eo{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 qo extends Eo{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1);}}class $o extends Eo{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1);}}class Ho extends Eo{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1);}}class Xo extends Eo{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1);}}class Yo extends Eo{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 Ko extends Eo{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 Qo extends Eo{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;}}
40class Jo extends Eo{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 ts extends Eo{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 es extends Eo{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1;}}class is extends Eo{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;hi(i)?i.bindVertexArray(t):null===(e=i.getExtension("OES_vertex_array_object"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1;}}class os extends Eo{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 ss extends Eo{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 rs extends Eo{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;}}
40class ns extends Eo{constructor(t,e){super(t),this.context=t,this.parent=e;}getDefault(){return null}}class as extends ns{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 ls extends ns{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 hs extends ns{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1;}}const cs="Framebuffer is not complete";class us{constructor(t,e,i,o,s){this.context=t,this.width=e,this.height=i;const r=t.gl,n=this.framebuffer=r.createFramebuffer();if(this.colorAttachment=new as(t,n),o)this.depthAttachment=s?new hs(t,n):new ls(t,n);else if(s)throw new Error("Stencil cannot be set without depth");if(r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE)throw new Error(cs)}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 ds{constructor(t){var e,i;if(this.gl=t,this.clearColor=new So(this),this.clearDepth=new Lo(this),this.clearStencil=new zo(this),this.colorMask=new Ro(this),this.depthMask=new Do(this),this.stencilMask=new Ao(this),this.stencilFunc=new ko(this),this.stencilOp=new Oo(this),this.stencilTest=new Bo(this),this.depthRange=new Fo(this),this.depthTest=new jo(this),this.depthFunc=new No(this),this.blend=new Zo(this),this.blendFunc=new Go(this),this.blendColor=new Uo(this),this.blendEquation=new Vo(this),this.cullFace=new Wo(this),this.cullFaceSide=new qo(this),this.frontFace=new $o(this),this.program=new Ho(this),this.activeTexture=new Xo(this),this.viewport=new Yo(this),this.bindFramebuffer=new Ko(this),this.bindRenderbuffer=new Qo(this),this.bindTexture=new Jo(this),this.bindVertexBuffer=new ts(this),this.bindElementBuffer=new es(this),this.bindVertexArray=new is(this),this.pixelStoreUnpack=new os(this),this.pixelStoreUnpackPremultiplyAlpha=new ss(this),this.pixelStoreUnpackFlipY=new rs(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),hi(t)){this.HALF_FLOAT=t.HALF_FLOAT;const o=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==o?void 0:o.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==o?void 0:o.RGB16F_EXT,t.getExtension("EXT_color_buffer_float");}else {t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const e=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES;}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault();}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0;}createIndexBuffer(t,e){return new Mo(this,t,e)}createVertexBuffer(t,e,i){return new Io(this,t,e,i)}createRenderbuffer(t,e,i){const o=this.gl,s=o.createRenderbuffer();return this.bindRenderbuffer.set(s),o.renderbufferStorage(o.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),s}createFramebuffer(t,e,i,o){return new us(this,t,e,i,o)}clear({color:t,depth:e,stencil:i}){const o=this.gl;let s=0;t&&(s|=o.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(s|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(s|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),o.clear(s);}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace));}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1);}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1);}setColorMode(t){e.bP(t.blendFunction,ii.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask);}createVertexArray(){var t;return hi(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return hi(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null);}}let _s;function ps(t,i,o,s,r){const n=t.context,a=t.transform,l=n.gl,h=t.useProgram("collisionBox"),c=[];let u=0,d=0;for(let e=0;e<s.length;e++){const _=s[e],p=i.getTile(_).getBucket(o);if(!p)continue;const m=r?p.textCollisionBox:p.iconCollisionBox,f=p.collisionCircleArray;f.length>0&&(c.push({circleArray:f,circleOffset:d,coord:_}),u+=f.length/4,d=u),m&&h.draw(n,l.LINES,ri.disabled,ai.disabled,t.colorModeForRenderPass(),si.disabled,Ji(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(_),a.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),o.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,t.transform.zoom,null,null,m.collisionVertexBuffer);}if(!r||!c.length)return;const _=t.useProgram("collisionCircle"),p=new e.c8;p.resize(4*u),p._trim();let m=0;for(const t of c)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,o=t.circleArray[i+0],s=t.circleArray[i+1],r=t.circleArray[i+2],n=t.circleArray[i+3];p.emplace(m++,o,s,r,n,0),p.emplace(m++,o,s,r,n,1),p.emplace(m++,o,s,r,n,2),p.emplace(m++,o,s,r,n,3);}(!_s||_s.length<2*u)&&(_s=function(t){const i=2*t,o=new e.ca;o.resize(i),o._trim();for(let t=0;t<i;t++){const e=6*t;o.uint16[e+0]=4*t+0,o.uint16[e+1]=4*t+1,o.uint16[e+2]=4*t+2,o.uint16[e+3]=4*t+2,o.uint16[e+4]=4*t
40+3,o.uint16[e+5]=4*t+0;}return o}(u));const f=n.createIndexBuffer(_s,!0),g=n.createVertexBuffer(p,e.c9.members,!0);for(const i of c){const s=to(t.transform);_.draw(n,l.TRIANGLES,ri.disabled,ai.disabled,t.colorModeForRenderPass(),si.disabled,s,t.style.map.terrain&&t.style.map.terrain.getTerrainData(i.coord),null,o.id,g,f,e.aV.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,t.transform.zoom,null,null,null);}g.destroy(),f.destroy();}const ms=e.ao(new Float32Array(16));function fs(t,i,o,s,r,n){const{horizontalAlign:a,verticalAlign:l}=e.aP(t);return new e.P((-(a-.5)*i/r+s[0])*n,(-(l-.5)*o/r+s[1])*n)}function gs(t,i,o,s,r,n){const a=i.tileAnchorPoint.add(new e.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let t=s.mult(n);o||(t=t.rotate(-r));const e=a.add(t);return qt(e.x,e.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(o){const e=ee(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(t),o=Math.atan(e.y/e.x)+(e.x<0?Math.PI:0);return t.add(s.rotate(o))}return t.add(s)}function vs(t,i,o,s,r,n,a,l,h,c,u,d){const _=t.text.placedSymbolArray,p=t.text.dynamicLayoutVertexArray,m=t.icon.dynamicLayoutVertexArray,f={};p.clear();for(let m=0;m<_.length;m++){const g=_.get(m),v=g.hidden||!g.crossTileID||t.allowVerticalPlacement&&!g.placedOrientation?null:s[g.crossTileID];if(v){const s=new e.P(g.anchorX,g.anchorY),_={getElevation:d,width:r.width,height:r.height,pitchedLabelPlaneMatrix:n,pitchWithMap:o,transform:r,tileAnchorPoint:s,translation:c,unwrappedTileID:u},m=o?oe(s.x,s.y,_):ee(s.x,s.y,_),y=$t(r.cameraToCenterDistance,m.signedDistanceFromCamera);let b=e.ax(t.textSizeData,l,g)*y/e.aJ;o&&(b*=t.tilePixelRatio/a);const{width:x,height:w,anchor:T,textOffset:P,textBoxScale:M}=v,C=fs(T,x,w,P,M,b),I=r.getPitchedTextCorrection(s.x+c[0],s.y+c[1],u),E=gs(m.point,_,i,C,-r.bearingInRadians,I),S=t.allowVerticalPlacement&&g.placedOrientation===e.aw.vertical?Math.PI/2:0;for(let t=0;t<g.numGlyphs;t++)e.aD(p,E,S);h&&g.associatedIconIndex>=0&&(f[g.associatedIconIndex]={shiftedAnchor:E,angle:S});}else le(g.numGlyphs,p);}if(h){m.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const o=i.get(t);if(o.hidden)le(o.numGlyphs,m);else {const i=f[t];if(i)for(let t=0;t<o.numGlyphs;t++)e.aD(m,i.shiftedAnchor,i.angle);else le(o.numGlyphs,m);}}t.icon.dynamicLayoutVertexBuffer.updateData(m);}t.text.dynamicLayoutVertexBuffer.updateData(p);}function ys(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function bs(t,i,o,s,r,n,a,l,h,c,u,d,_){const p=t.context,m=p.gl,f=t.transform,g="map"===l,v="map"===h,y="viewport"!==l&&"point"!==o.layout.get("symbol-placement"),b=g&&!v&&!y,x=!o.layout.get("symbol-sort-key").isConstant();let w=!1;const T=t.getDepthModeForSublayer(0,ri.ReadOnly),P=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[],C=f.getCircleRadiusCorrection();for(const l of s){const s=i.getTile(l),h=s.getBucket(o);if(!h)continue;const u=r?h.text:h.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const d=u.programConfigurations.get(o.id),p=r||h.sdfIcons,T=r?h.textSizeData:h.iconSizeData,I=v||0!==f.pitch,E=t.useProgram(ys(p,r,h),d),S=e.av(T,f.zoom),L=t.style.map.terrain&&t.style.map.terrain.getTerrainData(l);let z,R,D,A,k=[0,0],O=null;if(r)R=s.glyphAtlasTexture,D=m.LINEAR,z=s.glyphAtlasTexture.size,h.iconsInText&&(k=s.imageAtlasTexture.size,O=s.imageAtlasTexture,A=I||t.options.rotating||t.options.zooming||"composite"===T.kind||"camera"===T.kind?m.LINEAR:m.NEAREST);else {const e=1!==o.layout.get("icon-size").constantOr(0)||h.iconsNeedLinear;R=s.imageAtlasTexture,D=p||t.options.rotating||t.options.zooming||e||I?m.LINEAR:m.NEAREST,z=s.imageAtlasTexture.size;}const B=e.aK(s,1,t.transform.zoom),F=Ut(g,t.transform,B),j=e.N();e.ay(j,F);const N=Vt(v,g,t.transform,B),Z=e.aL(f,s,n,a),G=f.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),U=P&&h.hasTextData(),V="none"!==o.layout.get("icon-text-fit")&&U&&h.hasIconData();if(y){const e=t.style.map.terrain?(e,i)=>t.style.map.terrain.getElevation(l,e,i):null,i="map"===o.layout.get("text-rotation-alignment");Xt(h,t,r,F,j,v,c,i,l.toUnwrapped(),f.width,f.height,Z,e);}const W=r&&P||V,q=y||W?ms:v?F:t.transform.clipSpaceToPixelsMatrix,$=p&&0!==o.paint.get(r?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=p?h.iconsInText?bo(T.kind,S,b,v,y,W,t,q,N,Z,z,k,C):yo(T.kind,S,b,v,y,W,t,q,N,Z,r,z,0,C):vo(T.kind,S,b,v,y,W,t,q,N,Z,r,z,C);const X={program:E,buffers:u,uniformValues:H,projectionData:G,atlasTexture:R,atlasTextureIcon:O,atlasInterpolation:D,atlasInterpolationIcon:A,isSDF:p,hasHalo:$};if(x&&h.canOverlap){w=!0;const t=u.segments.get();for(const i of t)M.push({segments:new e.aV([i]),sortKey:i.sortKey,state:X,terrainData:L});}else M.push({segments:u.segments,sortKey:0,state:X,terrainData:L});}w&&M.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of M){const i=e.state;if(p.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const s=i.uniformValues;i.hasHalo&&(s.u_is_halo=1,xs(i.buffers,e.segments,o,t,i.program,T,u,d,s,i.projectionData,e.terrainData)),s.u_is_halo=0;}xs(i.buffers,e.segments,o,t,i.program,T,u,d,i.uniformValues,i.projectionData,e.terrainData);}}function xs(t,e,i,o,s,r,n,a,l,h,c){const u=o.context;s.draw(u,u.gl.TRIANGLES,r,n,a,si.backCCW,l,c,h,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,o.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer);}function ws(t,i,o,s,r){const n=t.context,a=n.gl,l=ai.disabled,h=new ii([a.ONE,a.ONE],e.bn.transparent,[!0,!0,!0,!0]),c=i.getBucket(o);if(!c)return;const u=s.key;let d=o.heatmapFbos.get(u);d||(d=Ps(n,i.tileSize,i.tileSize),o.heatmapFbos.set(u,d)),n.bindFramebuffer.set(d.framebuffer),n.viewport.set([0,0,i.tileSize,i.tileSize]),n.clear({color:e.bn.transparent});const _=c.programConfigurations.get(o.id),p=t.useProgram("heatmap",_,!r),m=t.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),f=t.style.map.terrain.getTerrainData(s);p.draw(n,a.TRIANGLES,ri.disabled,l,h,si.disabled,io(i,t.transform.zoom,o.paint.get("heatmap-intensity"),1),f,m,o.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,o.paint,t.transform.zoom,_);}function Ts(t,e,i,o,s){const r=t.context,n=r.gl,a=t.transform;r.setColorMode(t.colorModeForRenderPass());const l=Ms(r,e),h=i.key,c=e.heatmapFbos.get(h);if(!c)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,c.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),l.bind(n.LINEAR,n.CLAMP_TO_EDGE);const u=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:s,applyGlobeMatrix:!o});t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,ri.disabled,ai.disabled,t.colorModeForRenderPass(),si.disabled,oo(t,e,0,1),null,u,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,a.zoom),c.destroy(),e.heatmapFbos.delete(h);}function Ps(t,e,i){var o,s;const r=t.gl,n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);const a=null!==(o=t.HALF_FLOAT)&&void 0!==o?o:r.UNSIGNED_BYTE,l=null!==(s=t.RGBA16F)&&void 0!==s?s:r.RGBA;
40r.texImage2D(r.TEXTURE_2D,0,l,e,i,0,r.RGBA,a,null);const h=t.createFramebuffer(e,i,!1,!1);return h.colorAttachment.set(n),h}function Ms(t,i){return i.colorRampTexture||(i.colorRampTexture=new e.T(t,i.colorRamp,t.gl.RGBA)),i.colorRampTexture}function Cs(t,i,o,s,r,n,a,l){let h=256;if(r.stepInterpolant){const s=i.getSource().maxzoom,r=a.canonical.z===s?Math.ceil(1<<t.transform.maxZoom-a.canonical.z):1;h=e.ak(e.cc(n.maxLineLength/e.a5*1024*r),256,o.maxTextureSize);}return l.gradient=e.cd({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:h,image:l.gradient||void 0,clips:n.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new e.T(o,l.gradient,s.RGBA),l.version=r.gradientVersion,l.texture}function Is(t,e,i,o,s){t.activeTexture.set(e.TEXTURE0),i.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),o.updatePaintBuffers(s);}function Es(t,e,i,o,s,r){(s||t.lineAtlas.dirty)&&(e.activeTexture.set(i.TEXTURE0),t.lineAtlas.bind(e)),o.updatePaintBuffers(r);}function Ss(t,e,i,o,s,r,n){const a=r.gradients[s.id];let l=a.texture;s.gradientVersion!==a.version&&(l=Cs(t,e,i,o,s,r,n,a)),i.activeTexture.set(o.TEXTURE0),l.bind(s.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE);}
40function Ls(t,e,i,o,s,r,n,a,l){const h=r.gradients[s.id];let c=h.texture;s.gradientVersion!==h.version&&(c=Cs(t,e,i,o,s,r,n,h)),i.activeTexture.set(o.TEXTURE0),c.bind(s.stepInterpolant?o.NEAREST:o.LINEAR,o.CLAMP_TO_EDGE),i.activeTexture.set(o.TEXTURE1),t.lineAtlas.bind(i),a.updatePaintBuffers(l);}function zs(t,e,i,o,s){if(!i||!o||!o.imageAtlas)return;const r=o.imageAtlas.patternPositions;let n=r[i.to.toString()],a=r[i.from.toString()];if(!n&&a&&(n=a),!a&&n&&(a=n),!n||!a){const t=s.getPaintProperty(e);n=r[t],a=r[t];}n&&a&&t.setConstantPatternPositions(n,a);}function Rs(t,i,o,s,r,n,a,l){const h=t.context.gl,c="fill-pattern",u=o.paint.get(c),d=u&&u.constantOr(1),_=o.getCrossfadeParameters();let p,m,f,g,v;const y=t.transform,b=o.paint.get("fill-translate"),x=o.paint.get("fill-translate-anchor");a?(m=d&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=h.LINES):(m=d?"fillPattern":"fill",p=h.TRIANGLES);const w=u.constantOr(null);for(const u of s){const s=i.getTile(u);if(d&&!s.patternsLoaded())continue;const T=s.getBucket(o);if(!T)continue;const P=T.programConfigurations.get(o.id),M=t.useProgram(m,P),C=t.style.map.terrain&&t.style.map.terrain.getTerrainData(u);d&&(t.context.activeTexture.set(h.TEXTURE0),s.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),P.updatePaintBuffers(_)),zs(P,c,w,s,o);const I=y.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),E=e.aL(y,s,b,x);if(a){g=T.indexBuffer2,v=T.segments2;const e=[h.drawingBufferWidth,h.drawingBufferHeight];f="fillOutlinePattern"===m&&d?Ki(t,_,s,e,E):Yi(e,E);}else g=T.indexBuffer,v=T.segments,f=d?Xi(t,_,s,E):{u_fill_translate:E};const S=t.stencilModeForClipping(u);M.draw(t.context,p,r,S,n,si.backCCW,f,C,I,o.id,T.layoutVertexBuffer,g,v,o.paint,t.transform.zoom,P);}}function Ds(t,i,o,s,r,n,a,l){const h=t.context,c=h.gl,u="fill-extrusion-pattern",d=o.paint.get(u),_=d.constantOr(1),p=o.getCrossfadeParameters(),m=o.paint.get("fill-extrusion-opacity"),f=d.constantOr(null),g=t.transform;for(const d of s){const s=i.getTile(d),v=s.getBucket(o);if(!v)continue;const y=t.style.map.terrain&&t.style.map.terrain.getTerrainData(d),b=v.programConfigurations.get(o.id),x=t.useProgram(_?"fillExtrusionPattern":"fillExtrusion",b);_&&(t.context.activeTexture.set(c.TEXTURE0),s.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),b.updatePaintBuffers(p));const w=g.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});zs(b,u,f,s,o);const T=e.aL(g,s,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),P=o.paint.get("fill-extrusion-vertical-gradient"),M=_?Hi(t,P,m,T,d,p,s):$i(t,P,m,T);x.draw(h,h.gl.TRIANGLES,r,n,a,si.backCCW,M,y,w,o.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,o.paint,t.transform.zoom,b,t.style.map.terrain&&v.centroidVertexBuffer);}}function As(t,e,i,o,s,r,n,a,l){var h;const c=t.style.projection,u=t.context,d=t.transform,_=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,p),f=!t.options.moving;for(const p of o){const o=e.getTile(p),g=o.fbo;if(!g)continue;const v=c.getMeshFromTileID(u,p.canonical,a,!0,"raster"),y=null===(h=t.style.map.terrain)||void 0===h?void 0:h.getTerrainData(p);u.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,g.colorAttachment.get());const b=d.getProjectionData({overscaledTileID:p,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(u,_.TRIANGLES,r,s[p.overscaledZ],n,si.backCCW,so(t,o,i),y,b,i.id,v.vertexBuffer,v.indexBuffer,v.segments);}}function ks(t,i,o,s,r,n,a,l,h){var c;const u=t.style.projection,d=t.context,_=t.transform,p=d.gl,m=t.useProgram("colorRelief"),f=!t.options.moving,g="nearest"===o.paint.get("resampling")?p.NEAREST:p.LINEAR;let v=!0,y=0;for(const b of s){const s=i.getTile(b),x=s.dem;if(v){const t=p.getParameter(p.MAX_TEXTURE_SIZE),{elevationTexture:e,colorTexture:i}=o.getColorRampTextures(d,t,x.getUnpackVector());d.activeTexture.set(p.TEXTURE1),e.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE4),i.bind(p.LINEAR,p.CLAMP_TO_EDGE),v=!1,y=e.size[0];}if(!x||!x.data)continue;const w=x.stride,T=x.getPixels();if(d.activeTexture.set(p.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||t.getTileTexture(w),s.demTexture){const t=s.demTexture;t.update(T,{premultiply:!1}),t.bind(g,p.CLAMP_TO_EDGE);}else s.demTexture=new e.T(d,T,p.RGBA,{premultiply:!1}),s.demTexture.bind(g,p.CLAMP_TO_EDGE);const P=u.getMeshFromTileID(d,b.canonical,l,!0,"raster"),M=null===(c=t.style.map.terrain)||void 0===c?void 0:c.getTerrainData(b),C=_.getProjectionData({overscaledTileID:b,aligned:f,applyGlobeMatrix:!h,applyTerrainMatrix:!0});m.draw(d,p.TRIANGLES,n,r[b.overscaledZ],a,si.backCCW,ao(o,s.dem,y),M,C,o.id,P.vertexBuffer,P.indexBuffer,P.segments);}}const Os=[new e.P(0,0),new e.P(e.a5,0),new e.P(e.a5,e.a5),new e.P(0,e.a5)];function Bs(t,e,i,o,s,r,n,a,l=!1,h=!1){const c=o[o.length-1].overscaledZ,u=t.context,d=u.gl,_=t.useProgram("raster"),p=t.transform,m=t.style.projection,f=t.colorModeForRenderPass(),g=!t.options.moving,v=i.paint.get("raster-opacity"),y="nearest"===i.paint.get("resampling")||"nearest"===i.paint.get("raster-resampling")?d.NEAREST:d.LINEAR,b=i.paint.get("raster-fade-duration"),x=!!t.style.map.terrain;for(const w of o){const o=t.getDepthModeForSublayer(w.overscaledZ-c,1===v?ri.ReadWrite:ri.ReadOnly,d.LESS),T=e.getTile(w);u.activeTexture.set(d.TEXTURE0),T.texture.bind(y,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1);const{parentTile:P,parentScaleBy:M,parentTopLeft:C,fadeValues:I}=Fs(T,e,b,x);T.fadeOpacity=I.tileOpacity,P?(P.fadeOpacity=I.parentTileOpacity,P.texture.bind(y,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):T.texture.bind(y,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&d.texParameterf(d.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const E=t.style.map.terrain&&t.style.map.terrain.getTerrainData(w),S=p.getProjectionData({overscaledTileID:w,aligned:g,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),L=fo(C,M,I.fadeMix,i,a),z=m.getMeshFromTileID(u,w.canonical,r,n,"raster");_.draw(u,d.TRIANGLES,o,s?s[w.overscaledZ]:ai.disabled,f,l?si.frontCCW:si.backCCW,L,E,S,i.id,z.vertexBuffer,z.indexBuffer,z.segments);}}function Fs(t,i,o,s){const r={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===o||s)return r;if(t.fadingParentID){const s=i.getLoadedTile(t.fadingParentID);if(!s)return r;
40const n=Math.pow(2,s.tileID.overscaledZ-t.tileID.overscaledZ),a=[t.tileID.canonical.x*n%1,t.tileID.canonical.y*n%1],h=function(t,i,o){const s=l(),r=(s-i.timeAdded)/o,n=t.fadingDirection===mt.Incoming,a=e.ak((s-t.timeAdded)/o,0,1),h=e.ak(1-r,0,1),c=n?a:h;return {tileOpacity:c,parentTileOpacity:n?h:a,fadeMix:{opacity:1,mix:1-c}}}(t,s,o);return {parentTile:s,parentScaleBy:n,parentTopLeft:a,fadeValues:h}}if(t.selfFading){const i=function(t,i){const o=(l()-t.timeAdded)/i,s=e.ak(o,0,1);return {tileOpacity:s,fadeMix:{opacity:s,mix:0}}}(t,o);return {parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:i}}return r}const js=new e.bn(1,0,0,1),Ns=new e.bn(0,1,0,1),Zs=new e.bn(0,0,1,1),Gs=new e.bn(1,0,1,1),Us=new e.bn(0,1,1,1);function Vs(t,e,i,o){qs(t,0,e+i/2,t.transform.width,i,o);}function Ws(t,e,i,o){qs(t,e-i/2,0,i,t.transform.height,o);}function qs(t,e,i,o,s,r){const n=t.context,a=n.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,o*t.pixelRatio,s*t.pixelRatio),n.clear({color:r}),a.disable(a.SCISSOR_TEST);}function $s(t,i,o){const s=t.context,r=s.gl,n=t.useProgram("debug"),a=ri.disabled,l=ai.disabled,h=t.colorModeForRenderPass(),c="$debug",u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(o);s.activeTexture.set(r.TEXTURE0);const d=i.getTileByID(o.key).latestRawTileData,_=Math.floor((d&&d.byteLength||0)/1024),p=i.getTile(o).tileSize,m=512/Math.min(p,512)*(o.overscaledZ/t.transform.zoom)*.5;let f=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(f+=` => ${o.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,o=t.context.gl,s=t.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,i.width,i.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(e,5,5),s.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);}(t,`${f} ${_}kB`);const g=t.transform.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(s,r.TRIANGLES,a,l,ii.alphaBlended,si.disabled,eo(e.bn.transparent,m),null,g,c,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),n.draw(s,r.LINE_STRIP,a,l,h,si.disabled,eo(e.bn.red),u,g,c,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments);}function Hs(t,e,i,o){const{isRenderingGlobe:s}=o,r=t.context,n=r.gl,a=t.transform,l=t.colorModeForRenderPass(),h=t.getDepthModeFor3D(),c=t.useProgram("terrain");r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]);for(const o of i){const i=e.getTerrainMesh(o.tileID),u=t.renderToTexture.getTexture(o),d=e.getTerrainData(o.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,u.texture);const _=e.getMeshFrameDelta(a.zoom),p=a.calculateFogMatrix(o.tileID.toUnwrapped()),m=Gi(_,p,t.style.sky,a.pitch,s),f=a.getProjectionData({overscaledTileID:o.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(r,n.TRIANGLES,h,ai.disabled,l,si.backCCW,m,d,f,"terrain",i.vertexBuffer,i.indexBuffer,i.segments);}}function Xs(t,i){if(!i.mesh){const o=new e.aU;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(1,1),o.emplaceBack(-1,1);const s=new e.aW;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),i.mesh=new je(t.createVertexBuffer(o,Ne.members),t.createIndexBuffer(s),e.aV.simpleSegment(0,0,o.length,s.length));}return i.mesh}class Ys{constructor(t,i){this.context=new ds(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=jt.maxOverzooming+jt.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ke;}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize();}setup(){const t=this.context,i=new e.aU;i.emplaceBack(0,0),i.emplaceBack(e.a5,0),i.emplaceBack(0,e.a5),i.emplaceBack(e.a5,e.a5),this.tileExtentBuffer=t.createVertexBuffer(i,Ne.members),this.tileExtentSegments=e.aV.simpleSegment(0,0,4,2);const o=new e.aU;o.emplaceBack(0,0),o.emplaceBack(e.a5,0),o.emplaceBack(0,e.a5),o.emplaceBack(e.a5,e.a5),this.debugBuffer=t.createVertexBuffer(o,Ne.members),this.debugSegments=e.aV.simpleSegment(0,0,4,5);const s=new e.cf;s.emplaceBack(0,0,0,0),s.emplaceBack(e.a5,0,e.a5,0),s.emplaceBack(0,e.a5,0,e.a5),s.emplaceBack(e.a5,e.a5,e.a5,e.a5),this.rasterBoundsBuffer=t.createVertexBuffer(s,Ni.members),this.rasterBoundsSegments=e.aV.simpleSegment(0,0,4,2);const r=new e.aU;r.emplaceBack(0,0),r.emplaceBack(e.a5,0),r.emplaceBack(0,e.a5),r.emplaceBack(e.a5,e.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(r,Ne.members),this.rasterBoundsSegmentsPosOnly=e.aV.simpleSegment(0,0,4,5);const n=new e.aU;
40n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,Ne.members),this.viewportSegments=e.aV.simpleSegment(0,0,4,2);const a=new e.cg;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(a);const l=new e.aW;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);const h=this.context.gl;this.stencilClearMode=new ai({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.tileExtentMesh=new je(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const o=e.N();e.c5(o,0,this.width,this.height,0,0,1),e.Q(o,o,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const s={mainMatrix:o,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o};this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,ri.disabled,this.stencilClearMode,ii.disabled,si.disabled,null,null,s,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments);}_renderTileClippingMasks(t,e,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();const o=this.context;o.setColorMode(ii.disabled),o.setDepthMode(ri.disabled);const s={};for(const t of e)s[t.key]=this.nextStencilID++;this._renderTileMasks(s,e,i,!0),this._renderTileMasks(s,e,i,!1),this._tileClippingMaskIDs=s;}_renderTileMasks(t,e,i,o){const s=this.context,r=s.gl,n=this.style.projection,a=this.transform,l=this.useProgram("clippingMask");for(const h of e){const e=t[h.key],c=this.style.map.terrain&&this.style.map.terrain.getTerrainData(h),u=n.getMeshFromTileID(this.context,h.canonical,o,!0,"stencil"),d=a.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(s,r.TRIANGLES,ri.disabled,new ai({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),ii.disabled,i?si.disabled:si.backCCW,null,c,d,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments);}}_renderTilesDepthBuffer(){const t=this.context,e=t.gl,i=this.style.projection,o=this.transform,s=this.useProgram("depth"),r=this.getDepthModeFor3D(),n=Lt(o,{tileSize:o.tileSize});for(const a of n){const n=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a),l=i.getMeshFromTileID(this.context,a.canonical,!0,!0,"raster"),h=o.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(t,e.TRIANGLES,r,ai.disabled,ii.disabled,si.backCCW,null,n,h,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new ai({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new ai({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),o=i[i.length-1].overscaledZ,s=i[0].overscaledZ-o+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();const t={};for(let i=0;i<s;i++)t[i+o]=new ai({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=s,[t,i]}return [{[o]:ai.disabled},i]}stencilConfigForOverlapTwoPass(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),o=i[i.length-1].overscaledZ,s=i[0].overscaledZ-o+1;if(this.clearStencil(),s>1){const t={},r={};for(let i=0;i<s;i++)t[i+o]=new ai({func:e.GREATER,mask:255},s+1+i,255,e.KEEP,e.KEEP,e.REPLACE),r[i+o]=new ai({func:e.GREATER,mask:255},1+i,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*s+1,[t,r,i]}return this.nextStencilID=3,[{[o]:new ai({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[o]:new ai({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new ii([t.CONSTANT_COLOR,t.ONE],new e.bn(i,i,i,0),[!0,!0,!0,!0])}return "opaque"===this.renderPass?ii.unblended:ii.alphaBlended}getDepthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return ri.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ri(i||this.context.gl.LEQUAL,e,[o,o])}getDepthModeFor3D(){return new ri(this.context.gl.LEQUAL,ri.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){var o,s;this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l()),this.imageManager.beginFrame();const r=this.style._order,n=this.style.tileManagers,a={},h={},c={},u={isRenderingToTexture:!1,isRenderingGlobe:(null===(o=t.projection)||void 0===o?void 0:o.transitionState)>0};for(const t in n){const e=n[t];e.used&&e.prepare(this.context),a[t]=e.getVisibleCoordinates(!1),h[t]=a[t].slice().reverse(),c[t]=e.getVisibleCoordinates(!0).reverse();}this.opaquePassCutoff=1/0;for(let t=0;t<r.length;t++)if(this.style._layers[r[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of r){const e=this.style._layers[t];
40if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=h[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,n[e.source],e,i,u);}if(null===(s=this.style.projection)||void 0===s||s.updateGPUdependent({context:this.context,useProgram:t=>this.useProgram(t)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?e.bn.black:e.bn.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(t,e){const i=t.context,o=i.gl,s=((t,e,i)=>{const o=Math.cos(e.rollInRadians),s=Math.sin(e.rollInRadians),r=xt(e),n=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return {u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-r*s)*i,(e.height/2+r*o)*i],u_horizon_normal:[-s,o],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*i,u_sky_blend:n}})(e,t.style.map.transform,t.pixelRatio),r=new ri(o.LEQUAL,ri.ReadWrite,[0,1]),n=ai.disabled,a=t.colorModeForRenderPass(),l=t.useProgram("sky"),h=Xs(i,e);l.draw(i,o.TRIANGLES,r,n,a,si.disabled,s,null,void 0,"sky",h.vertexBuffer,h.indexBuffer,h.segments);}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[r[this.currentLayer]],e=n[t.source],i=a[t.source];this._renderTileClippingMasks(t,i,!1),this.renderLayer(this,e,t,i,u);}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const t=this.style._layers[r[this.currentLayer]],e=n[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t,u))continue;this.opaquePassEnabledForLayer()||d||(d=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===t.type?c:h)[t.source];this._renderTileClippingMasks(t,a[t.source],!!this.renderToTexture),this.renderLayer(this,e,t,i,u);}if(u.isRenderingGlobe&&function(t,i,o){const s=t.context,r=s.gl,n=t.useProgram("atmosphere"),a=new ri(r.LEQUAL,ri.ReadOnly,[0,1]),l=t.transform,h=function(t,i){const o=t.properties.get("position"),s=[-o.x,-o.y,-o.z],r=e.ao(new Float64Array(16));return "map"===t.properties.get("anchor")&&(e.be(r,r,i.rollInRadians),e.bf(r,r,-i.pitchInRadians),e.be(r,r,i.bearingInRadians),e.bf(r,r,i.center.lat*Math.PI/180),e.bH(r,r,-i.center.lng*Math.PI/180)),e.ce(s,s,r),s}(o,t.transform),c=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=i.properties.get("atmosphere-blend")*c.projectionTransition;if(0===u)return;const d=bi(l.worldSize,l.center.lat),_=l.inverseProjectionMatrix,p=new Float64Array(4);p[3]=1,e.aE(p,p,l.modelViewProjectionMatrix),p[0]/=p[3],p[1]/=p[3],p[2]/=p[3],p[3]=1,e.aE(p,p,_),p[0]/=p[3],p[1]/=p[3],p[2]/=p[3],p[3]=1;const m=((t,e,i,o,s)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:i,u_globe_radius:o,u_inv_proj_matrix:s}))(h,u,[p[0],p[1],p[2]],d,_),f=Xs(s,i);n.draw(s,r.TRIANGLES,a,ai.disabled,ii.alphaBlended,si.disabled,m,null,null,"atmosphere",f.vertexBuffer,f.indexBuffer,f.segments);}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const t=function(t,e){let i=null;const o=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.tileManagers[i.source]]:[])),s=o.filter((t=>"vector"===t.getSource().type)),r=o.filter((t=>"vector"!==t.getSource().type)),n=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t);};return s.forEach((t=>n(t))),i||r.forEach((t=>n(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let o=0;o<i.length;o++)$s(t,e,i[o]);}(this,t,t.getVisibleCoordinates());}this.options.showPadding&&function(t){const e=t.transform.padding;Vs(t,t.transform.height-(e.top||0),3,js),Vs(t,e.bottom||0,3,Ns),Ws(t,e.left||0,3,Zs),Ws(t,t.transform.width-(e.right||0),3,Gs);const i=t.transform.centerPoint;
40!function(t,e,i,o){qs(t,e-1,i-10,2,20,o),qs(t,e-10,i-1,20,2,o);}(t,i.x,t.transform.height-i.y,Us);}(this),this.context.setDefault();}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,o=this.transform.modelViewProjectionMatrix;let s=this.terrainFacilitator.dirty;s||(s=t?!e.ch(i,o):!e.ci(i,o)),s||(s=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),s&&(e.cj(i,o),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const o=t.context,s=o.gl,r=t.transform,n=ii.unblended,a=new ri(s.LEQUAL,ri.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),h=t.useProgram("terrainDepth");o.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),o.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),o.clear({color:e.bn.transparent,depth:1});for(const t of l){const e=i.getTerrainMesh(t.tileID),l=i.getTerrainData(t.tileID),c=r.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),u={u_ele_delta:i.getMeshFrameDelta(r.zoom)};h.draw(o,s.TRIANGLES,a,ai.disabled,n,si.backCCW,u,l,c,"terrain",e.vertexBuffer,e.indexBuffer,e.segments);}o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);}(this,this.style.map.terrain),function(t,i){const o=t.context,s=o.gl,r=t.transform,n=ii.unblended,a=new ri(s.LEQUAL,ri.ReadWrite,[0,1]),l=i.getCoordsTexture(),h=i.tileManager.getRenderableTiles(),c=t.useProgram("terrainCoords");o.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),o.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),o.clear({color:e.bn.transparent,depth:1}),i.coordsIndex=[];for(const t of h){const e=i.getTerrainMesh(t.tileID),h=i.getTerrainData(t.tileID);o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.texture);const u={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(r.zoom)},d=r.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(o,s.TRIANGLES,a,ai.disabled,n,si.backCCW,u,h,d,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),i.coordsIndex.push(t.tileID.key);}o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);}(this,this.style.map.terrain));}renderLayer(t,i,o,s,r){o.isHidden(this.transform.zoom)||("background"===o.type||"custom"===o.type||(s||[]).length)&&(this.id=o.id,e.aQ(o)?function(t,i,o,s,r,n){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:a}=n,l=ai.disabled,h=t.colorModeForRenderPass();(o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(t,i,o,s,r,n,a,l,h){const c=i.transform,u=i.style.map.terrain,d="map"===r,_="map"===n;for(const r of t){const t=s.getTile(r),n=t.getBucket(o);if(!n||!n.text||!n.text.segments.get().length)continue;const p=e.av(n.textSizeData,c.zoom),m=e.aK(t,1,i.transform.zoom),f=Ut(d,i.transform,m),g="none"!==o.layout.get("icon-text-fit")&&n.hasIconData();if(p){const i=Math.pow(2,c.zoom-t.tileID.overscaledZ),o=u?(t,e)=>u.getElevation(r,t,e):null;vs(n,d,_,h,c,f,i,p,g,e.aL(c,t,a,l),r.toUnwrapped(),o);}}}(s,t,o,i,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),r),0!==o.paint.get("icon-opacity").constantOr(1)&&bs(t,i,o,s,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),l,h,a),0!==o.paint.get("text-opacity").constantOr(1)&&bs(t,i,o,s,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),l,h,a),i.map.showCollisionBoxes&&(ps(t,i,o,s,!0),ps(t,i,o,s,!1));}(t,i,o,s,this.style.placement.variableOffsets,r):e.ck(o)?function(t,i,o,s,r){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:n}=r,a=o.paint.get("circle-opacity"),l=o.paint.get("circle-stroke-width"),h=o.paint.get("circle-stroke-opacity"),c=!o.layout.get("
40circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;const u=t.context,d=u.gl,_=t.transform,p=t.getDepthModeForSublayer(0,ri.ReadOnly),m=ai.disabled,f=t.colorModeForRenderPass(),g=[],v=_.getCircleRadiusCorrection();for(let r=0;r<s.length;r++){const a=s[r],l=i.getTile(a),h=l.getBucket(o);if(!h)continue;const u=o.paint.get("circle-translate"),d=o.paint.get("circle-translate-anchor"),p=e.aL(_,l,u,d),m=h.programConfigurations.get(o.id),f=t.useProgram("circle",m),y=h.layoutVertexBuffer,b=h.indexBuffer,x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(a),w={programConfiguration:m,program:f,layoutVertexBuffer:y,indexBuffer:b,uniformValues:Qi(t,l,o,p,v),terrainData:x,projectionData:_.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!n,applyTerrainMatrix:!0})};if(c){const t=h.segments.get();for(const i of t)g.push({segments:new e.aV([i]),sortKey:i.sortKey,state:w});}else g.push({segments:h.segments,sortKey:0,state:w});}c&&g.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of g){const{programConfiguration:i,program:s,layoutVertexBuffer:r,indexBuffer:n,uniformValues:a,terrainData:l,projectionData:h}=e.state;s.draw(u,d.TRIANGLES,p,m,f,si.backCCW,a,l,h,o.id,r,n,e.segments,o.paint,t.transform.zoom,i);}}(t,i,o,s,r):e.cl(o)?function(t,i,o,s,r){if(0===o.paint.get("heatmap-opacity"))return;const n=t.context,{isRenderingToTexture:a,isRenderingGlobe:l}=r;if(t.style.map.terrain){for(const e of s){const s=i.getTile(e);i.hasRenderableParent(e)||("offscreen"===t.renderPass?ws(t,s,o,e,l):"translucent"===t.renderPass&&Ts(t,o,e,a,l));}n.viewport.set([0,0,t.width,t.height]);}else "offscreen"===t.renderPass?function(t,i,o,s){const r=t.context,n=r.gl,a=t.transform,l=ai.disabled,h=new ii([n.ONE,n.ONE],e.bn.transparent,[!0,!0,!0,!0]);((function(t,i,o){const s=t.gl;t.activeTexture.set(s.TEXTURE1),t.viewport.set([0,0,i.width/4,i.height/4]);let r=o.heatmapFbos.get(e.cb);r?(s.bindTexture(s.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer)):(r=Ps(t,i.width/4,i.height/4),o.heatmapFbos.set(e.cb,r));}))(r,t,o),r.clear({color:e.bn.transparent});for(let e=0;e<s.length;e++){const c=s[e];if(i.hasRenderableParent(c))continue;const u=i.getTile(c),d=u.getBucket(o);if(!d)continue;const _=d.programConfigurations.get(o.id),p=t.useProgram("heatmap",_),m=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),f=a.getCircleRadiusCorrection();p.draw(r,n.TRIANGLES,ri.disabled,l,h,si.backCCW,io(u,a.zoom,o.paint.get("heatmap-intensity"),f),null,m,o.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,o.paint,a.zoom,_);}r.viewport.set([0,0,t.width,t.height]);}(t,i,o,s):"translucent"===t.renderPass&&function(t,i){const o=t.context,s=o.gl;o.setColorMode(t.colorModeForRenderPass());const r=i.heatmapFbos.get(e.cb);r&&(o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,r.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),Ms(o,i).bind(s.LINEAR,s.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(o,s.TRIANGLES,ri.disabled,ai.disabled,t.colorModeForRenderPass(),si.disabled,oo(t,i,0,1),null,null,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom));}(t,o);}(t,i,o,s,r):e.cm(o)?function(t,e,i,o,s){if("translucent"!==t.renderPass)return;const{isRenderingToTexture:r}=s,n=i.paint.get("line-opacity"),a=i.paint.get("line-width");if(0===n.constantOr(1)||0===a.constantOr(1))return;const l=t.getDepthModeForSublayer(0,ri.ReadOnly),h=t.colorModeForRenderPass(),c=i.paint.get("line-dasharray"),u=c.constantOr(1),d=i.paint.get("line-pattern"),_=d.constantOr(1),p=i.paint.get("line-gradient"),m=i.getCrossfadeParameters();let f;f=_?"linePattern":u&&p?"lineGradientSDF":u?"lineSDF":p?"lineGradient":"line";const g=t.context,v=g.gl,y=t.transform;let b=!0;for(const s of o){const o=e.getTile(s);if(_&&!o.patternsLoaded())continue;const n=o.getBucket(i);if(!n)continue;const a=n.programConfigurations.get(i.id),x=t.context.program.get(),w=t.useProgram(f,a),T=b||w.program!==x,P=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),M=d.constantOr(null),C=c&&c.constantOr(null);if(M&&o.imageAtlas){const t=o.imageAtlas,e=t.patternPositions[M.to.toString()],i=t.patternPositions[M.from.toString()];e&&i&&a.setConstantPatternPositions(e,i);}else if(C){const e="round"===i.layout.get("line-cap"),o=t.lineAtlas.getDash(C.to,e),s=t.lineAtlas.getDash(C.from,e);a.setConstantDashPositions(o,s);}const I=y.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!r,applyTerrainMatrix:!0}),E=y.getPixelScale();let S;_?(S=co(t,o,i,E,m),Is(g,v,o,a,m)):u&&p?(S=_o(t,o,i,E,m,n.lineClipsArray.length),Ls(t,e,g,v,i,n,s,a,m)):u?(S=uo(t,o,i,E,m),Es(t,g,v,a,T,m)):p?(S=ho(t,o,i,E,n.lineClipsArray.length),Ss(t,e,g,v,i,n,s)):S=lo(t,o,i,E);const L=t.stencilModeForClipping(s);w.draw(g,v.TRIANGLES,l,L,h,si.disabled,S,P,I,i.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,i.paint,t.transform.zoom,a,n.layoutVertexBuffer2),b=!1;}}(t,i,o,s,r):e.cn(o)?function(t,i,o,s,r){const n=o.paint.get("fill-color"),a=o.paint.get("fill-opacity");if(0===a.constantOr(1))return;const{isRenderingToTexture:l}=r,h=t.colorModeForRenderPass(),c=o.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===n.constantOr(e.bn.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){const e=t.getDepthModeForSublayer(1,"opaque"===t.renderPass?ri.ReadWrite:ri.ReadOnly);Rs(t,i,o,s,e,h,!1,l);}if("translucent"===t.renderPass&&o.paint.get("fill-antialias")){const e=t.getDepthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,ri.ReadOnly);Rs(t,i,o,s,e,h,!0,l);}}
40(t,i,o,s,r):e.co(o)?function(t,e,i,o,s){const r=i.paint.get("fill-extrusion-opacity");if(0===r)return;const{isRenderingToTexture:n}=s;if("translucent"===t.renderPass){const s=new ri(t.context.gl.LEQUAL,ri.ReadWrite,t.depthRangeFor3D);if(1!==r||i.paint.get("fill-extrusion-pattern").constantOr(1))Ds(t,e,i,o,s,ai.disabled,ii.disabled,n),Ds(t,e,i,o,s,t.stencilModeFor3D(),t.colorModeForRenderPass(),n);else {const r=t.colorModeForRenderPass();Ds(t,e,i,o,s,ai.disabled,r,n);}}}(t,i,o,s,r):e.cp(o)?function(t,i,o,s,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const{isRenderingToTexture:n}=r,a=t.context,l=t.style.projection.useSubdivision,h=t.getDepthModeForSublayer(0,ri.ReadOnly),c=t.colorModeForRenderPass();if("offscreen"===t.renderPass)!function(t,i,o,s,r,n,a){const l=t.context,h=l.gl,c="nearest"===s.paint.get("resampling")?h.NEAREST:h.LINEAR;for(const u of o){const o=i.getTile(u),d=o.dem;if(!d||!d.data)continue;if(!o.needsHillshadePrepare)continue;const _=d.dim,p=d.stride,m=d.getPixels();if(l.activeTexture.set(h.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),o.demTexture=o.demTexture||t.getTileTexture(p),o.demTexture){const t=o.demTexture;t.update(m,{premultiply:!1}),t.bind(h.NEAREST,h.CLAMP_TO_EDGE);}else o.demTexture=new e.T(l,m,h.RGBA,{premultiply:!1}),o.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);l.activeTexture.set(h.TEXTURE0);let f=o.fbo;if(!f){const t=new e.T(l,{width:_,height:_,data:null},h.RGBA);t.bind(c,h.CLAMP_TO_EDGE),f=o.fbo=l.createFramebuffer(_,_,!0,!1),f.colorAttachment.set(t.texture);}l.bindFramebuffer.set(f.framebuffer),l.viewport.set([0,0,_,_]),t.useProgram("hillshadePrepare").draw(l,h.TRIANGLES,r,n,a,si.disabled,ro(o.tileID,d),null,null,s.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),o.needsHillshadePrepare=!1;}}(t,i,s,o,h,ai.disabled,c),a.viewport.set([0,0,t.width,t.height]);else if("translucent"===t.renderPass)if(l){const[e,r,a]=t.stencilConfigForOverlapTwoPass(s);As(t,i,o,a,e,h,c,!1,n),As(t,i,o,a,r,h,c,!0,n);}else {const[e,r]=t.getStencilConfigForOverlapAndUpdateStencilID(s);As(t,i,o,r,e,h,c,!1,n);}}(t,i,o,s,r):e.cq(o)?function(t,e,i,o,s){if("translucent"!==t.renderPass)return;if(!o.length)return;const{isRenderingToTexture:r}=s,n=t.style.projection.useSubdivision,a=t.getDepthModeForSublayer(0,ri.ReadOnly),l=t.colorModeForRenderPass();if(n){const[s,n,h]=t.stencilConfigForOverlapTwoPass(o);ks(t,e,i,h,s,a,l,!1,r),ks(t,e,i,h,n,a,l,!0,r);}else {const[s,n]=t.getStencilConfigForOverlapAndUpdateStencilID(o);ks(t,e,i,n,s,a,l,!1,r);}}(t,i,o,s,r):e.bS(o)?function(t,e,i,o,s){if("translucent"!==t.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!o.length)return;const{isRenderingToTexture:r}=s,n=e.getSource(),a=t.style.projection.useSubdivision;if(n instanceof st)Bs(t,e,i,o,null,!1,!1,n.tileCoords,n.flippedWindingOrder,r);else if(a){const[s,n,a]=t.stencilConfigForOverlapTwoPass(o);Bs(t,e,i,a,s,!1,!0,Os,!1,r),Bs(t,e,i,a,n,!0,!0,Os,!1,r);}else {const[s,n]=t.getStencilConfigForOverlapAndUpdateStencilID(o);Bs(t,e,i,n,s,!1,!0,Os,!1,r);}}(t,i,o,s,r):e.cr(o)?function(t,e,i,o,s){const r=i.paint.get("background-color"),n=i.paint.get("background-opacity");if(0===n)return;const{isRenderingToTexture:a}=s,l=t.context,h=l.gl,c=t.style.projection,u=t.transform,d=u.tileSize,_=i.paint.get("background-pattern");if(t.isPatternMissing(_))return;const p=!_&&1===r.a&&1===n&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==p)return;const m=ai.disabled,f=t.getDepthModeForSublayer(0,"opaque"===p?ri.ReadWrite:ri.ReadOnly),g=t.colorModeForRenderPass(),v=t.useProgram(_?"backgroundPattern":"background"),y=o||Lt(u,{tileSize:d,terrain:t.style.map.terrain});_&&(l.activeTexture.set(h.TEXTURE0),t.imageManager.bind(t.context));const b=i.getCrossfadeParameters();for(const e of y){const o=u.getProjectionData({overscaledTileID:e,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),s=_?wo(n,t,_,{tileID:e,tileSize:d},b):xo(n,r),p=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e),y=c.getMeshFromTileID(l,e.canonical,!1,!0,"raster");v.draw(l,h.TRIANGLES,f,m,g,si.backCCW,s,p,o,i.id,y.vertexBuffer,y.indexBuffer,y.segments);}}
40(t,0,o,s,r):e.cs(o)&&function(t,e,i,o){const{isRenderingGlobe:s}=o,r=t.context,n=i.implementation,a=t.style.projection,l=t.transform,h=l.getProjectionDataForCustomLayer(s),c={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:a.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${a.shaderPreludeCode.vertexSource}`,define:a.shaderDefine},defaultProjectionData:h},u=n.renderingMode?n.renderingMode:"2d";if("offscreen"===t.renderPass){const e=n.prerender;e&&(t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),e.call(n,r.gl,c),r.setDirty(),t.setBaseState());}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),r.setColorMode(t.colorModeForRenderPass()),r.setStencilMode(ai.disabled);const e="3d"===u?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,ri.ReadOnly);r.setDepthMode(e),n.render(r.gl,c),r.setDirty(),t.setBaseState(),r.bindFramebuffer.set(null);}}(t,0,o,r));}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.length<Ys.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?e.push(t):t.destroy():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,i=!1,o=[]){this.cache=this.cache||{};const s=!!this.style.map.terrain,r=this.style.projection,n=i?Be.projectionMercator:r.shaderPreludeCode,a=i?Ze:r.shaderDefine,l=t+(e?e.cacheKey:"")+`/${i?Ge:r.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(s?"/terrain":"")+(o?`/${o.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Wi(this.context,Be[t],e,Po[t],this._showOverdrawInspector,s,n,a,o)),this.cache[l]}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 e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){var t,e;if(this._tileTextures){for(const t in this._tileTextures){const e=this._tileTextures[t];if(e)for(const t of e)t.destroy();}this._tileTextures={};}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.vertexBuffer)||void 0===t||t.destroy()),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.indexBuffer)||void 0===e||e.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const t in this.cache){const e=this.cache[t];e&&e.program&&this.context.gl.deleteProgram(e.program);}this.cache={};}this.context&&this.context.setDefault();}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function Ks(t,e){let i,o=!1,s=null,r=null;const n=()=>{s=null,o&&(t.apply(r,i),s=setTimeout(n,e),o=!1);};return (...t)=>(o=!0,r=this,i=t,s||n(),s)}Ys.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Qs{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((t=>
40t.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t);})),(e&&e[1]||"").split("/")}return t.split("/")},this._onHashChange=()=>{const t=this._getCurrentHash();if(!this._isValidHash(t))return !1;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},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t);},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join("/");let i=e;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${e}`);let o=window.location.hash.replace(i,"");o.startsWith("#&")?o=o.slice(0,1)+o.slice(2):"#"===o&&(o="");let s=window.location.href.replace(/(#.+)?$/,o);s=s.replace("&&","&"),window.history.replaceState(window.history.state,null,s);},this._updateHash=Ks(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t);}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,o=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,o),r=Math.round(e.lng*s)/s,n=Math.round(e.lat*s)/s,a=this._map.getBearing(),l=this._map.getPitch();let h="";if(h+=t?`/${r}/${n}/${i}`:`${i}/${n}/${r}`,(a||l)&&(h+="/"+Math.round(10*a)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const o=i.split("=")[0];return o===t?(e=!0,`${o}=${h}`):i})).filter((t=>t));return e||i.push(`${t}=${h}`),`#${i.join("&")}`}return `#${h}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return !1;try{new e.V(+t[2],+t[1]);}catch(t){return !1}const i=+t[0],o=+(t[3]||0),s=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&o>=-180&&o<=180&&s>=this._map.getMinPitch()&&s<=this._map.getMaxPitch()}}const Js={linearity:.3,easing:e.ct(0,0,.3,1)},tr=e.e({deceleration:2500,maxSpeed:1400},Js),er=e.e({deceleration:20,maxSpeed:1400},Js),ir=e.e({deceleration:1e3,maxSpeed:360},Js),or=e.e({deceleration:1e3,maxSpeed:90},Js),sr=e.e({deceleration:1e3,maxSpeed:360},Js);class rr{constructor(t){this._map=t,this.clear();}clear(){this._inertiaBuffer=[];}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l(),settings:t});}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=l();for(;t.length>0&&e-t[0].time>160;)t.shift();}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){const r=ar(i.pan.mag(),o,e.e({},tr,t||{})),n=i.pan.mult(r.amount/i.pan.mag()),a=this._map.cameraHelper.handlePanInertia(n,this._map.transform);s.center=a.easingCenter,s.offset=a.easingOffset,nr(s,r);}if(i.zoom){const t=ar(i.zoom,o,er),r=e.cu(this._map.transform.zoom+t.amount,this._map.getZoomSnap(),t.amount);s.zoom=r,nr(s,t);}if(i.bearing){const t=ar(i.bearing,o,ir);s.bearing=this._map.transform.bearing+e.ak(t.amount,-179,179),nr(s,t);}if(i.pitch){const t=ar(i.pitch,o,or);s.pitch=this._map.transform.pitch+t.amount,nr(s,t);}if(i.roll){const t=ar(i.roll,o,sr);s.roll=this._map.transform.roll+e.ak(t.amount,-179,179),nr(s,t);}if(s.zoom||s.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;s.around=t?this._map.unproject(t):this._map.getCenter();}return this.clear(),e.e(s,{noMoveStart:!0})}}function nr(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing);}function ar(t,i,o){const{maxSpeed:s,linearity:r,deceleration:n}=o,a=e.ak(t*r/(i/1e3),-s,s),l=Math.abs(a)/(n*r);return {easing:o.easing,duration:1e3*l,amount:a*(l/2)}}class lr extends e.l{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,o,s={}){o=o instanceof MouseEvent?o:new MouseEvent(t,o);const r=d.mousePos(i.getCanvas(),o),n=i.unproject(r);super(t,e.e({point:r,lngLat:n,originalEvent:o},s)),this._defaultPrevented=!1,this.target=i;}}class hr extends e.l{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,o){const s="touchend"===t?o.changedTouches:o.touches,r=d.touchPos(i.getCanvasContainer(),s),n=r.map((t=>i.unproject(t))),a=r.reduce(((t,e,i,o)=>t.add(e.div(o.length))),new e.P(0,0));super(t,{points:r,point:a,lngLats:n,lngLat:i.unproject(a),originalEvent:o}),this._defaultPrevented=!1;}}class cr extends e.l{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1;}}class ur{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance;}reset(){delete this._mousedownPos;}wheel(t){return this._firePreventable(new cr(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new lr(t.type,this._map,t))}mouseup(t){this._map.fire(new lr(t.type,this._map,t));}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new lr(t.type,this._map,t));}dblclick(t){return this._firePreventable(new lr(t.type,this._map,t))}mouseover(t){this._map.fire(new lr(t.type,this._map,t));}mouseout(t){this._map.fire(new lr(t.type,this._map,t));}touchstart(t){return this._firePreventable(new hr(t.type,this._map,t))}touchmove(t){this._map.fire(new hr(t.type,this._map,t));}touchend(t){this._map.fire(new hr(t.type,this._map,t));}touchcancel(t){this._map.fire(new hr(t.type,this._map,t));}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class dr{constructor(t){this._map=t;}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent;}mousemove(t){this._map.fire(new lr(t.type,this._map,t));}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new lr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new lr(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class _r{constructor(t){this._map=t;}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return {lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this._map.terrain)}}class pr{constructor(t,e){this._map=t,this._tr=new _r(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1,e.boxZoom&&"object"==typeof e.boxZoom&&(this._boxZoomEnd=e.boxZoom.boxZoomEnd);}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&&(d.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 o=this._startPos;this._lastPos=i,this._box||(this._box=d.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const s=Math.min(o.x,i.x),r=Math.max(o.x,i.x),n=Math.min(o.y,i.y),a=Math.max(o.y,i.y);this._box.style.transform=`translate(${s}px,${n}px)`,this._box.style.width=r-s+"px",this._box.style.height=a-n+"px";}mouseupWindow(t,i){if(!this._active)return;if(0!==t.button)return;const o=this._startPos,s=i;if(this.reset(),d.suppressClick(),o.x!==s.x||o.y!==s.y)return this._map.fire(new e.l("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,o,s,t):{cameraAnimation:t=>t.fitScreenCoordinates(o,s,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t);}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t));}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),d.enableDrag(),delete this._startPos,delete this._lastPos;}_fireEvent(t,i){return this._map.fire(new e.l(t,{originalEvent:i}))}}function mr(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 o=0;o<t.length;o++)i[t[o].identifier]=e[o];return i}
40class fr{constructor(t){this.reset(),this.numTouches=t.numTouches;}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1;}touchstart(t,i,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=mr(o,i)));}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const o=mr(i,e);for(const t in this.touches){const e=o[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0);}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class gr{constructor(t){this.singleTap=new fr(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 o=this.singleTap.touchend(t,e,i);if(o){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(o)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class vr{constructor(t){this._tr=new _r(t),this._zoomIn=new gr({numTouches:1,numTaps:2}),this._zoomOut=new gr({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,i,o){const s=this._zoomIn.touchend(t,i,o),r=this._zoomOut.touchend(t,i,o),n=this._tr;return s?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:e.cu(n.zoom+1,i.getZoomSnap()),around:n.unproject(s)},{originalEvent:t})}):r?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:e.cu(n.zoom-1,i.getZoomSnap()),around:n.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}}class yr{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset();}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t);}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0));}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const o=Array.isArray(e)?e[0]:e;return !this._moved&&o.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(i,o))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&d.suppressClick(),this.reset(t));}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const br=0,xr=2,wr={[br]:1,[xr]:2};class Tr{constructor(t){this._correctEvent=t.checkCorrectEvent;}startMove(t){this._eventButton=t.button;}endMove(t){delete this._eventButton;}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return !function(t,e){const i=wr[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Pr{constructor(){this._firstTouch=void 0;}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier;}endMove(t){delete this._firstTouch;}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Mr{constructor(t=new Tr({checkCorrectEvent:()=>!0}),e=new Pr){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e;}_executeRelevantHandler(t,e,i){return t instanceof MouseEvent?e(t):"undefined"!=typeof TouchEvent&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.startMove(t)),(t=>this.oneFingerTouchMoveStateManager.startMove(t)));}endMove(t){this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.endMove(t)),(t=>this.oneFingerTouchMoveStateManager.endMove(t)));}isValidStartEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidStartEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidMoveEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(t=>this.mouseMoveStateManager.isValidEndEvent(t)),(t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t)))}}const Cr=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault();};};class Ir{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset();}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0);}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t);}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset();}touchcancel(){this.reset();}_calculateTransform(t,i,o){o.length>0&&(this._active=!0);const s=mr(o,i),r=new e.P(0,0),n=new e.P(0,0);let a=0;for(const t in s){const e=s[t],i=this._touches[t];i&&(r._add(e),n._add(e.sub(i)),a++,s[t]=e);}if(this._touches=s,this._shouldBePrevented(a)||!n.mag())return;
40const l=n.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:r.div(a),panDelta:l}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Er{constructor(){this.reset();}reset(){this._active=!1,delete this._firstTwoTouches;}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]));}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[o,s]=this._firstTwoTouches,r=Sr(i,e,o),n=Sr(i,e,s);if(!r||!n)return;const a=this._aroundCenter?null:r.add(n).div(2);return this._move([r,n],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,r=Sr(i,e,o),n=Sr(i,e,s);r&&n||(this._active&&d.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 Sr(t,e,i){for(let o=0;o<t.length;o++)if(t[o].identifier===i)return e[o]}function Lr(t,e){return Math.log(t/e)/Math.LN2}class zr extends Er{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(Lr(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Lr(this._distance,i),pinchAround:e}}}function Rr(t,e){return 180*t.angleWith(e)/Math.PI}class Dr extends Er{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector;}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1]);}_move(t,e,i){const o=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Rr(this._vector,o),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Rr(t,this._startVector);return Math.abs(i)<e}}function Ar(t){return Math.abs(t.y)>Math.abs(t.x)}class kr extends Er{constructor(t){super(),this._currentTouchCount=0,this._map=t;}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints;}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length;}_start(t){this._lastPoints=t,Ar(t[0].sub(t[1]))&&(this._valid=!1);}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=t[0].sub(this._lastPoints[0]),s=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,s,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const o=t.mag()>=2,s=e.mag()>=2;if(!o&&!s)return;if(!o||!s)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const r=t.y>0==e.y>0;return Ar(t)&&Ar(e)&&r}}const Or={panStep:100,bearingStep:15,pitchStep:10};class Br{constructor(t){this._tr=new _r(t);const e=Or;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1;}reset(){this._active=!1;}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,o=0,s=0,r=0,n=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?o=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?o=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?s=1:(t.preventDefault(),n=-1);break;case 40:t.shiftKey?s=-1:(t.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(o=0,s=0),{cameraAnimation:a=>{const l=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:Fr,zoom:i?e.cu(l.zoom+i*(t.shiftKey?2:1),a.getZoomSnap()):l.zoom,bearing:l.bearing+o*this._bearingStep,pitch:l.pitch+s*this._pitchStep,offset:[-r*this._panStep,-n*this._panStep],center:l.center},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0;}enableRotation(){this._rotationDisabled=!1;}}function Fr(t){return t*(2-t)}const jr=4.000244140625,Nr=1/450;class Zr{constructor(t,e){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t);}
40,this._map=t,this._tr=new _r(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Nr;}setZoomRate(t){this._defaultZoomRate=t;}setWheelZoomRate(t){this._wheelZoomRate=t;}isEnabled(){return !!this._enabled}isActive(){return !!this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around);}disable(){this.isEnabled()&&(this._enabled=!1);}_shouldBePrevented(t){return !!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=l(),o=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%jr==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(o*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault();}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=d.mousePos(this._map.getCanvas(),t),o=this._tr;this._aroundPoint=this._aroundCenter?o.transform.locationToScreenPoint(e.V.convert(o.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const e=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=e),"number"==typeof this._targetZoom&&(this._targetZoom+=e);}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>jr?this._wheelZoomRate:this._defaultZoomRate;let o=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==o&&(o=1/o);const s="number"!=typeof this._targetZoom?t.scale:e.an(this._targetZoom),r=t.applyConstrain(t.getCameraLngLat(),e.aq(s*o)).zoom,n=this._map.getZoomSnap();if("wheel"===this._type&&n>0){const i=e.cu(t.zoom,n);this._targetZoom=e.cu(r,n,r-i);}else this._targetZoom=r;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}const i="number"!=typeof this._targetZoom?t.zoom:this._targetZoom,o=this._startZoom,s=this._easing;let r,n=!1;if("wheel"===this._type&&o&&s){const t=l()-this._lastWheelEventTime,a=Math.min((t+5)/200,1),h=s(a);r=e.G.number(o,i,h),a<1?this._frameId||(this._frameId=!0):n=!0;}else r=i,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout;}),200)),this._lastExpectedZoom=r,{noInertia:!0,needsRenderFrame:!n,zoomDelta:r-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.cw;if(this._prevEase){const t=this._prevEase,o=(l()-t.start)/t.duration,s=t.easing(o+.01)-t.easing(o),r=.27/Math.sqrt(s*s+1e-4)*.01,n=Math.sqrt(.0729-r*r);i=e.ct(r,n,.25,1);}return this._prevEase={start:l(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);}}class Gr{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 Ur{constructor(t){this._tr=new _r(t),this.reset();}reset(){this._active=!1;}dblclick(t,i){return t.preventDefault(),{cameraAnimation:o=>{o.easeTo({duration:300,zoom:e.cu(this._tr.zoom+(t.shiftKey?-1:1),o.getZoomSnap()),around:this._tr.unproject(i)},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Vr{constructor(){this._tap=new gr({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset();}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const o=e[0],s=t.timeStamp-this._tapTime<500,r=this._tapPoint.dist(o)<30;s&&r?i.length>0&&(this._swipePoint=o,this._swipeTouch=i[0].identifier):this.reset();}else this._tap.touchstart(t,e,i);}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const o=e[0],s=o.y-this._swipePoint.y;return this._swipePoint=o,t.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(t,e,i);}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else {const o=this._tap.touchend(t,e,i);o&&(this._tapTime=t.timeStamp,this._tapPoint=o);}}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}
40class Wr{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class qr{constructor(t,e,i,o){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=i,this._mouseRoll=o;}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable();}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable();}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class $r{constructor(t,e,i,o){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0;}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate");}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable();}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();}}class Hr{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1;}isActive(){return !1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=d.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=e,this._container.appendChild(o);const s=document.createElement("div");s.className="maplibregl-mobile-message",s.textContent=i,this._container.appendChild(s),this._container.setAttribute("aria-hidden","true");}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container;}enable(){this._setupUI(),this._enabled=!0;}disable(){this._enabled=!1,this._destroyUI();}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new e.l("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show");}),100));}}const Xr=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class Yr extends e.l{}function Kr(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class Qr{get _ownerDocument(){var t;return (null===(t=this._el)||void 0===t?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,e;return (null===(e=null===(t=this._el)||void 0===t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView)||window}constructor(t,i){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`);},this.handleEvent=(t,i)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;const o="renderFrame"===t.type?void 0:t,s={needsRenderFrame:!1},r={},n={};for(const{handlerName:a,handler:l,allowed:h}of this._handlers){if(!l.isEnabled())continue;let c;if(this._blockedByActive(n,h,a))l.reset();else if(l[i||t.type]){if(e.cx(t,i||t.type)){const e=d.mousePos(this._map.getCanvas(),t);c=l[i||t.type](t,e);}else if(e.cy(t,i||t.type)){const e=this._getMapTouches(t.touches),o=d.touchPos(this._map.getCanvas(),e);c=l[i||t.type](t,o,e);}else e.cz(i||t.type)||(c=l[i||t.type](t));this.mergeHandlerResult(s,r,c,a,o),c&&c.needsRenderFrame&&this._triggerRe
40nderFrame();}(c||l.isActive())&&(n[a]=l);}const a={};for(const t in this._previousActiveHandlers)n[t]||(a[t]=o);this._previousActiveHandlers=n,(Object.keys(a).length||Kr(s))&&(this._changes.push([s,r,a]),this._triggerRenderFrame()),(Object.keys(n).length||Kr(s))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=s;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map));},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rr(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const o=this._el;this._listeners=[[o,"touchstart",{passive:!0}],[o,"touchmove",{passive:!1}],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1}],[o,"keyup",void 0],[o,"wheel",{passive:!1}],[o,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[t,e,i]of this._listeners)t.addEventListener(e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i);}destroy(){for(const[t,e,i]of this._listeners)t.removeEventListener(e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i);}_addDefaultHandlers(t){const i=this._map,o=i.getCanvasContainer();this._add("mapEvent",new ur(i,t));const s=i.boxZoom=new pr(i,t);this._add("boxZoom",s),t.interactive&&t.boxZoom&&s.enable();const r=i.cooperativeGestures=new Hr(i,t.cooperativeGestures);this._add("cooperativeGestures",r),t.cooperativeGestures&&r.enable();const n=new vr(i),a=new Ur(i);i.doubleClickZoom=new Gr(a,n),this._add("tapZoom",n),this._add("clickZoom",a),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();const l=new Vr;this._add("tapDragZoom",l);const h=i.touchPitch=new kr(i);this._add("touchPitch",h),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);const c=()=>i.project(i.getCenter()),u=function({enable:t,clickTolerance:i,aroundCenter:o=!0,minPixelCenterThreshold:s=100,rotateDegreesPerPixelMoved:r=.8},n){const a=new Tr({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey});return new yr({clickTolerance:i,move:(t,i)=>{const a=n();if(o&&Math.abs(a.y-t.y)>s)return {bearingDelta:e.cv(new e.P(t.x,i.y),i,a)};let l=(i.x-t.x)*r;return o&&i.y<a.y&&(l=-l),{bearingDelta:l}},moveStateManager:a,enable:t,assignEvents:Cr})}(t,c),d=function({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5}){const o=new Tr({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button});return new yr({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:o,enable:t,assignEvents:Cr})}(t),_=function({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:i=.3},o){const s=new Tr({checkCorrectEvent:t=>2===t.button&&t.ctrlKey});return new yr({clickTolerance:e,move:(t,e)=>{const s=o();let r=(e.x-t.x)*i;return e.y<s.y&&(r=-r),{rollDelta:r}},moveStateManager:s,enable:t,assignEvents:Cr})}(t,c);i.dragRotate=new qr(t,u,d,_),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",_,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();const p=function({enable:t,clickTolerance:e}){const i=new Tr({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey});return new yr({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Cr})}(t),m=new Ir(t,i);i.dragPan=new Wr(o,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);const f=new Dr,g=new zr;i.touchZoomRotate=new $r(o,g,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new dr(i));const v=i.scrollZoom=new Zr(i,(()=>
40this._triggerRenderFrame()));this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);const y=i.keyboard=new Br(i);this._add("keyboard",y),t.interactive&&t.keyboard&&i.keyboard.enable();}_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(Xr(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const o in t)if(o!==i&&(!e||e.indexOf(o)<0))return !0;return !1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,o,s,r){if(!o)return;e.e(t,o);const n={handlerName:s,originalEvent:o.originalEvent||r};void 0!==o.zoomDelta&&(i.zoom=n),void 0!==o.panDelta&&(i.drag=n),void 0!==o.rollDelta&&(i.roll=n),void 0!==o.pitchDelta&&(i.pitch=n),void 0!==o.bearingDelta&&(i.rotate=n);}_applyChanges(){const t={},i={},o={};for(const[s,r,n]of this._changes)s.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(s.panDelta)),s.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+s.pitchDelta),s.rollDelta&&(t.rollDelta=(t.rollDelta||0)+s.rollDelta),void 0!==s.around&&(t.around=s.around),void 0!==s.pinchAround&&(t.pinchAround=s.pinchAround),s.noInertia&&(t.noInertia=s.noInertia),e.e(i,r),e.e(o,n);this._updateMapTransform(t,i,o),this._changes=[];}_updateMapTransform(t,e,i){const o=this._map,s=o._getTransformForUpdate(),r=o.terrain;if(!(Kr(t)||r&&this._terrainMovement))return this._fireEvents(e,i,!0);o._stop(!0);let{panDelta:n,zoomDelta:a,bearingDelta:l,pitchDelta:h,rollDelta:c,around:u,pinchAround:d}=t;void 0!==d&&(u=d),u=u||o.transform.centerPoint,r&&!s.isPointOnMapSurface(u)&&(u=s.centerPoint);const _={panDelta:n,zoomDelta:a,rollDelta:c,pitchDelta:h,bearingDelta:l,around:u};this._map.cameraHelper.useGlobeControls&&!s.isPointOnMapSurface(u)&&(u=s.centerPoint);const p=u.distSqr(s.centerPoint)<.01?s.center:s.screenPointToLocation(n?u.sub(n):u);this._handleMapControls({terrain:r,tr:s,deltasForHelper:_,preZoomAroundLoc:p,combinedEventsInProgress:e,panDelta:n}),o._applyUpdatedTransform(s),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0);}_handleMapControls({terrain:t,tr:e,deltasForHelper:i,preZoomAroundLoc:o,combinedEventsInProgress:s,panDelta:r}){const n=this._map.cameraHelper;if(n.handleMapControlsRollPitchBearingZoom(i,e),t)return n.useGlobeControls?(this._terrainMovement||!s.drag&&!s.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void n.handleMapControlsPan(i,e,o)):this._terrainMovement||!s.drag&&!s.zoom?void(s.drag&&this._terrainMovement&&r?e.setCenter(e.screenPointToLocation(e.centerPoint.sub(r))):n.handleMapControlsPan(i,e,o)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void n.handleMapControlsPan(i,e,o));n.handleMapControlsPan(i,e,o);}_fireEvents(t,i,o){const s=Xr(this._eventsInProgress),r=Xr(t),a={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(a[`${e}start`]=i),this._eventsInProgress[e]=t[e];}!s&&r&&this._fireEvent("movestart",r.originalEvent);for(const t in a)this._fireEvent(t,a[t]);r&&this._fireEvent("move",r.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i);}const l={};let h;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:o}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],h=i[e]||o,l[`${t}end`]=h);}for(const t in l)this._fireEvent(t,l[t]);const c=Xr(this._eventsInProgress),u=(s||r)&&!c;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();
40this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(t);}if(o&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;!t||!t.essential&&n.prefersReducedMotion?(this._map.fire(new e.l("moveend",{originalEvent:h})),i(this._map.getBearing())&&this._map.resetNorth()):(i(t.bearing||this._map.getBearing())&&(t.bearing=0),t.freezeElevation=!0,this._map.easeTo(t,{originalEvent:h})),this._updatingCamera=!1;}}_fireEvent(t,i){this._map.fire(new e.l(t,i?{originalEvent:i}:{}));}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Yr("renderFrame",{timeStamp:t})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}class Jr extends e.E{constructor(t,e,i){super(),this._renderFrameCallback=()=>{const t=Math.min((l()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._zoomSnap=i.zoomSnap,this.cameraHelper=e,this.on("moveend",(()=>{delete this._requestedCameraState;}));}migrateProjection(t,e){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=e;}getCenter(){return new e.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t;}panBy(t,i,o){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),o)}panTo(t,i,o){return this.easeTo(e.e({center:t},i),o)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,o){return this.easeTo(e.e({zoom:t},i),o)}zoomIn(t,i){return this.zoomTo(e.cu(this.getZoom()+1,this._zoomSnap),t,i),this}zoomOut(t,i){return this.zoomTo(e.cu(this.getZoom()-1,this._zoomSnap),t,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new e.l("movestart",i)).fire(new e.l("move",i)).fire(new e.l("moveend",i))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,o){return this.easeTo(e.e({bearing:t},i),o)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=q.convert(t).adjustAntiMeridian();const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,i,o,s){const r={top:0,bottom:0,right:0,left:0};if("number"==typeof(s=e.e({padding:r,offset:[0,0],maxZoom:this.transform.maxZoom},s)).padding){const t=s.padding;s.padding={top:t,bottom:t,right:t,left:t};}const n=e.e(r,s.padding);s.padding=n;const a=this.transform,l=new q(t,i);return this.cameraHelper.cameraForBoxAndBearing(s,n,l,o,a)}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,i,o,s,r){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(e.P.convert(t)),this.transform.screenPointToLocation(e.P.convert(i)),o,s),s,r)}_fitInternal(t,i,o){return t?(delete(i=e.e(t,i)).padding,i.linear?this.easeTo(i,o):this.flyTo(i,o)):this}jumpTo(t,i){this.stop();const o=this._getTransformForUpdate();let s=!1,r=!1,n=!1;const a=o.zoom;this.terrain&&o.setElevation(this.terrain.getElevationForLngLatZoom(t.center?e.V.convert(t.center):o.center,t.zoom||o.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(o,t);const l=o.zoom!==a;return "elevation"in t&&o.elevation!==+t.elevation&&o.setElevation(+t.elevation),"bearing"in t&&o.bearing!==+t.bearing&&(s=!0,o.setBearing(+t.bearing)),"pitch"in t&&o.pitch!==+t.pitch&&(r=!0,o.setPitch(+t.pitch)),"roll"in t&&o.roll!==+t.roll&&(n=!0,o.setRoll(+t.roll)),null==t.padding||o.isPaddingEqual(t.padding)||o.setPadding(t.padding),this._applyUpdatedTransform(o),this.fire(new e.l("movestart",i)).fire(new e.l("move",i)),l&&this.fire(new e.l("zoomstart",i)).fire(new e.l("zoom",i)).fire(new e.l("zoomend",i)),s&&this.fire(new e.l("rotatestart",i)).fire(new e.l("rotate",i)).fire(new e.l("rotateend",i)),r&&this.fire(new e.l("pitchstart",i)).fire(new e.l("pitch",i)).fire(new e.l("pitchend",
40i)),n&&this.fire(new e.l("rollstart",i)).fire(new e.l("roll",i)).fire(new e.l("rollend",i)),this.fire(new e.l("moveend",i))}calculateCameraOptionsFromTo(t,i,o,s=0){const r=e.a6.fromLngLat(t,i),n=e.a6.fromLngLat(o,s),a=n.x-r.x,l=n.y-r.y,h=n.z-r.z,c=Math.hypot(a,l,h);if(0===c)throw new Error("Can't calculate camera options with same From and To");const u=Math.hypot(a,l),d=e.aq(this.transform.cameraToCenterDistance/c/this.transform.tileSize),_=180*Math.atan2(a,-l)/Math.PI;let p=180*Math.acos(u/c)/Math.PI;return p=h<0?90-p:90+p,{center:n.toLngLat(),elevation:s,zoom:d,pitch:p,bearing:_}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,o,s){const r=this.transform.calculateCenterFromCameraLngLatAlt(t,e,i,o);return {center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:i,pitch:o,roll:s}}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.cw},t)).animate||!t.essential&&n.prefersReducedMotion)&&(t.duration=0);const o=this._getTransformForUpdate(),s=this.getBearing(),r=o.pitch,a=o.roll,l="bearing"in t?this._normalizeBearing(t.bearing,s):s,h="pitch"in t?+t.pitch:r,c="roll"in t?this._normalizeBearing(t.roll,a):a,u="padding"in t?t.padding:o.padding,d=e.P.convert(t.offset);let _,p;t.around&&(_=e.V.convert(t.around),p=o.locationToScreenPoint(_));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(o,{bearing:l,pitch:h,roll:c,padding:u,around:_,aroundPoint:p,offsetAsPoint:d,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||s!==l,this._pitching=this._pitching||h!==r,this._rolling=this._rolling||c!==a,this._padding=!o.isPaddingEqual(u),this._zooming=this._zooming||f.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,m),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease((e=>{f.easeFunc(e),this.terrain&&!t.freezeElevation&&this._updateElevation(e),this._applyUpdatedTransform(o),this._fireMoveEvents(i);}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e);}),t),this}_prepareEase(t,i,o={}){this._moving=!0,i||o.moving||this.fire(new e.l("movestart",t)),this._zooming&&!o.zooming&&this.fire(new e.l("zoomstart",t)),this._rotating&&!o.rotating&&this.fire(new e.l("rotatestart",t)),this._pitching&&!o.pitching&&this.fire(new e.l("pitchstart",t)),this._rolling&&!o.rolling&&this.fire(new e.l("rollstart",t));}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0;}_updateElevation(t){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i;}this.transform.setElevation(e.G.number(this._elevationStart,this._elevationTarget,t));}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain);}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return {};const e=t.getCameraLngLat(),i=t.getCameraAltitude(),o=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(i<o){const i=this.calculateCameraOptionsFromTo(e,o,t.center,t.elevation);return {pitch:i.pitch,zoom:i.zoom}}return {}}_applyUpdatedTransform(t){const e=[];if(e.push((t=>this._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;const i=t.clone();for(const t of e){const e=i.clone(),{center:o,zoom:s,roll:r,pitch:n,bearing:a,elevation:l}=t(e);o&&e.setCenter(o),void 0!==l&&e.setElevation(l),void 0!==s&&e.setZoom(s),void 0!==r&&e.setRoll(r),void 0!==n&&e.setPitch(n),void 0!==a&&e.setBearing(a),i.apply(e,!1);}this.transform.apply(i,!1);}_fireMoveEvents(t){this.fire(new e.l("move",t)),this._zooming&&this.fire(new e.l("zoom",t)),this._rotating&&this.fire(new e.l("rotate",t)),this._pitching&&this.fire(new e.l("pitch",t)),this._rolling&&this.fire(new e.l("roll",t));}
40_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const o=this._zooming,s=this._rotating,r=this._pitching,n=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,o&&this.fire(new e.l("zoomend",t)),s&&this.fire(new e.l("rotateend",t)),r&&this.fire(new e.l("pitchend",t)),n&&this.fire(new e.l("rollend",t)),this.fire(new e.l("moveend",t));}flyTo(t,i){if(!t.essential&&n.prefersReducedMotion){const o=e.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(o,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.cw},t);const o=this._getTransformForUpdate(),s=o.bearing,r=o.pitch,a=o.roll,l=o.padding,h="bearing"in t?this._normalizeBearing(t.bearing,s):s,c="pitch"in t?+t.pitch:r,u="roll"in t?this._normalizeBearing(t.roll,a):a,d="padding"in t?t.padding:o.padding,_=e.P.convert(t.offset);let p=o.centerPoint.add(_);const m=o.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(o,{bearing:h,pitch:c,roll:u,padding:d,locationAtOffset:m,offsetAsPoint:_,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let g=t.curve;const v=Math.max(o.width,o.height),y=v/f.scaleOfZoom,b=f.pixelPathLength;"number"==typeof f.scaleOfMinZoom&&(g=Math.sqrt(v/f.scaleOfMinZoom/b*2));const x=g*g;function w(t){const e=(y*y-v*v+(t?-1:1)*x*x*b*b)/(2*(t?y:v)*x*b);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return (Math.exp(t)-Math.exp(-t))/2}function P(t){return (Math.exp(t)+Math.exp(-t))/2}const M=w(!1);let C=function(t){return P(M)/P(M+g*t)}
40,I=function(t){return v*((P(M)*(T(e=M+g*t)/P(e))-T(M))/x)/b;var e;},E=(w(!0)-M)/g;if(Math.abs(b)<2e-6||!isFinite(E)){if(Math.abs(v-y)<1e-6)return this.easeTo(t,i);const e=y<v?-1:1;E=Math.abs(Math.log(y/v))/g,I=()=>0,C=t=>Math.exp(e*g*t);}return t.duration="duration"in t?+t.duration:1e3*E/("screenSpeed"in t?+t.screenSpeed/g:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=c!==r,this._rolling=u!==a,this._padding=!o.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease((n=>{const m=n*E,g=1/C(m),v=I(m);this._rotating&&o.setBearing(e.G.number(s,h,n)),this._pitching&&o.setPitch(e.G.number(r,c,n)),this._rolling&&o.setRoll(e.G.number(a,u,n)),this._padding&&(o.interpolatePadding(l,d,n),p=o.centerPoint.add(_)),f.easeFunc(n,g,v,p),this.terrain&&!t.freezeElevation&&this._updateElevation(n),this._applyUpdatedTransform(o),this._fireMoveEvents(i);}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i);}),t),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e);}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=l(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_normalizeBearing(t,i){t=e.W(t,-180,180);const o=Math.abs(t-i);return Math.abs(t-360-i)<o&&(t-=360),Math.abs(t+360-i)<o&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(e.V.convert(t),this.transform):null}}const tn={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class en{constructor(t=tn){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")));},this._updateData=t=>{!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType&&"terrain"!==t.type||this._updateAttributions();},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"));},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show");},this.options=t;}getDefaultPosition(){return "bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=d.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=d.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=d.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0;}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i);}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>"string"!=typeof t?"":t))):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id;}const e=this._map.style.tileManagers;for(const i in e){const o=e[i];if(o.used||o.usedForTerrain){const e=o.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution);}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let o=i+1;o<t.length;o++)if(t[o].indexOf(e)>=0)return !1;return !0}));const i=t.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=d.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null);}}class on{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact");}},this.options=t;}getDefaultPosition(){return "bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=d.create("div","maplibregl-ctrl");const e=d.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0;}}class sn{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;
40for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}var rn=e.aS([{name:"a_pos3d",type:"Int16",components:3}]);class nn extends e.E{constructor(t){super(),this._lastTilesetChange=l(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize;}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null;}getSource(){return this.tileManager._source}update(t,i){this.tileManager.update(t,i),this._renderableTilesKeys=[];const o={};for(const s of Lt(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))o[s.key]=!0,this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.terrainRttPosMatrix32f=new Float64Array(16),e.c5(s.terrainRttPosMatrix32f,0,e.a5,e.a5,0,0,1),this._tiles[s.key]=new ft(s,this.tileSize),this._lastTilesetChange=l());for(const t in this._tiles)o[t]||delete this._tiles[t];}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[]);}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const i={};for(const o of this._renderableTilesKeys){const s=this._tiles[o].tileID,r=t.clone(),n=e.bi();if(s.canonical.equals(t.canonical))e.c5(n,0,e.a5,e.a5,0,0,1);else if(s.canonical.isChildOf(t.canonical)){const i=s.canonical.z-t.canonical.z,o=s.canonical.x-(s.canonical.x>>i<<i),r=s.canonical.y-(s.canonical.y>>i<<i),a=e.a5>>i;e.c5(n,0,a,a,0,0,1),e.O(n,n,[-o*a,-r*a,0]);}else {if(!t.canonical.isChildOf(s.canonical))continue;{const i=t.canonical.z-s.canonical.z,o=t.canonical.x-(t.canonical.x>>i<<i),r=t.canonical.y-(t.canonical.y>>i<<i),a=e.a5>>i;e.c5(n,0,e.a5,e.a5,0,0,1),e.O(n,n,[o*a,r*a,0]),e.Q(n,n,[1/2**i,1/2**i,0]);}}r.terrainRttPosMatrix32f=new Float32Array(n),i[o]=r;}return i}_getTerrainCoordsForTileRanges(t,i){const o={};for(const s of this._renderableTilesKeys){const r=this._tiles[s].tileID;if(!this._isWithinTileRanges(r,i))continue;const n=t.clone(),a=e.bi();if(r.canonical.z===t.canonical.z){const i=t.canonical.x-r.canonical.x+t.wrap*(1<<t.canonical.z),o=t.canonical.y-r.canonical.y;e.c5(a,0,e.a5,e.a5,0,0,1),e.O(a,a,[i*e.a5,o*e.a5,0]);}else if(r.canonical.z>t.canonical.z){const i=r.canonical.z-t.canonical.z,o=r.canonical.x-(r.canonical.x>>i<<i)+t.wrap*(1<<r.canonical.z),s=r.canonical.y-(r.canonical.y>>i<<i),n=t.canonical.x-(r.canonical.x>>i),l=t.canonical.y-(r.canonical.y>>i),h=e.a5>>i;e.c5(a,0,h,h,0,0,1),e.O(a,a,[-o*h+n*e.a5,-s*h+l*e.a5,0]);}else {const i=t.canonical.z-r.canonical.z,o=t.canonical.x-(t.canonical.x>>i<<i)+t.wrap*(1<<t.canonical.z),s=t.canonical.y-(t.canonical.y>>i<<i),n=(t.canonical.x>>i)-r.canonical.x,l=(t.canonical.y>>i)-r.canonical.y,h=e.a5<<i;e.c5(a,0,h,h,0,0,1),e.O(a,a,[o*e.a5+n*h,s*e.a5+l*h,0]);}n.terrainRttPosMatrix32f=new Float32Array(a),o[s]=n;}return o}getSourceTile(t,e){const i=this.tileManager._source;let o=t.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(o).key);let s=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(null==s?void 0:s.dem)&&e)for(;o>=i.minzoom&&!(null==s?void 0:s.dem);)s=this.findTileInCaches(t.scaledTo(o--).key);return s}findTileInCaches(t){let e=this.tileManager.getTileByID(t);return e||(e=this.tileManager._outOfViewCache.getByKey(t),e)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){const i=e[t.canonical.z];return !!i&&(t.wrap>i.minWrap||t.wrap<i.maxWrap||t.canonical.x>=i.minTileXWrapped&&t.canonical.x<=i.maxTileXWrapped&&t.canonical.y>=i.minTileY&&t.canonical.y<=i.maxTileY)}}class an{constructor(t,e,i){this._meshCache={},this.painter=t,this.tileManager=new nn(e),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qual
40ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024;}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct();}getDEMElevation(t,i,o,s=e.a5){var r;const n=t.normalizeCoordinates(i,o,s);if(!n)return 0;const a=this.getTerrainData(n.tileID),l=null===(r=a.tile)||void 0===r?void 0:r.dem;if(!l)return 0;const h=e.cA([],[n.x/s*e.a5,n.y/s*e.a5],a.u_terrain_matrix),c=[h[0]*l.dim,h[1]*l.dim],u=Math.floor(c[0]),d=Math.floor(c[1]),_=c[0]-u,p=c[1]-d;return l.get(u,d)*(1-_)*(1-p)+l.get(u+1,d)*_*(1-p)+l.get(u,d+1)*(1-_)*p+l.get(u+1,d+1)*_*p}getElevationForLngLatZoom(t,i){if(!e.cB(i,t.wrap()))return 0;const{tileID:o,mercatorX:s,mercatorY:r}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(o,s%e.a5,r%e.a5,e.a5)}getElevationForLngLat(t,e){const i=Lt(e,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let o=0;for(const t of i)t.canonical.z>o&&(o=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,o)}getElevation(t,i,o,s=e.a5){return this.getDEMElevation(t,i,o,s)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const t=this.painter.context,i=new e.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new e.T(t,i,t.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new e.T(t,new e.R({width:1,height:1}),t.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=e.ao([]);}const i=this.tileManager.getSourceTile(t,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new e.T(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1;}const o=i&&i.toString()+i.tileID.key+t.key;if(o&&!this._demMatrixCache[o]){const o=this.tileManager.getSource().maxzoom;let s=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=o?s=t.canonical.z-o:e.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const r=t.canonical.x-(t.canonical.x>>s<<s),n=t.canonical.y-(t.canonical.y>>s<<s),a=e.cC(new Float64Array(16),[1/(e.a5<<s),1/(e.a5<<s),0]);e.O(a,a,[r*e.a5,n*e.a5,0]),this._demMatrixCache[t.key]={matrix:a,coord:t};}return {u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:o?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const i=this.painter,o=i.width/devicePixelRatio,s=i.height/devicePixelRatio;return !this._fbo||this._fbo.width===o&&this._fbo.height===s||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new e.T(i.context,{width:o,height:s,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new e.T(i.context,{width:o,height:s,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(o,s,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,o,s))),this._fbo.colorAttachment.set("coords"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let o=0;o<this._coordsTextureSize;o++,e+=4)i[e+0]=255&o,i[e+1]=255&t,i[e+2]=o>>8<<4|t>>8,i[e+3]=0;const o=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),s=new e.T(t,o,t.gl.RGBA,{premultiply:!1});return s.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=s,s}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),o=this.painter.context,s=o.gl,r=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),n=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),a=Math.round(this.painter.height/devicePixelRatio);o.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),s.readPixels(r,a-n-1,1,1,s.RGBA,s.UNSIGNED_BYTE,i),o.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),h=i[1]+((15&i[2])<<8),c=this.coordsIndex[255-i[3]],u=c&&this.tileManager.getTileByID(c);if(!u)return null;const d=this._coordsTextureSize,_=(1<<u.tileID.canonical.z)*d;return new e.a6((u.tileID.canonical.x*d+l)/_+u.tileID.wrap,(u.tileID.canonical.y*d+h)/_,this.getElevation(u.tileID,l,h,d))}depthAtPoint(t){const e=new Uint8Array(4),i=this.painter.context,o=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,o.RGBA,o.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var i;const o=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,s=o&&0===t.canonical.y,r=o&&t.canonical.y===(1<<t.canonical.z)-1,n=`m_${s?"n":""}_${r?"s":""}`;if(this._meshCache[n])return this._meshCache[n];const a=this.painter.context,l=new e.cD,h=new e.aW,c=this.meshSize,u=e.a5/c,d=c*c;for(let t=0;t<=c;t++)for(let e=0;e<=c;e++)l.emplaceBack(e*u,t*u,0);for(let t=0;t<d;t+=c+1)for(let e=0;e<c;e++)h.emplaceBack(e+t,c+e+t+1,c+e+t+2),h.emplaceBack(e+t,c+e+t+2,e+t+1);
40const _=l.length,p=_+(c+1),m=(c+1)*c,f=s?e.bp:0,g=s?0:1,v=r?e.bq:e.a5,y=r?0:1;for(let t=0;t<=c;t++)l.emplaceBack(t*u,f,g);for(let t=0;t<=c;t++)l.emplaceBack(t*u,v,y);for(let t=0;t<c;t++)h.emplaceBack(m+t,p+t,p+t+1),h.emplaceBack(m+t,p+t+1,m+t+1),h.emplaceBack(0+t,_+t+1,_+t),h.emplaceBack(0+t,0+t+1,_+t+1);const b=l.length,x=b+2*(c+1);for(const t of [0,1])for(let i=0;i<=c;i++)for(const o of [0,1])l.emplaceBack(t*e.a5,i*u,o);for(let t=0;t<2*c;t+=2)h.emplaceBack(b+t,b+t+1,b+t+3),h.emplaceBack(b+t,b+t+3,b+t+2),h.emplaceBack(x+t,x+t+3,x+t+1),h.emplaceBack(x+t,x+t+2,x+t+3);const w=new je(a.createVertexBuffer(l,rn.members),a.createIndexBuffer(h),e.aV.simpleSegment(0,0,l.length,h.length));return this._meshCache[n]=w,w}getMeshFrameDelta(t){return 2*Math.PI*e.bC/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,i){var o;if(!e.cB(i,t.wrap()))return 0;const{tileID:s}=this._getOverscaledTileIDFromLngLatZoom(t,i);return null!==(o=this.getMinMaxElevation(s).minElevation)&&void 0!==o?o:0}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,i){const o=e.a6.fromLngLat(t.wrap()),s=(1<<i)*e.a5,r=o.x*s,n=o.y*s,a=Math.floor(r/e.a5),l=Math.floor(n/e.a5);return {tileID:new e.a2(i,0,i,a,l),mercatorX:r,mercatorY:n}}}class ln{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0;}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy();}_createObject(t){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),o=new e.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return o.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(o.texture),{id:t,fbo:i,texture:o,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id);}stampObject(t){t.stamp=++this._stamp;}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1;}freeAllObjects(){for(const t of this._objects)this.freeObject(t);}isFull(){return !(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const hn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class cn{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new ln(t.context,30,e.tileManager.tileSize*e.qualityFactor);}destruct(){this.pool.destruct();}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){var i,o;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsAscending={};for(const e in t.tileManagers){this._coordsAscending[e]={};const i=t.tileManagers[e].getVisibleCoordinates(),o=t.tileManagers[e].getSource(),s=o instanceof st?o.terrainTileRanges:null;for(const t of i){const i=this.terrain.tileManager.getTerrainCoords(t,s);for(const t in i)this._coordsAscending[e][t]||(this._coordsAscending[e][t]=[]),this._coordsAscending[e][t].push(i[t]);}}this._rttFingerprints={};for(const e of t._order){const s=t._layers[e],r=s.source;if(hn[s.type]&&!this._rttFingerprints[r]){this._rttFingerprints[r]={};const e=null!==(o=null===(i=t.tileManagers[r])||void 0===i?void 0:i.getState().revision)&&void 0!==o?o:0;for(const t in this._coordsAscending[r])this._rttFingerprints[r][t]=`${this._coordsAscending[r][t].map((t=>t.key)).sort().join()}#${e}`;}}for(const t of this._renderableTiles)for(const e in this._rttFingerprints){const i=this._rttFingerprints[e][t.tileID.key];i&&i!==t.rttFingerprint[e]&&(t.rtt=[]);}}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return !1;const o=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),s=t.type,r=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(hn[s]&&(this._prevType&&hn[this._prevType]||this._stacks.push([]),this._prevType=s,this._stacks[this._stacks.length-1].push(t.id),!n))return !0;if(hn[this._prevType]||hn[s]&&n){this._prevType=s;const t=this._stacks.length-1,i=this._stacks[t]||[];
40for(const s of this._renderableTiles){if(this.pool.isFull()&&(Hs(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[t]){const e=this.pool.getObjectForId(s.rtt[t].id);if(e.stamp===s.rtt[t].stamp){this.pool.useObject(e);continue}}const n=this.pool.getOrCreateFreeObject();this.pool.useObject(n),this.pool.stampObject(n),s.rtt[t]={id:n.id,stamp:n.stamp},r.context.bindFramebuffer.set(n.fbo.framebuffer),r.context.clear({color:e.bn.transparent,stencil:0}),r.currentStencilSource=void 0;for(let t=0;t<i.length;t++){const e=r.style._layers[i[t]],a=e.source?this._coordsAscending[e.source][s.tileID.key]:[s.tileID];r.context.viewport.set([0,0,n.fbo.width,n.fbo.height]),r._renderTileClippingMasks(e,a,!0),r.renderLayer(r,r.style.tileManagers[e.source],e,a,o),e.source&&(s.rttFingerprint[e.source]=this._rttFingerprints[e.source][s.tileID.key]);}}return Hs(this.painter,this.terrain,this._rttTiles,o),this._rttTiles=[],this.pool.freeAllObjects(),hn[s]}return !1}}const un={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},dn=p,_n={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:tn,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:e.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let pn,mn=class extends Jr{get _ownerWindow(){var t,e;return (null===(e=null===(t=this._container)||void 0===t?void 0:t.ownerDocument)||void 0===e?void 0:e.defaultView)||window}constructor(t){var i,o;e.cE.mark(e.cF.create);const s=Object.assign(Object.assign(Object.assign({},_n),t),{canvasContextAttributes:Object.assign(Object.assign({},_n.canvasContextAttributes),t.canvasContextAttributes)});if(null!=s.minZoom&&null!=s.maxZoom&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=s.minPitch&&null!=s.maxPitch&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=s.minPitch&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=s.maxPitch&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const r=new Ke,a=new ei;void 0!==s.minZoom&&r.setMinZoom(s.minZoom),void 0!==s.maxZoom&&r.setMaxZoom(s.maxZoom),void 0!==s.minPitch&&r.setMinPitch(s.minPitch),void 0!==s.maxPitch&&r.setMaxPitch(s.maxPitch),void 0!==s.renderWorldCopies&&r.setRenderWorldCopies(s.renderWorldCopies),null!==s.transformConstrain&&r.setConstrainOverride(s.transformConstrain),super(r,a,{bearingSnap:s.bearingSnap,zoomSnap:s.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new sn,this._controls=[],this._mapId=e.ac(),this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with i
40d '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(const[e]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${e}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new e.l("webglcontextlost",{originalEvent:t}));}else this.fire(new e.l("webglcontextlost",{originalEvent:t}));},this._contextRestored=t=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new e.l("webglcontextrestored",{originalEvent:t}));},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update();},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=!0===s.trackResize,this._bearingSnap=s.bearingSnap,this._zoomSnap=s.zoomSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=!0===s.refreshExpiredTiles,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=!0===s.crossSourceCollisions,this._collectResourceTiming=!0===s.collectResourceTiming,this._locale=Object.assign(Object.assign({},un),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this._zoomLevelsToOverscale=s.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=s.transformCameraUpdate,this.transformConstrain=s.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===s.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(s.anisotropicFilterPitch),void 0!==s.reduceMotion&&(n.prefersReducedMotion=s.reduceMotion),this._imageQueueHandle=_.addThrottleControl((()=>this.isMoving())),this._requestManager=new m(s.transformRequest),this._container=this._resolveContainer(s.container),s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0);})),this.once("idle",(()=>{this._idleTriggered=!0;})),"undefined"!=typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Qr(this,s),this._hash=s.hash&&new Qs("string"==typeof s.hash&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,e.e({},s.fitBoundsOptions,{duration:0}))));const l="string"==typeof s.style||!("globe"===(null===(o=null===(i=s.style)||void 0===i?void 0:i.projection)||void 0===o?void 0:o.type));this.resize(null,l),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new en("boolean"==typeof s.attributionControl?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new on,s.logoPosition),this.on("style.load",(()=>{if(l||this._resizeTransform(),this.transform.unmodified){const t=e.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t);}})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.l(`${t.dataType}data`,t));})),this.on("dataloading",(t=>{this.fire(new e.l(`${t.dataType}dataloading`,t));})),this.on("dataabort",(t=>{this.fire(new e.l("sourcedataabort",t));}));}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=t.onAdd(this);this._controls.push(t);const s=this._controlPositions[i];return -1!==i.indexOf("bottom")?s.insertBefore(o,s.firstChild):s.appendChild(o),this}
40removeControl(t){if(!t||!t.onRemove)return this.fire(new e.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}coveringTiles(t){return Lt(this.transform,t)}calculateCameraOptionsFromTo(t,e,i,o){return null==o&&this.terrain&&(o=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(t,e,i,o)}resize(t,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);const o=!this._moving;return o&&(this.stop(),this.fire(new e.l("movestart",t)).fire(new e.l("move",t))),this.fire(new e.l("resize",t)),o&&this.fire(new e.l("moveend",t)),this}_resizeInternal(t=!0){const[e,i]=this._containerDimensions(),o=this._getClampedPixelRatio(e,i);if(this._resizeCanvas(e,i,o),this.painter.resize(e,i,o),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const o=this._getClampedPixelRatio(e,i);this._resizeCanvas(e,i,o),this.painter.resize(e,i,o);}this._resizeTransform(t);}_resizeTransform(t=!0){var e;const[i,o]=this._containerDimensions();this.transform.resize(i,o,t),null===(e=this._requestedCameraState)||void 0===e||e.resize(i,o,t);}_getClampedPixelRatio(t,e){const{0:i,1:o}=this._maxCanvasSize,s=this.getPixelRatio(),r=t*s,n=e*s;return Math.min(r>i?i/r:1,n>o?o/n:1)*s}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize();}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(q.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom){const i=this.transform.zoom,o=this._getTransformForUpdate();return o.setMinZoom(t),this._applyUpdatedTransform(o),this._update(),i!==this.transform.zoom&&this.fire(new e.l("zoomstart")).fire(new e.l("zoom")).fire(new e.l("zoomend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),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){const i=this.transform.zoom,o=this._getTransformForUpdate();return o.setMaxZoom(t),this._applyUpdatedTransform(o),this._update(),i!==this.transform.zoom&&this.fire(new e.l("zoomstart")).fire(new e.l("zoom")).fire(new e.l("zoomend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),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){const i=this.transform.pitch,o=this._getTransformForUpdate();return o.setMinPitch(t),this._applyUpdatedTransform(o),this._update(),i!==this.transform.pitch&&this.fire(new e.l("pitchstart")).fire(new e.l("pitch")).fire(new e.l("pitchend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),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)>180)throw new Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch){const i=this.transform.pitch,o=this._getTransformForUpdate();return o.setMaxPitch(t),this._applyUpdatedTransform(o),this._update(),i!==this.transform.pitch&&this.fire(new e.l("pitchstart")).fire(new e.l("pitch")).fire(new e.l("pitchend")).fire(new e.l("movestart")).fire(new e.l("move")).fire(new e.l("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t=null==t?20:t)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this.transform.setConstrainOverride(t),this._update()}project(t){return this.transform.locationToScreenPoint(e.V.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}
40_createDelegatedListener(t,e,i){if("mouseenter"===t||"mouseover"===t){let o=!1;const s=s=>{const r=e.filter((t=>this.getLayer(t))),n=0!==r.length?this.queryRenderedFeatures(s.point,{layers:r}):[];n.length?o||(o=!0,i.call(this,new lr(t,this,s.originalEvent,{features:n}))):o=!1;};return {layers:e,listener:i,delegates:{mousemove:s,mouseout:()=>{o=!1;}}}}if("mouseleave"===t||"mouseout"===t){let o=!1;const s=s=>{const r=e.filter((t=>this.getLayer(t)));(0!==r.length?this.queryRenderedFeatures(s.point,{layers:r}):[]).length?o=!0:o&&(o=!1,i.call(this,new lr(t,this,s.originalEvent)));},r=e=>{o&&(o=!1,i.call(this,new lr(t,this,e.originalEvent)));};return {layers:e,listener:i,delegates:{mousemove:s,mouseout:r}}}{const o=t=>{const o=e.filter((t=>this.getLayer(t))),s=0!==o.length?this.queryRenderedFeatures(t.point,{layers:o}):[];s.length&&(t.features=s,i.call(this,t),delete t.features);};return {layers:e,listener:i,delegates:{[t]:o}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e);}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const o=this._delegatedListeners[t];for(let t=0;t<o.length;t++){const s=o[t];if(s.listener===i&&s.layers.length===e.length&&s.layers.every((t=>e.includes(t)))){for(const t in s.delegates)this.off(t,s.delegates[t]);return void o.splice(t,1)}}}on(t,e,i){if(void 0===i)return super.on(t,e);const o="string"==typeof e?[e]:e,s=this._createDelegatedListener(t,o,i);this._saveDelegatedListener(t,s);for(const t in s.delegates)this.on(t,s.delegates[t]);return {unsubscribe:()=>{this._removeDelegatedListener(t,o,i);}}}once(t,e,i){if(void 0===i)return super.once(t,e);const o="string"==typeof e?[e]:e,s=this._createDelegatedListener(t,o,i);for(const e in s.delegates){const r=s.delegates[e];s.delegates[e]=(...e)=>{this._removeDelegatedListener(t,o,i),r(...e);};}this._saveDelegatedListener(t,s);for(const t in s.delegates)this.once(t,s.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,"string"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,i){if(!this.style)return [];let o;const s=t instanceof e.P||Array.isArray(t),r=s?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(s?{}:t)||{},r instanceof e.P||"number"==typeof r[0])o=[e.P.convert(r)];else {const t=e.P.convert(r[0]),i=e.P.convert(r[1]);o=[t,new e.P(i.x,t.y),i,new e.P(t.x,i.y),t];}return this.style.queryRenderedFeatures(o,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,i){return !1!==(i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
40idateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var i,o;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(t,e)));const s=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new ji(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,e,s):this.style.loadJSON(t,e,s),this):(null===(o=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===o||o.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ji(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty());}_diffStyle(t,i){return e._(this,void 0,void 0,(function*(){if("string"==typeof t){const o=t,s=yield this._requestManager.transformRequest(o,"Style");try{const t=yield e.j(s,new AbortController);this._updateDiff(t.data,i);}catch(t){t&&this.fire(new e.k(t));}}else "object"==typeof t&&this._updateDiff(t,i);}))}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0);}catch(o){e.w(`Unable to perform style diff: ${o.message||o.error||o}.  Rebuilding the style from scratch.`),this._updateStyle(t,i);}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():e.w("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.tileManagers[t];if(void 0!==i)return i.loaded();this.fire(new e.k(new Error(`There is no tile manager with ID '${t}'`)));}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){const i=this.style.tileManagers[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const o=this.style._layers[i];"hillshade"===o.type&&o.source===t.source&&e.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===o.type&&o.source===t.source&&e.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.");}this.terrain=new an(this.painter,i,t),this.painter.renderToTexture=new cn(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=e=>{var i;"style"===e.dataType?this.terrain.tileManager.freeRtt():"source"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=e.source)||void 0===i?void 0:i.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(e.tile.tileID));},this.style.on("data",this._terrainDataCallback);}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
40d&&this.transform.setElevation(0);return this.fire(new e.l("terrain",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.tileManagers;for(const e of Object.values(t))if(!e.areTilesLoaded())return !1;return !0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,e,i){if(i){const o=this.getSource(i);if(!o)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);o.calculateTileZoom=It(Math.max(1,t),Math.max(1,e));}else for(const i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=It(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,i){const o=this.style.tileManagers[t];if(!o)throw new Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===i?o.reload(!0):o.refreshTiles(i.map((t=>new e.a9(t.z,t.x,t.y))));}addImage(t,i,o={}){const{pixelRatio:s=1,sdf:r=!1,stretchX:a,stretchY:l,content:h,textFitWidth:c,textFitHeight:u}=o;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:o,height:n,data:d}=i,_=i;return this.style.addImage(t,{data:new e.R({width:o,height:n},new Uint8Array(d)),pixelRatio:s,stretchX:a,stretchY:l,content:h,textFitWidth:c,textFitHeight:u,sdf:r,version:0,userImage:_}),_.onAdd&&_.onAdd(this,t),this}}{const{width:o,height:d,data:_}=n.getImageData(i);this.style.addImage(t,{data:new e.R({width:o,height:d},_),pixelRatio:s,stretchX:a,stretchY:l,content:h,textFitWidth:c,textFitHeight:u,sdf:r,version:0});}}updateImage(t,i){const o=this.style.getImage(t);if(!o)return this.fire(new e.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=i instanceof HTMLImageElement||e.b(i)?n.getImageData(i):i,{width:r,height:a,data:l}=s;if(void 0===r||void 0===a)return this.fire(new e.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(r!==o.data.width||a!==o.data.height)return this.fire(new e.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const h=!(i instanceof HTMLImageElement||e.b(i));return o.data.replace(l,h),this.style.updateImage(t,o),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.k(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t);}loadImage(t){return e._(this,void 0,void 0,(function*(){return _.getImage(yield this._requestManager.transformRequest(t,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){if(this._debugLayerOrdering&&this._debugLayerOrdering.has(t))throw new Error(`Attempted to remove a ordered layer with ID ${t} using a non-ordered removeLayer function. Use LeafletGL map's "removeMapLibreOrderedLayer" function instead.`);return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,o={}){return this.style.setPaintProperty(t,e,i,o),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,o={}){return this.style.setLayoutProperty(t,e,i,o),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0);})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0);})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupResizeObserver(){var t;let e=!1;const i=Ks((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw());}),50),o=null!==(t=this._ownerWindow.ResizeObserver)&&void 0!==t?t:ResizeObserver;this._resizeObserver=new o((t=>{e?i(t):e=!0;})),this._resizeObserver.observe(this._container);}
40_resolveContainer(t){if("string"==typeof t){const e=document.getElementById(t);if(!e)throw new Error(`Container '${t}' not found.`);return e}if(t instanceof HTMLElement)return t;if(t&&"object"==typeof t&&1===t.nodeType)return t;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const t=this._container;t.classList.add("maplibregl-map");const e=this._canvasContainer=d.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=d.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),o=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],o);const s=this._controlContainer=d.create("div","maplibregl-control-container",t),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((t=>{r[t]=d.create("div",`maplibregl-ctrl-${t} `,s);})),this._container.addEventListener("scroll",this._onMapScroll,!1);}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`;}_setupPainter(){const t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type);}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i){const t="Failed to initialize WebGL";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new Ys(i,this.transform);}migrateProjection(t,i){super.migrateProjection(t,i),this.painter.transform=t,this.fire(new e.l("projectiontransition",{newProjection:this.style.projection.name}));}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t);}_render(t){var i,o,s,r,n;const a=this._idleTriggered?this._fadeDuration:0,h=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let c=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=l();this.style.zoomHistory.update(t,i);const o=new e.H(t,{now:i,fadeDuration:a,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),s=o.crossFadingFactor();1===s&&s===this._crossFadingFactor||(c=!0,this._crossFadingFactor=s),this.style.update(o);}const u=(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState)>0!==h;null===(s=this.style.projection)||void 0===s||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState,null===(n=this.style.projection)||void 0===n?void 0:n.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
40d&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,a,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new e.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.cE.mark(e.cF.load),this.fire(new e.l("load"))),this.style&&(this.style.hasTransitions()||c)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,e.cE.mark(e.cF.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),_.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),e.cE.remove(),this._removed=!0,this.fire(new e.l("remove"));}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,n.frame(this._frameRequest,(t=>{e.cE.recordStartOfFrameAt(t),this._frameRequest=null;try{this._render(t);}catch(t){if(!e.Z(t)&&!function(t){return t.message===cs}(t))throw t}}),(()=>{}),this._ownerWindow));}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update());}get showPadding(){return !!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update());}get repaint(){return !!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(t){this._vertices=t,this._update();}get version(){return dn}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}};function fn(t){if(null!=t&&"number"==typeof t)return Math.max(t-1,0)}function gn(t,e){if(!1===e)return t;const i=Math.pow(10,void 0===e?6:e);return Math.round(t*i)/i}function vn(t,e,i){const o=e[1],s=e[0],r=o-s;return t===o&&i?t:((t-s)%r+r)%r+s}function yn(t){return t.trim().split(/\s+/)}function bn(t){if(!("_leaflet_id"in t)){if(!pn){const t=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;throw new Error("Unable to locate global object.")}();t.leafletGLstampIdContainer||(t.leafletGLstampIdContainer={lastId:0}),pn=t.leafletGLstampIdContainer;}t._leaflet_id=++pn.lastId;}return t._leaflet_id}function xn(){return !1}
40class wn extends Error{constructor(){super("This layer is not in a map.");}}class Tn{constructor(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e;}mapboxPoint(){return new e.P(this.x,this.y)}static fromMapbox(t){return new Tn(t.x,t.y)}clone(){return new Tn(this.x,this.y)}add(t){return this.clone()._add(Pn(t))}_add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.clone()._subtract(Pn(t))}_subtract(t){return this.x-=t.x,this.y-=t.y,this}divideBy(t){return this.clone()._divideBy(t)}_divideBy(t){return this.x/=t,this.y/=t,this}multiplyBy(t){return this.clone()._multiplyBy(t)}_multiplyBy(t){return this.x*=t,this.y*=t,this}scaleBy(t){return new Tn(this.x*t.x,this.y*t.y)}unscaleBy(t){return new Tn(this.x/t.x,this.y/t.y)}round(){return this.clone()._round()}_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}floor(){return this.clone()._floor()}_floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.clone()._ceil()}_ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}trunc(){return this.clone()._trunc()}_trunc(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}distanceTo(t){const e=Pn(t),i=e.x-this.x,o=e.y-this.y;return Math.sqrt(i*i+o*o)}equals(t){const e=Pn(t);return e.x===this.x&&e.y===this.y}contains(t){const e=Pn(t);return Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)}toString(){return `Point(${gn(this.x)} ${gn(this.y)})`}sub(t){return this.clone()._subtract(Pn(t))}_sub(t){return this.x-=t.x,this.y-=t.y,this}divByPoint(t){return this.clone()._divByPoint(Pn(t))}_divByPoint(t){return this.x/=t.x,this.y/=t.y,this}div(t){return this.clone()._divideBy(t)}_div(t){return this.x/=t,this.y/=t,this}mult(t){return this.clone()._multiplyBy(t)}_mult(t){return this.x*=t,this.y*=t,this}multByPoint(t){return this.clone()._multByPoint(Pn(t))}_multByPoint(t){return this.x*=t.x,this.y*=t.y,this}rotate(t){return this.clone()._rotate(t)}rotateAround(t,e){return this.clone()._rotateAround(t,e)}matMult(t){return this.clone()._matMult(t)}unit(){return this.clone()._unit()}perp(){return this.clone()._perp()}mag(){return Math.sqrt(this.x*this.x+this.y*this.y)}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i}angle(){return Math.atan2(this.y,this.x)}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}angleWith(t){return this.angleWithSep(t.x,t.y)}angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)}_matMult(t){const e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this}_unit(){return this._div(this.mag()),this}_perp(){const t=this.y;return this.y=this.x,this.x=-t,this}_rotate(t){const e=Math.cos(t),i=Math.sin(t),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this}_rotateAround(t,e){const i=Math.cos(t),o=Math.sin(t),s=e.y+o*(this.x-e.x)+i*(this.y-e.y);
40return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=s,this}static convert(t){return Pn(t)}}function Pn(t,e,i){return t instanceof Tn?t:Array.isArray(t)?new Tn(t[0],t[1]):void 0!==t?null===t?null:"number"==typeof t?"number"==typeof e?new Tn(t,e,i):new Tn(t,t):"object"==typeof t&&"x"in t&&"y"in t?new Tn(+t.x,+t.y):void 0:void 0}const Mn=6371e3;class Cn{constructor(t,e,i){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LatLng object: (${t}, ${e})`);this.lat=+t,this.lng=+e,void 0!==i&&(this.alt=+i);}equals(t,e){return !!t&&(t=In(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===e?1e-9:e))}toString(t){return `LatLng(${gn(this.lat,t)}, ${gn(this.lng,t)})`}distanceTo(t){const e=In(t),i=Math.PI/180,o=this.lat*i,s=e.lat*i,r=Math.sin((e.lat-this.lat)*i/2),n=Math.sin((e.lng-this.lng)*i/2),a=r*r+Math.cos(o)*Math.cos(s)*n*n,l=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return Mn*l}wrap(){return new Cn(this.lat,vn(this.lng,[-180,180],!0),this.alt)}clone(){return new Cn(this.lat,this.lng,this.alt)}}function In(t,e,i){if(t instanceof Cn)return t;if(null==t)throw new Error("The first parameter of toLatLng cannot be null or undefined.");if(Array.isArray(t)){if(3===t.length)return new Cn(t[0],t[1],t[2]);if(2===t.length)return new Cn(t[0],t[1]);throw new Error("The first parameter of toLatLng cannot be an array of a length different than 2 or 3.")}if("object"==typeof t&&"lat"in t)return new Cn(t.lat,"lng"in t?t.lng:t.lon,t.alt);if(void 0===e)throw new Error("The second parameter of toLatLng cannot be null or undefined when the first parameter is not sufficient to describe coordinates.");return new Cn(t,e,i)}class En{constructor(t,e){if(!t)return;if("object"==typeof t&&"_northEast"in t&&"_southWest"in t)return this.extend(In(t._northEast)),void this.extend(In(t._southWest));const i=Ln(t)?e?[t,e]:[t]:t,o=i.length;for(let t=0;t<o;t++)this.extend(i[t]);}extend(t){const e=this._southWest,i=this._northEast;let o,s;if(Ln(t)){const e=In(t);o=e,s=e;}else {const e=Sn(t);if(o=e._southWest,s=e._northEast,!o||!s)return this}return e||i?(e.lat=Math.min(o.lat,e.lat),e.lng=Math.min(o.lng,e.lng),i.lat=Math.max(s.lat,i.lat),i.lng=Math.max(s.lng,i.lng)):(this._southWest=new Cn(o.lat,o.lng),this._northEast=new Cn(s.lat,s.lng)),this}pad(t){const e=this._southWest,i=this._northEast,o=Math.abs(e.lat-i.lat)*t,s=Math.abs(e.lng-i.lng)*t;return new En(new Cn(e.lat-o,e.lng-s),new Cn(i.lat+o,i.lng+s))}getCenter(){return new Cn((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)}getSouthWest(){return this._southWest}getNorthEast(){return this._northEast}getNorthWest(){return new Cn(this.getNorth(),this.getWest())}getSouthEast(){return new Cn(this.getSouth(),this.getEast())}getWest(){return this._southWest.lng}getSouth(){return this._southWest.lat}getEast(){return this._northEast.lng}getNorth(){return this._northEast.lat}contains(t){let e,i;
40Ln(t)?e=i=t=In(t):(e=(t=Sn(t)).getSouthWest(),i=t.getNorthEast());const o=this._southWest,s=this._northEast;return e.lat>=o.lat&&i.lat<=s.lat&&e.lng>=o.lng&&i.lng<=s.lng}intersects(t){t=Sn(t);const e=this._southWest,i=this._northEast,o=t.getSouthWest(),s=t.getNorthEast();return s.lat>=e.lat&&o.lat<=i.lat&&s.lng>=e.lng&&o.lng<=i.lng}overlaps(t){t=Sn(t);const e=this._southWest,i=this._northEast,o=t.getSouthWest(),s=t.getNorthEast();return s.lat>e.lat&&o.lat<i.lat&&s.lng>e.lng&&o.lng<i.lng}toBBoxString(){return [this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")}equals(t,e){return !!t&&(t=Sn(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))}isValid(){return !(!this._southWest||!this._northEast)}}function Sn(t,e){return t instanceof En?t:new En(t,e)}function Ln(t){return !(t instanceof En||Array.isArray(t)&&"number"!=typeof t[0])}function zn(t,e){return new En(t,e)}const Rn=!Bn("chrome")&&Bn("safari");"undefined"!=typeof orientation||Bn("mobile");const Dn="undefined"!=typeof window&&!!window.PointerEvent,An="undefined"!=typeof window&&("ontouchstart"in window||!!window.TouchEvent),kn=An||Dn,On="undefined"!=typeof window&&void 0!==window.devicePixelRatio&&window.devicePixelRatio>1;function Bn(t){return "undefined"!=typeof navigator&&void 0!==navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t)}"undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Mac"),"undefined"!=typeof navigator&&void 0!==navigator.platform&&navigator.platform.startsWith("Linux");var Fn={safari:Rn,pointer:Dn,touch:kn,touchNative:An,retina:On};const jn={touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",touchcancel:"pointercancel"},Nn={touchstart:function(t,e){qn(t,e);},touchmove:qn,touchend:qn,touchcancel:qn},Zn={};let Gn=!1;function Un(t){Zn[t.pointerId]=t;}function Vn(t){Zn[t.pointerId]&&(Zn[t.pointerId]=t);}function Wn(t){delete Zn[t.pointerId];}function qn(t,e){if("mouse"!==e.pointerType){e.touches=[];for(const t in Zn)Object.prototype.hasOwnProperty.call(Zn,t)&&e.touches.push(Zn[t]);e.changedTouches=[e],t(e);}}function $n(t,e,i,o){if("string"==typeof e){const s=yn(e);for(let e=0,r=s.length;e<r;e++)Qn(t,s[e],i,o);}else for(const[o,s]of Object.entries(e))Qn(t,o,s,i);}const Hn="_leaflet_events";function Xn(t,e,i,o){if(e)if("string"==typeof e){const s=yn(e);if(void 0===i)Yn(t,(t=>s.includes(t)));else for(let r=0,n=e.length;r<n;r++)Jn(t,s[r],i,o);}else for(const[o,s]of Object.entries(e))Jn(t,o,s,i);else Yn(t),delete t[Hn];}function Yn(t,e){for(const i in t[Hn])if(Object.prototype.hasOwnProperty.call(t[Hn],i)){const o=i.split(/\d/)[0];e&&!e(o)||Jn(t,o,null,void 0,i);}}
40const Kn={mouseenter:"mouseover",mouseleave:"mouseout",wheel:"undefined"!=typeof window&&!("onwheel"in window)};function Qn(t,e,i,o){var s;const r=e+bn(i)+(o?`_${bn(o)}`:"");if(null===(s=t[Hn])||void 0===s?void 0:s[r])return;let n=function(e){return i.call(o||t,e||window.event)};const a=n;!Fn.touchNative&&Fn.pointer&&e.startsWith("touch")?n=function(t,e,i){return "touchstart"===e&&(Gn||(document.addEventListener("pointerdown",Un,!0),document.addEventListener("pointermove",Vn,!0),document.addEventListener("pointerup",Wn,!0),document.addEventListener("pointercancel",Wn,!0),Gn=!0)),Nn[e]?(i=Nn[e].bind(this,i),t.addEventListener(jn[e],i,!1),i):(console.warn("wrong event specified:",e),xn)}(t,e,n):Fn.touch&&"dblclick"===e?n=function(t,e){t.addEventListener("dblclick",e);let i,o=0;function s(t){var e;if(1!==t.detail)return void(i=t.detail);if("mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents)return;const s=t.composedPath();if(s.some((t=>t instanceof HTMLLabelElement&&"for"in t.attributes))&&!s.some((t=>t instanceof HTMLInputElement||t instanceof HTMLSelectElement)))return;const r=Date.now();r-o<=200?(i++,2===i&&(null===(e=t.target)||void 0===e||e.dispatchEvent(function(t){const e={bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed,detail:2,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey,button:t.button,buttons:t.buttons,relatedTarget:t.relatedTarget,region:t.region,pointerId:void 0,width:void 0,height:void 0,pressure:void 0,tangentialPressure:void 0,tiltX:void 0,tiltY:void 0,twist:void 0,pointerType:void 0,isPrimary:void 0};let i;if(t instanceof PointerEvent){const o=Object.assign(Object.assign({},e),{pointerId:t.pointerId,width:t.width,height:t.height,pressure:t.pressure,tangentialPressure:t.tangentialPressure,tiltX:t.tiltX,tiltY:t.tiltY,twist:t.twist,pointerType:t.pointerType,isPrimary:t.isPrimary});i=new PointerEvent("dblclick",o);}else i=new MouseEvent("dblclick",e);return i}(t)))):i=1,o=r;}return t.addEventListener("click",s),{dblclick:e,simDblclick:s}}(t,n):"addEventListener"in t?"touchstart"===e||"touchmove"===e||"wheel"===e?t.addEventListener(Kn[e]||e,n,{passive:!1}):"mouseenter"===e||"mouseleave"===e?(n=function(e){e=e||window.event,ia(t,e)&&a(e);},t.addEventListener(Kn[e],n,!1)):t.addEventListener(e,a,!1):t.attachEvent(`on${e}`,n),t[Hn]=t[Hn]||{},t[Hn][r]=n;}function Jn(t,e,i,o,s){s=s||e+bn(i)+(o?`_${bn(o)}`:"");const r=t[Hn]&&t[Hn][s];r&&(!Fn.touchNative&&Fn.pointer&&e.startsWith("touch")?function(t,e,i){jn[e]?t.removeEventListener(jn[e],i,!1):console.warn("wrong event specified:",e);}(t,e,r):Fn.touch&&"dblclick"===e?function(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick);}(t,r):"removeEventListener"in t?t.removeEventListener(Kn[e]||e,r,!1):t.detachEvent(`on${e}`,r),t[Hn][s]=null);}function ta(t){t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0;}function ea(t){t.preventDefault?t.preventDefault():t.returnValue=!1;}function ia(t,e){let i=e.relatedTarget;if(!i)return !0;try{for(;i&&i!==t;)i=i.parentNode;}catch(t){return !1}return i!==t}var oa={on:$n,addListener:$n,off:Xn,removeListener:Xn,stopPropagation:ta,disableScrollPropagation:function(t){Qn(t,"wheel",ta);},disableClickPropagation:function(t){$n(t,"mousedown touchstart dblclick contextmenu",ta),t._leaflet_disable_click=!0;},preventDefault:ea,stop:function(t){ea(t),ta(t);},isExternalTarget:ia};const sa=/\{ *([\w_ -]+) *\}/g,ra=JSON.parse("true");function na(t,e){return t.replace(sa,((t,i)=>{let o=e[i];if(void 0===o)throw new Error(`No value provided for variable ${t}`);return "function"==typeof o&&(o=o(e)),o}))}function aa(t,e,i){const o=e||new Tn(0,0);t.style.transform=`translate3d(${o.x}px,${o.y}px,0)${i?` scale(${i})`:""}`;}function la(t){const i=In(t);return new e.V(i.lng,i.lat)}
40function ha(t){const e=1/Math.max(t||.5,.2);return t=>1-Math.pow(1-t,e)}function ca(t){return t instanceof En?t:Sn(t)}function ua(t){const e=ca(t);return q.convert([e.getWest(),e.getSouth(),e.getEast(),e.getNorth()])}function da(t,e){let i=e.relatedTarget;if(!i)return !0;try{for(;i&&i!==t;)i=i.parentNode;}catch(t){return !1}return i!==t}function _a(t,e){return window.requestAnimationFrame(t.bind(e))}function pa(t){void 0!==t&&"undefined"!=typeof window&&window.cancelAnimationFrame(t);}function ma(t,...e){for(let i=0,o=e.length;i<o;i++){const o=e[i];for(const e in o)t[e]=o[e];}return t}function fa(t,e){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?Object.create(t.options):{});for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t.options[i]=e[i]);return t.options}function ga(t,e,i){oa.on(t,"focus",(()=>{i._tooltip&&(i._tooltip._source=e,i.openTooltip());}),i),oa.on(t,"blur",i.closeTooltip,i);}function va(t,e){var i;const o=null===(i=e._tooltip)||void 0===i?void 0:i.containerId;o&&t.setAttribute("aria-describedby",o);}function ya(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}class ba{constructor(){this._events={},this._firingCount=0,this._eventParents={};}on(t,e,i){if("object"==typeof t)for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&void 0!==t[i]&&this._on(i,t[i],e);else if(t){const o=yn(t);for(let t=0,s=o.length;t<s;t++)this._on(o[t],e,i);}return this}off(t,e,i){if(arguments.length){if("object"==typeof t)for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&void 0!==t[i]&&this._off(i,t[i],e);else if(t){const o=yn(t),s=1===arguments.length;for(let t=0,r=o.length;t<r;t++)s?this._off(o[t]):this._off(o[t],e,i);}}else this._events={};return this}_on(t,e,i,o){if("function"!=typeof e)return void console.warn("wrong listener type: "+typeof e);if(!1!==this._listens(t,e,i))return;i===this&&(i=void 0);const s={fn:e,ctx:i};o&&(s.once=!0),this._events[t]=this._events[t]||[],this._events[t].push(s);}_off(t,e,i){if(!this._events)return;let o=this._events[t];if(!o)return;if(1===arguments.length){if(this._firingCount>0)for(let t=0,e=o.length;t<e;t++)o[t].fn=xn;return void delete this._events[t]}if("function"!=typeof e)return void console.warn("wrong listener type: "+typeof e);const s=this._listenerIndex(t,e,i);s>=0&&(this._firingCount>0&&(o[s].fn=xn,this._events[t]=o=o.slice()),o.splice(s,1));}fire(t,e,i){if(!this.listens(t,i))return this;const o=ma({},null!=e?e:{},{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){const e=this._events[t];if(e){this._firingCount++;for(let i=0,s=e.length;i<s;i++){const s=e[i],r=s.fn;s.once&&this._off(t,r,s.ctx),r.call(s.ctx||this,o);}this._firingCount--;}}return i&&this._propagateEvent(o),this}listens(t,e,i,o){let s;"function"!=typeof e?(o=!!e,s=void 0,i=void 0):s=e;const r=this._events&&this._events[t];if(r&&r.length&&!1!==this._listens(t,s,i))return !0;if(o)for(const s in this._eventParents)if(this._eventParents[s].listens(t,e,i,o))return !0;return !1}_listens(t,e,i){const o=this._events[t]||[];if(!e)return !!o.length;i===this&&(i=void 0);for(let t=0,s=o.length;t<s;t++)if(o[t].fn===e&&o[t].ctx===i)return !0;return !1}_listenerIndex(t,e,i){const o=this._events[t]||[];i===this&&(i=void 0);for(let t=0,s=o.length;t<s;t++)if(o[t].fn===e&&o[t].ctx===i)return t;return -1}once(t,e,i){if("object"==typeof t)for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&void 0!==t[i]&&this._on(i,t[i],e,!0);else {const o=yn(t);for(let t=0,s=o.length;t<s;t++)this._on(o[t],e,i,!0);}return this}addEventParent(t){return this._eventParents=this._eventParents||{},this._eventParents[bn(t)]=t,this}removeEventParent(t){return this._eventParents&&delete this._eventParents[bn(t)],this}_propagateEvent(t){for(const e in this._eventParents)Object.prototype.hasOwnProperty.call(this._eventParents,e)&&this._eventParents[e].fire(t.type,ma({layer:t.target,propagatedFrom:t.target},t),!0);}}class xa extends ba{get map(){return this._map}set map(t){this._map=t;}get leafletMap(){var t;return null===(t=this._map)||void 0===t?void 0:t.leafletMap}constructor(t){super(),this._popup=null,this._tooltip=null,this._tooltipHandlersAdded=!1,this._moveEndOpensTooltip=!1,this.options=Object.assign(Object.assign({},xa.defaultOptions),t);}addTo(t){return t.addLayer(this),this}remove(){if(!this._map)throw new wn;return this.removeFrom(this._map)}removeFrom(t){return t&&t.removeLayer(this),this}getPane(t){var e;return this._map&&null!==(null===(e=this.options)||void 0===e?void 0:e.pane)?this._map.getPane(t?this.options[t]||t:this.options.pane):null}addInteractiveTarget(t){if(!this._map)throw new wn;return this._map instanceof xa?this._map.addInteractiveTarget(t):this._map.interactiveTargets[bn(t)]=this,this}removeInteractiveTarget(t){if(!this._map)throw new wn;return this._map instanceof xa?this._map.removeInteractiveTarget(t):delete this._map.interactiveTargets[bn(t)],this}getAttribution(){return this.options.attribution}_layerAdd(t){const e=t.target;if(e.hasLayer(this)){if(this._map=e,this._tooltip&&this._initTooltipInteractions(),this.getEvents){const t=this.getEvents();e.on(t,this),this.once("remove",(function(){e.off(t,this);}),this);}this.onAdd&&this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this});}}_initOverlay(t,e,i,o){if(i instanceof t)return fa(i,o),i._source=this,i;{const s=e&&!o?e:new t(o,this);return s.setContent(i),s}}unbindPopup(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this}bindPopup(t,e){return this._popup=this._initOverlay(xa.Popup,this._popup,t,e),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this}openPopup(t){return this._popup&&(this._popup._source=this,this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this.leafletMap)),this}
40closePopup(){return this._popup&&this._popup.close(),this}togglePopup(){return this._popup&&this._popup.toggle(this),this}isPopupOpen(){return !!this._popup&&this._popup.isOpen()}setPopupContent(t){return this._popup&&this._popup.setContent(t),this}getPopup(){return this._popup}_openPopup(t){if(!this._popup||!this._map)return;oa.stop(t);const e=t.layer||t.target;this._popup._source!==e||"type"in e&&"Path"===e.type?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);}_movePopup(t){this._popup&&this._popup.setLatLng(t.latlng);}_onKeyPress(t){"Enter"===t.originalEvent.code&&this._openPopup(t);}bindTooltip(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(xa.Tooltip,this._tooltip,t,e),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this}unbindTooltip(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this}_initTooltipInteractions(t){if(!this._tooltip)return;if(!t&&this._tooltipHandlersAdded)return;if(!this._map)return;const e={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?e.add=this._openTooltip:(e.mouseover=this._openTooltip,e.mouseout=this.closeTooltip,e.click=this._openTooltip,this.leafletMap?this._addTooltipFocusListeners(this):e.add=()=>{this._addTooltipFocusListeners(this);}),this._tooltip.options.sticky&&(e.mousemove=this._moveTooltip),t?this.off(e):this.on(e),this._tooltipHandlersAdded=!t;}openTooltip(t){return this._tooltip&&(this.addEventParent&&this.removeEventParent||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this._setAriaDescribedByTooltipLayer(this))),this}closeTooltip(){return this._tooltip&&this._tooltip.close(),this}toggleTooltip(){return this._tooltip&&this._tooltip.toggle(this),this}isTooltipOpen(){return !!this._tooltip&&this._tooltip.isOpen()}setTooltipContent(t){return this._tooltip&&this._tooltip.setContent(t),this}getTooltip(){return this._tooltip}_addTooltipFocusListeners(t){throw new Error("This layer type does not support tooltips.")}_setAriaDescribedByOnLayer(t){t._setAriaDescribedByTooltipLayer(this);}_setAriaDescribedByTooltipLayer(t){throw new Error("This layer type does not support tooltips.")}_openTooltip(t){if(!this._map||!this.leafletMap)throw new wn;if(!this._tooltip)return;if(this.leafletMap.draggingMoving)return void("add"!==t.type||this._moveEndOpensTooltip||(this._moveEndOpensTooltip=!0,this.leafletMap.once("moveend",(()=>{this._moveEndOpensTooltip=!1,this._openTooltip(t);}))));const e=t.layer||t.target;e instanceof xa&&(this._tooltip._source=e),this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0);}_moveTooltip(t){if(!this._map||!this.leafletMap)throw new wn;if(!this._tooltip)return;let e,i,o=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this.leafletMap.mouseEventToContainerPoint(t.originalEvent),i=this.leafletMap.containerPointToLayerPoint(e),o=this.leafletMap.layerPointToLatLng(i)),o&&this._tooltip.setLatLng(o);}toGeoJSON(t){return {type:"FeatureCollection",features:[]}}}xa.defaultOptions={pane:"overlayPane",attribution:null};class wa{constructor(t,e){if(!t)return;const i=Pa(t)&&e&&Pa(e)?[t,e]:"min"in t?[t.min,t.max]:t;for(let t=0,e=i.length;t<e;t++)this.extend(i[t]);}extend(t){if(!t)return this;let e,i;if(Pa(t))e=i=Pn(t);else {const o=Ta(t);if(e=o.min,i=o.max,!e||!i)return this}return this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(i.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(i.y,this.max.y)):(this.min=e.clone(),this.max=i.clone()),this}getCenter(t){return new Tn((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)}getBottomLeft(){return new Tn(this.min.x,this.max.y)}getTopRight(){return new Tn(this.max.x,this.min.y)}getTopLeft(){return this.min}getBottomRight(){return this.max}getSize(){return this.max.subtract(this.min)}contains(t){let e,i;if(Pa(t))e=i=Pn(t);else {const o=Ta(t);e=o.min,i=o.max;}return e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y}intersects(t){const e=Ta(t),i=this.min,o=this.max,s=e.min,r=e.max;return r.x>=i.x&&s.x<=o.x&&r.y>=i.y&&s.y<=o.y}overlaps(t){const e=Ta(t),i=this.min,o=this.max,s=e.min,r=e.max;return r.x>i.x&&s.x<o.x&&r.y>i.y&&s.y<o.y}isValid(){return !(!this.min||!this.max)}pad(t){const e=this.min,i=this.max,o=Math.abs(e.x-i.x)*t,s=Math.abs(e.y-i.y)*t;return Ta(Pn(e.x-o,e.y-s),Pn(i.x+o,i.y+s))}equals(t){if(!t)return !1;const e=Ta(t);return this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight())}}function Ta(t,e){return !t||t instanceof wa?t:new wa(t,e)}function Pa(t){return t instanceof Tn||"number"==typeof t[0]||"x"in t}var Ma;function Ca(t,e,i){const o=document.createElement(t);return o.className=e||"",i&&i.appendChild(o),o}function Ia(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t);}function Ea(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild);}function Sa(t,e,i){const o=e||new Tn(0,0);t.style.transform=`translate3d(${o.x}px,${o.y}px,0)${i?` scale(${i})`:""}`;}const La=new WeakMap;function za(t,e){La.set(t,e),Sa(t,e);}function Ra(t){var e;return null!==(e=La.get(t))&&void 0!==e?e:new Tn(0,0)}const Da="undefined"==typeof document?{}:document.documentElement.style,Aa=null!==(Ma=["userSelect","WebkitUserSelect"].find((t=>t in Da)))&&void 0!==Ma?Ma:"userSelect";let ka,Oa,Ba;function Fa(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(ja(),Oa=t,Ba=t.style.outlineStyle,t.style.outlineStyle="none",oa.on(window,"keydown",ja));}function ja(){Oa&&(Oa.style.outlineStyle=null!=Ba?Ba:"",Oa=void 0,Ba=void 0,oa.off(window,"keydown",ja));}function Na(t){return "correspondingElement"in t&&t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function Za(t,e){if(void 0!==t.classList)return t.classList.contains(e);const i=Na(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function Ga(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e;}const Ua={create:Ca,setTransform:Sa,setPosition:za,getPosition:Ra,addClass:function(t,e){const i=yn(e);if(void 0!==t.classList)for(const e of i)t.classList.add(e);else for(const e of i)if(!Za(t,e)){const i=Na(t);Ga(t,(i?i+" ":"")+e);}}};var Va,Wa,qa,$a;class Ha extends(Wa=xa){constructor(t){super(Object.assign(Object.assign({},Va.defaultOptions),t)),this._container=void 0,this._zoom=void 0,this._center=void 0,this._bounds=void 0;}onAdd(t){return this._container||(this._container=this._initContainer(),this._container.classList.add("leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._resizeContainer(),this._onMoveEnd(),this}onRemove(t){return this._destroyContainer(),this}getEvents(){return {viewreset:this._reset,zoom:this._onZoom,moveend:this._onMoveEnd,zoomend:this._onZoomEnd,resize:this._resizeContainer,move:this.options.continuous?this._onMoveEnd:void 0}}
40_onZoom(){if(!this.leafletMap)throw new wn;this._updateTransform(this.leafletMap.getCenter(),this.leafletMap.getZoom());}_updateTransform(t,e){var i,o;if(!this.leafletMap||!this._container)throw new wn;const s=this.leafletMap,r=s.getZoomScale(e,this._zoom),n=s.getSize().multiplyBy(.5+(null!==(i=this.options.padding)&&void 0!==i?i:0)),a=s.project(null!==(o=this._center)&&void 0!==o?o:s.getCenter(),e),l=n.multiplyBy(-r).add(a).subtract(this.leafletMap._getNewPixelOrigin(t,e));aa(this._container,l,r);}_onMoveEnd(t){var e;if(!this.leafletMap)throw new wn;const i=this.leafletMap,o=null!==(e=this.options.padding)&&void 0!==e?e:0,s=i.getSize(),r=i.containerPointToLayerPoint(s.multiplyBy(-o)).round();this._bounds=new wa(r,r.add(s.multiplyBy(1+2*o)).round()),this._center=i.getCenter(),this._zoom=i.getZoom(),this._updateTransform(this._center,this._zoom),this._onSettled(t);}_reset(){var t,e;if(!this.leafletMap)throw new wn;this._onSettled(),this._updateTransform(null!==(t=this._center)&&void 0!==t?t:this.leafletMap.getCenter(),null!==(e=this._zoom)&&void 0!==e?e:this.leafletMap.getZoom()),this._onViewReset&&this._onViewReset();}_initContainer(){return Ca("div")}_destroyContainer(){this._container&&(oa.off(this._container),this._container.remove(),this._container=void 0);}_resizeContainer(){var t;if(!this.leafletMap||!this._container)throw new wn;const e=null!==(t=this.options.padding)&&void 0!==t?t:0,i=this.leafletMap.getSize().multiplyBy(1+2*e).round();return this._container.style.width=`${i.x}px`,this._container.style.height=`${i.y}px`,i}}Va=Ha,Ha.defaultOptions=Object.assign(Object.assign({},Reflect.get(Wa,"defaultOptions",Va)),{padding:.1,continuous:!1});class Xa extends($a=Ha){constructor(t){super(Object.assign(Object.assign({},qa.defaultOptions),t)),this._layers={},bn(this);}onAdd(t){return super.onAdd(t),this.on("update",this._updatePaths,this),this}onRemove(t){return super.onRemove(t),this.off("update",this._updatePaths,this),this}_onZoomEnd(){for(const t in this._layers)Object.prototype.hasOwnProperty.call(this._layers,t)&&this._layers[t]._project();}_updatePaths(){for(const t in this._layers)Object.prototype.hasOwnProperty.call(this._layers,t)&&this._layers[t]._update();}_onViewReset(){for(const t in this._layers)Object.prototype.hasOwnProperty.call(this._layers,t)&&this._layers[t]._reset();}_onSettled(){this._update();}}function Ya(t,e){oa.on(t,"click",(t=>{if(!e.leafletMap)throw new wn;const i=e.leafletMap.maplibreMap,o=d.mousePos(i._canvas,t),s=In(i.unproject(o)),r={containerPoint:Tn.fromMapbox(o),latlng:s,layerPoint:e.leafletMap.latLngToLayerPoint(s),target:e,type:"click",originalEvent:t};e.fire("click",r),t.stopPropagation();}));}function Ka(t){oa.off(t,"click");}function Qa(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}qa=Xa,Xa.defaultOptions=Object.assign(Object.assign({},Reflect.get($a,"defaultOptions",qa)),{tolerance:0});class Ja extends Xa{_initContainer(){const t=Qa("svg");return t.setAttribute("pointer-events","none"),this._rootGroup=Qa("g"),t.appendChild(this._rootGroup),t}_destroyContainer(){super._destroyContainer(),this._rootGroup=void 0,this._svgSize=void 0;}_resizeContainer(){const t=super._resizeContainer();if(!this._container)throw new Error("SVG container not initialized.");return this._svgSize&&this._svgSize.equals(t)||(this._svgSize=t,this._container.setAttribute("width",t.x.toString()),this._container.setAttribute("height",t.y.toString())),t}_update(){if(!this._container||!this._bounds)throw new Error("SVG container not initialized.");const t=this._bounds,e=t.getSize();this._container.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update");}_initPath(t){const e=t._path=Qa("path");t.options.className&&e.classList.add(...yn(t.options.className)),t.options.interactive&&e.classList.add("leaflet-interactive"),this._updateStyle(t),this._layers[bn(t)]=t;}_addPath(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path),Ya(t._path,t);}_removePath(t){t._path.remove(),t.removeInteractiveTarget(t._path),Ka(t._path),delete this._layers[bn(t)];}_updatePath(t){t._project(),t._update();}_updateStyle(t){const e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity.toString()),e.setAttribute("stroke-width",i.weight.toString()),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray","string"==typeof i.dashArray?i.dashArray:i.dashArray.toString()):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity.toString()),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"));}_updatePoly(t,e){this._setPath(t,function(t,e){let i="";for(let o=0,s=t.length;o<s;o++){const s=t[o];for(let t=0,e=s.length;t<e;t++){const e=s[t];i+=`${(t?"L":"M")+e.x} ${e.y}`;}i+=e?"z":"";}return i||"M0 0"}(t._parts,null!=e&&e));}_updateCircle(t){const e=t._point,i=Math.max(Math.round(t._radius),1),o=`a${i},${Math.max(Math.round(t._radiusPixels),1)||i} 0 1,0 `,s=t._empty()?"M0 0":`M${e.x-i},${e.y}${o}${2*i},0 ${o}${2*-i},0 `;this._setPath(t,s);}_setPath(t,e){t._path.setAttribute("d",e);}_bringToFront(t){!function(t){const e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t);}(t._path);}_bringToBack(t){!function(t){const e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild);}(t._path);}}function tl(t){return new Ja(t)}class el extends Xa{constructor(){super(...arguments),this._postponeUpdatePaths=!1,this._layerInfos={};}getEvents(){const t=super.getEvents();return e.e(t,{viewprereset:this._onViewPreReset})}_onViewPreReset(){this._postponeUpdatePaths=!0;}onAdd(t){return super.onAdd(t),this._draw(),this}_initContainer(){const t=document.createElement("canvas");oa.on(t,"mousemove",this._onMouseMove,this),oa.on(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),oa.on(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0;const e=t.getContext("2d");if(!e)throw new Error("Failed to create Canvas2D context.");return this._ctx=e,t}_destroyContainer(){pa(this._redrawRequest),delete this._ctx,super._destroyContainer();}_resizeContainer(){const t=super._resizeContainer(),e=this._ctxScale=window.devicePixelRatio;return this._container.width=e*t.x,this._container.height=e*t.y,t}_updatePaths(){if(this._postponeUpdatePaths)return;let t;this._redrawBounds=void 0;for(const e in this._layers)Object.prototype.hasOwnProperty.call(this._layers,e)&&(t=this._layers[e],t._update());this._redraw();}
40_update(){var t,e,i,o;if(!this.leafletMap)throw new wn;if(this.leafletMap._animatingZoom&&this._bounds)return;if(!this._ctx)return;const s=this._bounds,r=this._ctxScale;this._ctx.setTransform(r,0,0,r,-(null!==(e=null===(t=null==s?void 0:s.min)||void 0===t?void 0:t.x)&&void 0!==e?e:0)*r,-(null!==(o=null===(i=null==s?void 0:s.min)||void 0===i?void 0:i.y)&&void 0!==o?o:0)*r),this.fire("update");}_reset(){super._reset(),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths());}_initPath(t){this._layers[bn(t)]=t;const e={layer:t,prev:this._drawLast,next:void 0};this._layerInfos[bn(t)]={drawOrder:e},this._updateDashArray(t),this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast;}_addPath(t){this._requestRedraw(t);}_removePath(t){const e=bn(t),i=this._layerInfos[e].drawOrder,{prev:o,next:s}=i;s?s.prev=o:this._drawLast=o,o?o.next=s:this._drawFirst=s,delete this._layerInfos[e],delete this._layers[e],this._requestRedraw(t);}_updatePath(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t);}_updateStyle(t){this._updateDashArray(t),this._requestRedraw(t);}_updateDashArray(t){var e;if("string"==typeof t.options.dashArray){const e=t.options.dashArray.split(/[, ]+/),i=[];for(let t=0;t<e.length;t++){const o=Number(e[t]);if(isNaN(o))return;i.push(o);}this._layerInfos[bn(t)].dashArray=i;}else this._layerInfos[bn(t)].dashArray=null!==(e=t.options.dashArray)&&void 0!==e?e:void 0;}_requestRedraw(t){this.map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||_a(this._redraw,this));}_extendRedrawBounds(t){if(t._pxBounds){const e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new wa,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]));}}_redraw(){this._redrawRequest=void 0,this._redrawBounds&&(this._redrawBounds.min.x=Math.floor(this._redrawBounds.min.x),this._redrawBounds.min.y=Math.floor(this._redrawBounds.min.y),this._redrawBounds.max.x=Math.ceil(this._redrawBounds.max.x),this._redrawBounds.max.y=Math.ceil(this._redrawBounds.max.y)),this._clear(),this._draw(),this._redrawBounds=void 0;}_clear(){if(!this._ctx)return;const t=this._redrawBounds;if(t){const e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y);}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore();}_draw(){if(!this._ctx)return;let t;const e=this._redrawBounds;this._ctx.save();try{if(e){const t=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,t.x,t.y),this._ctx.clip();}this._drawing=!0;for(let i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();}finally{this._drawing=!1,this._ctx.restore();}}_updatePoly(t,e){if(!this._drawing||!this._ctx)return;const i=t._parts,o=i.length,s=this._ctx;if(o){s.beginPath();for(let t=0;t<o;t++){for(let e=0,o=i[t].length;e<o;e++){const o=i[t][e];s[e?"lineTo":"moveTo"](o.x,o.y);}e&&s.closePath();}this._fillStroke(s,t);}}_updateCircle(t){if(!this._drawing||t._empty()||!this._ctx)return;const e=t._point,i=this._ctx,o=Math.max(Math.round(t._radius),1),s=(Math.max(Math.round(t._radiusPixels),1)||o)/o;1!==s&&(i.save(),i.scale(1,s)),i.beginPath(),i.arc(e.x,e.y/s,o,0,2*Math.PI,!1),1!==s&&i.restore(),this._fillStroke(i,t);}_fillStroke(t,e){var i;const o=e.options;o.fill&&(t.globalAlpha=null!==(i=o.fillOpacity)&&void 0!==i?i:1,t.fillStyle=o.fillColor||o.color,t.fill(o.fillRule||"evenodd")),o.stroke&&0!==o.weight&&(t.setLineDash&&t.setLineDash(e.options&&this._layerInfos[bn(e)].dashArray||[]),t.globalAlpha=o.opacity,t.lineWidth=o.weight,t.strokeStyle=o.color,t.lineCap=o.lineCap,t.lineJoin=o.lineJoin,t.stroke());}_onClick(t){if(!this.leafletMap)throw new wn;const e=this.leafletMap.mouseEventToLayerPoint(t);let i;for(let o=this._drawFirst;o;o=o.next){const s=o.layer;s.options.interactive&&s._containsPoint(e)&&("click"!==t.type&&"preclick"!==t.type||!this.leafletMap._draggableMoved(s))&&(i=s);}this._fireEvent(i?[i]:void 0,t);}_onMouseMove(t){if(!this.leafletMap)throw new wn;if(!this.map||this.leafletMap.draggingMoving||this.leafletMap._animatingZoom)return;const e=this.leafletMap.mouseEventToLayerPoint(t);this._handleMouseHover(t,e);}_handleMouseOut(t){const e=this._hoveredLayer;e&&(this._container.classList.remove("leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=void 0,this._mouseHoverThrottled=!1);}_handleMouseHover(t,e){if(this._mouseHoverThrottled)return;let i;for(let t=this._drawFirst;t;t=t.next){const o=t.layer;o.options.interactive&&o._containsPoint(e)&&(i=o);}i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(this._container.classList.add("leaflet-interactive"),this._fireEvent([i],t,"mouseover"),this._hoveredLayer=i)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:void 0,t),this._mouseHoverThrottled=!0,setTimeout((()=>{this._mouseHoverThrottled=!1;}),32);}_fireEvent(t,e,i){if(!this.leafletMap)throw new wn;this.leafletMap._fireDOMEvent(e,i||e.type,t);}_bringToFront(t){const e=this._layerInfos[bn(t)].drawOrder;if(!e)return;const{prev:i,next:o}=e;o&&(o.prev=i,i?i.next=o:o&&(this._drawFirst=o),e.prev=this._drawLast,this._drawLast.next=e,e.next=void 0,this._drawLast=e,this._requestRedraw(t));}_bringToBack(t){const e=this._layerInfos[bn(t)].drawOrder;if(!e)return;const{prev:i,next:o}=e;i&&(i.next=o,o?o.prev=i:i&&(this._drawLast=i),e.prev=void 0,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t));}}function il(t){return new el(t)}const ol=6378137,sl={R:ol,MAX_LATITUDE:85.0511287798,project(t){const e=Math.PI/180,i=this.MAX_LATITUDE,o=Math.max(Math.min(i,t.lat),-i),s=Math.sin(o*e);return new Tn(this.R*t.lng*e,this.R*Math.log((1+s)/(1-s))/2)},unproject(t){const e=180/Math.PI;return new Cn((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:function(){const t=ol*Math.PI;return new wa([-t,-t],[t,t])}()};class rl{constructor(t,e,i,o){if(Array.isArray(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=i,this._d=o;}transform(t,e){return this._transform(t.clone(),e)}_transform(t,e){return t.x=(e=e||1)*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t}untransform(t,e){return new Tn((t.x/(e=e||1)-this._b)/this._a,(t.y/e-this._d)/this._c)}}class nl{latLngToPoint(t,e){const i=this.projection.project(t),o=this.scale(e);return this.transformation._transform(i,o)}pointToLatLng(t,e){const i=this.scale(e),o=this.transformation.untransform(t,i);return this.projection.unproject(o)}project(t){return this.projection.project(t)}unproject(t){return this.projection.unproject(t)}scale(t){return 256*Math.pow(2,t)}zoom(t){return Math.log(t/256)/Math.LN2}getProjectedBounds(t){const e=this.projection.bounds,i=this.scale(t),o=this.transformation.transform(e.min,i),s=this.transformation.transform(e.max,i);return new wa(o,s)}get wrapLng(){}get wrapLat(){}wrapLatLng(t){const e=this.wrapLng?vn(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?vn(t.lat,this.wrapLat,!0):t.lat;return new Cn(i,e,t.alt)}wrapLatLngBounds(t){const e=t.getCenter(),i=this.wrapLatLng(e),o=e.lat-i.lat,s=e.lng-i.lng;if(0===o&&0===s)return t;
40const r=t.getSouthWest(),n=t.getNorthEast(),a=new Cn(r.lat-o,r.lng-s),l=new Cn(n.lat-o,n.lng-s);return new En(a,l)}}class al extends nl{constructor(){super(...arguments),this.R=Mn;}get wrapLng(){return [-180,180]}distance(t,e){return t.distanceTo(e)}}const ll=.5/(Math.PI*sl.R),hl=(cl=ll,ul=-ll,Array.isArray(cl)?new rl(cl):new rl(cl,.5,ul,.5));var cl,ul;class dl extends al{constructor(){super(...arguments),this.projection=sl,this.transformation=hl;}get code(){return "EPSG:3857"}}const _l=new dl;new class extends dl{get code(){return "EPSG:900913"}};const pl=_l,ml=new class extends al{constructor(){super(...arguments),this.projection={project(t){throw new Error("Not implemented.")},unproject(t){throw new Error("Not implemented.")},bounds:new wa([0,0],[0,0])},this.transformation=new rl(0,0,0,0);}get code(){throw new Error("Not implemented - do not use.")}};class fl{constructor(t){this._map=null,this.options=Object.assign(Object.assign({},fl.defaultOptions),t);}getPosition(){return this.options.position}setPosition(t){const e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this}getContainer(){return this._container}addTo(t){this.remove(),this._map=t;const e=this._container=this.onAdd(t),i=this.getPosition(),o=t.getControlCorner(i);if(!o)throw new Error("Trying to add a control to map, but control container is not initialized.");return e.classList.add("leaflet-control"),i.includes("bottom")?o.insertBefore(e,o.firstChild):o.appendChild(e),this._map.on("unload",this.remove,this),this}remove(){return this._map?(this._container.remove(),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this}_refocusOnMap(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus();}}fl.defaultOptions={position:"topright"};class gl extends fl{constructor(t){super(Object.assign(Object.assign({},gl.defaultOptions),t)),this._disabled=!1;}onAdd(t){const e="leaflet-control-zoom",i=Ua.create("div",`${e} leaflet-bar`),o=this.options;return this._zoomInButton=this._createButton(o.zoomInText,o.zoomInTitle,`${e}-in`,i,this._zoomIn),this._zoomOutButton=this._createButton(o.zoomOutText,o.zoomOutTitle,`${e}-out`,i,this._zoomOut),this._updateDisabled(),t.on("zoomend",this._updateDisabled,this),i}onRemove(t){t.off("zoomend",this._updateDisabled,this);}disable(){return this._disabled=!0,this._updateDisabled(),this}enable(){return this._disabled=!1,this._updateDisabled(),this}_zoomIn(t){if(!this._map)throw new wn;const e=this._map.maplibreMap;!this._disabled&&e.getZoom()<e.getMaxZoom()&&e.zoomTo(e.getZoom()+this._map.options.zoomDelta*(t.shiftKey?3:1),{duration:200});}_zoomOut(t){if(!this._map)throw new wn;const e=this._map.maplibreMap;!this._disabled&&e.getZoom()>e.getMinZoom()&&e.zoomTo(e.getZoom()-this._map.options.zoomDelta*(t.shiftKey?3:1),{duration:200});}_createButton(t,e,i,o,s){const r=Ua.create("a",i,o);return r.innerHTML=t,r.href="#",r.title=e,r.setAttribute("role","button"),r.setAttribute("aria-label",e),oa.disableClickPropagation(r),oa.on(r,"click",oa.stop),oa.on(r,"click",s,this),oa.on(r,"click",this._refocusOnMap,this),r}_updateDisabled(){if(!this._map)throw new wn;const t=this._map.maplibreMap,e="leaflet-disabled";this._zoomInButton.classList.remove(e),this._zoomOutButton.classList.remove(e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t.getZoom()===t.getMinZoom())&&(this._zoomOutButton.classList.add(e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t.getZoom()===t.getMaxZoom())&&(this._zoomInButton.classList.add(e),this._zoomInButton.setAttribute("aria-disabled","true"));}}function vl(t){return new gl(t)}gl.defaultOptions={position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"};class yl{constructor(){this._buckets=[];}addLayerAndGetBeforeId(t,e){let i=-1;e=null!=e?e:2e9;for(let t=0;t<=this._buckets.length;t++){if(t===this._buckets.length||this._buckets[t].bucketID>e){i=t,this._buckets.splice(t,0,{bucketID:e,layerIDs:[]});break}if(this._buckets[t].bucketID===e){i=t;break}}return this._buckets[i].layerIDs.push(t),i<this._buckets.length-1?this._buckets[i+1].layerIDs[0]:void 0}removeLayer(t){for(let e=0;e<this._buckets.length;e++){const i=this._buckets[e];let o=!1;for(let s=0;s<i.layerIDs.length;s++)if(i.layerIDs[s]===t){i.layerIDs.splice(s,1),o=!0,0===i.layerIDs.length&&this._buckets.splice(e,1);break}if(o)break}}has(t){for(const e of this._buckets)if(e.layerIDs.indexOf(t)>=0)return !0;return !1}_stringifyState(){let t="";for(const e of this._buckets)t+=`${e.bucketID}: ${e.layerIDs.join(", ")}\n`;return t}}const bl=250;class xl extends ba{get maplibreMap(){return this._maplibreMap}get leafletMap(){return this}get fadeAnimated(){return !1}get _animatingZoom(){return this._zoomInProgress}get draggingMoving(){return this._moveInProgress}get interactiveTargets(){return this._interactiveTargets}get webGLPixelRatio(){return this._maplibreMap.painter.width/this._maplibreMap.transform.width}get canvasPixelRatio(){return null==this.options.maxCanvasRatio?this.webGLPixelRatio:Math.min(this.webGLPixelRatio,this.options.maxCanvasRatio)}constructor(t,e){var i;super(),this._layers={},this._pixelOrigin=new Tn(0,0),this._interactiveTargets={},this._paneRenderers={},this._renderer=void 0,this._zoomInProgress=!1,this._moveInProgress=!1,this._lastZoomPixelOrigin=new Tn(0,0),this._layerOrdering=new yl,this._mouseEvents=["click","dblclick","mouseover","mouseout","contextmenu"],this.options=Object.assign(Object.assign({},xl.defaultOptions),e);const o={container:t,minZoom:fn((e=this.options).minZoom),maxZoom:fn(e.maxZoom),zoom:fn(e.zoom),keyboard:e.keyboard,attributionControl:!!e.attributionControl&&void 0,dragRotate:!1,pitchWithRotate:!1,touchPitch:!1,maxPitch:0,minPitch:0,doubleClickZoom:e.doubleClickZoom,scrollZoom:e.scrollWheelZoom,dragPan:e.dragging,touchZoomRotate:e.touchZoom,style:{layers:[],sources:{},version:8},fadeDuration:null!==(i=e.fadeDuration)&&void 0!==i?i:void 0};this._maplibreMap=new mn(o),this._maplibreMap._debugLayerOrdering=this._layerOrdering,this._maplibreMap.touchZoomRotate.disableRotation(),this._lastZoomHandleUpdateZoom=this.getZoom(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&this._maplibreMap.setZoom(e.zoom),e.center&&void 0!==e.zoom&&this.setView(In(e.center),e.zoom,{animate:!1}),this._maplibreMap.keyboard.disable(),this._maplibreMap.on("zoomstart",(()=>{this._zoomInProgress=!0;})),this._maplibreMap.on("zoom",(()=>{this._handleZoomOrigin(!1);})),this._maplibreMap.on("zoomend",(()=>{this._handleZoomOrigin(!this.displayDuringZoom),this._zoomInProgress=!1;})),this._maplibreMap.on("movestart",(()=>{this._moveInProgress=!0;})),this._maplibreMap.on("moveend",(()=>{this._moveInProgress=!1;})),this._maplibreMap.on("move",(()=>{this._updatePaneTranslation();})),this._initLayout(),this._initEvents(),this._addLayers(this.options.layers),this._updatePaneTranslation();}get displayDuringZoom(){return this.options.displayDuringZoom}set displayDuringZoom(t){this.options.displayDuringZoom=t;}_initLayout(){const t=this.maplibreMap._container;this._baseContainer=void 0;for(const e of t.children)if(e.classList.contains("maplibregl-canvas-container")){this._baseContainer=e;break}if(!this._baseContainer)throw new Error("Failed to find MapLibre map container.");const e=["leaflet-container"];Fn.touch&&e.push("leaflet-touch"),Fn.retina&&e.push("leaflet-retina"),Fn.safari&&e.push("leaflet-safari"),this.fadeAnimated&&e.push("leaflet-fade-anim"),this._leafletContainer=Ca("div","",this._baseContainer),this._leafletContainer.classList.add(...e),this._leafletContainer.setAttribute("style","overflow: visible;");const{position:i}=getComputedStyle(this._leafletContainer);"absolute"!==i&&"relative"!==i&&"fixed"!==i&&"sticky"!==i&&(this._leafletContainer.style.position="relative"),this._initPanes(),this._initControlPos(),this.options.zoomControl&&(this._zoomControl=new gl,this.addControl(this._zoomControl));}_initEvents(t){const e=t?oa.off:oa.on;if(!this._baseContainer)throw new Error("Failed to find MapLibre map container.");this._interactiveTargets={},this._interactiveTargets[bn(this._baseContainer)]=this,t||(this._maplibreMap.on("load",(t=>{this.fire("load");})),this._maplibreMap.on("unload",(t=>{this.fire("unload");})),this._maplibreMap.on("zoomstart",(t=>{this.fire("zoomstart");})),this._maplibreMap.on("zoom",(t=>{this.fire("zoom");})),this._maplibreMap.on("zoomend",(t=>{this.fire("zoomend"),this.fire("viewreset");})),this._maplibreMap.on("movestart",(t=>{this.fire("movestart");})),this._maplibreMap.on("move",(t=>{this.fire("move");})),this._maplibreMap.on("moveend",(t=>{this.fire("moveend");})),this._maplibreMap.on("dragstart",(t=>{this.fire("dragstart");})),this._maplibreMap.on("drag",(t=>{this.fire("drag");})),this._maplibreMap.on("dragend",(t=>{this.fire("dragend");})),this._maplibreMap.on("resize",(t=>{this.fire("resize",{newSize:new Tn(this._maplibreMap.transform.width,this._maplibreMap.transform.height)});}))),e(this._baseContainer,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this);}_initPanes(){this._panes={},this._mapPane=this.createPane("mapPane",this._leafletContainer),za(this._mapPane,new Tn(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane");}addMapLibreOrderedLayerToBucket(t,e){const i=this._layerOrdering.addLayerAndGetBeforeId(t.id,e),o=()=>{this._layerOrdering.removeLayer(t.id),this.maplibreMap.getLayer(t.id)&&this.maplibreMap.removeLayer(t.id);},s=e=>{var i;const s=null===(i=e.error)||void 0===i?void 0:i.message;s&&(s.includes("already exists on this map")?this._layerOrdering.removeLayer(t.id):s.includes("before non-existing layer")&&o());};this.maplibreMap.style.on("error",s);try{this.maplibreMap.addLayer(t,i);}catch(t){throw o(),t}finally{this.maplibreMap.style.off("error",s);}return this}moveMapLibreOrderedLayerToBucket(t,e){this._layerOrdering.removeLayer(t);const i=this._layerOrdering.addLayerAndGetBeforeId(t,e);return this.maplibreMap.style.moveLayer(t,i),this}removeMapLibreOrderedLayer(t){return this._layerOrdering.removeLayer(t),this.maplibreMap.removeLayer(t),this}setView(t,e,i){const o=i;return this._mapLibreEaseTo(la(t),void 0===e?void 0:e-1,o),this}setZoom(t,e){return this.setView(this.getCenter(),t,e)}
40zoomIn(t,e){return t=t||this.options.zoomDelta,this.setZoom(this.getZoom()+t,e)}zoomOut(t,e){return t=t||this.options.zoomDelta,this.setZoom(this.getZoom()-t,e)}setZoomAround(t,e,i){const o=this.getZoomScale(e),s=this.getSize().divideBy(2),r=(t instanceof Tn?t:this.latLngToContainerPoint(t)).subtract(s).multiplyBy(1-1/o),n=this.containerPointToLatLng(s.add(r));return this.setView(n,e,i)}fitBounds(t,e){var i,o,s;let r=null==e?void 0:e.padding;if(e&&void 0===e.padding&&(e.paddingTopLeft||e.paddingBottomRight)){r={top:0,bottom:0,left:0,right:0};const t=Pn(null!==(i=e.paddingTopLeft)&&void 0!==i?i:[0,0]),s=Pn(null!==(o=e.paddingBottomRight)&&void 0!==o?o:[0,0]);e.paddingTopLeft&&(r.left=t.x,r.top=t.y),e.paddingBottomRight&&(r.right=s.x,r.bottom=s.y);}return this._maplibreMap.fitBounds(ua(t),{animate:null!==(s=null==e?void 0:e.animate)&&void 0!==s&&s,padding:r,easing:ha()}),this}fitWorld(t){return this.fitBounds([[-90,-180],[90,180]],t)}panTo(t,e){return this.setView(t,void 0,e)}panBy(t,e){var i,o;return this._maplibreMap.easeTo({center:this._maplibreMap.transform.center,animate:null!==(i=null==e?void 0:e.animate)&&void 0!==i&&i,offset:Pn(t).mult(-1),duration:null!==(o=null==e?void 0:e.duration)&&void 0!==o?o:bl,easing:ha(null==e?void 0:e.easeLinearity)}),this}flyTo(t,e,i){var o,s;return i=i||{},this._maplibreMap.flyTo({center:la(t),zoom:e,animate:null!==(o=null==i?void 0:i.animate)&&void 0!==o&&o,duration:null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:bl,easing:ha(null==i?void 0:i.easeLinearity)}),this}flyToBounds(t,e){var i,o;const s=this._maplibreMap.cameraForBounds(ua(t));return s?(this._maplibreMap.flyTo({center:s.center,zoom:s.zoom,animate:null!==(i=null==(e=e||{})?void 0:e.animate)&&void 0!==i&&i,duration:null!==(o=null==e?void 0:e.duration)&&void 0!==o?o:bl,easing:ha(null==e?void 0:e.easeLinearity)}),this):this}setMaxBounds(t){return this._maplibreMap.setMaxBounds(ua(t)),this}setMinZoom(t){return this._maplibreMap.setMinZoom(t),this}setMaxZoom(t){return this._maplibreMap.setMaxZoom(t),this}panInsideBounds(t,e){const i=this._maplibreMap.transform.clone();return i.setMaxBounds(ua(t)),this._mapLibreEaseTo(i.center,i.zoom,e),this}stop(){return this._maplibreMap.stop(),this}remove(){this._initEvents(!0);for(const t in this._layers)Object.prototype.hasOwnProperty.call(this._layers,t)&&this._layers[t].remove();return this._layers={},this._clearControlPos(),this._maplibreMap.remove(),this}createPane(t,e){const i=Ca("div","leaflet-pane"+(t?` leaflet-${t.replace("Pane","")}-pane`:""),e||this._mapPane);return t&&(this._panes[t]=i),i}getCenter(){const t=this._maplibreMap.getCenter();return new Cn(t.lat,t.lng)}getZoom(){return this._maplibreMap.getZoom()+1}getBounds(){const t=this._maplibreMap.getBounds();return new En(t._sw,t._ne)}getMinZoom(){return this._maplibreMap.getMinZoom()}getMaxZoom(){return this._maplibreMap.getMaxZoom()}getBoundsZoom(t,e,i){const o=ca(t);i=Pn(i||[0,0]);let s=this.getZoom()||0;const r=this.getMinZoom(),n=this.getMaxZoom(),a=o.getNorthWest(),l=o.getSouthEast(),h=this.getSize().subtract(i),c=Ta(this.project(l,s),this.project(a,s)).getSize(),u=this.options.zoomSnap,d=h.x/c.x,_=h.y/c.y,p=e?Math.max(d,_):Math.min(d,_);return s=this.getScaleZoom(p,s),u&&(s=Math.round(s/(u/100))*(u/100),s=e?Math.ceil(s/u)*u:Math.floor(s/u)*u),Math.max(r,Math.min(n,s))}getSize(){return new Tn(this._maplibreMap.transform.width,this._maplibreMap.transform.height)}getPixelBounds(t,e){const i=this._getTopLeftPoint(void 0!==t?In(t):void 0,e);return new wa(i,i.add(this.getSize()))}getMercatorBounds(){const t=this.maplibreMap.transform.screenPointToMercatorCoordinate(new Tn(0,0)),e=this.maplibreMap.transform.screenPointToMercatorCoordinate(new Tn(this.maplibreMap.transform.width,this.maplibreMap.transform.height));return new wa(t,e)}getPixelOrigin(){return this._pixelOrigin}getPixelWorldBounds(t){return pl.getProjectedBounds(void 0===t?this.getZoom():t)}getControlCorner(t){return this._controlCorners?this._controlCorners[t]:void 0}getPane(t){return this._panes[t]}hasPane(t){return void 0!==this._panes[t]}getPanes(){return this._panes}getContainer(){return this._maplibreMap.getContainer()}getZoomScale(t,i){return i=void 0===i?this.getZoom():i,e.an(t-i)}getScaleZoom(t,i){return i=void 0===i?this.getZoom():i,t<=0?1/0:e.aq(t)+i}project(t,e){return e=void 0===e?this.getZoom():e,pl.latLngToPoint(In(t),e)}unproject(t,e){return e=void 0===e?this.getZoom():e,pl.pointToLatLng(Pn(t),e)}layerPointToLatLng(t){const e=Pn(t).add(this.getPixelOrigin());return this.unproject(e)}latLngToLayerPoint(t){return this.project(In(t)).subtract(this.getPixelOrigin())}wrapLatLngBounds(t){return pl.wrapLatLngBounds(ca(t))}wrapLatLng(t){return pl.wrapLatLng(In(t))}distance(t,e){return pl.distance(In(t),In(e))}containerPointToLayerPoint(t){return Pn(t).subtract(this._getMapPanePos())}layerPointToContainerPoint(t){return Pn(t).add(this._getMapPanePos())}containerPointToLatLng(t){return In(this.maplibreMap.unproject(Pn(t)))}latLngToContainerPoint(t){return Tn.fromMapbox(this._maplibreMap.project(la(In(t))))}mouseEventToContainerPoint(t){return Tn.fromMapbox(d.mousePos(this.maplibreMap.getCanvas(),t))}mouseEventToLayerPoint(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))}mouseEventToLatLng(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))}addLayer(t){var e;if(!t._layerAdd)throw new Error("The provided object is not a Layer.");const i=bn(t);return this._layers[i]||(this._layers[i]=t,function(t){return "TileLayer"===t._type}(t)&&(void 0===this.options.minZoom&&this.maplibreMap.setMinZoom(Math.max(null!==(e=fn(t.options.minZoom))&&void 0!==e?e:0,0)),void 0===this.options.maxZoom&&this.maplibreMap.setMaxZoom(fn(t.options.maxZoom))),t.beforeAdd&&t.beforeAdd(this),t._layerAdd({target:this})),this}removeLayer(t){const e=bn(t);return this._layers[e]?(t.onRemove&&t.onRemove(this),delete this._layers[e],this.fire("layerremove",{layer:t}),t.fire("remove"),t.map=void 0,this):this}hasLayer(t){return bn(t)in this._layers}eachLayer(t,e){for(const i in this._layers)Object.prototype.hasOwnProperty.call(this._layers,i)&&t.call(e,this._layers[i]);return this}_updatePaneTranslation(){const t=this.getSize().divideBy(2),e=this.project(this.getCenter()).subtract(t),i=this._lastZoomPixelOrigin.subtract(e);za(this._mapPane,new Tn(Math.round(i.x),Math.round(i.y)));}_updatePixelOrigin(){this._pixelOrigin=this._getNewPixelOrigin(this.getCenter());}_handleZoomOrigin(t){if(!t){const t=this.getZoom();if(Math.abs(t-this._lastZoomHandleUpdateZoom)<.1)return;this._lastZoomHandleUpdateZoom=t;}za(this._mapPane,new Tn(0,0)),this._updatePixelOrigin(),this._lastZoomPixelOrigin=this._pixelOrigin;}_addLayers(t){for(let e=0,i=(t=t?Array.isArray(t)?t:[t]:[]).length;e<i;e++)this.addLayer(t[e]);}_getTopLeftPoint(t,e){return (t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin()).subtract(this._getMapPanePos())}_getNewPixelOrigin(t,e){const i=this.getSize().divideBy(2);return this.project(t,e).subtract(i).add(this._getMapPanePos())}_latLngToNewLayerPoint(t,e,i){const o=this._getNewPixelOrigin(i,e);return this.project(t,e).subtract(o)}
40_latLngBoundsToNewLayerBounds(t,e,i){const o=this._getNewPixelOrigin(i,e);return Ta([this.project(t.getSouthWest(),e).subtract(o),this.project(t.getNorthWest(),e).subtract(o),this.project(t.getSouthEast(),e).subtract(o),this.project(t.getNorthEast(),e).subtract(o)])}_getCenterLayerPoint(){return this.containerPointToLayerPoint(this.getSize().divideBy(2))}_getCenterOffset(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())}whenReady(t,e){return this._maplibreMap.style._loaded?t.call(e||this,{target:this}):this._maplibreMap.once("style.load",(()=>{t.call(e||this,{target:this});})),this}waitReady(){return e._(this,void 0,void 0,(function*(){return new Promise((t=>{this.whenReady(t);}))}))}openPopup(t,e,i){return this._initOverlay(xl.Popup,t,e,i).openOn(this),this}closePopup(t){return (t=null!=t?t:this._popup)&&t.close(),t===this._popup&&(this._popup=void 0),this}openTooltip(t,e,i){return this._initOverlay(xl.Tooltip,t,e,i).openOn(this),this}closeTooltip(t){return t.close(),this}_initOverlay(t,e,i,o){let s;return s=e instanceof t?e:new t(o).setContent(e),i&&s.setLatLng(i),s}_draggableMoved(t){return Tl(t)&&t.dragging.enabled()?t.dragging.moved():!!Tl(this)&&this.dragging.moved()}_findEventTargets(t,e){let i=[],o=t.target||t.srcElement,s=!1;const r="mouseout"===e||"mouseover"===e;for(;o;){const n=this._interactiveTargets[bn(o)];if(n&&("click"===e||"preclick"===e)&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!da(o,t))break;if(i.push(n),r)break}if(o===this._baseContainer)break;if(!wl(o))break;o=o.parentNode;}return i.length||s||r||!this.listens(e,!0)||(i=[this]),i}_isClickDisabled(t){for(;t&&t!==this._baseContainer;){if(t._leaflet_disable_click||!t.parentNode)return !0;t=t.parentNode;}}_handleDOMEvent(t){const e=t.target||t.srcElement;if(e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e))return;const i=t.type;"mousedown"===i&&Fa(e),"click"===t.type&&this.draggingMoving||this._fireDOMEvent(t,i);}_fireDOMEvent(t,e,i){if("click"===e){const e=ma({},t,{type:"preclick"});this._fireDOMEvent(e,"preclick",i);}let o=this._findEventTargets(t,e);if(i){const t=[];for(let o=0;o<i.length;o++)i[o].listens(e,!0)&&t.push(i[o]);o=t.concat(o);}if(!o.length)return;"contextmenu"===e&&oa.preventDefault(t);const s=o[0],r={originalEvent:t,containerPoint:void 0,layerPoint:void 0,latlng:void 0};if(function(t){return "keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type}(t)){const e=function(t){return t.getLatLng&&(!t._radius||t._radius<=10)}(s);r.containerPoint=e?this.latLngToContainerPoint(s.getLatLng()):this.mouseEventToContainerPoint(t),r.layerPoint=this.containerPointToLayerPoint(r.containerPoint),r.latlng=e?s.getLatLng():this.maplibreMap.unproject(r.containerPoint);}for(let t=0;t<o.length;t++)if(o[t].fire(e,r,!0),r.originalEvent._stopped||!1===o[t].options.bubblingMouseEvents&&this._mouseEvents.includes(e))return}_getMapPanePos(){return Ra(this._mapPane)||new Tn(0,0)}_mapLibreEaseTo(t,e,i){var o,s;this._maplibreMap.easeTo({animate:null!==(o=null==i?void 0:i.animate)&&void 0!==o&&o,center:t,zoom:e,duration:null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:bl,easing:ha(null==i?void 0:i.easeLinearity)});}getRenderer(t){let e=t.options.renderer||t.options.pane&&this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e}_getPaneRenderer(t){if("overlayPane"===t||void 0===t)return;let e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e}_createRenderer(t){return this.options.preferCanvas&&il(t)||tl(t)}getTileBounds(t){t=null!=t?t:Math.ceil(this.getZoom());const e=this.maplibreMap,i=e.transform.screenPointToLocation(new Tn(0,0)),o=e.transform.screenPointToLocation(new Tn(e.transform.width,e.transform.height)),s=new Tn(Pl(i.lng,t),Ml(i.lat,t)),r=new Tn(Pl(o.lng,t),Ml(o.lat,t)),n=new wa(s,r);return n.min.y=Math.max(n.min.y,0),n.max.y=Math.min(n.max.y,Math.pow(2,t)-1),n}addControl(t){return t.addTo(this),this}removeControl(t){return t.remove(),this}_initControlPos(){const t=this._controlCorners={},e="leaflet-",i=this._controlContainer=Ca("div",`${e}control-container`,this.getContainer());function o(o,s){t[o+s]=Ca("div",`${e+o} ${e}${s}`,i);}o("top","left"),o("top","right"),o("bottom","left"),o("bottom","right");}_clearControlPos(){var t;for(const t in this._controlCorners)Object.prototype.hasOwnProperty.call(this._controlCorners,t)&&this._controlCorners[t].remove();null===(t=this._controlContainer)||void 0===t||t.remove(),delete this._controlCorners,delete this._controlContainer;}}function wl(t){return Object.prototype.hasOwnProperty.call(t,"parentNode")}function Tl(t){return !!t.dragging}function Pl(t,e){const i=Math.pow(2,e);return Math.floor(i*(t/360+.5))}function Ml(t,e,i=!0){const o=Math.PI/180,s=Math.sin(t*o),r=Math.pow(2,e)*(.5-.25*Math.log((1+s)/(1-s))/Math.PI);return i?Math.floor(r):r}var Cl,Il;xl.defaultOptions={layers:[],zoomSnap:1,zoomDelta:1,closePopupOnClick:!0,keyboard:!0,attributionControl:!0,zoomControl:!0,doubleClickZoom:!0,scrollWheelZoom:!0,dragging:!0,touchZoom:!0,center:[0,0],zoom:0,minZoom:null,maxZoom:null,renderer:null,preferCanvas:!1,displayDuringZoom:!1,maxBounds:null,maxCanvasRatio:null,fadeDuration:null};class El extends(Il=xa){constructor(t,e){(null==e?void 0:e.pane)&&console.warn("LeafletGL tile layers do not support the 'pane' option, since they are drawn using WebGL."),super(Object.assign(Object.assign({},Cl.defaultOptions),e)),this._type="TileLayer",this._visible=!0,this._url=t,this.options.minZoom=Math.min(this.options.maxZoom,this.options.minZoom);}source(){var t,e;return null===(e=null===(t=this._containingMap)||void 0===t?void 0:t.maplibreMap)||void 0===e?void 0:e.getSource(this._getSourceId())}sourceCache(){var t,e,i;return null===(i=null===(e=null===(t=this._containingMap)||void 0===t?void 0:t.maplibreMap)||void 0===e?void 0:e.style)||void 0===i?void 0:i.tileManagers[this._getSourceId()]}layer(){var t,e;return null===(e=null===(t=this._containingMap)||void 0===t?void 0:t.maplibreMap)||void 0===e?void 0:e.getLayer(this._getLayerId())}_trySetVisibility(){var t;const e=null===(t=this._containingMap)||void 0===t?void 0:t.maplibreMap;if(!e)return;const i=e.getLayer(this._getLayerId());if(i&&(i.visibility=this._visible?"visible":"none",this._visible)){const t=this._getSourceId(),i=e.style.tileManagers[t];if(!i)throw new Error(`Tile cache ${t} does not exist`);i.used=!0,i.resume(),i.update(e.transform);}}set visible(t){this._visible=t,this._trySetVisibility();}get visible(){return this._visible}get id(){var t;return null===(t=this.layer())||void 0===t?void 0:t.id}onAdd(t){return this._containingMap=t,t.whenReady((()=>{this._addMapLibreObjects();})),this}onRemove(t){return this._removeMapLibreObjects(),this._containingMap=void 0,this}setOpacity(t){this.options.opacity=t;const e=this.layer();return e&&(e.paint["raster-opacity"]=t),this}isLoading(){return !!this._containingMap&&!this._containingMap.maplibreMap.loaded()}redraw(){return this._containingMap&&this._recreateMaplibreObjects(),this}getEvents(){return {}}getTileSize(){return new Tn(this.options.tileSize,this.options.tileSize)}setUrl(t){if(this._url=t,this._containingMap){const t=this._containingMap.maplibreMap,e=t.getSource(this._getSourceId()),i=this._getSourceId(),o=t.style.tileManagers[i];if(!o)throw new Error(`Tile cache ${i} does not exist`);o.clearTiles(),e.setTiles([this._url]);}return this}_getLayerId(){return this.options.layerId?this.options.layerId:`_leaflet_tile_layer_${bn(this)}`}_getSourceId(){return `_leaflet_source_${bn(this)}`}_addMapLibreObjects(){var t,e,i,o,s;const r=this._getSourceId(),n=this._getLayerId(),a=this._containingMap;if(!a)throw new wn;a.maplibreMap.addSource(r,{type:"raster",tiles:Sl(this._url,this.options.subdomains),minzoom:null!==(t=this.options.minNativeZoom)&&void 0!==t?t:this.options.minZoom,maxzoom:null!==(e=this.options.maxNativeZoom)&&void 0!==e?e:this.options.maxZoom,attribution:this.getAttribution&&null!==(i=this.getAttribution())&&void 0!==i?i:"",tileSize:null!==(o=this.options.tileSize)&&void 0!==o?o:256});const l=Object.assign({"raster-opacity":this.options.opacity},this.options.paint);a.addMapLibreOrderedLayerToBucket({id:n,source:r,type:"raster",minzoom:fn(this.options.minZoom),maxzoom:fn(this.options.maxZoom+.999),paint:l},null!==(s=this.options.layerBucketId)&&void 0!==s?s:void 0),this._trySetVisibility();}_removeMapLibreObjects(){const t=this._containingMap;if(!t)throw new wn;const e=this._getLayerId();t.removeMapLibreOrderedLayer(e),t.maplibreMap.removeSource(this._getSourceId());}_recreateMaplibreObjects(){const t=this._containingMap;if(!t)throw new wn;this.onRemove(t),this.onAdd(t);}}function Sl(t,e){if(!e||!t.includes("{s}"))return [t];let i;if(Array.isArray(e))i=e;else {i=[];for(let t=0;t<e.length;t++)i.push(e[t]);}const o=[];for(const e of i)o.push(t.replaceAll("{s}",e));return o}function Ll(t,e){return new El(t,e)}function zl(t){const e={x:t.x,y:t.y,z:t.z},i=1<<e.z;return e.x=e.x%i,e.x<0&&(e.x+=i),e.x|=0,e}function Rl(t){return `${t.x}_${t.y}_${t.z}`}function Dl(t,e){return `${t.x+(1<<t.z)*e}_${t.y}_${t.z}`}function Al(t){const e=t.split("_");return {x:parseInt(e[0]),y:parseInt(e[1]),z:parseInt(e[2]),key:t}}Cl=El,El.defaultOptions=Object.assign(Object.assign({},Reflect.get(Il,"defaultOptions",Cl)),{tileSize:256,minZoom:0,maxZoom:18,opacity:1,subdomains:"abc",pane:null,minNativeZoom:null,maxNativeZoom:null,layerId:null,paint:null,layerBucketId:null});class kl{constructor(){this._root={x:0,y:0,z:0,children:[],payload:null,parent:null,key:Rl({x:0,y:0,z:0})};}get root(){return this._root}
40traverseTo(t,e,i,o){t|=0,e|=0;const s=1<<(i|=0);if(i<0||t<0||e<0||i>30||t>=s||e>=s)throw new Error("Quad tree set coordinates are not in valid range.");let r=this._root;for(;r;){if(r.z===i){if(r.x!==t||r.y!==e)throw new Error("Found the wrong quadtree entry!");break}const s=1<<i-r.z-1,n=t/s|0,a=e/s|0;let l=null;for(const t of r.children)if(t&&t.x===n&&t.y===a){l=t;break}if(null===l){if(!o)return null;l={x:n,y:a,z:r.z+1,children:[],payload:null,parent:r,key:Rl({x:n,y:a,z:r.z+1})},r.children.push(l);}r=l;}return r}set(t,e,i,o){const s=null===o,r=this.traverseTo(t,e,i,!s);if(!r)return null;if(r.payload=o,!s)return r;let n=r;for(;null===n.payload&&null!==n.parent&&0===n.children.length;){n.payload=null;const t=n.parent;for(let e=0;e<t.children.length;e++)if(t.children[e]===n){t.children.splice(e,1);break}n.parent=null,n=t;}return null}delete(t,e,i){this.set(t,e,i,null);}gatherOrderedRenderable(t,e,i,o){const s=new Set;for(let r=t.min.y;r<=t.max.y;r++)for(let n=t.min.x;n<=t.max.x;n++){const t={x:n,y:r,z:e},a=zl(t),l=t.x-a.x>>t.z;let h=this._root,c=this._root;for(;c&&c.z<a.z;){null!==c.payload&&(h=c);const t=1<<a.z-c.z-1,e=a.x/t|0,i=a.y/t|0;let o=null;for(let t=0;t<c.children.length;t++){const s=c.children[t];if(s&&s.x===e&&s.y===i){o=s;break}}c=o;}let u=!1;c&&(u=this._gatherUsableChildren(c,s,l,o)),u||null!==h.payload&&a.z-h.z<=i&&s.add(Dl(h,l));}const r=[...s].map((t=>Al(t)));return r.sort(((t,e)=>t.z===e.z?t.y===e.y?t.x-e.x:t.y-e.y:t.z-e.z)),r}_gatherUsableChildren(t,e,i,o){if(null!==t.payload)return e.add(Dl(t,i)),!0;if(0===o)return !1;let s=0;for(let r=0;r<t.children.length;r++)this._gatherUsableChildren(t.children[r],e,i,o-1)&&s++;return 4===s}}const Ol="tile aborted";class Bl extends ba{get pendingTilesCount(){return this._pendingTiles.size}get cachedTilesCount(){return this._cachedTiles.size}get requestedTilesCount(){return this._cachedTiles.size+this._pendingTiles.size}get quadTree(){return this._quadtree}constructor(t,e){super(),this._pendingTiles=new Map,this._cachedTiles=new Map,this._quadtree=new kl,this._tileRequests=new Map,this._deleteQueue=new Map,this._deleteLoop=null,this._lastBounds=null,this._lastZoom=null,this.deleteWaitTimeSeconds=5,this.autoDeleteRedundantTiles="preserveParents",this._loadTile=t,this._beforeTileDeleted=e,this._deleteLoop=setInterval((()=>{this._checkTilesForDeletion();}),1e3);}getData(t){var e;return null!==(e=this._cachedTiles.get(Rl(zl(t))))&&void 0!==e?e:null}hasTile(t){return this._cachedTiles.has(Rl(zl(t)))}forEachTile(t){for(const[e,i]of this._cachedTiles.entries())t(Al(e),i);}getOrderedTilePyramid(t,e,i,o){return this._quadtree.gatherOrderedRenderable(t,e,i,o)}update(t,e,i=!1){if(e=Math.round(e),!i&&this._lastBounds&&this._lastZoom&&this._lastZoom===e&&this._lastBounds.equals(t))return;this._lastZoom=e,this._lastBounds=new wa(t);const o=function(t,e){const i=[];for(let o=t.min.y;o<=t.max.y;o++)for(let s=t.min.x;s<=t.max.x;s++){const t=zl({x:s,y:o,z:e});i.push(Object.assign(Object.assign({},t),{key:Rl(t)}));}return i}(t,e),s=new Set;for(let t=0;t<o.length;t++)s.add(o[t].key);const r=new Set(s),n=[...o];for(;n.length>0;){const t=n.pop();if(0===t.z)continue;const e={x:t.x>>1,y:t.y>>1,z:t.z-1,key:""};e.key=Rl(e),r.has(e.key)||(r.add(e.key),n.push(e));}const a=[];for(const[i]of this._cachedTiles)this._shouldDeleteTile(i,s,r,t,e)&&a.push(Al(i));for(const[i]of this._pendingTiles)this._shouldDeleteTile(i,s,r,t,e)&&a.push(Al(i));this._triggerLoads(o),this._triggerDeletes(a);}manualUpdate(t,e){this._triggerLoads(t),this._triggerDeletes(e);}dispose(){for(const t of this._pendingTiles.keys()){const e=Al(t);this._deleteTile(e);}for(const t of this._cachedTiles.keys()){const e=Al(t);this._deleteTile(e);}for(const t of this._tileRequests.values())for(let e=0;e<t.resolves.length;e++)(0,t.resolves[e])({status:"disposed"});this._tileRequests.clear(),null!==this._deleteLoop&&(clearInterval(this._deleteLoop),this._deleteLoop=null);}awaitTile(t,i){return e._(this,void 0,void 0,(function*(){const e=Rl(zl(t));if(this._cachedTiles.has(e)){const t=this._cachedTiles.get(e);return t?{status:"success",tile:t}:{status:"failed"}}return new Promise((o=>{const s=this._tileRequests.get(e);s?s.resolves.push(o):this._tileRequests.set(e,{coords:t,resolves:[o]}),i&&i.addEventListener("abort",(()=>{const t=this._tileRequests.get(e);if(!t)return;const i=t.resolves.indexOf(o);i<0||(t.resolves.splice(i,1),o({status:"aborted"}),0===t.resolves.length&&this._tileRequests.delete(e));}));}))}))}forceDeleteTile(t){this._deleteTile({x:t.x,y:t.y,z:t.z,key:Rl(t)});}_triggerLoads(t){for(let e=0;e<t.length;
40e++){const i=t[e],o=i.key,s=this._cachedTiles.has(o),r=this._pendingTiles.has(o);s||r||this._triggerTileLoad(i),this._deleteQueue.delete(o);}}_triggerDeletes(t){const e=performance.now()/1e3;for(let i=0;i<t.length;i++){const o=t[i],s=o.key,r=this._pendingTiles.get(s);r?(r.abort(`${Ol}: tile deleted`),this._pendingTiles.delete(s)):this.deleteWaitTimeSeconds<=0?this._deleteTile(o):this._deleteQueue.has(s)||this._deleteQueue.set(s,e);}}_checkTilesForDeletion(){const t=performance.now()/1e3,e=this._deleteQueue.keys();for(const i of e){const e=this._deleteQueue.get(i);void 0!==e&&t-e>=this.deleteWaitTimeSeconds&&this._deleteTile(Al(i));}}_deleteTile(t){const e=this._pendingTiles.get(t.key);if(e)e.abort(`${Ol}: tile deleted`),this._pendingTiles.delete(t.key);else if(this._cachedTiles.has(t.key)){const e=this._cachedTiles.get(t.key);void 0!==e&&(this.fire("beforetiledeleted",{coords:t,tile:e}),this._beforeTileDeleted&&this._beforeTileDeleted(t,e),this._cachedTiles.delete(t.key),this._quadtree.set(t.x,t.y,t.z,null));}this._deleteQueue.delete(t.key);}_shouldDeleteTile(t,e,i,o,s){if(e.has(t))return !1;if(this._pendingTiles.has(t))return !0;if(i.has(t))return !1;const r=Al(t),n={x:r.x,y:r.y,z:r.z};for(;n.z>s;)n.x=n.x/2|0,n.y=n.y/2|0,n.z-=1;const a=Rl(n);return !(!this._cachedTiles.has(a)&&e.has(a))}_triggerTileLoad(t){return e._(this,void 0,void 0,(function*(){var e;const i=new AbortController;this._pendingTiles.set(t.key,i);let o=null,s=!1;try{o=null!==(e=yield this._loadTile(t,i.signal))&&void 0!==e?e:null;}catch(t){i.signal.aborted?s=!0:(o=null,console.error(t));}finally{i.signal.aborted&&(s=!0);const e=o&&!s;if(s)null!==o&&this._beforeTileDeleted&&this._beforeTileDeleted(t,o);else {this._cachedTiles.set(t.key,o),o&&this._quadtree.set(t.x,t.y,t.z,o),this._pendingTiles.delete(t.key);const i=this._tileRequests.get(t.key);if(i){for(let t=0;t<i.resolves.length;t++)(0,i.resolves[t])(e&&o?{status:"success",tile:o}:{status:"failed"});this._tileRequests.delete(t.key);}}e&&(this.fire("tileloaded",{coords:t,tile:o}),"none"!==this.autoDeleteRedundantTiles&&this._partialUpdate()),0===this._pendingTiles.size&&this.fire("alltilesloaded");}}))}_partialUpdate(){if(!this._lastBounds)return;const t=[];this._recurseGatherRedundantForDeletion(this._quadtree.root,t),this._triggerDeletes(t);}_recurseGatherChildrenForDeletion(t,e){for(let i=0;i<t.children.length;i++){const o=t.children[i];this._cachedTiles.has(o.key)&&e.push(o),this._recurseGatherChildrenForDeletion(o,e);}}_recurseGatherRedundantForDeletion(t,e){if(null===this._lastZoom||!this._lastBounds)return !0;const i=this._cachedTiles.has(t.key);if(!Fl(t,this._lastBounds,this._lastZoom))return i&&e.push(t),this._recurseGatherChildrenForDeletion(t,e),!0;if(t.z===this._lastZoom)return !!i&&(this._recurseGatherChildrenForDeletion(t,e),!0);let o=!0;for(let i=0;i<2;i++)for(let s=0;s<2;s++){let r=!1;for(let o=0;o<t.children.length;o++){const n=t.children[o];n.x===2*t.x+s&&n.y===2*t.y+i&&(r=this._recurseGatherRedundantForDeletion(n,e));}Fl({x:2*t.x+s,y:2*t.y+i,z:t.z+1},this._lastBounds,this._lastZoom)&&o&&(o=r);}return o&&i&&"all"===this.autoDeleteRedundantTiles&&e.push(t),o||(o=i),o}}function Fl(t,e,i){const o=Math.pow(2,i-t.z),s=1<<t.z,r=Math.floor(Math.floor(e.min.x/o)/s),n=Math.floor(e.min.x/o)-r*s,a=Math.floor(e.min.y/o),l=Math.floor(e.max.x/o)-r*s,h=Math.floor(e.max.y/o);return !(t.y<a||t.y>h)&&(t.x>=n&&t.x<=l||t.x+s>=n&&t.x+s<=l)}var jl,Nl;const Zl=256;class Gl extends(Nl=xa){set showBorders(t){this._showBorders=t;}get showBorders(){return this._showBorders}constructor(t){super(Object.assign(Object.assign({},jl.defaultOptions),t)),this._showBorders=!1,this._zooming=!1,this._gridTiles=new Map,this._physicalTileSize=new Tn(Zl,Zl),this._contentScale=1,this._onZoom=()=>{if(!this.leafletMap)throw new wn;this.leafletMap.displayDuringZoom&&(this._updateLevels(),this._update());},this._onZoomStart=()=>{if(!this.leafletMap)throw new wn;this._zooming=!0,this.leafletMap.displayDuringZoom||(this._hideShowLayer(!0),this._removeAllTiles());},this._onZoomEnd=()=>{if(!this.leafletMap)throw new wn;this._zooming=!1,this.leafletMap.displayDuringZoom||(this._removeAllTiles(),this._updateLevels(),this._hideShowLayer(!1)),this._update(!0);},this._onMapMove=()=>{this._zooming||(this._hideShowLayer(!1),this._update());};const e=this.getTileSize().x,i=Math.pow(2,Math.floor(Math.log2(e)));this._physicalTileSize=new Tn(i,i),this._tileCache=new Bl(((t,e)=>void 0!==this.options.minZoom&&t.z<this.options.minZoom||void 0!==this.options.maxZoom&&t.z>this.options.maxZoom?Promise.resolve(null):this._loadTileData(t,e))),this._tileCache.on("tileloaded",(()=>{this._update();}));}static getTileSizeForZoomOffset(t){return 256*Math.pow(2,t)}get container(){return this._container}get levelTransform(){var t;return null===(t=this._level)||void 0===t?void 0:t.transform}_loadTileData(t,i){return e._(this,void 0,void 0,(function*(){return Promise.resolve(null)}))}_createTileContents(t,e,i){const o=document.createElement("div");o.innerHTML=`${e.z}/${e.x}/${e.y}`,t.appendChild(o);const s=this.options.tileSize,r=[s instanceof Tn?s.x:s,s instanceof Tn?s.y:s],n=document.createElement("div");n.style.cssText="position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(45deg); display: flex; align-items: center; justify-content: center; flex-direction: column; color:white; font-size: 0.75em;",n.innerHTML='<span>"_createTileContents"</span> <span>not implemented</span>',t.appendChild(n),t.style.border="1px solid white",t.style.color="red",t.style.fontSize="2em",t.style.width=`${r[0]}px`,t.style.height=`${r[1]}px`;}_onTileLoaded(t,e){this.fire("tileload",{tile:e,coords:t});}reload(){return this._removeAllTiles(),this._update(!0),this}onAdd(t){return this._initContainer(),this._updateLevels(),this._init(t),this}onRemove(t){return this._removeAllTiles(),this._destroy(),this}getTileSize(){const t=this.options.tileSize;return t instanceof Tn?t:new Tn(t,t)}getTilePos(t){if(!this._level)throw new wn;return (t instanceof Tn?t:new Tn(t.x,t.y)).scaleBy(this._physicalTileSize).subtract(this._level.origin)}_createGridTile(t,e){if(!this._level)throw new wn;const i=document.createElement("div");this._createTileContents(i,t,e);const o=new Tn(t.x,t.y).scaleBy(this._physicalTileSize).subtract(this._level.origin);return this._level&&this._level.element.appendChild(i),i.style.transform=`translate3d(${o.x}px, ${o.y}px, 0px)`,i.style.position="absolute",i.classList.add("leaflet-tile"),i.classList.add("leaflet-tile-loaded"),i.classList.add("grid-layer-tile"),this.showBorders&&this._renderDebugTileBorder(i,t),this._onTileLoaded(t,i),{element:i,
40coordinates:t}}_update(t=!1){var e;if(!this.leafletMap)throw new wn;const i=this.leafletMap.getZoom(),o=Math.log2(Zl/this.getTileSize().x),s=Math.round(i+o),r=this.leafletMap.getTileBounds(s),n=null!==(e=this.options.keepBuffer)&&void 0!==e?e:0,a=new wa({x:r.min.x-n,y:Math.max(r.min.y-n,0)},{x:r.max.x+n,y:Math.min(r.max.y+n,(1<<s)-1)});this._tileCache.update(a,s,t);const l=this._tileCache.getOrderedTilePyramid(r,s,999,0),h=[],c=new Set;for(const t of l){const e=Rl(t);if(c.add(e),!this._gridTiles.has(e)){const i=zl(t),o=this._tileCache.getData(i);o&&this._gridTiles.set(e,this._createGridTile(t,o));}}for(const t of this._gridTiles.keys())c.has(t)||h.push(t);for(const t of h){const e=this._gridTiles.get(t);this._gridTiles.delete(t),null==e||e.element.remove();}}_removeAllTiles(){this._tileCache.dispose();for(const t of this._gridTiles.values())t.element.remove();this._gridTiles.clear();}_init(t){const e=t.maplibreMap;e.on("zoomstart",this._onZoomStart),e.on("zoomend",this._onZoomEnd),e.on("zoom",this._onZoom),e.on("move",this._onMapMove),this._update(!0);}_destroy(){var t;if(!(null===(t=this.map)||void 0===t?void 0:t.maplibreMap))throw new wn;const e=this.map.maplibreMap;this._level&&(this._level.element.remove(),this._level=void 0),e.off("zoomstart",this._onZoomStart),e.off("zoomend",this._onZoomEnd),e.off("zoom",this._onZoom),e.off("move",this._onMapMove);}_hideShowLayer(t=!0){var e,i;const o=null!==(i=null===(e=this._level)||void 0===e?void 0:e.element)&&void 0!==i?i:this._container;o&&(o.style.visibility=t?"hidden":"visible");}_initContainer(){this._container||(this._container=Ca("div",`leaflet-layer leaflet-grid-layer ${this.options.className||""}`),this.getPane(this.options.pane).appendChild(this._container));}_updateLevels(){if(!this.leafletMap)throw new wn;if(!this._level){const t=Ca("div","leaflet-tile-container leaflet-zoom-animated",this._container);this._level={element:t,origin:Pn([0,0]),zoom:0,transform:{translate:Pn([0,0]),scale:1}};}const t=this.leafletMap,e=t.getZoom(),i=Math.log2(Zl/this.getTileSize().x),o=Math.log2(Zl/this._physicalTileSize.x),s=e+(Math.round(e+i)-Math.round(e+o));this._level.origin=t.project(t.unproject(t.getPixelOrigin()),s).round(),this._level.zoom=s;const r=t.getZoomScale(e,Math.round(s));this._contentScale=r;const n=t.getCenter(),a=this._level.origin.multiplyBy(r).subtract(t._getNewPixelOrigin(n,e)).round();this._level.transform={translate:a,scale:r},aa(this._level.element,a,r);}_renderDebugTileBorder(t,e){const i=document.createElement("div");i.innerHTML=`${e.z}/${e.x}/${e.y}`,i.classList.add("debug-tile-coords"),t.appendChild(i),t.classList.add("debug-tile");}}function Ul(t){return new Gl(t)}function Vl(t){let e=0,i=0,o=0;for(let s=0;s<t.length;s++){const r=In(t[s]);e+=r.lat,i+=r.lng,o++;}return In([e/o,i/o])}function Wl(t){return ql(t)?t:Wl(t[0])}function ql(t){return !Array.isArray(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function $l(t){return 0===t.length||ql(t[0])}function Hl(t){return new Cn(t[1],t[0],t[2])}function Xl(t,e){const i=[],o=function(t){return "number"==typeof t[0][0]}(t);for(let s,r=0,n=t.length;r<n;r++)s=o?(e||Hl)(t[r]):Xl(t[r],e),i.push(s);return i}function Yl(t,e){return void 0!==(t=In(t)).alt?[gn(t.lng,e),gn(t.lat,e),gn(t.alt,e)]:[gn(t.lng,e),gn(t.lat,e)]}function Kl(t,e,i){if(ql(t)){const o=[];for(let e=0;e<t.length;e++)o.push(Yl(t[e],i));return e&&o.length>0&&o.push(o[0].slice()),o}{const o=[];for(let s=0;s<t.length;s++)o.push(Kl(t[s],e,i));return o}}function Ql(t,e){return t.feature?(ma({},t.feature,{geometry:e}),t.feature):{type:"Feature",properties:{},geometry:e}}function Jl(t){return "Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}function th(t,e){return Ql(t,{type:"Point",coordinates:Yl(t.getLatLng(),e)})}var eh;jl=Gl,Gl.defaultOptions=Object.assign(Object.assign({},Reflect.get(Nl,"defaultOptions",jl)),{tileSize:Zl,minZoom:0,maxZoom:18,pane:"tilePane",className:"",keepBuffer:2});class ih{constructor(t){this.options=t;}_setIconStyles(t,e,i,o){"number"==typeof i&&(i=[i,i]);const s=Pn(i),r=Pn(o||s.divideBy(2));t.className=`leaflet-marker-${e} ${this.options.className||""}`,r&&(t.style.marginLeft=-r.x+"px",t.style.marginTop=-r.y+"px"),s&&(t.style.width=`${s.x}px`,t.style.height=`${s.y}px`);}}class oh extends ih{constructor(t){super(Object.assign(Object.assign({},eh.defaultOptions),t));}createIcon(t){return this._createIcon("icon",t)}createShadow(t){return this._createIcon("shadow",t)}_createIcon(t,e){const i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}if("shadow"===t&&null==this.options.shadowSize)throw new Error("If icon's shadow image is specified, its shadow size must also be specified.");const o=this._createImg(i,e&&"IMG"===e.tagName?e:void 0);return this._setIconStyles(o,t,"icon"===t?this.options.iconSize:this.options.shadowSize,"icon"===t?this.options.iconAnchor:this.options.shadowAnchor||this.options.iconAnchor),(this.options.crossOrigin||""===this.options.crossOrigin)&&(o.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),o}_createImg(t,e){return (e=e||document.createElement("img")).src=t,e}_getIconUrl(t){return this._getIconUrlInternal(t)}_getIconUrlInternal(t){return "icon"===t?(Fn.retina?this.options.iconRetinaUrl:this.options.iconUrl)||this.options.iconUrl:(Fn.retina?this.options.shadowRetinaUrl:this.options.shadowUrl)||this.options.shadowUrl}_getDefaultIconUrl(t){const e=eh.Default;return "string"!=typeof e.imagePath&&(e.imagePath=this._detectIconPath()),(this.options.imagePath||e.imagePath)+this._getIconUrlInternal(t)}
40_stripUrl(t){const e=function(t,e,i){const o=e.exec(t);return o&&o[i]},i=e(t,/^url\((['"])?(.+)\1\)$/,2);return i&&e(i,/^(.*)marker-icon\.png$/,1)}_detectIconPath(){const t=Ca("div","leaflet-default-icon-path",document.body),e=this._stripUrl(getComputedStyle(t).backgroundImage);if(document.body.removeChild(t),e)return e;const i=document.querySelector('link[href$="leaflet.css"]');return i?i.href.substring(0,i.href.length-11-1):""}static getIconDefaultDefaultOptions(){return {iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]}}}eh=oh,oh.defaultOptions={popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1,className:"",iconRetinaUrl:null,iconAnchor:null,iconUrl:"marker-icon.png",shadowUrl:null,iconSize:[12,12],shadowSize:null,shadowAnchor:null,shadowRetinaUrl:null,imagePath:null},oh.Default=class extends eh{constructor(){super(eh.getIconDefaultDefaultOptions());}_getIconUrl(t){return super._getDefaultIconUrl(t)}};const sh={iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon",popupAnchor:[0,0],tooltipAnchor:[0,0],iconAnchor:null};class rh extends ih{constructor(t){super(Object.assign(Object.assign({},sh),t));}createIcon(t){const e=t&&"DIV"===t.tagName?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(e.replaceChildren(),e.appendChild(i.html)):e.innerHTML=!1!==i.html?i.html:"",i.bgPos){const t=Pn(i.bgPos);e.style.backgroundPosition=`${-t.x}px ${-t.y}px`;}return this._setIconStyles(e,"icon",this.options.iconSize,this.options.iconAnchor),e}createShadow(t){return null}}function nh(t){return new oh(t)}function ah(t){return new rh(t)}class lh{constructor(t){this._enabled=!1,this._map=t;}enable(){return this._enabled||(this._enabled=!0,this.addHooks()),this}disable(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this}enabled(){return this._enabled}}const hh=Fn.touch?"touchstart mousedown":"mousedown";class ch extends ba{constructor(t,e,i,o){super(),this._enabled=!1,this._moved=!1,this._moving=!1,this._lastTarget=null,this.options=Object.assign(Object.assign({},ch.defaultOptions),o),this._element=t,this._dragStartTarget=e||t,this._preventOutline=!!i;}enable(){return this._enabled||(oa.on(this._dragStartTarget,hh,this._onDown,this),this._enabled=!0),this}disable(){return this._enabled?(ch._dragging===this&&this.finishDrag(!0),oa.off(this._dragStartTarget,hh,this._onDown,this),this._enabled=!1,this._moved=!1,this):this}_onDown(t){if(!this._enabled)return;if(this._moved=!1,this._element.classList.contains("leaflet-zoom-anim"))return;if(this.isTouchEvent(t)&&t.touches&&1!==t.touches.length)return void(ch._dragging===this&&this.finishDrag());if(ch._dragging||t.shiftKey||t instanceof MouseEvent&&0!==t.button)return;const e=function(t){do{if(!(t=t.parentNode))return null}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}(this._element);if(!e)return;if(ch._dragging=this,this._preventOutline&&Fa(this._element),oa.on(window,"dragstart",oa.preventDefault),function(){const t=Da[Aa];"none"!==t&&(ka=t,Da[Aa]="none");}(),t.stopPropagation(),this._moving)return;this.fire("down");const i=this.isTouchEvent(t)?t.touches[0]:t;this._startPoint=new Tn(i.clientX,i.clientY),this._startPos=Ra(this._element),this._parentScale=function(t){const e=t.getBoundingClientRect();return {x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}(e);const o="mousedown"===t.type;oa.on(document,o?"mousemove":"touchmove",this._onMove,this),oa.on(document,o?"mouseup":"touchend touchcancel",this._onUp,this);}_onMove(t){var e;if(!this._enabled)return;if(this.isTouchEvent(t)&&t.touches.length>1)return void(this._moved=!0);const i=this.isTouchEvent(t)?t.touches[0]:t,o=new Tn(i.clientX,i.clientY)._subtract(this._startPoint);if((o.x||o.y)&&!(Math.abs(o.x)+Math.abs(o.y)<this.options.clickTolerance)){if(o.x/=this._parentScale.x,o.y/=this._parentScale.y,oa.preventDefault(t),!this._moved){this.fire("dragstart"),this._moved=!0,document.body.classList.add("leaflet-dragging"),this._lastTarget=t.target||t.srcElement;const i=window.SVGElementInstance;i&&this._lastTarget instanceof i&&(this._lastTarget=this._lastTarget.correspondingUseElement),null===(e=this._lastTarget)||void 0===e||e.classList.add("leaflet-drag-target");}this._newPos=this._startPos.add(o),this._moving=!0,this._lastEvent=t,this._updatePosition();}}_updatePosition(){const t={originalEvent:this._lastEvent};this.fire("predrag",t),za(this._element,this._newPos),this.fire("drag",t);}_onUp(){this._enabled&&this.finishDrag();}isTouchEvent(t){return Fn.touchNative&&t instanceof TouchEvent}finishDrag(t){document.body.classList.remove("leaflet-dragging"),this._lastTarget&&(this._lastTarget.classList.remove("leaflet-drag-target"),this._lastTarget=null),oa.off(document,"mousemove touchmove",this._onMove,this),oa.off(document,"mouseup touchend touchcancel",this._onUp,this),oa.off(window,"dragstart",oa.preventDefault),void 0!==ka&&(Da[Aa]=ka,ka=void 0);const e=this._moved&&this._moving;this._moving=!1,ch._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)});}}ch.defaultOptions={clickTolerance:3},ch._dragging=!1;class uh extends lh{constructor(t){if(!t.leafletMap)throw new wn;super(t.leafletMap),this._marker=t;}addHooks(){const t=this._marker._icon;return t?(this._draggable||(this._draggable=new ch(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),t.classList.add("leaflet-marker-draggable"),this):this}removeHooks(){return this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&this._marker._icon.classList.remove("leaflet-marker-draggable"),this}moved(){return this._draggable&&this._draggable._moved}_adjustPan(t){if(!this._marker.leafletMap)throw new wn;if(!this._marker._icon)return;const e=this._marker.leafletMap,i=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Ra(this._marker._icon),r=e.getPixelBounds(),n=e.getPixelOrigin(),a=Ta(r.min._subtract(n).add(o),r.max._subtract(n).subtract(o));if(!a.contains(s)){const o=Pn((Math.max(a.max.x,s.x)-a.max.x)/(r.max.x-a.max.x)-(Math.min(a.min.x,s.x)-a.min.x)/(r.min.x-a.min.x),(Math.max(a.max.y,s.y)-a.max.y)/(r.max.y-a.max.y)-(Math.min(a.min.y,s.y)-a.min.y)/(r.min.y-a.min.y)).multiplyBy(i);e.panBy(o,{animate:!1}),this._draggable._newPos._add(o),this._draggable._startPos._add(o),za(this._marker._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=_a(this._adjustPan.bind(this,t));}}_onDragStart(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart");}_onPreDrag(t){this._marker.options.autoPan&&(pa(this._panRequest),this._panRequest=_a(this._adjustPan.bind(this,t)));}_onDrag(t){if(!this._marker||!this._marker.leafletMap)throw new wn;if(!this._marker._icon)return;const e=this._marker._shadow,i=Ra(this._marker._icon),o=this._marker.leafletMap.layerPointToLatLng(i);e&&za(e,i),this._marker._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,this._marker.fire("move",t).fire("drag",t);}_onDragEnd(t){pa(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t);}}var dh,_h;let ph=class extends(_h=xa){constructor(t,e){super(Object.assign(Object.assign({},dh.defaultOptions),e)),this._icon=null,this._shadow=null,this._latlng=In(t);}onAdd(t){return this._initIcon(),this._update(),this}onRemove(t){return this._icon&&this._removeIcon(),this._removeShadow(),this}getEvents(){return {zoom:this._update,viewreset:this._update,zoomend:this._update}}getLatLng(){return this._latlng}setLatLng(t){const e=this._latlng;return this._latlng=In(t),this._update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})}setZIndexOffset(t){return this.options.zIndexOffset=t,this._update()}getIcon(){return this.options.icon}setIcon(t){return this.options.icon=t,this.map&&(this._initIcon(),this._update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this}setOpacity(t){return this.options.opacity=t,this.map&&this._updateOpacity(),this}getElement(){return this._icon}
40_update(){if(this._icon&&this.leafletMap){const t=this.leafletMap.latLngToLayerPoint(this._latlng).round();this._setPos(t);}return this}_addTooltipFocusListeners(t){const e=this.getElement();e&&ga(e,this,t);}_setAriaDescribedByTooltipLayer(t){const e=this.getElement();e&&va(e,t);}_initIcon(){if(!this.map)throw new wn;const t=this.options,e=t.icon.createIcon(this._icon);let i=!1;e!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(e.title=t.title),"IMG"===e.tagName&&(e.alt=t.alt||"")),t.keyboard&&(e.tabIndex=0,e.setAttribute("role","button")),this._icon=e,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&oa.on(e,"focus",this._panOnFocus,this);const o=t.icon.createShadow(this._shadow);let s=!1;return o!==this._shadow&&(this._removeShadow(),s=!0),o&&o instanceof HTMLImageElement&&(o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(o),Ya(this._icon,this),i}_removeIcon(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this._icon&&(this.options.autoPanOnFocus&&oa.off(this._icon,"focus",this._panOnFocus,this),Ka(this._icon),this._icon.remove(),this.removeInteractiveTarget(this._icon),this._icon=null);}_removeShadow(){this._shadow&&this._shadow.remove(),this._shadow=null;}_setPos(t){this._icon&&za(this._icon,t),this._shadow&&za(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex();}_updateZIndex(t){this._icon&&(this._icon.style.zIndex=(this._zIndex+t).toString());}_initInteraction(){if(!this.options.interactive)return;this._icon&&(this._icon.classList.add("leaflet-interactive"),this.addInteractiveTarget(this._icon));let t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new uh(this),t&&this.dragging.enable();}_updateOpacity(){this._icon&&(this._icon.style.opacity=this.options.opacity.toString());}_bringToFront(){this._updateZIndex(this.options.riseOffset);}_resetZIndex(){this._updateZIndex(0);}_panOnFocus(){var t;if(!(null===(t=this.map)||void 0===t?void 0:t.maplibreMap))throw new wn;this.map.maplibreMap.panTo(this._latlng);}_getPopupAnchor(){return this.options.icon.options.popupAnchor}_getTooltipAnchor(){return this.options.icon.options.tooltipAnchor}toGeoJSON(t){return th(this,t)}};function mh(t,e){return new ph(t,e)}dh=ph,ph.defaultOptions=Object.assign(Object.assign({},Reflect.get(_h,"defaultOptions",dh)),{icon:new oh.Default,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10});class fh extends xa{get maplibreMap(){var t;return null===(t=this.leafletMap)||void 0===t?void 0:t.maplibreMap}constructor(t,e){if(super(e),this._layers={},t)for(let e=0,i=t.length;e<i;e++)this.addLayer(t[e]);}addLayer(t){const e=this.getLayerId(t);return this._layers[e]=t,this.map&&this.map.addLayer(t),this}removeLayer(t){const e="number"==typeof t?t:this.getLayerId(t);return this.map&&this._layers[e]&&this.map.removeLayer(this._layers[e]),delete this._layers[e],this}hasLayer(t){return ("number"==typeof t?t:this.getLayerId(t))in this._layers}clearLayers(){return this.eachLayer(this.removeLayer,this)}invoke(t,...e){let i,o;for(i in this._layers)Object.prototype.hasOwnProperty.call(this._layers,i)&&(o=this._layers[i],o[t]&&o[t].apply(o,e));return this}eachLayer(t,e){for(const i in this._layers)Object.prototype.hasOwnProperty.call(this._layers,i)&&t.call(e,this._layers[i]);return this}getLayer(t){return this._layers[t]}getLayers(){const t=[];return this.eachLayer(t.push,t),t}setZIndex(t){return this.invoke("setZIndex",t)}getLayerId(t){return bn(t)}onAdd(t){return this.eachLayer(t.addLayer,t)}onRemove(t){return this.eachLayer(t.removeLayer,t)}_toMultiPoint(t){const e=[];return this.eachLayer((i=>{const o=i.toGeoJSON(t);"FeatureCollection"!==o.type&&"GeometryCollection"!==o.geometry.type&&e.push(o.geometry.coordinates);})),Ql(this,{type:"MultiPoint",coordinates:e})}toGeoJSON(t){const e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this._toMultiPoint(t);if("GeometryCollection"===e){const e=[];return this.eachLayer((i=>{i.toGeoJSON&&yh(i.toGeoJSON(t),e);})),Ql(this,{geometries:e,type:"GeometryCollection"})}{const e=[];return this.eachLayer((i=>{i.toGeoJSON&&vh(Jl(i.toGeoJSON(t)),e);})),{type:"FeatureCollection",features:e}}}_addTooltipFocusListeners(t){this.eachLayer((e=>{e._addTooltipFocusListeners(t);}));}_setAriaDescribedByTooltipLayer(t){this.eachLayer((e=>{e._setAriaDescribedByTooltipLayer(t);}));}}const gh=function(t,e){return new fh(t,e)};function vh(t,e){if("Feature"===t.type)e.push(t);else for(const i of t.features)vh(i,e);}function yh(t,e){if("Feature"===t.type)e.push(t.geometry);else for(const i of t.features)yh(i,e);}class bh extends fh{addLayer(t){return this.hasLayer(t)?this:(t.addEventParent(this),super.addLayer(t),this.fire("layeradd",{layer:t}))}removeLayer(t){if(!this.hasLayer(t))return this;const e=this.getLayerId(t);return e in this._layers&&(t=this._layers[e]),t.removeEventParent(this),super.removeLayer(t),this.fire("layerremove",{layer:t})}setStyle(t){return this.invoke("setStyle",t)}bringToFront(){return this.invoke("bringToFront")}bringToBack(){return this.invoke("bringToBack")}getBounds(){const t=new En(void 0,void 0);for(const e in this._layers)if(Object.prototype.hasOwnProperty.call(this._layers,e)){const i=this._layers[e];i.getBounds?t.extend(i.getBounds()):i.getLatLng&&t.extend(i.getLatLng());}return t}openPopup(t){return this._popup&&this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this.leafletMap),this}}function xh(t,e){return new bh(t,e)}var wh,Th,Ph,Mh,Ch,Ih;class Eh extends(Th=xa){get containerId(){var t;return null===(t=this._container)||void 0===t?void 0:t.id}constructor(t,e){t&&(t instanceof Cn||Array.isArray(t))?(super(Object.assign(Object.assign({},wh.defaultOptions),e)),this._latlng=In(t)):(super(Object.assign(Object.assign({},wh.defaultOptions),t)),this._source=e),this.options.content&&(this._content=this.options.content);}openOn(t){if(!(t=null!=t?t:this._source.leafletMap))throw new wn;return t.hasLayer(this)||t.addLayer(this),this}close(){return this.map&&this.map.removeLayer(this),this}toggle(t){return this.map?this.close():(t?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t.leafletMap)),this}onAdd(t){return this._container||this._initLayout(),t.fadeAnimated&&(this._container.style.opacity="0"),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this._update(),t.fadeAnimated&&(this._container.style.opacity="1"),this.bringToFront(),this.options.interactive&&(this._container.classList.add("leaflet-interactive"),this.addInteractiveTarget(this._container)),this}onRemove(t){return t.fadeAnimated?(this._container.style.opacity="0",this._removeTimeout=setTimeout((()=>this._container.remove()),200)):this._container.remove(),this.options.interactive&&(this._container.classList.remove("leaflet-interactive"),this.removeInteractiveTarget(this._container)),this}getLatLng(){return this._latlng}setLatLng(t){return this._latlng=In(t),this.map&&(this._updatePosition(),this._adjustPan()),this}getContent(){return this._content}setContent(t){return this._content=t,this._update(),this}getElement(){return this._container}_addTooltipFocusListeners(t){const e=this.getElement();e&&ga(e,this,t);}_setAriaDescribedByTooltipLayer(t){const e=this.getElement();e&&va(e,t);}getEvents(){return {zoom:this._updatePosition,viewreset:this._updatePosition,zoomend:this._updatePosition}}isOpen(){return !!this.map&&this.map.hasLayer(this)}bringToFront(){return this.map&&Ia(this._container),this}bringToBack(){return this.map&&Ea(this._container),this}_prepareOpen(t){let e=this._source;if(!e.leafletMap)return !1;
40if(e instanceof bh){const t=e._layers;let i=null;for(const e in t)if(t[e].leafletMap){i=t[e];break}if(!i)return !1;e=i,this._source=i;}if(!t)if(e.getCenter)t=e.getCenter();else if(e.getLatLng)t=e.getLatLng();else {if(!e.getBounds)throw new Error("Unable to get source layer LatLng.");t=e.getBounds().getCenter();}return this.setLatLng(t),this.map&&this._update(),!0}_update(){this.map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan());}_updateContent(){if(!this._content)return;const t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else {for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e);}this.fire("contentupdate");}_updatePosition(){if(!this.leafletMap)return;const t=this.leafletMap.latLngToLayerPoint(this._latlng),e=this._getAnchor();let i=Pn(this.options.offset);i=i.add(t).add(e);const o=this._containerBottom=-i.y,s=this._containerLeft=-Math.round(this._containerWidth/2)+i.x;this._container.style.bottom=`${o}px`,this._container.style.left=`${s}px`;}_getAnchor(){return [0,0]}}wh=Eh,Eh.defaultOptions=Object.assign(Object.assign({},Reflect.get(Th,"defaultOptions",wh)),{interactive:!1,offset:[0,0],className:"",content:""});class Sh extends(Mh=xa){constructor(t){super(Object.assign(Object.assign({},Ph.defaultOptions),t)),this.type="Path";}beforeAdd(t){return this._renderer=t.getRenderer(this),this}onAdd(t){return this._renderer._initPath(this),this._reset(),this._renderer._addPath(this),this}onRemove(t){return this._renderer._removePath(this),this}redraw(){return this.map&&this._renderer._updatePath(this),this}setStyle(t){return this.options=Object.assign(Object.assign({},this.options),t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),this}bringToFront(){return this._renderer&&this._renderer._bringToFront(this),this}bringToBack(){return this._renderer&&this._renderer._bringToBack(this),this}_reset(){this._project(),this._update();}_clickTolerance(){return (this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}Ph=Sh,Sh.defaultOptions=Object.assign(Object.assign({},Reflect.get(Mh,"defaultOptions",Ph)),{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",className:"",interactive:!1,bubblingMouseEvents:!0,renderer:null});let Lh,zh=class extends(Ih=Eh){constructor(t,e){t&&(t instanceof Cn||Array.isArray(t))?super(t,Object.assign(Object.assign({},Ch.defaultOptions),e)):super(Object.assign(Object.assign({},Ch.defaultOptions),t),e),this._autopanning=!1;}openOn(t){if(!(t=t||this._source.leafletMap))throw new wn;const e=t._popup;return !t.hasLayer(this)&&e&&e.options.autoClose&&t.closePopup(e),t._popup=this,super.openOn(t)}onAdd(t){return super.onAdd(t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Sh||this._source.on("preclick",oa.stopPropagation)),this}onRemove(t){return super.onRemove(t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Sh||this._source.off("preclick",oa.stopPropagation)),this}getEvents(){if(!this.leafletMap)throw new wn;const t=super.getEvents();return (void 0!==this.options.closeOnClick?this.options.closeOnClick:this.leafletMap.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t}_initLayout(){const t="leaflet-popup",e=this._container=Ca("div",`${t} ${this.options.className||""}`),i=this._wrapper=Ca("div",`${t}-content-wrapper`,e);if(this._contentNode=Ca("div",`${t}-content`,i),oa.disableClickPropagation(e),oa.disableScrollPropagation(this._contentNode),oa.on(e,"contextmenu",oa.stopPropagation),this._tipContainer=Ca("div",`${t}-tip-container`,e),this._tip=Ca("div",`${t}-tip`,this._tipContainer),this.options.closeButton){const i=this._closeButton=Ca("a",`${t}-close-button`,e);i.setAttribute("role","button"),i.setAttribute("aria-label",this.options.closeButtonLabel),i.href="#close",i.innerHTML='<span aria-hidden="true">&#215;</span>',oa.on(i,"click",(function(t){oa.preventDefault(t),this.close();}),this);}}_updateLayout(){const t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";let i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=`${i+1}px`,e.whiteSpace="",e.height="";const o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&t.offsetHeight>o?(e.height=`${o}px`,t.classList.add(s)):t.classList.remove(s),this._containerWidth=this._container.offsetWidth;}_adjustPan(){if(!this.leafletMap)throw new wn;if(!this.options.autoPan)return;if(this._autopanning)return void(this._autopanning=!1);const t=this.leafletMap,e=parseInt(getComputedStyle(this._container).marginBottom,10)||0,i=this._container.offsetHeight+e,o=this._containerWidth,s=new Tn(this._containerLeft,-i-this._containerBottom).add(Ra(this._container)),r=t.layerPointToContainerPoint(s),n=Pn(this.options.autoPanPadding),a=Pn(this.options.autoPanPaddingTopLeft||n),l=Pn(this.options.autoPanPaddingBottomRight||n),h=t.getSize();let c=0,u=0;r.x+o+l.x>h.x&&(c=r.x+o-h.x+l.x),r.x-c-a.x<0&&(c=r.x-a.x),r.y+i+l.y>h.y&&(u=r.y+i-h.y+l.y),r.y-u-a.y<0&&(u=r.y-a.y),(c||u)&&(this.options.keepInView&&
40(this._autopanning=!0),t.fire("autopanstart").panBy([c,u]));}_getAnchor(){return this._source&&this._source instanceof ph?Pn(this._source._getPopupAnchor()):new Tn(0,0)}toGeoJSON(t){return th(this,t)}};function Rh(t,e){return new zh(t,e)}function Dh(t,e){if(!e||!t.length)return t.slice();const i=e*e;return t=function(t,e){const i=[t[0]];let o=0;for(let s=1;s<t.length;s++)Zh(t[s],t[o])>e&&(i.push(t[s]),o=s);return o<t.length-1&&i.push(t[t.length-1]),i}(t,i),t=function(t,e){const i=t.length,o=new("undefined"!=typeof Uint8Array?Uint8Array:Array)(i);o[0]=o[i-1]=1,Bh(t,o,e,0,i-1);const s=[];for(let e=0;e<i;e++)o[e]&&s.push(t[e]);return s}(t,i),t}function Ah(t,e,i){return Math.sqrt(kh(t,e,i))}function kh(t,e,i){const o=Oh(t,e,i),s=t.x-o.x,r=t.y-o.y;return s*s+r*r}function Oh(t,e,i){let o=e.x,s=e.y;const r=i.x-o,n=i.y-s,a=r*r+n*n;if(a>0){const e=((t.x-o)*r+(t.y-s)*n)/a;e>1?(o=i.x,s=i.y):e>0&&(o+=r*e,s+=n*e);}return new Tn(o,s)}function Bh(t,e,i,o,s){let r,n=0,a=s-1;for(let e=o+1;e<=s-1;e++)r=Gh(t[e],t[o],t[s]),r>n&&(a=e,n=r);n>i&&(e[a]=1,Bh(t,e,i,o,a),Bh(t,e,i,a,s));}function Fh(t,e,i,o,s){let r,n,a,l=o?Lh:Nh(t,i),h=Nh(e,i);for(Lh=h;;){if(!(l|h))return [t,e];if(l&h)return !1;r=l||h,n=jh(t,e,r,i,s),a=Nh(n,i),r===l?(t=n,l=a):(e=n,h=a);}}function jh(t,e,i,o,s){const r=e.x-t.x,n=e.y-t.y,a=o.min,l=o.max;let h,c;return 8&i?(h=t.x+r*(l.y-t.y)/n,c=l.y):4&i?(h=t.x+r*(a.y-t.y)/n,c=a.y):2&i?(h=l.x,c=t.y+n*(l.x-t.x)/r):1&i&&(h=a.x,c=t.y+n*(a.x-t.x)/r),new Tn(h,c,s)}function Nh(t,e){let i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function Zh(t,e){const i=e.x-t.x,o=e.y-t.y;return i*i+o*o}function Gh(t,e,i,o){let s,r=e.x,n=e.y,a=i.x-r,l=i.y-n;const h=a*a+l*l;return h>0&&(s=((t.x-r)*a+(t.y-n)*l)/h,s>1?(r=i.x,n=i.y):s>0&&(r+=a*s,n+=l*s)),a=t.x-r,l=t.y-n,a*a+l*l}function Uh(t,e){if(!t||0===t.length)throw new Error("latlngs not passed");let i;ql(t)?i=t:(console.warn("latlngs are not flat! Only the first ring will be used"),i=Wl(t));let o=In([0,0]);const s=Sn(i);
40s.getNorthWest().distanceTo(s.getSouthWest())*s.getNorthEast().distanceTo(s.getNorthWest())<1700&&(o=Vl(i));const r=i.length,n=[];for(let t=0;t<r;t++){const s=In(i[t]);n.push(e.project(In([s.lat-o.lat,s.lng-o.lng])));}let a,l=0;for(let t=0;t<r-1;t++)l+=n[t].distanceTo(n[t+1])/2;if(0===l)a=n[0];else {let t=0;a=n[n.length-1];for(let e=0;e<r-1;e++){const i=n[e],o=n[e+1],s=i.distanceTo(o);if(t+=s,t>l){const e=(t-l)/s;a=[o.x-e*(o.x-i.x),o.y-e*(o.y-i.y)];break}}}const h=e.unproject(Pn(a));return In([h.lat+o.lat,h.lng+o.lng])}Ch=zh,zh.defaultOptions=Object.assign(Object.assign({},Reflect.get(Ih,"defaultOptions",Ch)),{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,closeButtonLabel:"Close popup",autoClose:!0,closeOnEscapeKey:!0,closeOnClick:!1}),xa.Popup=zh,xl.Popup=zh;const Vh={simplify:Dh,pointToSegmentDistance:Ah,squaredDistanceOfClosestPointOnSegment:kh,closestPointOnSegment:Oh,clipSegment:Fh,polylineCenter:Uh};var Wh,qh,$h,Hh,Xh,Yh,Kh,Qh,Jh,tc,ec,ic,oc,sc,rc,nc,ac,lc;class hc extends(qh=Sh){constructor(t,e){super(Object.assign(Object.assign({},Wh.defaultOptions),e)),this._setLatLngs(t);}getLatLngs(){return this._latlngs}setLatLngs(t){return this._setLatLngs(t),this.redraw()}isEmpty(){return !this._latlngs.length}closestLayerPoint(t){let e,i=1/0;for(let o=0,s=this._parts.length;o<s;o++){const s=this._parts[o];for(let o=1,r=s.length;o<r;o++){const r=s[o-1],n=s[o],a=kh(t,r,n);a<i&&(i=a,e=Oh(t,r,n));}}if(e){const t=e;return t.distance=Math.sqrt(i),t}}getCenter(){if(!this.map)throw new wn;return Uh(this._defaultShape(),pl)}getBounds(){return this._bounds}addLatLng(t,e){e=e||this._defaultShape();const i=In(t);return e.push(i),this._bounds.extend(t),this.redraw()}_setLatLngs(t){this._bounds=new En(void 0,void 0),this._latlngs=this._convertLatLngs(t);}_defaultShape(){return ql(this._latlngs)?this._latlngs:ql(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]}_convertLatLngs(t){if(ql(t)){const e=[];for(let i=0,o=t.length;i<o;i++)e[i]=In(t[i]),this._bounds.extend(e[i]);return e}{const e=[];for(let i=0,o=t.length;i<o;i++)e[i]=this._convertLatLngs(t[i]);return e}}_project(){const t=new wa;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds());}_updateBounds(){const t=this._clickTolerance(),e=new Tn(t,t);this._rawPxBounds&&(this._pxBounds=new wa([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]));}_projectLatlngs(t,e,i){if(!this.leafletMap)throw new wn;const o=t.length;if(ql(t)){const s=[];for(let e=0;e<o;e++)s[e]=this.leafletMap.latLngToLayerPoint(t[e]),i.extend(s[e]);e.push(s);}else for(let s=0;s<o;s++)this._projectLatlngs(t[s],e,i);}_clipPoints(){const t=this._renderer._bounds;if(this._parts=[],!this._pxBounds||!t||!this._pxBounds.intersects(t))return;if(this.options.noClip)return void(this._parts=this._rings);const e=this._parts;let i,o,s,r,n,a,l;for(i=0,s=0,r=this._rings.length;i<r;i++)for(l=this._rings[i],o=0,n=l.length;o<n-1;o++)a=Fh(l[o],l[o+1],t,o,!0),a&&(e[s]=e[s]||[],e[s].push(a[0]),a[1]===l[o+1]&&o!==n-2||(e[s].push(a[1]),s++));}_simplifyPoints(){const t=this._parts,e=this.options.smoothFactor;for(let i=0,o=t.length;i<o;i++)t[i]=Dh(t[i],e);}_update(){this.map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath());}_updatePath(){this._renderer._updatePoly(this);}_containsPoint(t,e){let i,o,s,r,n,a;const l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return !1;for(i=0,r=this._parts.length;i<r;i++)for(a=this._parts[i],o=0,n=a.length,s=n-1;o<n;s=o++)if((e||0!==o)&&Ah(t,a[s],a[o])<=l)return !0;return !1}toGeoJSON(t){const e=this._latlngs;return ql(e)?Ql(this,{type:"LineString",coordinates:Kl(e,!1,t)}):Ql(this,{type:"MultiLineString",coordinates:Kl(e,!1,t)})}}function cc(t,e){return new hc(t,e)}function uc(t,e,i){const o=[1,4,2,8];let s=[];for(let i=0,o=t.length;i<o;i++){const o=t[i];o._code=Nh(t[i],e),s.push(o);}for(let t=0;t<4;t++){const r=o[t],n=[];let a;for(let t=0,o=s.length,l=o-1;t<o;l=t++){const o=s[t],h=s[l];o._code&r?h._code&r||(a=jh(h,o,r,e,i),a._code=Nh(a,e),n.push(a)):(h._code&r&&(a=jh(h,o,r,e,i),a._code=Nh(a,e),n.push(a)),n.push(o));}s=n;}return s}Wh=hc,hc.defaultOptions=Object.assign(Object.assign({},Reflect.get(qh,"defaultOptions",Wh)),{smoothFactor:1,noClip:!1});class dc extends(Hh=hc){constructor(t,e){super(t,Object.assign(Object.assign({},$h.defaultOptions),e));}isEmpty(){return ql(this._latlngs)?!this._latlngs.length:ql(this._latlngs[0])?!this._latlngs[0].length:!this._latlngs[0][0].length}getCenter(){if(!this.map)throw new wn;return function(t,e){let i,o,s,r,n,a,l,h,c,u;if(!t||0===t.length)throw new Error("latlngs not passed");ql(t)?u=t:(console.warn("latlngs are not flat! Only the first ring will be used"),u=Wl(t));let d=In([0,0]);const _=Sn(u);
40_.getNorthWest().distanceTo(_.getSouthWest())*_.getNorthEast().distanceTo(_.getNorthWest())<1700&&(d=Vl(u));const p=u.length,m=[];for(i=0;i<p;i++){const t=In(u[i]);m.push(e.project(In([t.lat-d.lat,t.lng-d.lng])));}for(a=l=h=0,i=0,o=p-1;i<p;o=i++)s=m[i],r=m[o],n=s.y*r.x-r.y*s.x,l+=(s.x+r.x)*n,h+=(s.y+r.y)*n,a+=3*n;c=0===a?m[0]:[l/a,h/a];const f=e.unproject(Pn(c));return In([f.lat+d.lat,f.lng+d.lng])}(this._defaultShape(),pl)}_convertLatLngs(t){const e=super._convertLatLngs(t),i=e.length;return ql(e)&&i>=2&&e[0].equals(e[i-1])&&e.pop(),e}_setLatLngs(t){this._bounds=new En(void 0,void 0);const e=this._convertLatLngs(t);this._latlngs=ql(e)?[e]:e;}_defaultShape(){return ql(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]}_clipPoints(){let t=this._renderer._bounds;if(!t)throw new wn;const e=this.options.weight,i=new Tn(e,e);if(t=new wa(t.min.subtract(i),t.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(let e,i=0,o=this._rings.length;i<o;i++)e=uc(this._rings[i],t,!0),e.length&&this._parts.push(e);}_updatePath(){this._renderer._updatePoly(this,!0);}_containsPoint(t){if(!this._pxBounds||!this._pxBounds.contains(t))return !1;let e=!1;for(let i=0;i<this._parts.length;i++){const o=this._parts[i];for(let i=0,s=o.length-1;i<o.length;s=i++){const r=o[i],n=o[s];r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(e=!e);}}return e||super._containsPoint(t,!0)}toGeoJSON(t){const e=this._latlngs;return ql(e)?Ql(this,{type:"Polygon",coordinates:[Kl(e,!0,t)]}):$l(e)?Ql(this,{type:"Polygon",coordinates:Kl(e,!0,t)}):Ql(this,{type:"MultiPolygon",coordinates:Kl(e,!0,t)})}}function _c(t,e){return new dc(t,e)}$h=dc,dc.defaultOptions=Object.assign(Object.assign({},Reflect.get(Hh,"defaultOptions",$h)),{fill:!0});class pc extends bh{constructor(t,e){super([],e),t&&this.addData(t);}addData(t){if(Array.isArray(t)||"FeatureCollection"===t.type){const e=Array.isArray(t)?t:t.features;for(let t=0,i=e.length;t<i;t++)this.addData(e[t]);return this}return this._addFeatureOrGeometry(t)}resetStyle(t){return void 0===t?this.eachLayer(this.resetStyle,this):(t.options=Object.assign({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this)}setStyle(t){return this.eachLayer((function(e){this._setLayerStyle(e,t);}),this)}_setLayerStyle(t,e){if(t.setStyle)if("function"==typeof e){const i=e(t.feature);t.setStyle(i);}else t.setStyle(e);return this}_addFeatureOrGeometry(t){const e=this.options;if(e.filter&&!e.filter(t))return this;const i=mc(t,e);return i?(i.feature=Jl(t),i.defaultOptions=i.options,this.resetStyle(i),e.onEachFeature&&e.onEachFeature(t,i),this.addLayer(i)):this}}function mc(t,e){const i="Feature"===t.type?t.geometry:t;if(!i)return null;const o=e&&e.pointToLayer,s=e&&e.coordsToLatLng||Hl;let r,n,a,l;switch(i.type){case "Point":return r=s(i.coordinates),gc(o,t,r,e);case "MultiPoint":{const n=[];for(a=0,l=i.coordinates.length;a<l;a++)r=s(i.coordinates[a]),n.push(gc(o,t,r,e));return new bh(n)}case "LineString":case "MultiLineString":return n=Xl(i.coordinates,s),new hc(n,e);case "Polygon":case "MultiPolygon":return n=Xl(i.coordinates,s),new dc(n,e);case "GeometryCollection":{const t=[];for(let o=0,s=i.geometries.length;o<s;o++){const s=mc({geometry:i.geometries[o],type:"Feature",properties:{}},e);
40s&&t.push(s);}return new bh(t)}case "FeatureCollection":{const t=[];for(let o=0,s=i.features.length;o<s;o++){const s=mc(i.features[o],e);s&&t.push(s);}return new bh(t)}default:throw new Error("Invalid GeoJSON object.")}}function fc(t,e){return new pc(t,e)}function gc(t,e,i,o){return t?t(e,i):new ph(i,(null==o?void 0:o.markersInheritOptions)?o:void 0)}class vc extends(Yh=Sh){get _radiusPixels(){return this._radius}constructor(t,e){super(Object.assign(Object.assign({},Xh.defaultOptions),e)),this._latlng=In(t),this._radius=this.options.radius;}setLatLng(t){const e=this._latlng;return this._latlng=In(t),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})}getLatLng(){return this._latlng}setRadius(t){return this.options.radius=this._radius=t,this.redraw()}getRadius(){return this._radius}setStyle(t){const e=t.radius||this._radius;return super.setStyle(t),this.setRadius(e),this}_project(){if(!this.leafletMap)throw new wn;this._point=this.leafletMap.latLngToLayerPoint(this._latlng),this._updateBounds();}_updateBounds(){const t=this._radius,e=this._radiusPixels,i=this._clickTolerance(),o=new Tn(t+i,e+i);this._pxBounds=new wa(this._point.subtract(o),this._point.add(o));}_update(){this.map&&this._updatePath();}_updatePath(){this._renderer._updateCircle(this);}_empty(){return !(!this._radius||this._renderer._bounds&&this._renderer._bounds.intersects(this._pxBounds))}_containsPoint(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}toGeoJSON(t){return th(this,t)}}function yc(t,e){return new vc(t,e)}Xh=vc,vc.defaultOptions=Object.assign(Object.assign({},Reflect.get(Yh,"defaultOptions",Xh)),{fill:!0,radius:10});class bc extends vc{get _radiusPixels(){return this._radiusY}constructor(t,e,i){let o;if("number"==typeof e?(o=null!=i?i:{},o.radius=e):o=null!=e?e:{},super(t,o),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius;}setRadius(t){return this._mRadius=t,this.redraw()}getRadius(){return this._mRadius}getBounds(){if(!this.leafletMap)throw new wn;const t=new Tn(this._radius,this._radiusPixels);return new En(this.leafletMap.layerPointToLatLng(this._point.subtract(t)),this.leafletMap.layerPointToLatLng(this._point.add(t)))}_project(){if(!this.leafletMap)throw new wn;const t=this._latlng.lng,e=this._latlng.lat,i=this.leafletMap,o=pl;if(o instanceof al){const o=Math.PI/180,s=this._mRadius/Mn/o,r=i.project([e+s,t]),n=i.project([e-s,t]),a=r.add(n).divideBy(2),l=i.unproject(a).lat;let h=Math.acos((Math.cos(s*o)-Math.sin(e*o)*Math.sin(l*o))/(Math.cos(e*o)*Math.cos(l*o)))/o;(isNaN(h)||0===h)&&(h=s/Math.cos(Math.PI/180*e)),this._point=a.subtract(i.getPixelOrigin()),this._radius=isNaN(h)?0:a.x-i.project([l,t-h]).x,this._radiusY=a.y-r.y;}else {const t=o.unproject(o.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(t).x;}this._updateBounds();}}function xc(t,e,i){return new bc(t,e,i)}class wc extends(Qh=Eh){constructor(t,e){t&&(t instanceof Cn||Array.isArray(t))?super(t,Object.assign(Object.assign({},Kh.defaultOptions),e)):super(Object.assign(Object.assign({},Kh.defaultOptions),t),e);}onAdd(t){return super.onAdd(t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0)),this}onRemove(t){return super.onRemove(t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0)),this}getEvents(){const t=super.getEvents();return this.options.permanent||(t.preclick=this.close),t}_initLayout(){this._contentNode=this._container=Ca("div",`leaflet-tooltip ${this.options.className||""}`),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id",`leaflet-tooltip-${bn(this)}`);}_updateLayout(){this._containerWidth=this._container.offsetWidth;}_adjustPan(){}_setPosition(t){if(!this.leafletMap)throw new wn;let e,i,o=this.options.direction;const s=this.leafletMap,r=this._container,n=s.latLngToContainerPoint(s.getCenter()),a=s.layerPointToContainerPoint(t),l=r.offsetWidth,h=r.offsetHeight,c=Pn(this.options.offset),u=this._getAnchor();
40"top"===o?(e=l/2,i=h):"bottom"===o?(e=l/2,i=0):"center"===o?(e=l/2,i=h/2):"right"===o?(e=0,i=h/2):"left"===o?(e=l,i=h/2):a.x<n.x?(o="right",e=0,i=h/2):(o="left",e=l+2*(c.x+u.x),i=h/2),t=t.subtract(Pn(e,i,!0)).add(c).add(u),r.classList.remove("leaflet-tooltip-right","leaflet-tooltip-left","leaflet-tooltip-top","leaflet-tooltip-bottom"),r.classList.add(`leaflet-tooltip-${o}`),za(r,t);}_updatePosition(){if(!this.leafletMap)throw new wn;const t=this.leafletMap.latLngToLayerPoint(this._latlng);this._setPosition(t);}setOpacity(t){return this.options.opacity=t,this._container&&(this._container.style.opacity=null==t?void 0:t.toString()),this}_getAnchor(){return !this.options.sticky&&(t=this._source)&&"_getTooltipAnchor"in t?Pn(this._source._getTooltipAnchor()):new Tn(0,0);var t;}}function Tc(t,e){return new wc(t,e)}Kh=wc,wc.defaultOptions=Object.assign(Object.assign({},Reflect.get(Qh,"defaultOptions",Kh)),{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9}),xa.Tooltip=wc,xl.Tooltip=wc;class Pc extends(tc=xa){constructor(t,e,i){super(Object.assign(Object.assign({},Jh.defaultOptions),i)),this._url=t,this._bounds=Sn(e);}onAdd(t){return this._image||(this._initImage(this._url),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(this._image.classList.add("leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset(),this}onRemove(t){return this._image.remove(),this.options.interactive&&this.removeInteractiveTarget(this._image),this}setOpacity(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this}setStyle(t){return t.opacity&&this.setOpacity(t.opacity),this}bringToFront(){return this.map&&Ia(this._image),this}bringToBack(){return this.map&&Ea(this._image),this}setUrl(t){return this._url=t,this._image&&(this._image.src=t),this}setBounds(t){return this._bounds=Sn(t),this.map&&this._reset(),this}getEvents(){return {zoom:this._reset,zoomend:this._reset,viewreset:this._reset}}setZIndex(t){return this.options.zIndex=t,this._updateZIndex(),this}getBounds(){return this._bounds}getElement(){return this._image}getCenter(){return this._bounds.getCenter()}_initImage(t){const e="string"!=typeof(o=t)&&"IMG"===o.tagName,i=e?t:Ca("img");var o;this._image=i,i.classList.add("leaflet-image-layer"),this.options.className&&i.classList.add(...yn(this.options.className)),i.onselectstart=xn,i.onmousemove=xn,i.onload=this.fire.bind(this,"load"),i.onerror=this._overlayOnError.bind(this),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=this.options.crossOrigin),i.decoding=this.options.decoding,this.options.zIndex&&this._updateZIndex(),e?this._url=i.src:(i.src=this._url,i.alt=this.options.alt);}_reset(){if(!this.leafletMap)throw new wn;const t=this._image,e=new wa(this.leafletMap.latLngToLayerPoint(this._bounds.getNorthWest()),this.leafletMap.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();za(t,e.min),t.style.width=`${i.x}px`,t.style.height=`${i.y}px`;}_updateOpacity(){this._image.style.opacity=this.options.opacity.toString();}_updateZIndex(){this._image&&null!=this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex.toString());}_overlayOnError(){this.fire("error");const t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t);}}function Mc(t,e,i){return new Pc(t,e,i)}Jh=Pc,Pc.defaultOptions=Object.assign(Object.assign({},Reflect.get(tc,"defaultOptions",Jh)),{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:"",decoding:"auto"});class Cc extends(ic=Pc){constructor(t,e,i){super(t,e,Object.assign(Object.assign({},ec.defaultOptions),i));}_reset(){super._reset(),this._rotate();}_rotate(){this._image.style.transform+=` rotate(${this.options.angle}deg)`;}}ec=Cc,Cc.defaultOptions=Object.assign(Object.assign({},Reflect.get(ic,"defaultOptions",ec)),{angle:0,opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:"",decoding:"auto",attribution:null,pane:null});class Ic extends bh{static set defaultImagePath(t){Ec.defaultOptions.imagePath=t,Sc.defaultOptions.icon=new Ec.Default;}constructor(t,e){super(void 0,e),this._kml=t,this._layers={},t&&this._addKML(t);}_addKML(t){const e=this._parseKML(t);
40if(e&&e.length){for(let t=0;t<e.length;t++)this.fire("addlayer",{layer:e[t]}),this.addLayer(e[t]);this.latLngs=this._getLatLngs(t),this.fire("loaded");}}_parseKML(t){const e=this._parseStyles(t);this._parseStyleMap(t,e);const i=[];let o=t.getElementsByTagName("Folder");for(let t=0;t<o.length;t++){if(!this._checkFolder(o[t]))continue;const s=this._parseFolder(o[t],e);s&&i.push(s);}o=t.getElementsByTagName("Placemark");for(let s=0;s<o.length;s++){if(!this._checkFolder(o[s]))continue;const r=this._parsePlacemark(o[s],t,e);r&&i.push(r);}o=t.getElementsByTagName("GroundOverlay");for(let t=0;t<o.length;t++){const e=this._parseGroundOverlay(o[t]);e&&i.push(e);}return i}_checkFolder(t,e){let i=t.parentNode;for(;i&&(!("tagName"in i)||"Folder"!==i.tagName);)i=i.parentNode;return !i||i===e}_parseStyles(t){const e={},i=t.getElementsByTagName("Style");for(let t=0,o=i.length;t<o;t++){const o=this._parseStyle(i[t]);o&&(e[`#${o.id}`]=o);}return e}_parseStyle(t){let e={};const i={color:!0,width:!0,Icon:!0,href:!0,hotSpot:!0},o=t.getElementsByTagName("LineStyle");o&&o[0]&&(e=Lc(o[0],i));let s={};const r=t.getElementsByTagName("PolyStyle");r&&r[0]&&(s=Lc(r[0],i)),s.color&&(e.fillColor=s.color),s.opacity&&(e.fillOpacity=s.opacity);let n={};const a=t.getElementsByTagName("IconStyle");a&&a[0]&&(n=Lc(a[0],i)),n.href&&(e.icon=new Ec({iconUrl:n.href,shadowUrl:null,anchorRef:{x:n.x,y:n.y},anchorType:{x:n.xunits,y:n.yunits}}));const l=t.getAttribute("id");return l&&e&&(e.id=l),e}_parseStyleMap(t,e){const i=t.getElementsByTagName("StyleMap");for(let t=0;t<i.length;t++){const o=i[t];let s="",r="";const n=o.getElementsByTagName("key");n&&n[0]&&(s=n[0].textContent);const a=o.getElementsByTagName("styleUrl");a&&a[0]&&(r=a[0].textContent),"normal"===s&&(e[`#${o.getAttribute("id")}`]=e[r]);}}_parseFolder(t,e){const i=[],o=t.getElementsByTagName("Folder");for(let s=0;s<o.length;s++){if(!this._checkFolder(o[s],t))continue;const r=this._parseFolder(o[s],e);r&&i.push(r);}const s=t.getElementsByTagName("Placemark");for(let o=0;o<s.length;o++){if(!this._checkFolder(s[o],t))continue;const r=this._parsePlacemark(s[o],t,e);r&&i.push(r);}const r=t.getElementsByTagName("GroundOverlay");for(let e=0;e<r.length;e++){if(!this._checkFolder(r[e],t))continue;const o=this._parseGroundOverlay(r[e]);o&&i.push(o);}if(i.length)return 1===i.length?i[0]:new bh(i)}_parsePlacemark(t,e,i,o){const s=o||{},r=t.getElementsByTagName("styleUrl");for(let t=0;t<r.length;t++){const e=r[t].childNodes[0].nodeValue;if(!e)continue;const o=i[e];for(const t in o)s[t]=o[t];}if(t.getElementsByTagName("Style")[0]){const e=this._parseStyle(t);if(e)for(const t in e)s[t]=e[t];}const n=["MultiGeometry","MultiTrack","gx:MultiTrack"];for(const o in n){const r=t.getElementsByTagName(n[o]);for(let t=0;t<r.length;t++)return this._parsePlacemark(r[t],e,i,s)}const a=[],l={LineString:this._parseLineString,Polygon:this._parsePolygon,Point:this._parsePoint,Track:this._parseTrack,"gx:Track":this._parseTrack},h=["LineString","Polygon","Point","Track","gx:Track"];for(const i of h){const o=t.getElementsByTagName(i),r=l[i];for(let t=0;t<o.length;t++){const i=r.call(this,o[t],e,s);i&&a.push(i);}}if(!a.length)return;let c;c=1===a.length?a[0]:new bh(a);let u=null;const d=t.getElementsByTagName("name");d.length&&d[0].childNodes.length&&(u=d[0].childNodes[0].nodeValue);let _="";const p=t.getElementsByTagName("description");for(let t=0;t<p.length;t++)for(let e=0;e<p[t].childNodes.length;e++)_+=p[t].childNodes[e].nodeValue;return u&&c.on("add",(()=>{c.bindPopup(`<h2>${ya(u)}</h2>${ya(_)}`,{className:"kml-popup"});})),c}_parseCoords(t){const e=t.getElementsByTagName("coordinates");return this._readCoords(e[0])}_parseLineString(t,e,i){const o=this._parseCoords(t);if(o.length)return new hc(o,i)}_parseTrack(t,e,i){let o=e.getElementsByTagName("gx:coord");0===o.length&&(o=e.getElementsByTagName("coord"));let s=[];for(let t=0;t<o.length;t++)s=s.concat(this._readGxCoords(o[t]));if(s.length)return new hc(s,i)}_parsePoint(t,e,i){const o=t.getElementsByTagName("coordinates");if(!o.length)return;const s=o[0].childNodes[0].nodeValue.split(",");return new Sc(new Cn(+s[1],+s[0]),i)}_parsePolygon(t,e,i){let o;const s=[],r=t.getElementsByTagName("outerBoundaryIs");for(let t=0;t<r.length;t++)o=this._parseCoords(r[t]),o&&s.push(o);const n=[],a=t.getElementsByTagName("innerBoundaryIs");for(let t=0;t<a.length;t++)o=this._parseCoords(a[t]),o&&n.push(o);if(s.length)return i.fillColor&&(i.fill=!0),new dc(1===s.length?s.concat(n):s,i)}_getLatLngs(t){const e=t.getElementsByTagName("coordinates");let i=[];for(let t=0;t<e.length;t++)i=i.concat(this._readCoords(e[t]));return i}_readCoords(t){let e="";for(let i=0;i<t.childNodes.length;i++)e+=t.childNodes[i].nodeValue;const i=[],o=e.split(/[\s\n]+/);for(let t=0;t<o.length;t++){const e=o[t].split(",");e.length<2||i.push(new Cn(+e[1],+e[0]));}return i}_readGxCoords(t){const e=t.firstChild.nodeValue.split(" ");return [new Cn(+e[1],+e[0])]}_parseGroundOverlay(t){const e=t.getElementsByTagName("LatLonBox")[0],i=e.getElementsByTagName("south")[0].childNodes[0].nodeValue,o=e.getElementsByTagName("west")[0].childNodes[0].nodeValue,s=e.getElementsByTagName("north")[0].childNodes[0].nodeValue,r=e.getElementsByTagName("east")[0].childNodes[0].nodeValue;if(!(i&&o&&s&&r))return null;const n=new En([+i,+o],[+s,+r]),a=zc(t,{Icon:!0,href:!0,color:!0});if(void 0!==e.getElementsByTagName("rotation")[0]){const t=e.getElementsByTagName("rotation")[0].childNodes[0].nodeValue;a.rotation=parseFloat(t);}return a.href?new Cc(a.href,n,{opacity:a.opacity,angle:a.rotation}):null}}class Ec extends(sc=oh){constructor(t){super(Object.assign(Object.assign({},oc.defaultOptions),t));}_setIconStyles(t,e){super._setIconStyles(t,e,this.options.iconSize),t.complete?this.applyCustomStyles(t):t.onload=this.applyCustomStyles.bind(this,t);}applyCustomStyles(t){var e,i,o,s;const r=this.options;this.options.popupAnchor=[0,-.83*t.height],t.style.marginLeft="fraction"===r.anchorType.x?-(null!==(e=r.anchorRef.x)&&void 0!==e?e:0)*t.width+"px":-(null!==(i=r.anchorRef.x)&&void 0!==i?i:0)+"px",t.style.marginTop="fraction"===r.anchorType.y?-(1-(null!==(o=r.anchorRef.y)&&void 0!==o?o:0))*t.height+1+"px":(null!==(s=r.anchorRef.y)&&void 0!==s?s:0)-t.height+1+"px";}}oc=Ec,Ec.defaultOptions=Object.assign(Object.assign({},Reflect.get(sc,"defaultOptions",oc)),{iconSize:[32,32],iconAnchor:[16,16],anchorRef:{},anchorType:{}}),Ec.Default=class extends oc{constructor(){super(oh.getIconDefaultDefaultOptions());}_getIconUrl(t){return super._getDefaultIconUrl(t)}};class Sc extends ph{constructor(t,e){super(t,Object.assign({icon:new Ec.Default},e));}}function Lc(t,e){const i={};for(let o=0;o<t.childNodes.length;
40o++){const s=t.childNodes[o],r=s.tagName;if(e[r])if("hotSpot"===r)for(let t=0;t<s.attributes.length;t++)i[s.attributes[t].name]=s.attributes[t].nodeValue;else if(s.childNodes.length>0){const t=s.childNodes[0].nodeValue;if("color"===r)i.opacity=parseInt(t.substring(0,2),16)/255,i.color=`#${t.substring(6,8)}${t.substring(4,6)}${t.substring(2,4)}`;else if("width"===r)i.weight=+t;else if("Icon"===r){const t=Lc(s,e);t.href&&(i.href=t.href);}else "href"===r&&(i.href=t);}}return i}function zc(t,e){const i={};let o={};for(let s=0;s<t.childNodes.length;s++){const r=t.childNodes[s],n=r.tagName;if(!e[n])continue;const a=r.childNodes[0].nodeValue;"Icon"===n?(o=zc(r,e),o.href&&(i.href=o.href)):"href"===n?i.href=a:"color"===n&&(i.opacity=parseInt(a.substring(0,2),16)/255,i.color=`#${a.substring(6,8)}${a.substring(4,6)}${a.substring(2,4)}`);}return i}function Rc(t,e){return new Ic(t,e)}class Dc extends(nc=bh){constructor(t,e){super(void 0,Object.assign(Object.assign({},rc.defaultOptions),e)),"string"==typeof t?t&&this.addGPX(t,e):this._gpx=t;}addGPX(t,e,i){if("string"==typeof t){const o=this,s=(t,e)=>{o._gpx=t,o.addGPX(t,e);};this.loadXML(t,s,e,i);}else {const i=this.parseGPX(t,e);if(!i)return this;this.addLayer(i),this.fire("loaded");}return this}parse(){return this._gpx&&this.addGPX(this._gpx),this}_humanReadableLength(t){return t<2e3?`${t.toFixed(0)} m`:`${(t/1e3).toFixed(1)} km`}loadXML(t,e,i,o){return void 0===i&&(i=this.options),void 0===o&&(o=i.async),fetch(t).then((t=>t.text())).then((t=>(new window.DOMParser).parseFromString(t,"text/xml"))).then((t=>e(t,i))).catch(),this}_polylineLen(t){return Oc(t._latlngs)}parseGPX(t,e){e=null!=e?e:{};const i=[];let o=!1;const s=[["rte","rtept"],["trkseg","trkpt"]];for(let r=0;r<s.length;r++){const n=t.getElementsByTagName(s[r][0]);for(let t=0;t<n.length;t++){const a=this._parseTrkSeg(n[t],e,s[r][1]);for(let e=0;e<a.length;e++)this._parseName(n[t],a[e])&&(o=!0),i.push(a[e]);}}const r=t.getElementsByTagName("wpt");if(!1!==e.display_wpt)for(let t=0;t<r.length;t++){const s=this._parseWpt(r[t],e);s&&(this._parseName(r[t],s)&&(o=!0),i.push(s));}if(!i.length)return null;let n=i[0];return i.length>1&&(n=new bh(i)),o||this._parseName(t,n),n}_parseName(t,e){let i="",o="",s=0,r=t.getElementsByTagName("name"),n=null,a=null;r.length&&(a=r[0].childNodes[0].nodeValue),r=t.getElementsByTagName("desc");for(let t=0;t<r.length;t++)for(let e=0;e<r[t].childNodes.length;e++)o+=r[t].childNodes[e].nodeValue;return r=t.getElementsByTagName("link"),r.length&&(n=r[0].getAttribute("href")),e instanceof Sh&&(s=this._polylineLen(e)),a&&(i+=`<h2>${ya(a)}</h2>${ya(o)}`),s&&(i+=`<p>${this._humanReadableLength(s)}</p>`),n&&(i+=`<p><a target="_blank" href="${ya(n)}">[...]</a></p>`),e&&void 0===e._popup&&e.bindPopup(i),i}_parseTrkSeg(t,e,i){const o=t.getElementsByTagName(i);if(!o.length)return [];const s=[];for(let t=0;t<o.length;t++){const e=new Cn(parseFloat(o[t].getAttribute("lat")),parseFloat(o[t].getAttribute("lon")));e.meta={};for(const i in o[t].childNodes){const s=o[t].childNodes[i];s.tagName&&(e.meta[s.tagName]=s.textContent);}s.push(e);}const r=[new hc(s,e)];return this.fire("addline",{line:r}),r}_parseWpt(t,e){const i=new ph(new Cn(parseFloat(t.getAttribute("lat")),parseFloat(t.getAttribute("lon"))),e),o={};for(let e=0;e<t.childNodes.length;e++){const i=t.childNodes[e];"#text"!==i.nodeName&&(o[i.nodeName]=i.textContent);}return this.fire("addpoint",{point:i,attributes:o}),i}speedSplitEnable(t){return fa(this,t),this.on("addline",this._speedSplit,this)}speedSplitDisable(){return this.off("addline",this._speedSplit,this)}_speedSplit(t){var e;const i=Wl(t.line.pop().getLatLngs());let o=Math.floor(i.length/(null!==(e=this.options.chunks)&&void 0!==e?e:1));o<3&&(o=3);let s=null;for(let e=0;e<i.length;e+=o){let r=0,n=null;e+o>i.length&&(o=i.length-e);for(let t=0;t<o;t++)s&&(r+=s.distanceTo(i[e+t])),s=i[e+t],n||(n=kc(s.meta.time));s=i[e+o-1],n=(kc(s.meta.time)-n)/36e5;const a=.001*r/n,l=Ac(a/this.options.maxSpeed),h=new hc(i.slice(e,e+o+1),{color:l,weight:2,opacity:1,interactive:!0});h.bindPopup(`Dist: ${r.toFixed()}m; Speed: ${a.toFixed(2)} km/h`),t.line.push(h);}}}function Ac(t){function e(t){return function(t){return Math.floor(t).toString(16).toUpperCase().padStart(2,"0")}(256*t)}return t<0?"#FF0000":t<1/3?`#FF${e(3*t)}00`:t<2/3?`#${e(2-3*t)}FF00`:t<1?`#00FF${e(3*t-2)}`:"#00FFFF"}function kc(t){try{return new Date(t).getTime()}catch(t){return (new Date).getTime()}}function Oc(t){let e=0;if(ql(t)){let i=null;for(let o=0;o<t.length;o++)o&&i&&(e+=i.distanceTo(t[o])),i=t[o];return e}for(const i of t)e+=Oc(i);return e}rc=Dc,Dc.defaultOptions=Object.assign(Object.assign({},Reflect.get(nc,"defaultOptions",rc)),{maxSpeed:110,chunks:200});class Bc extends(lc=xa){constructor(t){super(Object.assign(Object.assign({},ac.defaultOptions),t)),this.options.font.split(" ").length<2&&(this.options.font+=" Verdana"),this.options.fontColor||(this.options.fontColor=this.options.color),this.options.zoomInterval&&(Array.isArray(this.options.zoomInterval)?(this.options.latInterval||(this.options.latInterval=this.options.zoomInterval),this.options.lngInterval||(this.options.lngInterval=this.options.zoomInterval)):(this.options.zoomInterval.latitude&&(this.options.latInterval=this.options.zoomInterval.latitude,this.options.zoomInterval.longitude||(this.options.lngInterval=this.options.zoomInterval.latitude)),this.options.zoomInterval.longitude&&(this.options.lngInterval=this.options.zoomInterval.longitude,this.options.zoomInterval.latitude||(this.options.latInterval=this.options.zoomInterval.longitude))));}onAdd(t){this._canvas||this._initCanvas();const e=t.getPane("overlayPane");if(!e)throw new Error("Overlay pane not present, cannot add LatLng graticule.");return e.appendChild(this._canvas),t.on("viewreset",this._reset,this),t.on("move",this._reset,this),t.on("moveend",this._reset,this),t.on("zoom",this._reset,this),this._reset(),this}onRemove(t){return this._canvas.remove(),t.off("viewreset",this._reset,this),t.off("move",this._reset,this),t.off("moveend",this._reset,this),t.off("zoom",this._reset,this),this}addTo(t){return t.addLayer(this),this}setOpacity(t){return this.options.opacity=t,this._updateOpacity(),this}_initCanvas(){this._canvas=Ca("canvas",""),this._updateOpacity(),oa.on(this._canvas,"onselectstart",xn),oa.on(this._canvas,"onmousemove",xn),oa.on(this._canvas,"onload",this._onCanvasLoad,this);}_reset(){if(!this.leafletMap)throw new wn;const t=this._canvas,e=this.leafletMap.getSize();za(t,this.leafletMap.containerPointToLayerPoint([0,0])),t.width=e.x,t.height=e.y,t.style.width=`${e.x}px`,t.style.height=`${e.y}px`,this._calcInterval(),this._draw(!0);}_onCanvasLoad(){this.fire("load");}_updateOpacity(){this._canvas.style.opacity=this.options.opacity.toString();}_formatLat(t){return this.options.latFormatTickLabel?this.options.latFormatTickLabel(t):t<0?`${-1*t}${this.options.sides[1]}`:t>0?`${t}${this.options.sides[0]}`:t.toString()}_formatLng(t){return this.options.lngFormatTickLabel?this.options.lngFormatTickLabel(t):-180===(t=vn(t,[-180,180],!0))?""+-1*t:0===t||180===t?`${t}`:t<0?`${-1*t}${this.options.sides[3]}`:t>0?`${t}${this.options.sides[2]}`:t.toString()}_calcInterval(){if(!this.leafletMap)throw new wn;const t=Math.floor(this.leafletMap.getZoom());if(this._currZoom!==t&&(this._currLngInterval=0,this._currLatInterval=0,this._currZoom=t),!this._currLngInterval)try{for(const e in this.options.lngInterval){const i=this.options.lngInterval[e];
40if(i.start<=t&&i.end&&i.end>=t){this._currLngInterval=i.interval;break}}}catch(t){this._currLngInterval=0;}if(!this._currLatInterval)try{for(const e in this.options.latInterval){const i=this.options.latInterval[e];if(i.start<=t&&i.end&&i.end>=t){this._currLatInterval=i.interval;break}}}catch(t){this._currLatInterval=0;}}_draw(t){var e;const i=this._canvas,o=this.leafletMap;if(!o)return;this._currLngInterval&&this._currLatInterval||this._calcInterval();const s=this._currLatInterval,r=this._currLngInterval,n=i.getContext("2d");if(!n)throw new Error("Failed to create 2D canvas context for LatLngGraticule.");let a;n.clearRect(0,0,i.width,i.height),n.lineWidth=this.options.weight,n.strokeStyle=this.options.color,n.fillStyle=null!==(e=this.options.fontColor)&&void 0!==e?e:this.options.color,n.setLineDash(this.options.dashArray),this.options.font&&(n.font=this.options.font);try{a=function(t){t.length>2&&"p"===t.charAt(t.length-2)&&(t=t.substr(0,t.length-2));try{return parseInt(t,10)}catch(t){return 0}}(n.font.trim().split(" ")[0]);}catch(t){a=12;}const l=i.width,h=i.height,c=o.containerPointToLatLng([0,0]),u=o.containerPointToLatLng([l,0]);let d=o.containerPointToLatLng([l,h]).lat,_=c.lat,p=c.lng,m=u.lng,f=(_-d)/(.2*h);if(isNaN(f))return;f<1&&(f=1),d=d<-90?-90:d-f|0,_=_>90?90:_+f|0;let g=(m-p)/(.2*l);if(g<1&&(g=1),p>0&&m<0&&(m+=360),m=m+g|0,p=p-g|0,s>0){for(let e=s;e<=_;e+=s)e>=d&&this._drawLatLine(e,t,n,a,p,m,l);for(let e=0;e>=d;e-=s)e<=_&&this._drawLatLine(e,t,n,a,p,m,l);}if(r>0){for(let e=r;e<=m;e+=r)e>=p&&this._drawLonLine(e,t,n,a,_,d,h);for(let e=0;e>=p;e-=r)e<=m&&this._drawLonLine(e,t,n,a,_,d,h);}}_drawLatLine(t,e,i,o,s,r,n){const a=this._latLngToCanvasPoint(new Cn(t,s)),l=this._formatLat(t),h=i.measureText(l).width,c=this.options.showLabel&&e?h+10:0,u=this._latLngToCanvasPoint(new Cn(t,r));if(i.beginPath(),i.moveTo(1+c,a.y),i.lineTo(u.x-1-c,u.y),i.stroke(),this.options.showLabel&&e){const t=a.y+o/2-2;i.fillText(l,0,t),i.fillText(l,n-h,t);}}_drawLonLine(t,e,i,o,s,r,n){const a=this._formatLng(t),l=i.measureText(a).width,h=this._latLngToCanvasPoint(new Cn(r,t)),c=this.options.showLabel&&e?o+5:0,u=this._latLngToCanvasPoint(new Cn(s,t));i.beginPath(),i.moveTo(u.x,5+c),i.lineTo(h.x,n-1-c),i.stroke(),this.options.showLabel&&e&&(i.fillText(a,u.x-l/2,o+5),i.fillText(a,h.x-l/2,n-3));}_latLngToCanvasPoint(t){if(!this.leafletMap)throw new wn;const e=this.leafletMap,i=e.project(t);return i._subtract(e.getPixelOrigin()),i.add(e._getMapPanePos())}}ac=Bc,Bc.defaultOptions=Object.assign(Object.assign({},Reflect.get(lc,"defaultOptions",ac)),{showLabel:!0,opacity:1,weight:.8,color:"#aaa",font:"12px Verdana",dashArray:[0,0],lngLineCurved:0,latLineCurved:0,zoomInterval:[{start:2,end:2,interval:40},{start:3,end:3,interval:20},{start:4,end:4,interval:10},{start:5,end:7,interval:5},{start:8,end:20,interval:1}],sides:["N","S","E","W"],latInterval:null,lngInterval:null,fontColor:null,latFormatTickLabel:null,lngFormatTickLabel:null});const Fc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class jc{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString());},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`;},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute("aria-label",i);},this.options=e.e({},Fc,t),this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),d.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),d.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t});})),this._compassIcon=d.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"));}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Nc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map;}_createButton(t,e){const i=d.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}}class Nc{constructor(t,i,o=!1){this.mousedown=t=>{this.startMove(t,d.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup);},this.mousemove=t=>{this.move(t,d.mousePos(this.element,t));},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp();},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=d.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend));},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=d.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos));},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp();},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp();},this._clickTolerance=10,this.element=i;const s=new Mr;this._rotatePitchHandler=new yr({clickTolerance:3,move:(t,s)=>{const r=i.getBoundingClientRect(),n=new e.P((r.bottom-r.top)/2,(r.right-r.left)/2);return {bearingDelta:e.cv(new e.P(t.x,s.y),s,n),pitchDelta:o?-.5*(s.y-t.y):void 0}},moveStateManager:s,enable:!0,assignEvents:()=>{}}),this.map=t,i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchcancel",this.reset);}startMove(t,e){this._rotatePitchHandler.dragStart(t,e),d.disableDrag();}move(t,e){const i=this.map,{bearingDelta:o,pitchDelta:s}=this._rotatePitchHandler.dragMove(t,e)||{};o&&i.setBearing(i.getBearing()+o),s&&i.setPitch(i.getPitch()+s);}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp();}offTemp(){d.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend);}}let Zc;function Gc(t,i,o,s=!1){if(s||!o.getCoveringTilesDetailsProvider().allowWorldCopies())return null==t?void 0:t.wrap();const r=new e.V(t.lng,t.lat);
40if(t=new e.V(t.lng,t.lat),i){const s=new e.V(t.lng-360,t.lat),r=new e.V(t.lng+360,t.lat),n=o.locationToScreenPoint(t).distSqr(i);o.locationToScreenPoint(s).distSqr(i)<n?t=s:o.locationToScreenPoint(r).distSqr(i)<n&&(t=r);}for(;Math.abs(t.lng-o.center.lng)>180;){const e=o.locationToScreenPoint(t);if(e.x>=0&&e.y>=0&&e.x<=o.width&&e.y<=o.height)break;t.lng>o.center.lng?t.lng-=360:t.lng+=360;}return t.lng!==r.lng&&o.isPointOnMapSurface(o.locationToScreenPoint(t))?t:r}const Uc={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 Vc(t,e,i){const o=t.classList;for(const t in Uc)o.remove(`maplibregl-${i}-anchor-${t}`);o.add(`maplibregl-${i}-anchor-${e}`);}class Wc extends e.E{constructor(t){if(super(),this._onClick=t=>{this.fire(new e.l("click",{originalEvent:t}));},this._onKeyPress=t=>{"Space"!==t.code&&"Enter"!==t.code||this.togglePopup();},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup();},this._update=t=>{if(!this._map)return;const e=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==t?void 0:t.type)||"render"===(null==t?void 0:t.type)&&!e)&&this._map.once("render",this._update),this._lngLat=Gc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let o="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?o="rotateX(0deg)":"map"===this._pitchAlignment&&(o=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),this._element.style.transform=`${Uc[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${o} ${i}`,n.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(t&&"moveend"===t.type);})).catch((()=>{}));},this._onMove=t=>{if(!this._isDragging){const e=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=e;}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.l("dragstart"))),this.fire(new e.l("drag")));},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new e.l("dragend")),this._state="inactive";},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp));},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else {this._defaultMarker=!0,this._element=d.create("div");const i=d.createNS("http://www.w3.org/2000/svg","svg"),o=41,s=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${o}px`),i.setAttributeNS(null,"width",`${s}px`),i.setAttributeNS(null,"viewBox",`0 0 ${s} ${o}`);const r=d.createNS("http://www.w3.org/2000/svg","g");
40r.setAttributeNS(null,"stroke","none"),r.setAttributeNS(null,"stroke-width","1"),r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"fill-rule","evenodd");const n=d.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");const a=d.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"transform","translate(3.0, 29.0)"),a.setAttributeNS(null,"fill","#000000");const l=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const t of l){const e=d.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),a.appendChild(e);}const h=d.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"fill",this._color);const c=d.createNS("http://www.w3.org/2000/svg","path");c.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),h.appendChild(c);const u=d.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"opacity","0.25"),u.setAttributeNS(null,"fill","#000000");const _=d.createNS("http://www.w3.org/2000/svg","path");_.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"),u.appendChild(_);const p=d.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");const m=d.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const f=d.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");const g=d.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#FFFFFF"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962"),m.appendChild(f),m.appendChild(g),n.appendChild(a),n.appendChild(h),n.appendChild(u),n.appendChild(p),n.appendChild(m),i.appendChild(n),i.setAttributeNS(null,"height",o*this._scale+"px"),i.setAttributeNS(null,"width",s*this._scale+"px"),this._element.appendChild(i),this._offset=e.P.convert(t&&t.offset||[0,-14]);}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t=>{t.preventDefault();})),this._element.addEventListener("mousedown",(t=>{t.preventDefault();})),Vc(this._element,this._anchor,"marker"),t&&t.className)for(const e of t.className.split(" "))this._element.classList.add(e);this._popup=null;}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const e=38.1,i=13.5,o=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
400,-e],"bottom-left":[o,-1*(e-i+o)],"bottom-right":[-o,-1*(e-i+o)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset;}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress);}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,o;const s=null===(i=this._map)||void 0===i?void 0:i.terrain,r=this._map.transform.isLocationOccluded(this._lngLat);if(!s||r){const t=r?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==t&&(this._element.style.opacity=t))}if(t)this._opacityTimeout=null;else {if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null;}),100);}const n=this._map,a=n.terrain.depthAtPoint(this._pos),l=n.terrain.getElevationForLngLat(this._lngLat,n.transform);if(n.transform.lngLatToCameraDepth(this._lngLat,l)-a<.006)return void(this._element.style.opacity=this._opacity);const h=-this._offset.y/n.transform.pixelsPerMeter,c=Math.sin(n.getPitch()*Math.PI/180)*h,u=n.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),d=n.transform.lngLatToCameraDepth(this._lngLat,l+c)-u>.006;(null===(o=this._popup)||void 0===o?void 0:o.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity;}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t);}removeClassName(t){this._element.classList.remove(t);}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return (void 0===this._opacity||void 0===t&&void 0===e)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const qc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let $c=0,Hc=!1;class Xc extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case "WAITING_ACTIVE":case "ACTIVE_LOCK":case "ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case "BACKGROUND":case "BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new e.l("geolocate",t)),this._finish();}},this._updateCamera=t=>{const i=new e.V(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,s=this._map.getBearing(),r=e.e({bearing:s},this.options.fitBoundsOptions),n=q.fromLngLat(i,o);this._map.fitBounds(n,r,{geolocateSource:!0});},this._updateMarker=t=>{if(t){const i=new e.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded();},this._onError=t=>{if(this._map){if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===t.code&&Hc)return;this._setErrorState();}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new e.l("error",t)),this._finish();}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;},this._onMoveStart=t=>{if(!this._map)return;const i=(null==t?void 0:t[0])instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new e.l("trackuserlocationend")),this.fire(new e.l("userlocationlostfocus")));},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=d.create("button","maplibregl-ctrl-geolocate",this._container),d.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0);},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t);}else {const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
40se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=d.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Wc({element:this._dotElement}),this._circleElement=d.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Wc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart);}},this.options=e.e({},qc,t);}onAdd(t){return this._map=t,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Zc&&!t)return Zc;if(void 0===window.navigator.permissions)return Zc=!!window.navigator.geolocation,Zc;try{const t=yield window.navigator.permissions.query({name:"geolocation"});Zc="denied"!==t.state;}catch(t){Zc=!!window.navigator.geolocation;}return Zc}))}().then((t=>this._finishSetupUI(t))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,$c=0,Hc=!1;}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case "WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case "ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case "BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case "ACTIVE_ERROR":case "BACKGROUND_ERROR":case "OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const t=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&t))return;const e=this._map.project(t),i=this._map.unproject([e.x+100,e.y]),o=t.distanceTo(i)/100,s=2*this._accuracy/o;this._circleElement.style.width=`${s.toFixed(2)}px`,this._circleElement.style.height=`${s.toFixed(2)}px`;}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case "OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.l("trackuserlocationstart"));break;case "WAITING_ACTIVE":case "ACTIVE_LOCK":case "ACTIVE_ERROR":case "BACKGROUND_ERROR":$c--,Hc=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new e.l("trackuserlocationend"));break;case "BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.l("trackuserlocationstart")),this.fire(new e.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case "WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case "ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case "OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),$c++,$c>1?(t={maximumAge:6e5,timeout:0},Hc=!0):(t=this.options.positionOptions,Hc=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
40se"),this.options.showUserLocation&&this._updateMarker(null);}}const Yc={maxWidth:100,unit:"metric"};class Kc{constructor(t){this._onMove=()=>{Qc(this._map,this._container,this.options);},this.setUnit=t=>{this.options.unit=t,Qc(this._map,this._container,this.options);},this.options=Object.assign(Object.assign({},Yc),t);}getDefaultPosition(){return "bottom-left"}onAdd(t){return this._map=t,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0;}}function Qc(t,e,i){const o=i&&i.maxWidth||100,s=t._container.clientHeight/2,r=t._container.clientWidth/2,n=t.unproject([r-o/2,s]),a=t.unproject([r+o/2,s]),l=Math.round(t.project(a).x-t.project(n).x),h=Math.min(o,l,t._container.clientWidth),c=n.distanceTo(a);if(i&&"imperial"===i.unit){const i=3.2808*c;i>5280?Jc(e,h,i/5280,t._getUIString("ScaleControl.Miles")):Jc(e,h,i,t._getUIString("ScaleControl.Feet"));}else i&&"nautical"===i.unit?Jc(e,h,c/1852,t._getUIString("ScaleControl.NauticalMiles")):c>=1e3?Jc(e,h,c/1e3,t._getUIString("ScaleControl.Kilometers")):Jc(e,h,c,t._getUIString("ScaleControl.Meters"));}function Jc(t,e,i,o){const s=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(s/i)+"px",t.innerHTML=`${s}&nbsp;${o}`;}class tu extends e.E{constructor(t={}){var i;super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange();},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen();},this._fullscreen=!1,this._pseudo=null!==(i=t.pseudo)&&void 0!==i&&i,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange");}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange);}_setupUI(){const t=this._fullscreenButton=d.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);d.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange);}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t;}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new e.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable());}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen();}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen();}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize();}}class eu{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon();},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"));},this.options=t;}onAdd(t){return this._map=t,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=d.create("button","maplibregl-ctrl-terrain",this._container),d.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
40ype="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0;}}class iu{constructor(){this._toggleProjection=()=>{var t;const e=null===(t=this._map.getProjection())||void 0===t?void 0:t.type;this._map.setProjection("mercator"!==e&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon();},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(t=this._map.getProjection())||void 0===t?void 0:t.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"));};}onAdd(t){return this._map=t,this._container=d.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=d.create("button","maplibregl-ctrl-globe",this._container),d.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0;}}const ou={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},su=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");class ru extends e.E{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"");},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new e.l("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=d.create("div","maplibregl-popup",this._map.getContainer()),this._tip=d.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer");}let e;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Gc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(e=t.point),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor;const s=nu(this.options.offset);if(!o){const t=this._container.offsetWidth,e=this._container.offsetHeight,r=function(t){var e,i,o,s;return t?{top:null!==(e=t.top)&&void 0!==e?e:0,right:null!==(i=t.right)&&void 0!==i?i:0,bottom:null!==(o=t.bottom)&&void 0!==o?o:0,left:null!==(s=t.left)&&void 0!==s?s:0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);let n;n=i.y+s.bottom.y<e+r.top?["top"]:i.y>this._map.transform.height-e-r.bottom?["bottom"]:[],i.x<t/2+r.left?n.push("left"):i.x>this._map.transform.width-t/2-r.right&&n.push("right"),o=0===n.length?"bottom":n.join("-");}let r=i.add(s[o]);this.options.subpixelPositioning||(r=r.round()),this._container.style.transform=`${Uc[o]} translate(${r.x}px,${r.y}px)`,Vc(this._container,o,"popup"),this._updateOpacity();},this._onClose=()=>{this.remove();},this.options=e.e(Object.create(ou),t);}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new e.l("open")),this}isOpen(){return !!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.V.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement("body");let o;for(i.innerHTML=t;o=i.firstChild,o;)e.appendChild(o);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=d.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t;}setPadding(t){this.options.padding=t,this._update();}_createCloseButton(){this.options.closeButton&&(this._closeButton=d.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose));}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(su);t&&t.focus();}}function nu(t){if(t){if("number"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return {center:new e.P(0,0),top:new e.P(0,t),"top-left":new e.P(i,i),"top-right":new e.P(-i,i),bottom:new e.P(0,-t),"bottom-left":new e.P(i,-i),"bottom-right":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return {center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return {center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),"top-left":e.P.convert(t["top-left"]||[0,0]),"top-right":e.P.convert(t["top-right"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),"bottom-left":e.P.convert(t["bottom-left"]||[0,0]),"bottom-right":e.P.convert(t["bottom-right"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return nu(new e.P(0,0))}const au=p;function lu(t,e){return _t().setRTLTextPlugin(t,e)}function hu(){return _t().getRTLTextPluginStatus()}function cu(){return au}function uu(){return R.workerCount}function du(t){R.workerCount=t;}function _u(){return e.c.MAX_PARALLEL_IMAGE_REQUESTS}function pu(t){e.c.MAX_PARALLEL_IMAGE_REQUESTS=t;}function mu(){return e.c.WORKER_URL}function fu(t){e.c.WORKER_URL=t;}function gu(t){return N().broadcast("IS",t)}var vu=Object.freeze({__proto__:null,AJAXError:e.cG,AttributionControl:en,BoxZoomHandler:pr,CanvasSource:nt,CooperativeGesturesHandler:Hr,DoubleClickZoomHandler:Gr,DragPanHandler:Wr,DragRotateHandler:qr,EXTENT:e.a5,EdgeInsets:Ve,Event:e.l,Evented:e.E,FullscreenControl:tu,GeoJSONSource:ot,GeolocateControl:Xc,GlobeControl:iu,Hash:Qs,ImageSource:st,KeyboardHandler:Br,LngLat:e.V,LngLatBounds:q,LogoControl:on,Map:mn,MapLibreMap:mn,MapMouseEvent:lr,MapTouchEvent:hr,MapWheelEvent:cr,MarkerMaplibre:Wc,MercatorCoordinate:e.a6,NavigationControl:jc,Point:e.P,PopupMaplibre:ru,RasterDEMTileSource:Y,RasterTileSource:X,ScaleControl:Kc,ScrollZoomHandler:Zr,Style:ji,TerrainControl:eu,TwoFingersTouchPitchHandler:kr,TwoFingersTouchRotateHandler:Dr,TwoFingersTouchZoomHandler:zr,TwoFingersTouchZoomRotateHandler:$r,VectorTileSource:H,VideoSource:rt,addProtocol:e.cH,addSourceType:ht,clearPrewarmedResources:F,config:e.c,createTileMesh:di,getMaxParallelImageRequests:_u,getRTLTextPluginStatus:hu,getVersion:cu,getWorkerCount:uu,getWorkerUrl:mu,importScriptInWorkers:gu,isTimeFrozen:u,now:l,prewarm:B,removeProtocol:e.cI,restoreNow:c,setMaxParallelImageRequests:pu,setNow:h,setRTLTextPlugin:lu,setWorkerCount:du,setWorkerUrl:fu});class yu{constructor(t,e,i){this._variants=new Map,this._sourceVertex=t,this._sourceFragment=e,this._uniforms=i;}getShader(t,e){const i=this._variants.get(e.variantName);if(void 0!==i)return i;const o=this._createShader(t,e);return this._variants.set(e.variantName,o),o}destroy(t){for(const e of this._variants.values())e&&t.deleteProgram(e.program);this._variants.clear();}_createShader(t,e){const i=`#version 100\n${e.vertexShaderPrelude}\n${e.define}\n${this._sourceVertex}`,o=`#version 100\n${this._sourceFragment}`,s=t.createShader(t.VERTEX_SHADER);if(!s)return null;t.shaderSource(s,i),t.compileShader(s);const r=t.createShader(t.FRAGMENT_SHADER);if(!r)return t.deleteShader(s),null;t.shaderSource(r,o),t.compileShader(r);const n=t.createProgram();if(t.attachShader(n,s),t.attachShader(n,r),t.linkProgram(n),t.deleteShader(s),t.deleteShader(r),!t.getProgramParameter(n,t.LINK_STATUS))return console.error(`Program failed to link: ${t.getProgramInfoLog(n)}`),t.deleteProgram(n),null;const a=t.getAttribLocation(n,"a_pos"),l={};for(const e of this._uniforms)l[e]=t.getUniformLocation(n,e);return {program:n,uniformLocations:l,mainAttribLocation:a}}}const bu=["u_projection_fallback_matrix","u_projection_matrix","u_projection_clipping_plane","u_projection_transition","u_projection_tile_mercator_coords","u_tex","u_opacity"];class xu{constructor(t,e){this.type="custom",this.renderingMode="2d",this.id=t,this.canvasLayer=e,this._shader=new yu("\nprecision highp float;\nattribute vec2 a_pos;\nvarying vec2 v_uv;\nvoid main() {\n    v_uv = a_pos;\n    gl_Position = u_projection_matrix * vec4(a_pos, 0.0, 1.0);\n}\n","\nprecision mediump float;\nuniform sampler2D u_tex;\nuniform float u_opacity;\nvarying vec2 v_uv;\nvoid main() {\n    if (v_uv.x < 0.0 || v_uv.y < 0.0 || v_uv.x > 1.0 || v_uv.y > 1.0) {\n        discard;\n    }\n    vec4 color = texture2D(u_tex, v_uv);\n    if (color.a < 0.5 / 255.0) {\n        discard;\n    }\n    color.a *= u_opacity;
40\n    gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n",bu);}render(t,i){var o,s;const r=this.canvasLayer;if(!this.canvasLayer.leafletMap||!this.map)throw new wn;const n=this.map.getProjection();if(n&&"mercator"!==n.type)throw new Error("Non-mercator projection not supported for canvas layer.");const a=this._shader.getShader(t,i.shaderData);if(!a)return;const l=this.canvasLayer.leafletMap.getZoom(),h=r.options;if(void 0!==h.minZoom&&l<h.minZoom||void 0!==h.maxZoom&&l>=h.maxZoom+1)return;const c=this.map.painter,u=c.transform;c.context.activeTexture.set(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,r.texture);const d=u.getProjectionData({overscaledTileID:new e.a2(0,0,0,0,0)}),_=r.lastRenderedArea;if(!_)return;let p=null!==(o=r.lastTopLeftOffset)&&void 0!==o?o:0,m=u.coordinatePoint(new e.a6(_.min.x+p,_.min.y));if(void 0!==r.lastTopLeftPixelX){const t=u.coordinatePoint(new e.a6(_.min.x+p+1,_.min.y)),i=p-Math.round((m.x-r.lastTopLeftPixelX)/(t.x-m.x));i!==p&&(p=i,m=u.coordinatePoint(new e.a6(_.min.x+p,_.min.y)));}r.lastTopLeftPixelX=m.x,r.lastTopLeftOffset=p;const f=u.coordinatePoint(new e.a6(_.max.x+p,_.max.y)),g=Tn.fromMapbox(m).divByPoint({x:u.width,y:u.height}).mult(2).sub({x:1,y:1}),v=Tn.fromMapbox(f).divByPoint({x:u.width,y:u.height}).mult(2).sub({x:1,y:1}),y=e.bg();y[12]=g.x,y[13]=g.y,y[0]=v.x-g.x,y[5]=v.y-g.y;const b=2/c.width,x=2/c.height,w=.5*b,T=.5*x;if(Math.abs(g.x+1)<w&&Math.abs(g.y+1)<T&&Math.abs(v.x-1)<w&&Math.abs(v.y-1)<T)y[12]=-1,y[13]=-1,y[0]=2,y[5]=2;else if(r.lastRenderedZoom===c.transform.zoom){const t=(g.x-1)/b,e=(g.y-1)/x;y[12]-=(t-Math.round(t))*b,y[13]-=(e-Math.round(e))*x;}y[5]*=-1,y[13]*=-1,d.mainMatrix=y,d.fallbackMatrix=y,t.disable(t.DEPTH_TEST),t.disable(t.STENCIL_TEST),t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.useProgram(a.program),t.uniform4f(a.uniformLocations.u_projection_clipping_plane,...d.clippingPlane),t.uniform1f(a.uniformLocations.u_projection_transition,d.projectionTransition),t.uniform4f(a.uniformLocations.u_projection_tile_mercator_coords,...d.tileMercatorCoords),t.uniformMatrix4fv(a.uniformLocations.u_projection_matrix,!1,d.mainMatrix),t.uniformMatrix4fv(a.uniformLocations.u_projection_fallback_matrix,!1,d.fallbackMatrix),t.uniform1f(a.uniformLocations.u_opacity,null!==(s=this.canvasLayer.options.opacity)&&void 0!==s?s:1),t.uniform1i(a.uniformLocations.u_tex,0),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.canvasLayer.texture),t.bindBuffer(t.ARRAY_BUFFER,c.viewportBuffer.buffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,c.quadTriangleIndexBuffer.buffer),t.enableVertexAttribArray(a.mainAttribLocation),t.vertexAttribPointer(a.mainAttribLocation,2,t.
40SHORT,!1,0,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),t.bindTexture(t.TEXTURE_2D,null);}onAdd(t,e){this.map=t;}onRemove(t,e){this._shader.destroy(e),this.map=void 0;}}var wu,Tu;class Pu extends(Tu=xa){get lastRenderedArea(){return this._lastRenderedArea}get lastRenderedZoom(){return this._lastRenderedZoom}get texture(){return this._texture}constructor(t){const i=Object.assign(Object.assign({},wu.defaultOptions),t);i.pane&&(console.error("LeafletGL canvas layers do not support the 'pane' option, since they are drawn using WebGL."),i.pane=null),super(i),this._framePending=!1,this._textureRefreshAbort=null,this._onResize=()=>{this._resize();},this._onMapRender=()=>e._(this,void 0,void 0,(function*(){var t,e;if(this._framePending){this._framePending=!1,this._textureRefreshAbort&&this._textureRefreshAbort.abort(),this._textureRefreshAbort=new AbortController;const i=yield this._refreshCanvasTexture(this._textureRefreshAbort.signal);this._textureRefreshAbort=null,i&&(null===(e=null===(t=this.map)||void 0===t?void 0:t.maplibreMap)||void 0===e||e.triggerRepaint());}})),this._onMoveEnd=()=>{this._redraw();},this._canvas=document.createElement("canvas"),this._init();}getPixelRatio(){if(!this.leafletMap)throw new wn;return this.options.forceNativePixelRatio?this.leafletMap.webGLPixelRatio:this.leafletMap.canvasPixelRatio}onAdd(t){var e;this._setEvents(!0),this._resize();const i=this._getLayerId();return this._layerObject=new xu(i,this),t.addMapLibreOrderedLayerToBucket(this._layerObject,null!==(e=this.options.bucketId)&&void 0!==e?e:void 0),this}onRemove(t){return this._setEvents(!1),this.leafletMap.removeMapLibreOrderedLayer(this._getLayerId()),this}_init(){}_getLayerId(){return `_leaflet_canvas_layer_${bn(this)}`}_setEvents(t=!0){const e=this.leafletMap.maplibreMap,i=t?e.on.bind(e):e.off.bind(e);i("resize",this._onResize),i("moveend",this._onMoveEnd),i("render",this._onMapRender);}_getGLContext(){if(!this.leafletMap)throw new wn;return this.leafletMap.maplibreMap.painter.context.gl}_redraw(){var t;this._framePending=!0,(null===(t=this.map)||void 0===t?void 0:t.maplibreMap)&&this.map.maplibreMap.triggerRepaint();}_refreshCanvasTexture(t){return e._(this,void 0,void 0,(function*(){var e;if(!this.leafletMap||!(null===(e=this.map)||void 0===e?void 0:e.maplibreMap))throw new wn;const i=this.leafletMap.getZoom();if(void 0!==this.options.minZoom&&i<this.options.minZoom||void 0!==this.options.maxZoom&&i>=this.options.maxZoom+1)return !1;const o=Math.round(i);if(yield this._draw(o,t),t.aborted)return !1;const s=this.map.maplibreMap.transform;this.lastTopLeftPixelX=void 0,this.lastTopLeftOffset=void 0,this._lastRenderedZoom=i,this._lastRenderedArea=new wa,this._lastRenderedArea.extend(s.screenPointToMercatorCoordinate(new Tn(0,0))),this._lastRenderedArea.extend(s.screenPointToMercatorCoordinate(new Tn(this.map.maplibreMap.transform.width,this.map.maplibreMap.transform.height)));const r=this._getGLContext();if(r.bindTexture(r.TEXTURE_2D,this._texture),hi(r))r.texSubImage2D(r.TEXTURE_2D,0,0,0,this._canvas.width,this._canvas.height,r.RGBA,r.UNSIGNED_BYTE,this._canvas);else {const t=this._canvas.getContext("2d");if(!t)throw new Error("Failed to create 2D canvas context for CanvasLayer.");const e=t.getImageData(0,0,this._canvas.width,this._canvas.height);r.texSubImage2D(r.TEXTURE_2D,0,0,0,this._canvas.width,this._canvas.height,r.RGBA,r.UNSIGNED_BYTE,e.data);}return r.bindTexture(r.TEXTURE_2D,null),!0}))}_resize(){var t,e;const i=null===(e=null===(t=this.leafletMap)||void 0===t?void 0:t.maplibreMap)||void 0===e?void 0:e.transform;if(!i)return;const o=this.getPixelRatio();this._canvas.width=i.width*o|0,this._canvas.height=i.height*o|0;const s=this._getGLContext();this._texture&&s.deleteTexture(this._texture);const r=s.createTexture();if(!r)throw new Error("Failed to create WebGL texture.");this._texture=r,s.bindTexture(s.TEXTURE_2D,this._texture),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,this._canvas.width,this._canvas.height,0,s.RGBA,s.UNSIGNED_BYTE,null),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.bindTexture(s.TEXTURE_2D,null),this._redraw();}}wu=Pu,Pu.defaultOptions=Object.assign(Object.assign({},Reflect.get(Tu,"defaultOptions",wu)),{pane:null,bucketId:null,forceNativePixelRatio:!0,minZoom:0,maxZoom:18,opacity:1});class Mu extends Pu{constructor(t,e,i){super(t),this._lastMovementTileUpdateTime=new Date,this._moving=!1,this._onMove=()=>{if(!this.leafletMap)throw new wn;const t=new Date;if(t.getTime()-this._lastMovementTileUpdateTime.getTime()<200)return;this._lastMovementTileUpdateTime=t;const e=Math.round(this.leafletMap.getZoom()),i=this.leafletMap.getTileBounds(e);this._tileCache.update(i,e);},this._moveStart=()=>{this._moving=!0;},this._moveEnd=()=>{this._moving=!1;},this._tileCache=new Bl(((t,i)=>void 0!==this.options.minZoom&&t.z<this.options.minZoom||void 0!==this.options.maxZoom&&t.z>this.options.maxZoom?Promise.resolve(null):e(t,i))),this._tileCache.on("tileloaded",(t=>{i&&i(t.coords,t.tile),this._moving||this._redraw();}));}onAdd(t){return t.leafletMap.on("move",this._onMove),t.leafletMap.on("movestart",this._moveStart),t.leafletMap.on("moveend",this._moveEnd),super.onAdd(t)}onRemove(t){return t.leafletMap.off("move",this._onMove),t.leafletMap.off("movestart",this._moveStart),t.leafletMap.off("moveend",this._moveEnd),super.onRemove(t)}redraw(){return this._redraw(),this}_draw(t,i){return e._(this,void 0,void 0,(function*(){if(!this.leafletMap)throw new wn;const e=this.leafletMap.getTileBounds(t);this._tileCache.update(e,t),yield this._drawTiles(e,t,i);}))}_drawTiles(t,i,o){return e._(this,void 0,void 0,(function*(){if(!this.leafletMap)throw new wn;const s=this._canvas,r=this._canvas.getContext("2d",{willReadFrequently:ra}),n=this.leafletMap.maplibreMap.transform,a=this.getPixelRatio();r.save();try{r.globalCompositeOperation="source-over",r.clearRect(0,0,s.width,s.height);const l=this._tileCache.getOrderedTilePyramid(t,i,999,2);r.strokeStyle="grey",r.lineWidth=i>6?1:.5;for(const t of l){if(o.aborted)break;const l=zl(t),h=this._tileCache.getData(l);if(!h)continue;const c=1<<t.z,u=n.coordinatePoint(new e.a6(t.x/c,t.y/c)).mult(a),d=n.coordinatePoint(new e.a6((t.x+1)/c,(t.y+1)/c)).mult(a),_=d.x-u.x,p=d.y-u.y,m=Math.max(u.x,0),f=Math.max(u.y,0),g=Math.min(d.x,s.width)-m,v=Math.min(d.y,s.height)-f;if(0!==g&&0!==v){r.save();try{r.beginPath(),r.rect(m,f,g,v),r.clip(),r.clearRect(m,f,g,v),yield this._drawTile(r,h,i,t.z,u.x,u.y,_,p,o);}catch(t){r.clearRect(m,f,g,v);}
40finally{r.restore();}}}}finally{r.restore();}}))}}function Cu(t,e){const i={value:t.value,_stringKey:e};return t.allocations.add(i),i}class Iu{get deleteTimeoutSeconds(){return this._deleteTimeoutSeconds}set deleteTimeoutSeconds(t){this._deleteTimeoutSeconds=t,this._checkTimeouts();}constructor(t,e,i){this._cache=new Map,this._currentlyLoading=new Map,this._waiting=new Map,this._disposed=!1,this._timeoutInterval=null,this._deleteTimeoutSeconds=10,this._getStringKey=t,this._load=e,this._delete=i,this._timeoutInterval=setInterval((()=>{this._checkTimeouts();}),1e3);}get(t,i){return e._(this,void 0,void 0,(function*(){if(this._disposed)throw new Error("Cache is disposed.");const e=this._getStringKey(t),o=this._cache.get(e);if(o)return Cu(o,e);let s=this._currentlyLoading.get(e);const r=!s;s||(s={mainAbort:new AbortController,promises:[]},this._currentlyLoading.set(e,s));const n=s,a=new Promise(((t,o)=>{const s={resolve:t,reject:o,finished:!1};n.promises.push(s),i&&i.addEventListener("abort",(()=>{if(s.finished)return;s.finished=!0,o(new Error("Aborted."));const t=this._currentlyLoading.get(e);t&&(t.promises.splice(t.promises.indexOf(s),1),0===t.promises.length&&(this._currentlyLoading.delete(e),t.mainAbort.abort(`${Ol}: request cancelled`)));}));}));return r&&this._load(t,n.mainAbort.signal).then((t=>{if(n.mainAbort.signal.aborted){this._delete&&this._delete(t);for(let t=0;t<n.promises.length;t++){const e=n.promises[t];e.finished=!0,e.reject(new Error("Aborted."));}return}if(this._currentlyLoading.get(e)!==n)throw new Error("Duplicate or otherwise invalid loading of item detected.");if(this._cache.has(e))throw new Error("Loaded an item that is already in the cache.");const i={allocations:new Set,value:t,key:e,zeroAllocsTime:performance.now()};this._cache.set(e,i),this._currentlyLoading.delete(e);const o=[];for(let t=0;t<n.promises.length;t++)o.push(Cu(i,e));for(let t=0;t<n.promises.length;t++){const e=n.promises[t];e.finished=!0,e.resolve(o[t]);}const s=this._waiting.get(e);if(s){for(const t of s)t.finished=!0,t.resolve(Cu(i,e));this._waiting.delete(e);}})).catch((t=>{this._currentlyLoading.get(e)===n&&this._currentlyLoading.delete(e);for(let e=0;e<n.promises.length;e++){const i=n.promises[e];i.finished=!0,i.reject(t);}if(!n.mainAbort.signal.aborted){const i=this._waiting.get(e);if(i){for(const e of i)e.finished=!0,e.reject(t);this._waiting.delete(e);}}})),a}))}awaitLoad(t,i){return e._(this,void 0,void 0,(function*(){if(this._disposed)throw new Error("Cache is disposed.");const e=this._getStringKey(t),o=this._cache.get(e);if(o)return Cu(o,e);let s=this._waiting.get(e);return s||(s=[],this._waiting.set(e,s)),new Promise(((t,o)=>{const r={resolve:t,reject:o,finished:!1};s.push(r),null==i||i.addEventListener("abort",(()=>{if(r.finished)return;r.finished=!0,r.reject(new Error("Aborted."));const t=this._waiting.get(e);if(!t||t!==s)return;const i=t.indexOf(r);i>=0&&t.splice(i,1),0===t.length&&this._waiting.delete(e);}));}))}))}free(t){if(this._disposed)throw new Error("Cache is disposed.");const e=this._cache.get(t._stringKey);if(!e)throw new Error("Tried to free an item that was already deleted.");if(!e.allocations.has(t))throw new Error("Tried to free an item with an alloc token that was already used or is invalid (maybe belongs to another cache or item?).");if(e.value!==t.value)throw new Error("Alloc token and real cache value mismatch detected.");e.allocations.delete(t),0===e.allocations.size&&(e.zeroAllocsTime=performance.now(),this._deleteTimeoutSeconds<=0&&this._deleteItem(e));}dispose(){if(this._disposed)throw new Error("Cache is disposed.");for(const t of this._currentlyLoading.values())t.mainAbort.abort("Cache was disposed of.");null!==this._timeoutInterval&&(clearInterval(this._timeoutInterval),this._timeoutInterval=null);for(const[t,e]of this._waiting)for(const t of e)t.reject("Cache was disposed of.");this._waiting.clear();for(const t of this._cache.values())this._deleteItem(t);this._disposed=!0;}_deleteItem(t){this._delete&&this._delete(t.value),this._cache.delete(t.key);}_checkTimeouts(){const t=performance.now();for(const e of this._cache.values())t-e.zeroAllocsTime>=1e3*this._deleteTimeoutSeconds&&0===e.allocations.size&&this._deleteItem(e);}}window.L=Object.assign(Object.assign({},Object.freeze({__proto__:null,Bounds:wa,CanvasLayer:Pu,CanvasRenderer:el,CanvasTileLayer:Mu,Circle:bc,CircleMarker:vc,DivIcon:rh,DivOverlay:Eh,DomEvent:oa,DomUtil:Ua,Draggable:ch,Earth:ml,FeatureGroup:bh,GPX:Dc,GeoJSON:pc,GridLayer:Gl,Icon:oh,ImageOverlay:Pc,KML:Ic,LatLng:Cn,LatLngBounds:En,LatLngGraticule:Bc,Layer:xa,LayerGroup:fh,LeafletGlMap:xl,LineUtil:Vh,Marker:ph,Path:Sh,PointLGL:Tn,Polygon:dc,Polyline:hc,Popup:zh,ReferenceCountedCache:Iu,RotatedImageOverlay:Cc,SVGRenderer:Ja,TileCache:Bl,TileLayer:El,TileQuadTree:kl,Tooltip:wc,canvas:il,circle:xc,circleMarker:yc,divIcon:ah,falseFn:xn,featureGroup:xh,geoJSON:fc,getCoordsKey:Rl,gridLayer:Ul,icon:nh,imageOverlay:Mc,isLatLngArrayFlat:ql,isLatLngArraySinglyNested:$l,isWebGL2:hi,kml:Rc,latLng:In,latLngBounds:zn,layerGroup:gh,marker:mh,polygon:_c,polyline:cc,popup:Rh,stamp:bn,svg:tl,template:na,tileLayer:Ll,tooltip:Tc,wrappedCoords:zl,zoom:vl})),vu),t.AJAXError=e.cG,t.EXTENT=e.a5,t.Event=e.l,t.Evented=e.E,t.LngLat=e.V,t.MercatorCoordinate=e.a6,t.Point=e.P,t.addProtocol=e.cH,t.config=e.c,t.removeProtocol=e.cI,t.AttributionControl
40=en,t.Bounds=wa,t.BoxZoomHandler=pr,t.CanvasLayer=Pu,t.CanvasRenderer=el,t.CanvasSource=nt,t.CanvasTileLayer=Mu,t.Circle=bc,t.CircleMarker=vc,t.CooperativeGesturesHandler=Hr,t.DivIcon=rh,t.DivOverlay=Eh,t.DomEvent=oa,t.DomUtil=Ua,t.DoubleClickZoomHandler=Gr,t.DragPanHandler=Wr,t.DragRotateHandler=qr,t.Draggable=ch,t.Earth=ml,t.EdgeInsets=Ve,t.FeatureGroup=bh,t.FullscreenControl=tu,t.GPX=Dc,t.GeoJSON=pc,t.GeoJSONSource=ot,t.GeolocateControl=Xc,t.GlobeControl=iu,t.GridLayer=Gl,t.Hash=Qs,t.Icon=oh,t.ImageOverlay=Pc,t.ImageSource=st,t.KML=Ic,t.KeyboardHandler=Br,t.LatLng=Cn,t.LatLngBounds=En,t.LatLngGraticule=Bc,t.Layer=xa,t.LayerGroup=fh,t.LeafletGlMap=xl,t.LineUtil=Vh,t.LngLatBounds=q,t.LogoControl=on,t.Map=mn,t.MapLibreMap=mn,t.MapMouseEvent=lr,t.MapTouchEvent=hr,t.MapWheelEvent=cr,t.Marker=ph,t.MarkerMaplibre=Wc,t.NavigationControl=jc,t.Path=Sh,t.PointLGL=Tn,t.Polygon=dc,t.Polyline=hc,t.Popup=zh,t.PopupMaplibre=ru,t.RasterDEMTileSource=Y,t.RasterTileSource=X,t.ReferenceCountedCache=Iu,t.RotatedImageOverlay=Cc,t.SVGRenderer=Ja,t.ScaleControl=Kc,t.ScrollZoomHandler=Zr,t.Style=ji,t.TerrainControl=eu,t.TileCache=Bl,t.TileLayer=El,t.TileQuadTree=kl,t.Tooltip=wc,t.TwoFingersTouchPitchHandler=kr,t.TwoFingersTouchRotateHandler=Dr,t.TwoFingersTouchZoomHandler=zr,t.TwoFingersTouchZoomRotateHandler=$r,t.VectorTileSource=H,t.VideoSource=rt,t.addSourceType=ht,t.canvas=il,t.circle=xc,t.circleMarker=yc,t.clearPrewarmedResources=F,t.createTileMesh=di,t.divIcon=ah,t.falseFn=xn,t.featureGroup=xh,t.geoJSON=fc,t.getCoordsKey=Rl,t.getMaxParallelImageRequests=_u,t.getRTLTextPluginStatus=hu,t.getVersion=cu,t.getWorkerCount=uu,t.getWorkerUrl=mu,t.gridLayer=Ul,t.icon=nh,t.imageOverlay=Mc,t.importScriptInWorkers=gu,t.isLatLngArrayFlat=ql,t.isLatLngArraySinglyNested=$l,t.isTimeFrozen=u,t.isWebGL2=hi,t.kml=Rc,t.latLng=In,t.latLngBounds=zn,t.layerGroup=gh,t.marker=mh,t.now=l,t.polygon=_c,t.polyline=cc,t.popup=Rh,t.prewarm=B,t.restoreNow=c,t.setMaxParallelImageRequests=pu,t.setNow=h,t.setRTLTextPlugin=lu,t.setWorkerCount=du,t.setWorkerUrl=fu,t.stamp=bn,t.svg=tl,t.template=na,t.tileLayer=Ll,t.tooltip=Tc,t.wrappedCoords=zl,t.zoom=vl;}));
41
42//
43// Our custom intro provides a specialized "define()" function, called by the
44// AMD modules below, that sets up the worker blob URL and then executes the
45// main module, storing its exported value as 'maplibregl'
46
47
48var maplibregl$1 = maplibregl;
49
50export { maplibregl$1 as default };
51var {AJAXError, AttributionControl, Base, Bounds, BoxZoomHandler, CanvasLayer, CanvasRenderer, CanvasSource, CanvasTileLayer, Circle, CircleMarker, CooperativeGesturesHandler, Departing, DivIcon, DivOverlay, DomEvent, DomUtil, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, Draggable, EXTENT, Earth, EdgeInsets, Event: _export_Event, Evented, FeatureGroup, FullscreenControl, GPX, GeoJSON, GeoJSONSource, GeolocateControl, GlobeControl, GridLayer, Hash, Icon, ImageOverlay, ImageSource, Incoming, KML, KeyboardHandler, LatLng, LatLngBounds, LatLngGraticule, Layer, LayerGroup, LeafletGlMap, LineUtil, LngLat, LngLatBounds, LogoControl, Map: _export_Map, MapLibreMap, MapMouseEvent, MapTouchEvent, MapWheelEvent, Marker, MarkerMaplibre, MercatorCoordinate, NavigationControl, Parent, Path, Point, PointLGL, Polygon, Polyline, Popup, PopupMaplibre, RasterDEMTileSource, RasterTileSource, ReferenceCountedCache, RotatedImageOverlay, SVGRenderer, ScaleControl, ScrollZoomHandler, Style, TerrainControl, TileCache, TileLayer, TileQuadTree, Tooltip, TwoFingersTouchPitchHandler, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource, VideoSource, _globeLatitudeErrorCorrectionRadians, _globeness, _leaflet_disable_click, _leaflet_disable_events, _leaflet_id, _path, _popup, abortController, aborted, actor, addProtocol, addSourceType, addThrottleControl, around, bearing, bearingDelta, buckets, button, cancelBubble, canvas, circle, circleMarker, className, clearPrewarmedResources, collisionCircleArray, collisionGroupID, config, contextmenu, createTileMesh, deltaMode, dem, distance, divIcon, duration, easing, etag, fadeEndTime, fadingDirection, falseFn, featureGroup, features, fillStyle, finished, freezeElevation, geoJSON, getCoordsKey, getImage, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, globalAlpha, gridLayer, hasVisibleVertices, headers, height, icon, id, imageOverlay, importScriptInWorkers, inUse, innerHTML, isLatLngArrayFlat, isLatLngArraySinglyNested, isTimeFrozen, isWebGL2, key, kml, lat, latLng, latLngBounds, latlng, layerGroup, leafletGLstampIdContainer, lineCap, lineJoin, lineWidth, lng, map, marker, message, mousedown, mousemoveWindow, mouseup, moveend, needsHillshadePrepare, needsTerrainPrepare, neighboringTiles, noInertia, now, oldLatLng, onload, options, panDelta, pinchAround, pitchDelta, polygon, polyline, popup, preclick, prewarm, refreshedUponExpiration, reloadPromise, removeProtocol, removeThrottleControl, renderPass, resetRequestQueue, resourceTiming, restoreNow, returnValue, rollDelta, rtt, setMaxParallelImageRequests, setNow, setRTLTextPlugin, setWorkerCount, setWorkerUrl, source, stamp, state, strokeStyle, svg, target, template, texture, tileLayer, tileSize, timeAdded, title, tooltip, type, usedForTerrain, width, wrappedCoords, x, y, z, zoom, zoomDelta} = maplibregl;
52export {AJAXError, AttributionControl, Base, Bounds, BoxZoomHandler, CanvasLayer, CanvasRenderer, CanvasSource, CanvasTileLayer, Circle, CircleMarker, CooperativeGesturesHandler, Departing, DivIcon, DivOverlay, DomEvent, DomUtil, DoubleClickZoomHandler, DragPanHandler, DragRotateHandler, Draggable, EXTENT, Earth, EdgeInsets, _export_Event as Event, Evented, FeatureGroup, FullscreenControl, GPX, GeoJSON, GeoJSONSource, GeolocateControl, GlobeControl, GridLayer, Hash, Icon, ImageOverlay, ImageSource, Incoming, KML, KeyboardHandler, LatLng, LatLngBounds, LatLngGraticule, Layer, LayerGroup, LeafletGlMap, LineUtil, LngLat, LngLatBounds, LogoControl, _export_Map as Map, MapLibreMap, MapMouseEvent, MapTouchEvent, MapWheelEvent, Marker, MarkerMaplibre, MercatorCoordinate, NavigationControl, Parent, Path, Point, PointLGL, Polygon, Polyline, Popup, PopupMaplibre, RasterDEMTileSource, RasterTileSource, ReferenceCountedCache, RotatedImageOverlay, SVGRenderer, ScaleControl, ScrollZoomHandler, Style, TerrainControl, TileCache, TileLayer, TileQuadTree, Tooltip, TwoFingersTouchPitchHandler, TwoFingersTouchRotateHandler, TwoFingersTouchZoomHandler, TwoFingersTouchZoomRotateHandler, VectorTileSource, VideoSource, _globeLatitudeErrorCorrectionRadians, _globeness, _leaflet_disable_click, _leaflet_disable_events, _leaflet_id, _path, _popup, abortController, aborted, actor, addProtocol, addSourceType, addThrottleControl, around, bearing, bearingDelta, buckets, button, cancelBubble, canvas, circle, circleMarker, className, clearPrewarmedResources, collisionCircleArray, collisionGroupID, config, contextmenu, createTileMesh, deltaMode, dem, distance, divIcon, duration, easing, etag, fadeEndTime, fadingDirection, falseFn, featureGroup, features, fillStyle, finished, freezeElevation, geoJSON, getCoordsKey, getImage, getMaxParallelImageRequests, getRTLTextPluginStatus, getVersion, getWorkerCount, getWorkerUrl, globalAlpha, gridLayer, hasVisibleVertices, headers, height, icon, id, imageOverlay, importScriptInWorkers, inUse, innerHTML, isLatLngArrayFlat, isLatLngArraySinglyNested, isTimeFrozen, isWebGL2, key, kml, lat, latLng, latLngBounds, latlng, layerGroup, leafletGLstampIdContainer, lineCap, lineJoin, lineWidth, lng, map, marker, message, mousedown, mousemoveWindow, mouseup, moveend, needsHillshadePrepare, needsTerrainPrepare, neighboringTiles, noInertia, now, oldLatLng, onload, options, panDelta, pinchAround, pitchDelta, polygon, polyline, popup, preclick, prewarm, refreshedUponExpiration, reloadPromise, removeProtocol, removeThrottleControl, renderPass, resetRequestQueue, resourceTiming, restoreNow, returnValue, rollDelta, rtt, setMaxParallelImageRequests, setNow, setRTLTextPlugin, setWorkerCount, setWorkerUrl, source, stamp, state, strokeStyle, svg, target, template, texture, tileLayer, tileSize, timeAdded, title, tooltip, type, usedForTerrain, width, wrappedCoords, x, y, z, zoom, zoomDelta};
53//# sourceMappingURL=leaflet-gl.js.map

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